MediaWiki:ArmorSearch.js

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

function headSelected { armor_menu.disabled = false; button.disabled = false;

$("#armor_menu").empty;

for (var head_opt_id in head_armor) { var head_opt_name = head_armor[head_opt_id].name; var head_opt = document.createElement("option"); head_opt.text = head_opt_name; head_opt.value = head_opt_id; armor_menu.add(head_opt); } }

function chestSelected { armor_menu.disabled = false; button.disabled = false; $("#armor_menu").empty; for (var chest_opt_id in chest_armor) { var chest_opt_name = chest_armor[chest_opt_id].name; var chest_opt = document.createElement("option"); chest_opt.text = chest_opt_name; chest_opt.value = chest_opt_id; armor_menu.add(chest_opt); } }

function handsSelected { armor_menu.disabled = false; button.disabled = false; $("#armor_menu").empty; for (var hands_opt_id in hands_armor) { var hands_opt_name = hands_armor[hands_opt_id].name; var hands_opt = document.createElement("option"); hands_opt.text = hands_opt_name; hands_opt.value = hands_opt_id; armor_menu.add(hands_opt); } }

function legsSelected { armor_menu.disabled = false; button.disabled = false; $("#armor_menu").empty; for (var legs_opt_id in legs_armor) { var legs_opt_name = legs_armor[legs_opt_id].name; var legs_opt = document.createElement("option"); legs_opt.text = legs_opt_name; legs_opt.value = legs_opt_id; armor_menu.add(legs_opt); } }

function armorSelectedIndexChanged { 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 (var trnum = 1; trnum <= 70; trnum++) { document.getElementById("tr"+trnum).innerHTML = ""; }

intCount++; var tr = document.getElementById("tr"+intCount);

tr.innerHTML = ''+head_armor[head_compare_id].name+' ';

for (var i = 0; i <= 11; i++) { tr.innerHTML = tr.innerHTML + ''+arrCompareHead[i]+' '; } }

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

for (head_temp_id in head_armor) {

if (head_temp_id === head_compare_id) continue;

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 = '<td style="text-align:left; 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 "lightning": if (parseFloat(arrTempHead[6]) >= parseFloat(arrCompareHead[6])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="text-align:left; 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 "bleed": if (parseFloat(arrTempHead[7]) >= parseFloat(arrCompareHead[7])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="text-align:left; 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 "poison": if (parseFloat(arrTempHead[8]) >= parseFloat(arrCompareHead[8])) { intCount++; var tr = document.getElementById("tr"+intCount); tr.innerHTML = '<td style="text-align:left; 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="text-align:left; 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="text-align:left; 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="text-align:left; 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; } } }