Made getpokedexurl link to the pokemon page, made clicking a pokemon in the tiers page open a pokemon page in a new tab

This commit is contained in:
Deukhoofd 2016-03-03 23:32:57 +01:00
parent ff1867b5af
commit d8c4a3067b
5 changed files with 33 additions and 4 deletions

View File

@ -268,7 +268,7 @@ class @Pokemon extends Backbone.Model
slugSpecies = slugify(@get('species'))
slugForme = slugify(@get('forme'))
"//wiki.p-insurgence.com/#{slugSpecies}"
"/pokemon/#{@get('species')}"
getIllu: ->
@get('illu')

View File

@ -28,6 +28,7 @@ style
height: 200px;
text-align: center;
vertical-align: middle;
padding: 0px;
}
.description{
width: 400px;

View File

@ -1876,7 +1876,7 @@
};
slugSpecies = slugify(this.get('species'));
slugForme = slugify(this.get('forme'));
return "//wiki.p-insurgence.com/" + slugSpecies;
return "/pokemon/" + (this.get('species'));
};
Pokemon.prototype.getIllu = function() {

View File

@ -1876,7 +1876,7 @@
};
slugSpecies = slugify(this.get('species'));
slugForme = slugify(this.get('forme'));
return "//wiki.p-insurgence.com/" + slugSpecies;
return "/pokemon/" + (this.get('species'));
};
Pokemon.prototype.getIllu = function() {

View File

@ -190,7 +190,8 @@ function populateTable(arr) {
for (var i in arr) {
var pokeObj = arr[i];
var row = table.insertRow(-1);
row.className += "row"
row.className += "row pokemonRow"
row.id = pokeObj.name
// Sets dexNo
var dexcell = row.insertCell(0);
dexcell.innerHTML = pokeObj.id;
@ -290,6 +291,33 @@ function populateTable(arr) {
}
function openTab(pkmn) {
pkmn = pkmn.replace(" ", "_")
url= "/pokemon/" + pkmn
window.open(url, '_blank');
}
$("table.table.list").click(function (e) {
target = e.target;
var search = target;
var searching = true;
while (searching) {
upNode = search.parentElement;
if (upNode.localName == "body") {
searching = false;
return;
}
if (upNode.className == "row pokemonRow") {
searching = false;
openTab(upNode.id)
}
else {
search = upNode;
}
}
})
$(document).ready(function () {
makeObject(function (arr) {
populateTable(arr)