MediaWiki:Gadget-item-generate.js

wowItem = new Array;

var orderMap = {"name": 1, "quality": 2, "icon": 3, "stack": 4, "location": 5, "bind": 6, "unique": 7, "unique_eq": 8, "unique_type": 9, "slot": 10, "type": 11, "mount": 12, "dmglow": 13, "dmghigh": 14, "dmgtype": 15, "bonuslow": 16, "bonushigh": 17, "bonustype": 18, "speed": 19, "armor": 20, "bonusarmor": 21, "strength": 22, "agility": 23, "stamina": 24, "intellect": 25, "spirit": 26, "fire": 27, "nature": 28, "frost": 29, "shadow": 30, "arcane": 31, "resist": 32, "gem": 33, "gemattrib": 34, "randomsuffix": 35, "req": 36, "rfaction": 37, "rep": 38, "rating": 39, "red_sockets": 40, "blue_sockets": 41, "yellow_sockets": 42, "meta_sockets": 43, "prismatic_sockets": 44, "cogwheel_sockets": 45, "sockbonus": 46, "durability": 47, "locked": 48, "bag": 49, "classes": 50, "races": 51, "prof": 52, "profskill": 53, "pickup": 54, "equip": 55, "crit": 56, "hit": 57, "haste": 58, "mastery": 59, "spellpen": 60, "spellpower": 61, "attackpower": 62, "rangedattackpower": 63, "expertise": 64, "onhit": 65, "use": 66, "create": 67, "set": 68, "level": 69, "ilvl": 70, "charges": 71, "sellprice": 72, "itemid": 73}

function createItemPage { tt = prompt("Item name or ID",wgTitle.replace(/( \(heroic\)|'|")/g,"")); if (tt) { wowItem[tt] = {}; importScriptURI("http://www.warcraftjs.com/i/"+tt); setTimeout('processItemPage("'+tt+'");',2000); } }

function processItemPage(tt) { if (typeof(retrieveItem) == "function") retrieveItem; if (wowItem[tt].error) { alert ("Error: "+wowItem[tt].error); } else { if (wowItem[tt].name.replace(/("|')/g,"") == tt || wowItem[tt].itemid == tt) { gTooltip = ""; if ($("#wpTextbox1").val) { $("#wpTextbox1").val($("#wpTextbox1").val.replace(/(\{\{#data:Itemtip(.|[\n])*?\}\}| (.|[\n])*?<\/onlyinclude>)/i,gTooltip)); } else { $("#wpTextbox1").val("\n" + gTooltip + "\n==Source==\n...\n\n==Patches and hotfixes==\n...\n\n==External links==\n\n"); } retrieveItem = 0; } else { setTimeout('processItemPage("'+tt+'");',2000); } } }

function gItemCreateLink { if ((wgAction == "edit" || wgAction == "submit") && wgPageName.indexOf("Quest:")==-1) { icText = ($("#wpTextbox1").val)?"Update item tooltip":"Create item page"; addPortletLink('p-cactions', 'javascript:createItemPage;', icText, 'ca-create-item', icText, 'i'); } } addOnloadHook(gItemCreateLink);