MediaWiki:ArmorSearch.js

$(document).ready(function {     eval(document.getElementById("armorsearchdata").innerHTML); });

for (var trnum = 1; trnum <= 70; trnum++) { document.getElementById("tr"+trnum).innerHTML = ""; }

switch(head_compare_lvl) { case "0": arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); break; case "1": if (head_armor[head_compare_id].lvl1 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl1.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "2": if (head_armor[head_compare_id].lvl2 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl2.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "3": if (head_armor[head_compare_id].lvl3 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl3.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "4": if (head_armor[head_compare_id].lvl4 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl4.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "5": if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "6": if (head_armor[head_compare_id].lvl6 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl6.split("|"); }       else if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }          break; case "7": if (head_armor[head_compare_id].lvl7 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl7.split("|"); }       else if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "8": if (head_armor[head_compare_id].lvl8 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl8.split("|"); }       else if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "9": if (head_armor[head_compare_id].lvl9 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl9.split("|"); }       else if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; case "10": if (head_armor[head_compare_id].lvl10 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl10.split("|"); }       else if (head_armor[head_compare_id].lvl5 !== undefined) { arrCompareHead = head_armor[head_compare_id].lvl5.split("|"); }       else { arrCompareHead = head_armor[head_compare_id].lvl0.split("|"); }       break; } arrCompareHead[10] = head_armor[head_compare_id].poise; arrCompareHead[11] = head_armor[head_compare_id].weight;

if (isNaN(arrCompareHead[9]) === true) { arrCompareHead[9] = "0.0"; } for (head_temp_id in head_armor) { switch(head_compare_lvl) { case "0": arrTempHead = head_armor[head_temp_id].lvl0.split("|"); break; case "1": if (head_armor[head_temp_id].lvl1 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl1.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "2": if (head_armor[head_temp_id].lvl2 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl2.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "3": if (head_armor[head_temp_id].lvl3 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl3.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "4": if (head_armor[head_temp_id].lvl4 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl4.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "5": if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "6": if (head_armor[head_temp_id].lvl6 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl6.split("|"); }           else if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }              break; case "7": if (head_armor[head_temp_id].lvl7 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl7.split("|"); }           else if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "8": if (head_armor[head_temp_id].lvl8 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl8.split("|"); }           else if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "9": if (head_armor[head_temp_id].lvl9 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl9.split("|"); }           else if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; case "10": if (head_armor[head_temp_id].lvl10 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl10.split("|"); }           else if (head_armor[head_temp_id].lvl5 !== undefined) { arrTempHead = head_armor[head_temp_id].lvl5.split("|"); }           else { arrTempHead = head_armor[head_temp_id].lvl0.split("|"); }           break; }   arrTempHead[10] = head_armor[head_temp_id].poise; arrTempHead[11] = head_armor[head_temp_id].weight; if (isNaN(arrTempHead[9]) === true) { arrTempHead[9] = "0.0"; }

switch (head_compare_stat) { case "physical": if (parseFloat(arrTempHead[0]) >= parseFloat(arrCompareHead[0])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "strike": if (parseFloat(arrTempHead[1]) >= parseFloat(arrCompareHead[1])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "slash": if (parseFloat(arrTempHead[2]) >= parseFloat(arrCompareHead[2])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "thrust": if (parseFloat(arrTempHead[3]) >= parseFloat(arrCompareHead[3])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "magic": if (parseFloat(arrTempHead[4]) >= parseFloat(arrCompareHead[4])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "fire": if (parseFloat(arrTempHead[5]) >= parseFloat(arrCompareHead[5])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "lightning": if (parseFloat(arrTempHead[6]) >= parseFloat(arrCompareHead[6])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "bleed": if (parseFloat(arrTempHead[7]) >= parseFloat(arrCompareHead[7])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = ''+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrTempHead[i]+' '; }           }            break; case "poison": if (parseFloat(arrTempHead[8]) >= parseFloat(arrCompareHead[8])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="background-color:#1d1d1d; border:1px solid black;">'+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + '<td style="background-color:#1d1d1d; border:1px solid black;">'+arrTempHead[i]+' '; }           }            break; case "curse": if (parseFloat(arrTempHead[9]) >= parseFloat(arrCompareHead[9])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="background-color:#1d1d1d; border:1px solid black;">'+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + '<td style="background-color:#1d1d1d; border:1px solid black;">'+arrTempHead[i]+' '; }           }            break; case "poise": if (parseFloat(arrTempHead[10]) >= parseFloat(arrCompareHead[10])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="background-color:#1d1d1d; border:1px solid black;">'+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + '<td style="background-color:#1d1d1d; border:1px solid black;">'+arrTempHead[i]+' '; }           }            break; case "weight": if (parseFloat(arrTempHead[11]) <= parseFloat(arrCompareHead[11])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="background-color:#1d1d1d; border:1px solid black;">'+head_armor[head_temp_id].name+' '; for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + '<td style="background-color:#1d1d1d; border:1px solid black;">'+arrTempHead[i]+' '; }           }            break; } }