MediaWiki:Redirect skin.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/** * Redirect User:Name/skin.js and skin.css to the current skin's pages * (unless the 'skin' page really exists). * * Dependencies: mediawiki.util * * @source https://www.mediawiki.org/wiki/Snippets/Redirect_skin.js * @revision 2016-04-13 */ mw.loader.using( [ 'mediawiki.util' ] ).then(function() { var titleParts = mw.config.get( 'wgPageName' ).split( '/' ); isMySkin = titleParts[0] === 'Special:MySkin'; if (isMySkin || mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) { // Make sure there was a part before and after the slash // And that the latter is 'skin.js' or 'skin.css' if ( titleParts.length === 2 ) { var userSkinPage = (isMySkin ? "User:" + mw.config.get('wgUserName') : titleParts[0]) + '/' + mw.config.get( 'skin' ); if ( titleParts[1] === 'skin.js' ) { window.location.href = mw.util.getUrl( userSkinPage + '.js' ); } else if ( titleParts[1] === 'skin.css' ) { window.location.href = mw.util.getUrl( userSkinPage + '.css' ); } } } });