Jump to content

User:Kangaroopower/rawtab.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Kangaroopower (talk | contribs) at 20:06, 10 August 2012 (nirvana). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
// Adds a portlet that saysraw to js and css pages which links to the raw text version of the page
/* Put: 
// [[User:Kangaroopower/scripts/rawtab.js]] 
importScript('User:Kangaroopower/scripts/rawtab.js');
in your skins's js page to use
*/

importScript('User:Kangaroopower/Nirvana.js');
$(function() {
   if (mw.config.get('wgPageName').endsWith(('.js') || ('.css')) == true && mw.config.get('wgNamespaceNumber') != -1) { 
	if ( mw.config.get ( 'skin' ) == 'vector' ) $('#ca-talk').after('<li id="ca-raw"><span><a href="/w/index.php?title='+ mw.config.get('wgPageName') +'&action=raw&ctype=text/javascript">Raw</a></span></li>');
	else $('#ca-move').before('<li id="ca-raw"><a href="/w/index.php?title='+ mw.config.get('wgPageName') +'&action=raw&ctype=text/javascript">Raw</a></li>');
   }
});