User:Sportzpikachu/common.js

//(mw.loader.getState('ext.gadget.rtrc') ? mw.loader.load('ext.gadget.rtrc') : mw.loader.load('https://www.mediawiki.org/w/load.php?modules=ext.gadget.rtrc&lang=' + mw.config.get('wgUserLanguage', 'en'))); mw.loader.load( '//en.wikipedia.org/wiki/User:Chlod/Scripts/GoToTitle.js?action=raw&ctype=text/javascript' ); // Backlink: []

// ripped off from User:SD0001/common.js who ripped it off from User:Enterprisey/search-shortcuts var expansions = { "wp:afd": "WP:Articles for deletion", "wp:tfd": "WP:Templates for discussion/Log", "wp:cfd": "WP:Categories for discussion/Log", "wp:rfd": "WP:Redirects for discussion/Log", "wp:ffd": "WP:Files for discussion/Log", "wp:mfd": "WP:Miscellany for deletion", "wp:drv": "WP:Deletion review", "wp:mrv": "WP:Move review", "template:dykn": "Template:Did you know nominations", // t: expands to template: "wp:pr": "WP:Peer review", "wp:gar": "WP:Good article reassessment", "wp:fac": "WP:Featured article candidates", "wp:rfa": "WP:Requests for adminship", "wp:rfb": "WP:Requests for bureaucratship", "wp:rfc": "WP:Requests for comment", "wp:brfa": "WP:Bots/Requests for approval",

// namespaces "t": "Template", "c": "Category", "me": "User:Sportzpikachu", "alt": "User:Sportshead", "co": "Special:Contribs", "wp": "hsw" };

function shortcutCB(event) { if (event.key === "/" || event.key === ":") { var val = $(this).val.toLowerCase; if (expansions[val]) { $(this).val(expansions[val]); }       }    }

$("#searchInput").on("keydown", shortcutCB);

Array.isArray(window.GoToTitleHooks) ? window.GoToTitleHooks.push(shortcutCB) : window.GoToTitleHooks = [shortcutCB];