MediaWiki:Gadget-quest-generate.js

var qP; function createQuestPage { qt = prompt("Quest name or ID",wgTitle.replace("Quest:","")); if (qt) { $.getJSON("http://pipes.yahoo.com/pipes/pipe.run?u="+ encodeURIComponent('http://db.mmo-champion.com/q/'+qt+'/json') + "&_id=67521109542675beea051573ccce4b44&_render=json&_callback=?", function (data) { qdb = data.value.items[0].fields; qID = data.value.items[0].pk; qP = ""; qP +="\n"; qP += "\n==Objectives==\n"+qdb.objective; qP += "\n\n==Description==\n"+qdb.description; qP += "\n\n==Rewards==\n"; if (qdb.money_reward) { qP += "You will receive: (or  at max level)"; } else { qP += "..."; } qP += "\n\n==Progress==\n..."; qP += "\n\n==Completion==\n..."; qP += "\n\n==Gains==\nYou will receive:\n"; if (qdb.experience_reward) qP += "*"+qdb.experience_reward+" XP (or  at max level)"; qP += "\n\n==Notes==\n..."; qP += "\n\n==Quest progression==\n"; qP += "\n\n==Patches and hotfixes==\n*"; qP += "\n\n==External links==\n{"+"{subst:el}"+"}\n{"+"{Elinks-quest|"+qID+"}"+"}"; $("#wpTextbox1").val(qP); }); } }

function gQuestCreateLink { if ((wgAction == "edit" || wgAction == "submit") && wgPageName.indexOf("Quest") == 0) { addPortletLink('p-cactions', 'javascript:createQuestPage;', "Create quest page", 'ca-create-quest', "Create quest page", 'q'); } } addOnloadHook(gQuestCreateLink);