85,514
edits
m (Test) |
m (Undo revision 57784 by Abhidevananda (talk)) |
||
Line 12: | Line 12: | ||
*/ | */ | ||
/* global mw, $ */ | /* global mw, $, importStylesheet, importScript */ | ||
/* jshint strict:false, browser:true */ | /* jshint strict:false, browser:true */ | ||
mw.loader.using( ['mediawiki. | mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'] ).done( function () { | ||
/* Begin of mw.loader.using callback */ | /* Begin of mw.loader.using callback */ | ||
Line 23: | Line 23: | ||
* Description: Adds an additional link to the complete list of languages available. | * Description: Adds an additional link to the complete list of languages available. | ||
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]] | * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]] | ||
* | * | ||
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) { | if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) { | ||
$( function () { | $( function () { | ||
Line 30: | Line 30: | ||
} ); | } ); | ||
} | } | ||
*/ | |||
/** | /** | ||
Line 80: | Line 81: | ||
if ( extraCSS ) { | if ( extraCSS ) { | ||
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { | if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { | ||
importStylesheet( extraCSS ); | |||
} else { | } else { | ||
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } ); | mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } ); | ||
Line 88: | Line 89: | ||
if ( extraJS ) { | if ( extraJS ) { | ||
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) { | if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) { | ||
importScript( extraJS ); | |||
} else { | } else { | ||
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } ); | mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } ); | ||
} | } | ||
} | |||
/** | |||
* Import more specific scripts if necessary | |||
*/ | |||
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) { | |||
/* scripts specific to editing pages */ | |||
importScript( 'MediaWiki:Common.js/edit.js' ); | |||
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) { | |||
/* watchlist scripts */ | |||
importScript( 'MediaWiki:Common.js/watchlist.js' ); | |||
} | |||
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) { | |||
/* file description page scripts */ | |||
importScript( 'MediaWiki:Common.js/file.js' ); | |||
} | |||
/** | |||
* Helper script for .hlist class in Common.css | |||
* Add pseudo-selector class to last-child list items in IE8 | |||
* @source mediawiki.org/wiki/Snippets/Horizontal_lists | |||
* @revision 6 (2014-08-23) | |||
* @author [[User:Edokter]] | |||
*/ | |||
( function ( mw, $ ) { | |||
var profile = $.client.profile(); | |||
if ( profile.name === 'msie' && profile.versionNumber === 8 ) { | |||
mw.hook( 'wikipage.content' ).add( function ( $content ) { | |||
$content.find( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' ) | |||
.addClass( 'hlist-last-child' ); | |||
} ); | |||
} | |||
}( mediaWiki, jQuery ) ); | |||
/** | |||
* Fix for Windows XP Unicode font rendering | |||
*/ | |||
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) { | |||
mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' + | |||
'.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' ); | |||
} | } | ||
Line 126: | Line 167: | ||
* Collapsible tables | * Collapsible tables | ||
* | * | ||
* Allows tables to be collapsed, showing only the header. See [[ | * Allows tables to be collapsed, showing only the header. See [[Wikipedia:NavFrame]]. | ||
* | * | ||
* @version 2.0.3 (2014-03-14) | * @version 2.0.3 (2014-03-14) | ||
Line 151: | Line 192: | ||
var Rows = Table.rows; | var Rows = Table.rows; | ||
var i; | var i; | ||
if ( Button.firstChild.data === collapseCaption ) { | if ( Button.firstChild.data === collapseCaption ) { | ||
Line 160: | Line 200: | ||
} else { | } else { | ||
for ( i = 1; i < Rows.length; i++ ) { | for ( i = 1; i < Rows.length; i++ ) { | ||
Rows[i].style.display = | Rows[i].style.display = Rows[0].style.display; | ||
} | } | ||
Button.firstChild.data = collapseCaption; | Button.firstChild.data = collapseCaption; | ||
Line 234: | Line 274: | ||
mw.hook( 'wikipage.content' ).add( createCollapseButtons ); | mw.hook( 'wikipage.content' ).add( createCollapseButtons ); | ||
/** | /** | ||
Line 426: | Line 436: | ||
} | } | ||
} ); | } ); | ||
} | } | ||