Jump to content

User:Mattflaschen/CommonsHelper Labs.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mattflaschen (talk | contribs) at 21:11, 9 January 2009 (fix canonical). 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.
// CommonsHelper Helper (CH²) by Krimpet
// Released into the public domain
 
if ( wgCanonicalNamespace == 'File' && wgAction == 'edit')
{
   //var page = 'User:Krimpet/CH2.js';
   var page = 'User:Superm401/CH2.js';

   //importedScripts[page] = true;
   var url = 'http://commons.wikimedia.org/w'
             + '/index.php?title='
             + encodeURIComponent( page.replace( / /g, '_' ) )
             + '&action=raw&ctype=text/javascript';
   var scriptElem = document.createElement( 'script' );
   scriptElem.setAttribute( 'src' , url );
   scriptElem.setAttribute( 'type' , 'text/javascript' );
   document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}