MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
var itemId = $(this).data("item-id"); | var itemId = $(this).data("item-id"); | ||
$.get( "../scripts/fetch_item.php", { | $.get( "../scripts/fetch_item.php", { id: itemId }).done(function(data) { | ||
var hc = 0, dc = 0; | var hc = 0, dc = 0; | ||
Line 13: | Line 13: | ||
table.find("th").each(function() { | table.find("th").each(function() { | ||
if (hc === 0) | if (hc === 0) | ||
$(this).text( | $(this).text("searching for item "+itemId); | ||
hc++; | hc++; | ||
}) | }) | ||
Line 21: | Line 19: | ||
// iterate over table data | // iterate over table data | ||
table.find("td").each(function() { | table.find("td").each(function() { | ||
$(this).text(dc+" data column"); | |||
if (dc === 0) | if (dc === 0) | ||
$(this).text(data.mlAcc); | $(this).text(data.mlAcc); | ||
Line 36: | Line 35: | ||
$(this).text(data.prayer); | $(this).text(data.prayer); | ||
else if (dc == 7) | else if (dc == 7) | ||
$(this).text( | $(this).text(data.slot); | ||
else if (dc === 8) | else if (dc === 8) | ||
$(this).text(data.mlStr); | $(this).text(data.mlStr); | ||
Line 44: | Line 43: | ||
$(this).text(data.mgStr); | $(this).text(data.mgStr); | ||
else if (dc === 11) | else if (dc === 11) | ||
$(this).text( | $(this).text(data.degrade); | ||
else if (dc === 12) | else if (dc === 12) | ||
$(this).text( | $(this).text(data.repair); | ||
else if (dc === 13) | else if (dc === 13) | ||
$(this).text( | $(this).text(data.req); | ||
else if (dc === 14) | else if (dc === 14) | ||
$(this).text( | $(this).text(data.speed); | ||
dc++; | dc++; | ||
}); | }); |
Revision as of 12:12, 30 August 2018
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function() { $(".item-bonus-table").each(function() { var table = $(this); var itemId = $(this).data("item-id"); $.get( "../scripts/fetch_item.php", { id: itemId }).done(function(data) { var hc = 0, dc = 0; // iterate over headers table.find("th").each(function() { if (hc === 0) $(this).text("searching for item "+itemId); hc++; }) // iterate over table data table.find("td").each(function() { $(this).text(dc+" data column"); if (dc === 0) $(this).text(data.mlAcc); else if (dc === 1) $(this).text(data.rnAcc); else if (dc === 2) $(this).text(data.mgAcc); else if (dc === 3) $(this).text(data.mlDef); else if (dc === 4) $(this).text(data.rnDef); else if (dc === 5) $(this).text(data.mgDef); else if (dc == 6) $(this).text(data.prayer); else if (dc == 7) $(this).text(data.slot); else if (dc === 8) $(this).text(data.mlStr); else if (dc === 9) $(this).text(data.rnStr); else if (dc === 10) $(this).text(data.mgStr); else if (dc === 11) $(this).text(data.degrade); else if (dc === 12) $(this).text(data.repair); else if (dc === 13) $(this).text(data.req); else if (dc === 14) $(this).text(data.speed); dc++; }); }); }); });