Notice: This page contains information for the legacy Phidget21 Library. Phidget21 is out of support. Bugfixes may be considered on a case by case basis. Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21. We recommend that new projects be developed against the Phidget22 Library.
|
MediaWiki:Common.js: Difference between revisions
From Phidgets Legacy Support
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/** | /** | ||
* Redirect User:Name/skin.js and skin.css to the current skin's pages | * Redirect User:Name/skin.js and skin.css to the current skin's pages | ||
* (unless the 'skin' page really exists) | * (unless the 'skin' page really exists). | ||
* @source | * | ||
* @ | * Dependencies: mediawiki.util | ||
* | |||
* @source https://www.mediawiki.org/wiki/Snippets/Redirect_skin.js | |||
* @revision 2016-04-13 | |||
*/ | */ | ||
if ( mw.config.get( 'wgArticleId' ) == 0 && mw.config.get( 'wgNamespaceNumber' ) == 2 ) { | if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) { | ||
mw.loader.using( 'mediawiki.util', function () { | |||
var titleParts = mw.config.get( 'wgPageName' ).split( '/' ); | |||
// 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 = 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' ); | |||
} | |||
} | |||
} ); | |||
} | } | ||
// Book specific | // Book specific | ||
var wgBookName = ( mw.config.get( 'wgPageName' ).split( '/', 1)[0] || '' ).split( ':', 2 ).join( ':' ); | var wgBookName = ( mw.config.get( 'wgPageName' ).split( '/', 1)[0] || '' ).split( ':', 2 ).join( ':' ); | ||
mw.loader.load( '/docs/index.php?title=MediaWiki:Common.css/'+wgBookName+'&action=raw&ctype=text/css', 'text/css' ); | |||
// Imported scripts | // Imported scripts | ||
mw.loader.load( '/docs/index.php?title=MediaWiki:Common.js/CollapseElements.js&action=raw&ctype=text/javascript'); | |||
Latest revision as of 23:51, 15 June 2022
/**
* 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
*/
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
mw.loader.using( 'mediawiki.util', function () {
var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
// 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 = 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' );
}
}
} );
}
// Book specific
var wgBookName = ( mw.config.get( 'wgPageName' ).split( '/', 1)[0] || '' ).split( ':', 2 ).join( ':' );
mw.loader.load( '/docs/index.php?title=MediaWiki:Common.css/'+wgBookName+'&action=raw&ctype=text/css', 'text/css' );
// Imported scripts
mw.loader.load( '/docs/index.php?title=MediaWiki:Common.js/CollapseElements.js&action=raw&ctype=text/javascript');