User:Dgw/prefixprompt.js

/* Add PrefixIndex lookup link to toolbox */ function prefixprompt { var prefixToLookUp = prompt('What prefix would you like to look up?\n(Type \'help\' for more information about this feature.)',mw.config.get('wgPageName')); switch(prefixToLookUp) {   case '': alert('Please enter a prefix.'); prefixprompt; break; case null: /* Do nothing */ break; case 'help': window.location = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", "User:Voyagerfan5761/prefixprompt"); break; default: window.location = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", "Special:PrefixIndex") + "/" + prefixToLookUp.replace(/ /, "_"); break; } } $( function { if(mw.config.get('wgCanonicalNamespace') != "Special")  {    addLink("p-tb", "javascript:prefixprompt;", "Prefix lookup", "t-prefixlookup", "List page titles with a prefix", 0, "t-upload");  } });