Jump to content

User:Quarl/userscript.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Quarl (talk | contribs) at 22:54, 10 January 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// User:Quarl/userscript.js

// requires addlilink.js, get_page_name.js

// adds "raw" tab to user script pages

// quarl 2006-01-10 initial version

function userscriptMakeUrl(pagename) {
    pagename = escape(pagename.replace(' ','_'));
    return 'http://en.wikipedia.org/w/index.php?title=' + pagename + '&action=raw&ctype=text/javascript&dontcountme=s';
}

function addTab_UserScriptRaw() {
    var pname = getPname();
    if (pname.match(/[.]js$/)) {
        addTab(userscriptMakeUrl(pname), 'raw', 'ca-raw', "Show raw version of user script");
    }
}

addOnloadHook(addTab_UserScriptRaw);