diff options
Diffstat (limited to 'skins/common')
33 files changed, 950 insertions, 1055 deletions
diff --git a/skins/common/IEFixes.js b/skins/common/IEFixes.js index dd999ed4..e35fcd1a 100644 --- a/skins/common/IEFixes.js +++ b/skins/common/IEFixes.js @@ -1,10 +1,17 @@ -// IE fixes javascript +// IE fixes javascript loaded by wikibits.js for IE <= 6.0 +( function ( mw, $ ) { -window.isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); -window.doneIETransform = undefined; -window.doneIEAlphaFix = undefined; +var doneIEAlphaFix, doneIETransform, expandedURLs, fixalpha, isMSIE55, + relativeforfloats, setrelative, hasClass; -window.hookit = function() { +// Also returns true for IE6, 7, 8, 9 and 10. createPopup is removed in IE11. +// Good thing this is only loaded for IE <= 6 by wikibits. +// Might as well set it to true. +isMSIE55 = window.isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); +doneIETransform = window.doneIETransform = undefined; +doneIEAlphaFix = window.doneIEAlphaFix = undefined; + +window.hookit = function () { if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) { doneIETransform = true; relativeforfloats(); @@ -17,26 +24,27 @@ if ( document.attachEvent ) { } // png alpha transparency fixes -window.fixalpha = function( logoId ) { +fixalpha = window.fixalpha = function ( logoId ) { // bg if ( isMSIE55 && !doneIEAlphaFix ) { - var plogo = document.getElementById( logoId || 'p-logo' ); + var bg, imageUrl, linkFix, logoa, logospan, plogo; + plogo = document.getElementById( logoId || 'p-logo' ); if ( !plogo ) { return; } - var logoa = plogo.getElementsByTagName('a')[0]; + logoa = plogo.getElementsByTagName('a')[0]; if ( !logoa ) { return; } - var bg = logoa.currentStyle.backgroundImage; - var imageUrl = bg.substring( 5, bg.length - 2 ); + bg = logoa.currentStyle.backgroundImage; + imageUrl = bg.substring( 5, bg.length - 2 ); doneIEAlphaFix = true; - if ( imageUrl.substr( imageUrl.length - 4 ).toLowerCase() == '.png' ) { - var logospan = logoa.appendChild( document.createElement( 'span' ) ); + if ( imageUrl.substr( imageUrl.length - 4 ).toLowerCase() === '.png' ) { + logospan = logoa.appendChild( document.createElement( 'span' ) ); logoa.style.backgroundImage = 'none'; logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')'; @@ -45,7 +53,7 @@ window.fixalpha = function( logoId ) { logospan.style.width = logoa.currentStyle.width; logospan.style.cursor = 'hand'; // Center image with hack for IE5.5 - if ( document.documentElement.dir == 'rtl' ) { + if ( document.documentElement.dir === 'rtl' ) { logospan.style.right = '50%'; logospan.style.setExpression( 'marginRight', '"-" + (this.offsetWidth / 2) + "px"' ); } else { @@ -55,7 +63,7 @@ window.fixalpha = function( logoId ) { logospan.style.top = '50%'; logospan.style.setExpression( 'marginTop', '"-" + (this.offsetHeight / 2) + "px"' ); - var linkFix = logoa.appendChild( logoa.cloneNode() ); + linkFix = logoa.appendChild( logoa.cloneNode() ); linkFix.style.position = 'absolute'; linkFix.style.height = '100%'; linkFix.style.width = '100%'; @@ -69,22 +77,23 @@ if ( isMSIE55 ) { } // fix ie6 disappering float bug -window.relativeforfloats = function() { - var bc = document.getElementById( 'bodyContent' ); +relativeforfloats = window.relativeforfloats = function () { + var bc, tables, divs; + bc = document.getElementById( 'bodyContent' ); if ( bc ) { - var tables = bc.getElementsByTagName( 'table' ); - var divs = bc.getElementsByTagName( 'div' ); + tables = bc.getElementsByTagName( 'table' ); + divs = bc.getElementsByTagName( 'div' ); setrelative( tables ); setrelative( divs ); } }; -window.setrelative = function( nodes ) { +setrelative = window.setrelative = function ( nodes ) { var i = 0; while ( i < nodes.length ) { - if( ( ( nodes[i].style.float && nodes[i].style.float != ( 'none' ) || - ( nodes[i].align && nodes[i].align != ( 'none' ) ) ) && - ( !nodes[i].style.position || nodes[i].style.position != 'relative' ) ) ) + if( ( ( nodes[i].style.float && nodes[i].style.float !== ( 'none' ) || + ( nodes[i].align && nodes[i].align !== ( 'none' ) ) ) && + ( !nodes[i].style.position || nodes[i].style.position !== 'relative' ) ) ) { nodes[i].style.position = 'relative'; } @@ -93,30 +102,31 @@ window.setrelative = function( nodes ) { }; // Expand links for printing -String.prototype.hasClass = function( classWanted ) { - var classArr = this.split(/\s/); - for ( var i = 0; i < classArr.length; i++ ) { - if ( classArr[i].toLowerCase() == classWanted.toLowerCase() ) { +hasClass = function ( classText, classWanted ) { + var i = 0, classArr = classText.split(/\s/); + for ( i = 0; i < classArr.length; i++ ) { + if ( classArr[i].toLowerCase() === classWanted.toLowerCase() ) { return true; } } return false; }; -window.expandedURLs = undefined; +expandedURLs = window.expandedURLs = undefined; -window.onbeforeprint = function() { - expandedURLs = []; +window.onbeforeprint = function () { + var allLinks, contentEl, expandedLink, expandedText, i; - var contentEl = document.getElementById( 'content' ); + expandedURLs = []; + contentEl = document.getElementById( 'content' ); if ( contentEl ) { - var allLinks = contentEl.getElementsByTagName( 'a' ); + allLinks = contentEl.getElementsByTagName( 'a' ); - for ( var i = 0; i < allLinks.length; i++ ) { - if ( allLinks[i].className.hasClass( 'external' ) && !allLinks[i].className.hasClass( 'free' ) ) { - var expandedLink = document.createElement( 'span' ); - var expandedText = document.createTextNode( ' (' + allLinks[i].href + ')' ); + for ( i = 0; i < allLinks.length; i++ ) { + if ( hasClass( allLinks[i].className, 'external' ) && !hasClass( allLinks[i].className, 'free' ) ) { + expandedLink = document.createElement( 'span' ); + expandedText = document.createTextNode( ' (' + allLinks[i].href + ')' ); expandedLink.appendChild( expandedText ); allLinks[i].parentNode.insertBefore( expandedLink, allLinks[i].nextSibling ); expandedURLs[i] = expandedLink; @@ -132,3 +142,5 @@ window.onafterprint = function() { } } }; + +}( mediaWiki, jQuery ) ); diff --git a/skins/common/ajax.js b/skins/common/ajax.js index 121f9d12..ca74b384 100644 --- a/skins/common/ajax.js +++ b/skins/common/ajax.js @@ -1,15 +1,23 @@ -// remote scripting library -// (c) copyright 2005 modernmethod, inc -window.sajax_debug_mode = false; -window.sajax_request_type = 'GET'; +/** + * Remote Scripting Library + * Copyright 2005 modernmethod, inc + * Under the open source BSD license + * http://www.modernmethod.com/sajax/ + */ + +/*jshint camelcase:false, onevar:false */ +/*global alert */ +( function ( mw ) { /** - * if sajax_debug_mode is true, this function outputs given the message into - * the element with id = sajax_debug; if no such element exists in the document, + * if sajax_debug_mode is true, this function outputs given the message into + * the element with id = sajax_debug; if no such element exists in the document, * it is injected. */ -window.sajax_debug = function(text) { - if (!sajax_debug_mode) return false; +function debug( text ) { + if ( !window.sajax_debug_mode ) { + return false; + } var e = document.getElementById( 'sajax_debug' ); @@ -33,36 +41,36 @@ window.sajax_debug = function(text) { e.appendChild( m ); return true; -}; +} /** * Compatibility wrapper for creating a new XMLHttpRequest object. */ -window.sajax_init_object = function() { - sajax_debug( 'sajax_init_object() called..' ); - var A; +function createXhr() { + debug( 'sajax_init_object() called..' ); + var a; try { // Try the new style before ActiveX so we don't // unnecessarily trigger warnings in IE 7 when // set to prompt about ActiveX usage - A = new XMLHttpRequest(); - } catch ( e ) { + a = new XMLHttpRequest(); + } catch ( xhrE ) { try { - A = new ActiveXObject( 'Msxml2.XMLHTTP' ); - } catch ( e ) { + a = new window.ActiveXObject( 'Msxml2.XMLHTTP' ); + } catch ( msXmlE ) { try { - A = new ActiveXObject( 'Microsoft.XMLHTTP' ); - } catch ( oc ) { - A = null; + a = new window.ActiveXObject( 'Microsoft.XMLHTTP' ); + } catch ( msXhrE ) { + a = null; } } } - if ( !A ) { - sajax_debug( 'Could not create connection object.' ); + if ( !a ) { + debug( 'Could not create connection object.' ); } - return A; -}; + return a; +} /** * Perform an AJAX call to MediaWiki. Calls are handled by AjaxDispatcher.php @@ -80,13 +88,13 @@ window.sajax_init_object = function() { * (1, 2, 3) as the parameter list, and will show the result in the element * with id = showFoo */ -window.sajax_do_call = function(func_name, args, target) { - var i, x, n; +function doAjaxRequest( func_name, args, target ) { + var i, x; var uri; var post_data; uri = mw.util.wikiScript() + '?action=ajax'; - if ( sajax_request_type == 'GET' ) { - if ( uri.indexOf( '?' ) == -1 ) { + if ( window.sajax_request_type === 'GET' ) { + if ( uri.indexOf( '?' ) === -1 ) { uri = uri + '?rs=' + encodeURIComponent( func_name ); } else { uri = uri + '&rs=' + encodeURIComponent( func_name ); @@ -102,47 +110,47 @@ window.sajax_do_call = function(func_name, args, target) { post_data = post_data + '&rsargs[]=' + encodeURIComponent( args[i] ); } } - x = sajax_init_object(); + x = createXhr(); if ( !x ) { alert( 'AJAX not supported' ); return false; } try { - x.open( sajax_request_type, uri, true ); + x.open( window.sajax_request_type, uri, true ); } catch ( e ) { - if ( window.location.hostname == 'localhost' ) { - alert( "Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing." ); + if ( location.hostname === 'localhost' ) { + alert( 'Your browser blocks XMLHttpRequest to "localhost", try using a real hostname for development/testing.' ); } throw e; } - if ( sajax_request_type == 'POST' ) { + if ( window.sajax_request_type === 'POST' ) { x.setRequestHeader( 'Method', 'POST ' + uri + ' HTTP/1.1' ); x.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); } x.setRequestHeader( 'Pragma', 'cache=yes' ); x.setRequestHeader( 'Cache-Control', 'no-transform' ); - x.onreadystatechange = function() { - if ( x.readyState != 4 ) { + x.onreadystatechange = function () { + if ( x.readyState !== 4 ) { return; } - sajax_debug( 'received (' + x.status + ' ' + x.statusText + ') ' + x.responseText ); + debug( 'received (' + x.status + ' ' + x.statusText + ') ' + x.responseText ); //if ( x.status != 200 ) // alert( 'Error: ' + x.status + ' ' + x.statusText + ': ' + x.responseText ); //else - if ( typeof( target ) == 'function' ) { + if ( typeof target === 'function' ) { target( x ); - } else if ( typeof( target ) == 'object' ) { - if ( target.tagName == 'INPUT' ) { - if ( x.status == 200 ) { + } else if ( typeof target === 'object' ) { + if ( target.tagName === 'INPUT' ) { + if ( x.status === 200 ) { target.value= x.responseText; } //else alert( 'Error: ' + x.status + ' ' + x.statusText + ' (' + x.responseText + ')' ); } else { - if ( x.status == 200 ) { + if ( x.status === 200 ) { target.innerHTML = x.responseText; } else { target.innerHTML = '<div class="error">Error: ' + x.status + @@ -150,24 +158,37 @@ window.sajax_do_call = function(func_name, args, target) { } } } else { - alert( 'bad target for sajax_do_call: not a function or object: ' + target ); + alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); } }; - sajax_debug( func_name + ' uri = ' + uri + ' / post = ' + post_data ); + debug( func_name + ' uri = ' + uri + ' / post = ' + post_data ); x.send( post_data ); - sajax_debug( func_name + ' waiting..' ); - delete x; + debug( func_name + ' waiting..' ); return true; -}; +} /** - * @return boolean whether the browser supports XMLHttpRequest + * @return {boolean} Whether the browser supports AJAX */ -window.wfSupportsAjax = function() { - var request = sajax_init_object(); +function wfSupportsAjax() { + var request = createXhr(); var supportsAjax = request ? true : false; - delete request; + request = undefined; return supportsAjax; -}; +} + +// Expose + Mark as deprecated +var deprecationNotice = 'Sajax is deprecated, use jQuery.ajax or mediawiki.api instead.'; + +// Variables +mw.log.deprecate( window, 'sajax_debug_mode', false, deprecationNotice ); +mw.log.deprecate( window, 'sajax_request_type', 'GET', deprecationNotice ); +// Methods +mw.log.deprecate( window, 'sajax_debug', debug, deprecationNotice ); +mw.log.deprecate( window, 'sajax_init_object', createXhr, deprecationNotice ); +mw.log.deprecate( window, 'sajax_do_call', doAjaxRequest, deprecationNotice ); +mw.log.deprecate( window, 'wfSupportsAjax', wfSupportsAjax, deprecationNotice ); + +}( mediaWiki ) ); diff --git a/skins/common/commonContent.css b/skins/common/commonContent.css index 0fe8489e..14d39b92 100644 --- a/skins/common/commonContent.css +++ b/skins/common/commonContent.css @@ -1,6 +1,9 @@ -/* -** MediaWiki style sheet for general styles on complex content -*/ +/** + * MediaWiki style sheet for general styles on complex content + * + * Styles for complex things which are a standard part of page content + * (ie: the CSS classing built into the system), like the TOC. + */ /* Table of Contents */ #toc, @@ -11,6 +14,43 @@ padding: 5px; font-size: 95%; } + +/** + * We want to display the ToC element with intrinsic width in block mode. The fit-content + * value for width is however not supported by large groups of browsers. + * + * We use display:table. Even though it should only contain other table-* display + * elements, there are no known problems with using this. + * + * Because IE < 8, FF 2 and other older browsers don't support display:table, we fallback to + * using inline-block mode, which features at least intrinsic width, but won't clear preceding + * inline elements. In practice inline elements surrounding the TOC are uncommon enough that + * this is an acceptable sacrifice. + */ +#toc, +.toc { + display: -moz-inline-block; + display: inline-block; + display: table; + + /* IE7 and earlier */ + zoom: 1; + *display: inline; + + padding: 7px; +} + +/* CSS for backwards-compatibility with cached page renders and creative uses in wikitext */ +table#toc, +table.toc { + border-collapse: collapse; +} +/* Remove additional paddings inside table-cells that are not present in <div>s */ +table#toc td, +table.toc td { + padding: 0; +} + #toc h2, .toc h2 { display: inline; @@ -93,6 +133,7 @@ html .thumbcaption { div.magnify { border: none !important; background: none !important; + margin-left: 3px; } div.magnify a, div.magnify img { display: block; @@ -110,11 +151,28 @@ img.thumbborder { } /** + * Edit forms + */ +#editform textarea { + display: block; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +/** * Basic styles for the user login and create account forms */ #userlogin, #userloginForm { border: solid 1px #cccccc; padding: 1.2em; - margin: .5em; - float: left; + margin: 0.5em; +} + +#loginend { + margin: 0.5em; +} + +#loginend table { + width: 100%; } diff --git a/skins/common/commonElements.css b/skins/common/commonElements.css index 02fd29fe..76ec4af7 100644 --- a/skins/common/commonElements.css +++ b/skins/common/commonElements.css @@ -1,6 +1,9 @@ /** * MediaWiki style sheet for general styles on basic content elements - * This style sheet is used by the monobook and vector skins + * + * Styles for basic elements: links, lists, etc... + * + * This style sheet is used by the Monobook and Vector skins. */ /* Links */ @@ -83,15 +86,9 @@ h6 { h1 { font-size: 188%; } -h1 .editsection { - font-size: 53%; -} h2 { font-size: 150%; } -h2 .editsection { - font-size: 67%; -} h3, h4, h5, @@ -102,28 +99,14 @@ h6 { h3 { font-size: 132%; } -h3 .editsection { - font-size: 76%; - font-weight: normal; -} h4 { font-size: 116%; } -h4 .editsection { - font-size: 86%; - font-weight: normal; } h5 { - font-size: 100%; -} -h5 .editsection { - font-weight: normal; + font-size: 108%; } h6 { - font-size: 80%; -} -h6 .editsection { - font-size: 125%; - font-weight: normal; + font-size: 100%; } /* Some space under the headers in the content area */ @@ -186,7 +169,7 @@ blockquote { pre, code, tt, kbd, samp, .mw-code { /* * Some browsers will render the monospace text too small, namely Firefox, Chrome and Safari. - * Specifying any valid, second value will trigger correct behaviour without forcing a different font. + * Specifying any valid, second value will trigger correct behavior without forcing a different font. */ font-family: monospace, Courier; } @@ -195,7 +178,7 @@ code { } pre, .mw-code { padding: 1em; - border: 1px dashed #2f6fab; + border: 1px solid #ddd; color: black; background-color: #f9f9f9; } diff --git a/skins/common/commonInterface.css b/skins/common/commonInterface.css index 60d6436b..af6665e4 100644 --- a/skins/common/commonInterface.css +++ b/skins/common/commonInterface.css @@ -1,6 +1,10 @@ -/* -** MediaWiki style sheet for common core styles on interfaces -*/ +/** + * MediaWiki style sheet for common core styles on interfaces + * + * Styles for the Monobook/Vector pattern of laying out common interfaces. + * These ids/classes are not built into the system, + * they are outputted by the actual MonoBook/Vector code by convention. + */ /* Categories */ .catlinks { diff --git a/skins/common/commonPrint.css b/skins/common/commonPrint.css index 48dd943f..58628772 100644 --- a/skins/common/commonPrint.css +++ b/skins/common/commonPrint.css @@ -111,7 +111,7 @@ div#jump-to-nav, div.top, div#column-one, #colophon, -.editsection, +.mw-editsection, .toctoggle, .tochidden, div#f-poweredbyico, @@ -125,7 +125,10 @@ li#privacy, .mw-hidden-catlinks, tr.mw-metadata-show-hide-extended, span.mw-filepage-other-resolutions, -#filetoc { +#filetoc, +.usermessage, +.patrollink, +#mw-navigation { /* Hides all the elements irrelevant for printing */ display: none; } @@ -189,7 +192,7 @@ a:link, a:visited { #content a.external.text:after, #content a.external.autonumber:after { /* Expand URLs for printing */ - content: " (" attr(href) ") "; + content: " (" attr(href) ")"; } #globalWrapper { @@ -350,7 +353,7 @@ a.sortheader { .wikitable, .thumb, img { page-break-inside: avoid; } -h2, h3, h4, h5, h6, h7 { +h2, h3, h4, h5, h6 { page-break-after: avoid; } p { diff --git a/skins/common/config.css b/skins/common/config.css index aa982d32..79780da9 100644 --- a/skins/common/config.css +++ b/skins/common/config.css @@ -88,7 +88,13 @@ } .config-input-check { - margin-left: 10em; + margin-left: 3.7em; + margin-right: 2em; + margin-bottom: 0.25em; +} + +.config-input-check input { + margin-left: -1em; } .error { @@ -102,7 +108,6 @@ .config-settings-block { list-style-type: none; list-style-image: none; - float: left; margin: 0; padding: 0; } diff --git a/skins/common/config.js b/skins/common/config.js index b1e28aba..fb8edc1f 100644 --- a/skins/common/config.js +++ b/skins/common/config.js @@ -1,5 +1,5 @@ ( function ( $ ) { - $( document ).ready( function () { + $( function () { var $label, labelText; function syncText() { @@ -25,7 +25,7 @@ .find( '.mw-help-field-data' ) .slideToggle( 'fast' ); } ); - + // Show/hide code for DB-specific options // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? $( '.dbRadio' ).each( function () { @@ -40,12 +40,12 @@ $wrapper.show( 'slow' ); } } ); - + // Scroll to the bottom of upgrade log $( '#config-live-log' ).children( 'textarea' ).each( function () { this.scrollTop = this.scrollHeight; } ); - + // Show/hide Creative Commons thingy $( '.licenseRadio' ).click( function () { var $wrapper = $( '#config-cc-wrapper' ); @@ -55,7 +55,7 @@ $wrapper.hide( 'slow' ); } } ); - + // Show/hide random stuff (email, upload) $( '.showHideRadio' ).click( function () { var $wrapper = $( '#' + $(this).attr( 'rel' ) ); @@ -88,7 +88,7 @@ $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' ); } } ); - + // Synchronize radio button label for sitename with textbox $label = $( 'label[for=config__NamespaceType_site-name]' ); labelText = $label.text(); @@ -97,7 +97,7 @@ // Show/Hide memcached servers when needed $( 'input[name$="config_wgMainCacheType"]' ).change( function () { - var $memc = $( "#config-memcachewrapper" ); + var $memc = $( '#config-memcachewrapper' ); if( $( 'input[name$="config_wgMainCacheType"]:checked' ).val() === 'memcached' ) { $memc.show( 'slow' ); } else { diff --git a/skins/common/images/Arr_u.png b/skins/common/images/Arr_u.png Binary files differindex 6132836b..1aa543af 100644 --- a/skins/common/images/Arr_u.png +++ b/skins/common/images/Arr_u.png diff --git a/skins/common/images/ar/button_headline.png b/skins/common/images/ar/button_headline.png Binary files differindex 04fb8f11..398e5614 100644 --- a/skins/common/images/ar/button_headline.png +++ b/skins/common/images/ar/button_headline.png diff --git a/skins/common/images/ar/button_nowiki.png b/skins/common/images/ar/button_nowiki.png Binary files differindex 12b986b4..743ea61b 100644 --- a/skins/common/images/ar/button_nowiki.png +++ b/skins/common/images/ar/button_nowiki.png diff --git a/skins/common/images/arrow_disabled_left_25.png b/skins/common/images/arrow_disabled_left_25.png Binary files differindex 8f979aab..83df0684 100644 --- a/skins/common/images/arrow_disabled_left_25.png +++ b/skins/common/images/arrow_disabled_left_25.png diff --git a/skins/common/images/arrow_disabled_right_25.png b/skins/common/images/arrow_disabled_right_25.png Binary files differindex 11022f62..aa4fbf8c 100644 --- a/skins/common/images/arrow_disabled_right_25.png +++ b/skins/common/images/arrow_disabled_right_25.png diff --git a/skins/common/images/arrow_right_25.png b/skins/common/images/arrow_right_25.png Binary files differindex 9e1b550c..3f8fee38 100644 --- a/skins/common/images/arrow_right_25.png +++ b/skins/common/images/arrow_right_25.png diff --git a/skins/common/images/button_hr.png b/skins/common/images/button_hr.png Binary files differindex 19e4ad45..47e1ca40 100644 --- a/skins/common/images/button_hr.png +++ b/skins/common/images/button_hr.png diff --git a/skins/common/images/button_nowiki.png b/skins/common/images/button_nowiki.png Binary files differindex c647de2b..2ba818de 100644 --- a/skins/common/images/button_nowiki.png +++ b/skins/common/images/button_nowiki.png diff --git a/skins/common/images/button_sig.png b/skins/common/images/button_sig.png Binary files differindex ff7348a9..fe34b3fb 100644 --- a/skins/common/images/button_sig.png +++ b/skins/common/images/button_sig.png diff --git a/skins/common/images/button_template.png b/skins/common/images/button_template.png Binary files differindex 53b6f92f..94d9d0b9 100644 --- a/skins/common/images/button_template.png +++ b/skins/common/images/button_template.png diff --git a/skins/common/images/critical-32.png b/skins/common/images/critical-32.png Binary files differindex dce5667a..9b38e6a2 100644 --- a/skins/common/images/critical-32.png +++ b/skins/common/images/critical-32.png diff --git a/skins/common/images/fa/button_nowiki.png b/skins/common/images/fa/button_nowiki.png Binary files differindex 12b986b4..743ea61b 100644 --- a/skins/common/images/fa/button_nowiki.png +++ b/skins/common/images/fa/button_nowiki.png diff --git a/skins/common/images/feed-icon.png b/skins/common/images/feed-icon.png Binary files differindex 7188fa23..00f49f6c 100644 --- a/skins/common/images/feed-icon.png +++ b/skins/common/images/feed-icon.png diff --git a/skins/common/images/icons/fileicon-psd.png b/skins/common/images/icons/fileicon-psd.png Binary files differnew file mode 100644 index 00000000..598f190e --- /dev/null +++ b/skins/common/images/icons/fileicon-psd.png diff --git a/skins/common/images/magnify-clip-rtl.png b/skins/common/images/magnify-clip-rtl.png Binary files differindex cfddc279..ff85c077 100644 --- a/skins/common/images/magnify-clip-rtl.png +++ b/skins/common/images/magnify-clip-rtl.png diff --git a/skins/common/images/question-small.png b/skins/common/images/question-small.png Binary files differnew file mode 100644 index 00000000..f7405d26 --- /dev/null +++ b/skins/common/images/question-small.png diff --git a/skins/common/images/question.svg b/skins/common/images/question.svg new file mode 100644 index 00000000..27973053 --- /dev/null +++ b/skins/common/images/question.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="21.059px" height="21.06px" viewBox="0 0 21.059 21.06" enable-background="new 0 0 21.059 21.06" xml:space="preserve">
+<path fill="#575757" d="M10.529,0C4.715,0,0,4.714,0,10.529s4.715,10.53,10.529,10.53c5.816,0,10.529-4.715,10.529-10.53
+ S16.346,0,10.529,0z M10.527,16.767c-0.861,0-1.498-0.688-1.498-1.516c0-0.862,0.637-1.534,1.498-1.534c0.828,0,1.5,0.672,1.5,1.534
+ C12.027,16.078,11.355,16.767,10.527,16.767z M12.664,10.255c-0.723,0.568-1,0.931-1,1.739v0.5H9.459v-0.603
+ c0-1.517,0.449-2.136,1.154-2.688c0.707-0.552,1.139-0.845,1.139-1.637c0-0.672-0.414-1.051-1.24-1.051
+ c-0.707,0-1.328,0.189-1.982,0.638L7.479,5.346c0.861-0.604,1.93-1.034,3.342-1.034c1.912,0,3.516,1.051,3.516,3.066
+ C14.336,8.808,13.543,9.566,12.664,10.255z"/>
+</svg>
diff --git a/skins/common/images/tick-32.png b/skins/common/images/tick-32.png Binary files differindex dfde1707..34cfa9ce 100644 --- a/skins/common/images/tick-32.png +++ b/skins/common/images/tick-32.png diff --git a/skins/common/images/warning-32.png b/skins/common/images/warning-32.png Binary files differindex b14a8315..0400734c 100644 --- a/skins/common/images/warning-32.png +++ b/skins/common/images/warning-32.png diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index 6dcdf6f1..eea8b8ee 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -11,24 +11,15 @@ h1 { font-size: 2em; } h2 { font-size: 1.5em; } h3 { font-size: 1.17em; } -h5 { font-size: .83em; } -h6 { font-size: .75em; } +h4 { font-size: 1.11em; } +h5 { font-size: 1.05em; } +h6 { font-size: 1em; } h1, h2, h3, h4, h5, h6 { font-weight: bolder; } /* Now the custom parts */ -/* Make edit sections (which are inside h# tags) normal-sized */ -.editsection { - font-weight: normal; -} -h1 .editsection { font-size: 50%; } -h2 .editsection { font-size: 66.7%; } -h3 .editsection { font-size: 85.5%; } -h5 .editsection { font-size: 120%; } -h6 .editsection { font-size: 133%; } - #footer { clear: both } /* images */ /* @noflip */ @@ -93,6 +84,7 @@ div.magnify { float: right; border: none !important; background: none !important; + margin-left: 3px; } div.magnify a, div.magnify img { @@ -130,6 +122,25 @@ img { border: none; } padding: 5px; font-size: 95%; text-align: center; + display: -moz-inline-block; + display: inline-block; + display: table; + + /* IE7 and earlier */ + zoom: 1; + *display: inline; + + padding: 7px; +} +/* CSS for backwards-compatibility with cached page renders and creative uses in wikitext */ +table#toc, +table.toc { + border-collapse: collapse; +} +/* Remove additional paddings inside table-cells that are not present in <div>s */ +table#toc td, +table.toc td { + padding: 0; } #toc h2, .toc h2 { @@ -161,9 +172,6 @@ img { border: none; } } /* preference page with js-genrated toc */ -#mw-pref-clear { - clear: both; -} #preftoc { float: left; margin: 1em 1em 1em 1em; @@ -283,7 +291,7 @@ li span.deleted { font-style: italic; } -/* Classes for EXIF data display */ +/* Classes for Exif data display */ table.mw_metadata { margin-left: 0.5em; } @@ -458,4 +466,4 @@ html > body.rtl div#bodyContent ul#filetoc { display: block; } -/* RTL specific CSS ends here **/
\ No newline at end of file +/* RTL specific CSS ends here **/ diff --git a/skins/common/protect.js b/skins/common/protect.js index a23c0cbd..dc142ca9 100644 --- a/skins/common/protect.js +++ b/skins/common/protect.js @@ -1,6 +1,7 @@ +( function ( mw, $ ) { -window.ProtectionForm = { - 'existingMatch': false, +var ProtectionForm = window.ProtectionForm = { + existingMatch: false, /** * Set up the protection chaining interface (i.e. "unlock move permissions" checkbox) @@ -12,40 +13,47 @@ window.ProtectionForm = { * numTypes The number of protection types * existingMatch True if all the existing expiry times match */ - 'init': function( opts ) { - if( !( document.createTextNode && document.getElementById && document.getElementsByTagName ) ) + init: function ( opts ) { + var box, boxbody, row, cell, check, label; + + if ( !( document.createTextNode && document.getElementById && document.getElementsByTagName ) ) { return false; + } - var box = document.getElementById( opts.tableId ); - if( !box ) + box = document.getElementById( opts.tableId ); + if ( !box ) { return false; - - var boxbody = box.getElementsByTagName('tbody')[0]; - var row = document.createElement( 'tr' ); + } + + boxbody = box.getElementsByTagName( 'tbody' )[0]; + row = document.createElement( 'tr' ); boxbody.insertBefore( row, boxbody.firstChild.nextSibling ); this.existingMatch = opts.existingMatch; - var cell = document.createElement( 'td' ); + cell = document.createElement( 'td' ); row.appendChild( cell ); // If there is only one protection type, there is nothing to chain - if( opts.numTypes > 1 ) { - var check = document.createElement( 'input' ); + if ( opts.numTypes > 1 ) { + check = document.createElement( 'input' ); check.id = 'mwProtectUnchained'; check.type = 'checkbox'; - cell.appendChild( check ); - addClickHandler( check, function() { ProtectionForm.onChainClick(); } ); + $( check ).click( function () { + ProtectionForm.onChainClick(); + } ); - cell.appendChild( document.createTextNode( ' ' ) ); - var label = document.createElement( 'label' ); + label = document.createElement( 'label' ); label.htmlFor = 'mwProtectUnchained'; label.appendChild( document.createTextNode( opts.labelText ) ); + + cell.appendChild( check ); + cell.appendChild( document.createTextNode( ' ' ) ); cell.appendChild( label ); check.checked = !this.areAllTypesMatching(); this.enableUnchainedInputs( check.checked ); } - + $( '#mwProtect-reason' ).byteLimit( 180 ); this.updateCascadeCheckbox(); @@ -56,17 +64,19 @@ window.ProtectionForm = { /** * Sets the disabled attribute on the cascade checkbox depending on the current selected levels */ - 'updateCascadeCheckbox': function() { + updateCascadeCheckbox: function () { + var i, lists, items, selected; + // For non-existent titles, there is no cascade option - if( !document.getElementById( 'mwProtect-cascade' ) ) { + if ( !document.getElementById( 'mwProtect-cascade' ) ) { return; } - var lists = this.getLevelSelectors(); - for( var i = 0; i < lists.length; i++ ) { - if( lists[i].selectedIndex > -1 ) { - var items = lists[i].getElementsByTagName( 'option' ); - var selected = items[ lists[i].selectedIndex ].value; - if( !this.isCascadeableLevel(selected) ) { + lists = this.getLevelSelectors(); + for ( i = 0; i < lists.length; i++ ) { + if ( lists[i].selectedIndex > -1 ) { + items = lists[i].getElementsByTagName( 'option' ); + selected = items[ lists[i].selectedIndex ].value; + if ( !this.isCascadeableLevel( selected ) ) { document.getElementById( 'mwProtect-cascade' ).checked = false; document.getElementById( 'mwProtect-cascade' ).disabled = true; return; @@ -81,7 +91,7 @@ window.ProtectionForm = { * @param level {String} * @return {Boolean} */ - 'isCascadeableLevel': function( level ) { + isCascadeableLevel: function ( level ) { var cascadeLevels, len, i; cascadeLevels = mw.config.get( 'wgCascadeableLevels' ); @@ -102,9 +112,10 @@ window.ProtectionForm = { * * @param source Element Level selector that changed */ - 'updateLevels': function(source) { - if( !this.isUnchained() ) + updateLevels: function ( source ) { + if ( !this.isUnchained() ) { this.setAllSelectors( source.selectedIndex ); + } this.updateCascadeCheckbox(); }, @@ -115,22 +126,24 @@ window.ProtectionForm = { * @param source Element expiry input that changed */ - 'updateExpiry': function(source) { - if( !this.isUnchained() ) { - var expiry = source.value; - this.forEachExpiryInput(function(element) { + updateExpiry: function ( source ) { + var expiry, listId, list; + + if ( !this.isUnchained() ) { + expiry = source.value; + this.forEachExpiryInput( function ( element ) { element.value = expiry; - }); + } ); } - var listId = source.id.replace( /^mwProtect-(\w+)-expires$/, 'mwProtectExpirySelection-$1' ); - var list = document.getElementById( listId ); - if (list && list.value != 'othertime' ) { + listId = source.id.replace( /^mwProtect-(\w+)-expires$/, 'mwProtectExpirySelection-$1' ); + list = document.getElementById( listId ); + if ( list && list.value !== 'othertime' ) { if ( this.isUnchained() ) { list.value = 'othertime'; } else { - this.forEachExpirySelector(function(element) { + this.forEachExpirySelector( function ( element ) { element.value = 'othertime'; - }); + } ); } } }, @@ -141,15 +154,16 @@ window.ProtectionForm = { * * @param source Element expiry selector that changed */ - 'updateExpiryList': function(source) { - if( !this.isUnchained() ) { - var expiry = source.value; - this.forEachExpirySelector(function(element) { + updateExpiryList: function ( source ) { + var expiry; + if ( !this.isUnchained() ) { + expiry = source.value; + this.forEachExpirySelector( function ( element ) { element.value = expiry; - }); - this.forEachExpiryInput(function(element) { + } ); + this.forEachExpiryInput( function ( element ) { element.value = ''; - }); + } ); } }, @@ -157,8 +171,8 @@ window.ProtectionForm = { * Update chain status and enable/disable various bits of the UI * when the user changes the "unlock move permissions" checkbox */ - 'onChainClick': function() { - if( this.isUnchained() ) { + onChainClick: function () { + if ( this.isUnchained() ) { this.enableUnchainedInputs( true ); } else { this.setAllSelectors( this.getMaxLevel() ); @@ -170,16 +184,17 @@ window.ProtectionForm = { /** * Returns true if the named attribute in all objects in the given array are matching */ - 'matchAttribute' : function( objects, attrName ) { - var value = null; + matchAttribute: function ( objects, attrName ) { + var i, element, value; // Check levels - for ( var i = 0; i < objects.length; i++ ) { - var element = objects[i]; - if ( value == null ) { + value = null; + for ( i = 0; i < objects.length; i++ ) { + element = objects[i]; + if ( value === null ) { value = element[attrName]; } else { - if ( value != element[attrName] ) { + if ( value !== element[attrName] ) { return false; } } @@ -192,7 +207,7 @@ window.ProtectionForm = { * * @return boolean */ - 'areAllTypesMatching': function() { + areAllTypesMatching: function () { return this.existingMatch && this.matchAttribute( this.getLevelSelectors(), 'selectedIndex' ) && this.matchAttribute( this.getExpirySelectors(), 'selectedIndex' ) @@ -204,7 +219,7 @@ window.ProtectionForm = { * * @return bool */ - 'isUnchained': function() { + isUnchained: function () { var element = document.getElementById( 'mwProtectUnchained' ); return element ? element.checked @@ -214,13 +229,13 @@ window.ProtectionForm = { /** * Find the highest protection level in any selector */ - 'getMaxLevel': function() { + getMaxLevel: function () { var maxIndex = -1; - this.forEachLevelSelector(function(element) { - if (element.selectedIndex > maxIndex) { + this.forEachLevelSelector( function ( element ) { + if ( element.selectedIndex > maxIndex ) { maxIndex = element.selectedIndex; } - }); + } ); return maxIndex; }, @@ -229,12 +244,12 @@ window.ProtectionForm = { * * @param index int Protection level */ - 'setAllSelectors': function(index) { - this.forEachLevelSelector(function(element) { - if (element.selectedIndex != index) { + setAllSelectors: function ( index ) { + this.forEachLevelSelector( function ( element ) { + if ( element.selectedIndex !== index ) { element.selectedIndex = index; } - }); + } ); }, /** @@ -242,10 +257,12 @@ window.ProtectionForm = { * * @param func callable Callback function */ - 'forEachLevelSelector': function(func) { - var selectors = this.getLevelSelectors(); - for (var i = 0; i < selectors.length; i++) { - func(selectors[i]); + forEachLevelSelector: function ( func ) { + var i, selectors; + + selectors = this.getLevelSelectors(); + for ( i = 0; i < selectors.length; i++ ) { + func( selectors[i] ); } }, @@ -254,12 +271,14 @@ window.ProtectionForm = { * * @return Array */ - 'getLevelSelectors': function() { - var all = document.getElementsByTagName("select"); - var ours = []; - for (var i = 0; i < all.length; i++) { - var element = all[i]; - if (element.id.match(/^mwProtect-level-/)) { + getLevelSelectors: function () { + var i, ours, all, element; + + all = document.getElementsByTagName( 'select' ); + ours = []; + for ( i = 0; i < all.length; i++ ) { + element = all[i]; + if ( element.id.match( /^mwProtect-level-/ ) ) { ours[ours.length] = element; } } @@ -271,10 +290,12 @@ window.ProtectionForm = { * * @param func callable Callback function */ - 'forEachExpiryInput': function(func) { - var inputs = this.getExpiryInputs(); - for (var i = 0; i < inputs.length; i++) { - func(inputs[i]); + forEachExpiryInput: function ( func ) { + var i, inputs; + + inputs = this.getExpiryInputs(); + for ( i = 0; i < inputs.length; i++ ) { + func( inputs[i] ); } }, @@ -283,12 +304,14 @@ window.ProtectionForm = { * * @return Array */ - 'getExpiryInputs': function() { - var all = document.getElementsByTagName("input"); - var ours = []; - for (var i = 0; i < all.length; i++) { - var element = all[i]; - if (element.name.match(/^mwProtect-expiry-/)) { + getExpiryInputs: function () { + var i, all, element, ours; + + all = document.getElementsByTagName( 'input' ); + ours = []; + for ( i = 0; i < all.length; i++ ) { + element = all[i]; + if ( element.name.match( /^mwProtect-expiry-/ ) ) { ours[ours.length] = element; } } @@ -299,10 +322,12 @@ window.ProtectionForm = { * Apply a callback to each expiry selector list * @param func callable Callback function */ - 'forEachExpirySelector': function(func) { - var inputs = this.getExpirySelectors(); - for (var i = 0; i < inputs.length; i++) { - func(inputs[i]); + forEachExpirySelector: function ( func ) { + var i, inputs; + + inputs = this.getExpirySelectors(); + for ( i = 0; i < inputs.length; i++ ) { + func( inputs[i] ); } }, @@ -311,12 +336,14 @@ window.ProtectionForm = { * * @return Array */ - 'getExpirySelectors': function() { - var all = document.getElementsByTagName("select"); - var ours = []; - for (var i = 0; i < all.length; i++) { - var element = all[i]; - if (element.id.match(/^mwProtectExpirySelection-/)) { + getExpirySelectors: function () { + var i, all, ours, element; + + all = document.getElementsByTagName( 'select' ); + ours = []; + for ( i = 0; i < all.length; i++ ) { + element = all[i]; + if ( element.id.match( /^mwProtectExpirySelection-/ ) ) { ours[ours.length] = element; } } @@ -328,30 +355,33 @@ window.ProtectionForm = { * * @param val boolean Enable? */ - 'enableUnchainedInputs': function(val) { + enableUnchainedInputs: function ( val ) { var first = true; - this.forEachLevelSelector(function(element) { - if (first) { + + this.forEachLevelSelector( function ( element ) { + if ( first ) { first = false; } else { element.disabled = !val; } - }); + } ); first = true; - this.forEachExpiryInput(function(element) { - if (first) { + this.forEachExpiryInput( function ( element ) { + if ( first ) { first = false; } else { element.disabled = !val; } - }); + } ); first = true; - this.forEachExpirySelector(function(element) { - if (first) { + this.forEachExpirySelector( function ( element ) { + if ( first ) { first = false; } else { element.disabled = !val; } - }); + } ); } }; + +}( mediaWiki, jQuery ) ); diff --git a/skins/common/shared.css b/skins/common/shared.css index 8f771e9a..ac7265a8 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -31,6 +31,12 @@ direction: rtl; } +/* User-Agent styles for new HTML5 elements */ +mark { + background-color: yellow; + color: black; +} + /* Input types that should follow user direction, like buttons */ /* TODO: What about buttons in wikipage content ? */ input[type="submit"], @@ -53,9 +59,8 @@ input[dir="rtl"] { } /* Default style for semantic tags */ -abbr, -acronym, -.explain { +abbr[title], +.explain[title] { border-bottom: 1px dotted; cursor: help; } @@ -121,21 +126,6 @@ span.texhtml { cursor: pointer; } -/* Edit section links */ -/* Correct directionality when page dir is different from site/user dir */ -/* @noflip */ -.mw-content-ltr .editsection, -.mw-content-rtl .mw-content-ltr .editsection { - float: right; - margin-left: 5px; -} -/* @noflip */ -.mw-content-rtl .editsection, -.mw-content-ltr .mw-content-rtl .editsection { - float: left; - margin-right: 5px; -} - /** * File description page */ @@ -226,6 +216,35 @@ td.mw-label { .prefsection table { width: 100%; } +.prefsection table.mw-htmlform-matrix { + width: auto; +} + +.mw-icon-question { + /* @embed */ + background: url('images/question-small.png') no-repeat; + /* SVG support using a transparent gradient to guarantee cross-browser + * compatibility (browsers able to understand gradient syntax support also SVG) + * lifted from #pt-login css rule in skins/vector/screen.css */ + /* @embed */ + background: -webkit-linear-gradient(transparent, transparent), url('images/question.svg') no-repeat; + /* @embed */ + background: linear-gradient(transparent, transparent), url('images/question.svg') no-repeat; + background-size: 13px 13px; + display: inline-block; + height: 13px; + width: 13px; + margin-left: 4px; +} + +.mw-icon-question:lang(ar), +.mw-icon-question:lang(fa), +.mw-icon-question:lang(ur) { + -webkit-transform: scaleX(-1); + -ms-transform: scaleX(-1); + transform: scaleX(-1); +} + td.mw-submit { white-space: nowrap; } @@ -248,6 +267,11 @@ tr.mw-htmlform-vertical-label td.mw-label { white-space: nowrap; } +.mw-htmlform-matrix td { + padding-left: 0.5em; + padding-right: 0.5em; +} + input#wpSummary { width: 80%; margin-bottom: 1em; @@ -307,6 +331,11 @@ input#wpSummary { padding-left: 0.25em; border-left: none; } + +/* (bug 5346) make category redirects italic */ +.catlinks li a.mw-redirect { + font-style: italic; +} /** * Hidden categories */ @@ -448,6 +477,11 @@ th.mw-revdel-checkbox { text-align: center; } +/* red links; see bug 36276 */ +a.new { + color: #BA0000; +} + /* feed links */ a.feedlink { /* @embed */ @@ -501,49 +535,57 @@ table.collapsed tr.collapsable { } /* success and error messages */ +.error, +.warning, .success { - color: green; font-size: larger; } +.error { + color: #cc0000; +} .warning { - color: #FFA500; /* orange */ - font-size: larger; + color: #705000; } -.error { - color: red; - font-size: larger; +.success { + color: #009000; } + .errorbox, .warningbox, .successbox { - font-size: larger; - border: 2px solid; + border: 1px solid; padding: .5em 1em; - float: left; - margin-bottom: 2em; - color: #000; -} -.errorbox { - border-color: red; - background-color: #fff2f2; -} -.warningbox { - border-color: #FF8C00; /* darkorange */ - background-color: #FFFFC0; -} -.successbox { - border-color: green; - background-color: #dfd; + margin-bottom: 1em; + display: -moz-inline-block; + display: inline-block; + zoom: 1; + *display: inline; } .errorbox h2, .warningbox h2, .successbox h2 { font-size: 1em; + color: inherit; font-weight: bold; display: inline; margin: 0 .5em 0 0; border: none; } +.errorbox { + color: #cc0000; + border-color: #fac5c5; + background-color: #fae3e3; +} +.warningbox { + color: #705000; + border-color: #fde29b; + background-color: #fdf1d1; +} +.successbox { + color: #009000; + border-color: #b7fdb5; + background-color: #e1fddf; +} /* general info/warning box for SP */ .mw-infobox { @@ -660,7 +702,7 @@ ul#filetoc { padding-right: 2em; } -/* Classes for EXIF data display */ +/* Classes for Exif data display */ table.mw_metadata { font-size: 0.8em; margin-left: 0.5em; @@ -794,6 +836,69 @@ div.gallerytext { word-wrap: break-word; } +/* new gallery stuff */ +ul.mw-gallery-nolines li.gallerybox div.thumb { + background-color: transparent; + border: none; +} + +ul.mw-gallery-nolines li.gallerybox div.gallerytext { + text-align: center; +} + +/* height constrained gallery */ + +ul.mw-gallery-packed li.gallerybox div.thumb, +ul.mw-gallery-packed-overlay li.gallerybox div.thumb, +ul.mw-gallery-packed-hover li.gallerybox div.thumb { + background-color: transparent; + border: none; +} +ul.mw-gallery-packed li.gallerybox div.thumb img, +ul.mw-gallery-packed-overlay li.gallerybox div.thumb img, +ul.mw-gallery-packed-hover li.gallerybox div.thumb img { + margin: 0 auto; +} + +ul.mw-gallery-packed-hover li.gallerybox, +ul.mw-gallery-packed-overlay li.gallerybox { + position:relative; +} + +ul.mw-gallery-packed-hover div.gallerytextwrapper { + overflow: hidden; + height: 0; +} + +ul.mw-gallery-packed-hover li.gallerybox:hover div.gallerytextwrapper, +ul.mw-gallery-packed-overlay li.gallerybox div.gallerytextwrapper, +ul.mw-gallery-packed-hover li.gallerybox.mw-gallery-focused div.gallerytextwrapper { + position:absolute; + opacity:.8; + filter:alpha(opacity=80); + zoom: 1; + background-color:white; + padding: 5px 10px; + bottom: 0; + left: 0; /* Needed for IE */ + height: auto; + font-weight: bold; + margin: 2px; /* correspond to style on div.thumb */ +} + +ul.mw-gallery-packed-hover, +ul.mw-gallery-packed-overlay, +ul.mw-gallery-packed { + text-align: center; +} + +ul.mw-gallery-packed-hover div.gallerytext, +ul.mw-gallery-packed-overlay div.gallerytext { + opacity: 1; + position: relative; /* Resets opacity in old IE */ +} + + .mw-ajax-loader { /* @embed */ background-image: url(images/ajax-loader.gif); @@ -815,6 +920,7 @@ div.gallerytext { /* Language specific height correction for titles. Ref Bug 29405 and Bug 30809 */ /* Languages like hi or ml require slightly more vertical space to show diacritics properly */ +h1:lang(anp), h1:lang(as), h1:lang(bh), /* Macrolanguage, used on bh.wikipedia.org, should be removed one day */ h1:lang(bho), @@ -822,16 +928,22 @@ h1:lang(bn), h1:lang(gu), h1:lang(hi), h1:lang(kn), +h1:lang(ks), h1:lang(ml), h1:lang(mr), h1:lang(my), +h1:lang(mai), +h1:lang(ne), +h1:lang(new), h1:lang(or), h1:lang(pa), +h1:lang(pi), h1:lang(sa), h1:lang(ta), h1:lang(te) { line-height: 1.6em !important; } +h2:lang(anp), h3:lang(anp), h4:lang(anp), h5:lang(anp), h6:lang(anp), h2:lang(as), h3:lang(as), h4:lang(as), h5:lang(as), h6:lang(as), h2:lang(bho), h3:lang(bho), h4:lang(bho), h5:lang(bho), h6:lang(bho), h2:lang(bh), h3:lang(bh), h4:lang(bh), h5:lang(bh), h6:lang(bh), @@ -839,11 +951,16 @@ h2:lang(bn), h3:lang(bn), h4:lang(bn), h5:lang(bn), h6:lang(bn), h2:lang(gu), h3:lang(gu), h4:lang(gu), h5:lang(gu), h6:lang(gu), h2:lang(hi), h3:lang(hi), h4:lang(hi), h5:lang(hi), h6:lang(hi), h2:lang(kn), h3:lang(kn), h4:lang(kn), h5:lang(kn), h6:lang(kn), +h2:lang(ks), h3:lang(ks), h4:lang(ks), h5:lang(ks), h6:lang(ks), h2:lang(ml), h3:lang(ml), h4:lang(ml), h5:lang(ml), h6:lang(ml), h2:lang(mr), h3:lang(mr), h4:lang(mr), h5:lang(mr), h6:lang(mr), h2:lang(my), h3:lang(my), h4:lang(my), h5:lang(my), h6:lang(my), +h2:lang(mai), h3:lang(mai), h4:lang(mai), h5:lang(mai), h6:lang(mai), +h2:lang(ne), h3:lang(ne), h4:lang(ne), h5:lang(ne), h6:lang(ne), +h2:lang(new), h3:lang(new), h4:lang(new), h5:lang(new), h6:lang(new), h2:lang(or), h3:lang(or), h4:lang(or), h5:lang(or), h6:lang(or), h2:lang(pa), h3:lang(pa), h4:lang(pa), h5:lang(pa), h6:lang(pa), +h2:lang(pi), h3:lang(pi), h4:lang(pi), h5:lang(pi), h6:lang(pi), h2:lang(sa), h3:lang(sa), h4:lang(sa), h5:lang(sa), h6:lang(sa), h2:lang(ta), h3:lang(ta), h4:lang(ta), h5:lang(ta), h6:lang(ta), h2:lang(te), h3:lang(te), h4:lang(te), h5:lang(te), h6:lang(te) { @@ -997,6 +1114,7 @@ ol:lang(or) li { direction: ltr; unicode-bidi: embed; } +.diff-multi, .diff-otitle, .diff-ntitle, .diff-lineno { @@ -1056,9 +1174,37 @@ table.floatleft { z-index: 99; } -.editsection, .toctoggle { - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; - user-select: none; +.mw-editsection, +.toctoggle { + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* Display editsection links smaller and next to headings */ +.mw-editsection { + font-size: small; + font-weight: normal; + margin-left: 1em; + vertical-align: baseline; + /* Reset line-height; headings tend to have it set to larger values */ + line-height: 1em; + /* As .mw-editsection is a <span> (inline element), it is treated as part */ + /* of the heading content when selecting text by multiple clicks and thus */ + /* selected together with heading content, despite the user-select: none; */ + /* rule set above. This enforces non-selection without changing the look. */ + display: inline-block; +} + +/* Correct directionality when page dir is different from site/user dir */ +/* @noflip */ +.mw-content-ltr .mw-editsection, +.mw-content-rtl .mw-content-ltr .mw-editsection { + margin-left: 1em; +} +/* @noflip */ +.mw-content-rtl .mw-editsection, +.mw-content-ltr .mw-content-rtl .mw-editsection { + margin-right: 1em; } diff --git a/skins/common/upload.js b/skins/common/upload.js index df819e19..d639f63a 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -1,12 +1,15 @@ +/*jshint camelcase:false */ ( function ( mw, $ ) { -var ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ), - fileExtensions = mw.config.get( 'wgFileExtensions' ); - -window.licenseSelectorCheck = function() { - var selector = document.getElementById( "wpLicense" ); - var selection = selector.options[selector.selectedIndex].value; - if( selector.selectedIndex > 0 ) { - if( selection == "" ) { +var licenseSelectorCheck, wgUploadWarningObj, wgUploadLicenseObj, fillDestFilename, + ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ), + fileExtensions = mw.config.get( 'wgFileExtensions' ), + $spinnerDestCheck, $spinnerLicense; + +licenseSelectorCheck = window.licenseSelectorCheck = function () { + var selector = document.getElementById( 'wpLicense' ), + selection = selector.options[selector.selectedIndex].value; + if ( selector.selectedIndex > 0 ) { + if ( !selection ) { // Option disabled, but browser is broken and doesn't respect this selector.selectedIndex = 0; } @@ -17,23 +20,29 @@ window.licenseSelectorCheck = function() { function uploadSetup() { // Disable URL box if the URL copy upload source type is not selected - var e = document.getElementById( 'wpSourceTypeurl' ); - if( e ) { - if( !e.checked ) { - var ein = document.getElementById( 'wpUploadFileURL' ); - if(ein) - ein.setAttribute( 'disabled', 'disabled' ); + var ein, + selector, ua, isMacIe, i, + optionsTable, row, td, + wpLicense, wpLicenseRow, wpLicenseTbody, + uploadSourceIds, len, onchange, + e = document.getElementById( 'wpSourceTypeurl' ); + if ( e ) { + if ( !e.checked ) { + ein = document.getElementById( 'wpUploadFileURL' ); + if ( ein ) { + ein.disabled = true; + } } } // For MSIE/Mac: non-breaking spaces cause the <option> not to render. // But for some reason, setting the text to itself works - var selector = document.getElementById("wpLicense"); - if (selector) { - var ua = navigator.userAgent; - var isMacIe = (ua.indexOf("MSIE") != -1) && (ua.indexOf("Mac") != -1); - if (isMacIe) { - for (var i = 0; i < selector.options.length; i++) { + selector = document.getElementById( 'wpLicense' ); + if ( selector ) { + ua = navigator.userAgent; + isMacIe = ua.indexOf( 'MSIE' ) !== -1 && ua.indexOf( 'Mac' ) !== -1; + if ( isMacIe ) { + for ( i = 0; i < selector.options.length; i++ ) { selector.options[i].text = selector.options[i].text; } } @@ -43,31 +52,31 @@ function uploadSetup() { if ( ajaxUploadDestCheck ) { // Insert an event handler that fetches upload warnings when wpDestFile // has been changed - document.getElementById( 'wpDestFile' ).onchange = function ( e ) { - wgUploadWarningObj.checkNow(this.value); + document.getElementById( 'wpDestFile' ).onchange = function () { + wgUploadWarningObj.checkNow( this.value ); }; // Insert a row where the warnings will be displayed just below the // wpDestFile row - var optionsTable = document.getElementById( 'mw-htmlform-description' ).tBodies[0]; - var row = optionsTable.insertRow( 1 ); - var td = document.createElement( 'td' ); + optionsTable = document.getElementById( 'mw-htmlform-description' ).tBodies[0]; + row = optionsTable.insertRow( 1 ); + td = document.createElement( 'td' ); td.id = 'wpDestFile-warning'; td.colSpan = 2; row.appendChild( td ); } - var wpLicense = document.getElementById( 'wpLicense' ); + wpLicense = document.getElementById( 'wpLicense' ); if ( mw.config.get( 'wgAjaxLicensePreview' ) && wpLicense ) { // License selector check wpLicense.onchange = licenseSelectorCheck; // License selector table row - var wpLicenseRow = wpLicense.parentNode.parentNode; - var wpLicenseTbody = wpLicenseRow.parentNode; + wpLicenseRow = wpLicense.parentNode.parentNode; + wpLicenseTbody = wpLicenseRow.parentNode; - var row = document.createElement( 'tr' ); - var td = document.createElement( 'td' ); + row = document.createElement( 'tr' ); + td = document.createElement( 'td' ); row.appendChild( td ); td = document.createElement( 'td' ); td.id = 'mw-license-preview'; @@ -78,156 +87,185 @@ function uploadSetup() { // fillDestFile setup - var i, - uploadSourceIds = mw.config.get( 'wgUploadSourceIds' ), - len = uploadSourceIds.length; - for ( i = 0; i < len; i += 1 ) - document.getElementById( uploadSourceIds[i] ).onchange = function (e) { - fillDestFilename( this.id ); - }; -}; + uploadSourceIds = mw.config.get( 'wgUploadSourceIds' ); + len = uploadSourceIds.length; + onchange = function () { + fillDestFilename( this.id ); + }; + for ( i = 0; i < len; i += 1 ) { + document.getElementById( uploadSourceIds[i] ).onchange = onchange; + } +} +wgUploadWarningObj = window.wgUploadWarningObj = { + responseCache: { '' : ' ' }, + nameToCheck: '', + typing: false, + delay: 500, // ms + timeoutID: false, -window.wgUploadWarningObj = { - 'responseCache' : { '' : ' ' }, - 'nameToCheck' : '', - 'typing': false, - 'delay': 500, // ms - 'timeoutID': false, + keypress: function () { + var cached, destFile, warningElt; - 'keypress': function () { - if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; + if ( !ajaxUploadDestCheck ) { + return; + } // Find file to upload - var destFile = document.getElementById('wpDestFile'); - var warningElt = document.getElementById( 'wpDestFile-warning' ); - if ( !destFile || !warningElt ) return ; + destFile = document.getElementById( 'wpDestFile' ); + warningElt = document.getElementById( 'wpDestFile-warning' ); + if ( !destFile || !warningElt ) { + return; + } - this.nameToCheck = destFile.value ; + this.nameToCheck = destFile.value; // Clear timer if ( this.timeoutID ) { - window.clearTimeout( this.timeoutID ); + clearTimeout( this.timeoutID ); } // Check response cache - for (cached in this.responseCache) { - if (this.nameToCheck == cached) { + for ( cached in this.responseCache ) { + if ( this.nameToCheck === cached ) { this.setWarning(this.responseCache[this.nameToCheck]); return; } } - this.timeoutID = window.setTimeout( 'wgUploadWarningObj.timeout()', this.delay ); + this.timeoutID = setTimeout( function () { + wgUploadWarningObj.timeout(); + }, this.delay ); }, - 'checkNow': function (fname) { - if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; + checkNow: function ( fname ) { + if ( !ajaxUploadDestCheck ) { + return; + } if ( this.timeoutID ) { - window.clearTimeout( this.timeoutID ); + clearTimeout( this.timeoutID ); } this.nameToCheck = fname; this.timeout(); }, - 'timeout' : function() { - if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; - injectSpinner( document.getElementById( 'wpDestFile' ), 'destcheck' ); - - // Get variables into local scope so that they will be preserved for the - // anonymous callback. fileName is copied so that multiple overlapping - // ajax requests can be supported. - var obj = this; - var fileName = this.nameToCheck; - sajax_do_call( 'SpecialUpload::ajaxGetExistsWarning', [this.nameToCheck], - function (result) { - obj.processResult(result, fileName) + timeout: function () { + if ( !ajaxUploadDestCheck || this.nameToCheck === '' ) { + return; + } + $spinnerDestCheck = $.createSpinner().insertAfter( '#wpDestFile' ); + + var uploadWarningObj = this; + ( new mw.Api() ).get( { + action: 'query', + titles: ( new mw.Title( this.nameToCheck, mw.config.get( 'wgNamespaceIds' ).file ) ).getPrefixedText(), + prop: 'imageinfo', + iiprop: 'uploadwarning', + indexpageids: '' + } ).done( function ( result ) { + var resultOut = ''; + if ( result.query ) { + resultOut = result.query.pages[result.query.pageids[0]].imageinfo[0]; } - ); + uploadWarningObj.processResult( resultOut, uploadWarningObj.nameToCheck ); + } ); }, - 'processResult' : function (result, fileName) { - removeSpinner( 'destcheck' ); - this.setWarning(result.responseText); - this.responseCache[fileName] = result.responseText; + processResult: function ( result, fileName ) { + $spinnerDestCheck.remove(); + $spinnerDestCheck = undefined; + this.setWarning( result.html ); + this.responseCache[fileName] = result.html; }, - 'setWarning' : function (warning) { - var warningElt = document.getElementById( 'wpDestFile-warning' ); - var ackElt = document.getElementsByName( 'wpDestFileWarningAck' ); + setWarning: function ( warning ) { + var warningElt = document.getElementById( 'wpDestFile-warning' ), + ackElt = document.getElementsByName( 'wpDestFileWarningAck' ); - this.setInnerHTML(warningElt, warning); + this.setInnerHTML( warningElt, warning ); // Set a value in the form indicating that the warning is acknowledged and // doesn't need to be redisplayed post-upload - if ( warning == '' || warning == ' ' ) { + if ( !warning ) { ackElt[0].value = ''; } else { ackElt[0].value = '1'; } }, - 'setInnerHTML' : function (element, text) { + setInnerHTML: function ( element, text ) { // Check for no change to avoid flicker in IE 7 - if (element.innerHTML != text) { + if ( element.innerHTML !== text ) { element.innerHTML = text; } } }; -window.fillDestFilename = function(id) { +fillDestFilename = window.fillDestFilename = function ( id ) { + var e, path, slash, backslash, fname, + found, ext, i, + destFile; if ( !mw.config.get( 'wgUploadAutoFill' ) ) { return; } - if (!document.getElementById) { + if ( !document.getElementById ) { return; } // Remove any previously flagged errors - var e = document.getElementById( 'mw-upload-permitted' ); - if( e ) e.className = ''; + e = document.getElementById( 'mw-upload-permitted' ); + if ( e ) { + e.className = ''; + } - var e = document.getElementById( 'mw-upload-prohibited' ); - if( e ) e.className = ''; + e = document.getElementById( 'mw-upload-prohibited' ); + if ( e ) { + e.className = ''; + } - var path = document.getElementById(id).value; + path = document.getElementById( id ).value; // Find trailing part - var slash = path.lastIndexOf('/'); - var backslash = path.lastIndexOf('\\'); - var fname; - if (slash == -1 && backslash == -1) { + slash = path.lastIndexOf( '/' ); + backslash = path.lastIndexOf( '\\' ); + if ( slash === -1 && backslash === -1 ) { fname = path; - } else if (slash > backslash) { - fname = path.substring(slash+1, 10000); + } else if ( slash > backslash ) { + fname = path.substring( slash + 1, 10000 ); } else { - fname = path.substring(backslash+1, 10000); + fname = path.substring( backslash + 1, 10000 ); } // Clear the filename if it does not have a valid extension. // URLs are less likely to have a useful extension, so don't include them in the // extension check. if ( mw.config.get( 'wgStrictFileExtensions' ) && fileExtensions && id !== 'wpUploadFileURL' ) { - var found = false; + found = false; if ( fname.lastIndexOf( '.' ) !== -1 ) { - var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 ); - for ( var i = 0; i < fileExtensions.length; i += 1 ) { + ext = fname.substr( fname.lastIndexOf( '.' ) + 1 ); + for ( i = 0; i < fileExtensions.length; i += 1 ) { if ( fileExtensions[i].toLowerCase() === ext.toLowerCase() ) { found = true; break; } } } - if( !found ) { + if ( !found ) { // Not a valid extension // Clear the upload and set mw-upload-permitted to error - document.getElementById(id).value = ''; - var e = document.getElementById( 'mw-upload-permitted' ); - if( e ) e.className = 'error'; + document.getElementById( id ).value = ''; + e = document.getElementById( 'mw-upload-permitted' ); + if ( e ) { + e.className = 'error'; + } - var e = document.getElementById( 'mw-upload-prohibited' ); - if( e ) e.className = 'error'; + e = document.getElementById( 'mw-upload-prohibited' ); + if ( e ) { + e.className = 'error'; + } // Clear wpDestFile as well - var e = document.getElementById( 'wpDestFile' ); - if( e ) e.value = ''; + e = document.getElementById( 'wpDestFile' ); + if ( e ) { + e.value = ''; + } return false; } @@ -241,72 +279,78 @@ window.fillDestFilename = function(id) { } // Output result - var destFile = document.getElementById( 'wpDestFile' ); + destFile = document.getElementById( 'wpDestFile' ); if ( destFile ) { // Call decodeURIComponent function to remove possible URL-encoded characters // from the file name (bug 30390). Especially likely with upload-form-url. // decodeURIComponent can throw an exception in input is invalid utf-8 try { destFile.value = decodeURIComponent( fname ); - } catch ( e ) { + } catch ( err ) { destFile.value = fname; } wgUploadWarningObj.checkNow( fname ); } }; -window.toggleFilenameFiller = function() { - if(!document.getElementById) return; - var upfield = document.getElementById('wpUploadFile'); - var destName = document.getElementById('wpDestFile').value; - wgUploadAutoFill = ( destName == '' || destName == ' ' ); +window.toggleFilenameFiller = function () { + if ( !document.getElementById ) { + return; + } + var destName = document.getElementById( 'wpDestFile' ).value; + mw.config.set( 'wgUploadAutoFill', !destName ); }; -window.wgUploadLicenseObj = { +wgUploadLicenseObj = window.wgUploadLicenseObj = { - 'responseCache' : { '' : '' }, + responseCache: { '' : '' }, - 'fetchPreview': function( license ) { - if ( !mw.config.get( 'wgAjaxLicensePreview' ) ) return; - for (cached in this.responseCache) { - if (cached == license) { + fetchPreview: function ( license ) { + var cached, title; + if ( !mw.config.get( 'wgAjaxLicensePreview' ) ) { + return; + } + for ( cached in this.responseCache ) { + if ( cached === license ) { this.showPreview( this.responseCache[license] ); return; } } - injectSpinner( document.getElementById( 'wpLicense' ), 'license' ); - var title = document.getElementById('wpDestFile').value; - if ( !title ) title = 'File:Sample.jpg'; + $spinnerLicense = $.createSpinner().insertAfter( '#wpLicense' ); - var url = mw.util.wikiScript( 'api' ) - + '?action=parse&text={{' + encodeURIComponent( license ) + '}}' - + '&title=' + encodeURIComponent( title ) - + '&prop=text&pst&format=json'; + title = document.getElementById( 'wpDestFile' ).value; + if ( !title ) { + title = 'File:Sample.jpg'; + } - var req = sajax_init_object(); - req.onreadystatechange = function() { - if ( req.readyState == 4 && req.status == 200 ) - wgUploadLicenseObj.processResult( eval( '(' + req.responseText + ')' ), license ); - }; - req.open( 'GET', url, true ); - req.send( '' ); + ( new mw.Api() ).get( { + action: 'parse', + text: '{{' + license + '}}', + title: title, + prop: 'text', + pst: '' + } ).done( function ( result ) { + wgUploadLicenseObj.processResult( result, license ); + } ); }, - 'processResult' : function( result, license ) { - removeSpinner( 'license' ); - this.responseCache[license] = result['parse']['text']['*']; + processResult: function ( result, license ) { + $spinnerLicense.remove(); + $spinnerLicense = undefined; + this.responseCache[license] = result.parse.text['*']; this.showPreview( this.responseCache[license] ); }, - 'showPreview' : function( preview ) { + showPreview: function ( preview ) { var previewPanel = document.getElementById( 'mw-license-preview' ); - if( previewPanel.innerHTML != preview ) + if ( previewPanel.innerHTML !== preview ) { previewPanel.innerHTML = preview; + } } }; -$( document ).ready( uploadSetup ); +$( uploadSetup ); }( mediaWiki, jQuery ) ); diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 05efb4a9..d28ca0a3 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1,497 +1,36 @@ /** * MediaWiki legacy wikibits */ -( function ( mw ) { - -window.clientPC = navigator.userAgent.toLowerCase(); // Get client info -window.is_gecko = /gecko/.test( clientPC ) && - !/khtml|spoofer|netscape\/7\.0/.test(clientPC); - -window.is_safari = window.is_safari_win = window.webkit_version = - window.is_chrome = window.is_chrome_mac = false; -window.webkit_match = clientPC.match(/applewebkit\/(\d+)/); -if (webkit_match) { - window.is_safari = clientPC.indexOf('applewebkit') != -1 && - clientPC.indexOf('spoofer') == -1; - window.is_safari_win = is_safari && clientPC.indexOf('windows') != -1; - window.webkit_version = parseInt(webkit_match[1]); - // Tests for chrome here, to avoid breaking old scripts safari left alone - // This is here for accesskeys - window.is_chrome = clientPC.indexOf('chrome') !== -1 && - clientPC.indexOf('spoofer') === -1; - window.is_chrome_mac = is_chrome && clientPC.indexOf('mac') !== -1 -} - -// For accesskeys; note that FF3+ is included here! -window.is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); -window.ff2_bugs = /firefox\/2/.test( clientPC ); -// These aren't used here, but some custom scripts rely on them -window.is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1; -window.is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1; - -window.is_opera = window.is_opera_preseven = window.is_opera_95 = - window.opera6_bugs = window.opera7_bugs = window.opera95_bugs = false; -if (clientPC.indexOf('opera') != -1) { - window.is_opera = true; - window.is_opera_preseven = window.opera && !document.childNodes; - window.is_opera_seven = window.opera && document.childNodes; - window.is_opera_95 = /opera\/(9\.[5-9]|[1-9][0-9])/.test( clientPC ); - window.opera6_bugs = is_opera_preseven; - window.opera7_bugs = is_opera_seven && !is_opera_95; - window.opera95_bugs = /opera\/(9\.5)/.test( clientPC ); -} -// As recommended by <http://msdn.microsoft.com/en-us/library/ms537509.aspx>, -// avoiding false positives from moronic extensions that append to the IE UA -// string (bug 23171) -window.ie6_bugs = false; -if ( /msie ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) != null -&& parseFloat( RegExp.$1 ) <= 6.0 ) { - ie6_bugs = true; -} - -// add any onload functions in this hook (please don't hard-code any events in the xhtml source) -window.doneOnloadHook = undefined; - -if (!window.onloadFuncts) { - window.onloadFuncts = []; -} - -window.addOnloadHook = function( hookFunct ) { - // Allows add-on scripts to add onload functions - if( !doneOnloadHook ) { - onloadFuncts[onloadFuncts.length] = hookFunct; - } else { - hookFunct(); // bug in MSIE script loading - } -}; - -window.importScript = function( page ) { - var uri = mw.config.get( 'wgScript' ) + '?title=' + - mw.util.wikiUrlencode( page ) + - '&action=raw&ctype=text/javascript'; - return importScriptURI( uri ); -}; - -window.loadedScripts = {}; // included-scripts tracker -window.importScriptURI = function( url ) { - if ( loadedScripts[url] ) { - return null; - } - loadedScripts[url] = true; - var s = document.createElement( 'script' ); - s.setAttribute( 'src', url ); - s.setAttribute( 'type', 'text/javascript' ); - document.getElementsByTagName('head')[0].appendChild( s ); - return s; -}; - -window.importStylesheet = function( page ) { - return importStylesheetURI( mw.config.get( 'wgScript' ) + '?action=raw&ctype=text/css&title=' + mw.util.wikiUrlencode( page ) ); -}; - -window.importStylesheetURI = function( url, media ) { - var l = document.createElement( 'link' ); - l.type = 'text/css'; - l.rel = 'stylesheet'; - l.href = url; - if( media ) { - l.media = media; - } - document.getElementsByTagName('head')[0].appendChild( l ); - return l; -}; - -window.appendCSS = function( text ) { - var s = document.createElement( 'style' ); - s.type = 'text/css'; - s.rel = 'stylesheet'; - if ( s.styleSheet ) { - s.styleSheet.cssText = text; // IE - } else { - s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null - } - document.getElementsByTagName('head')[0].appendChild( s ); - return s; -}; - -// Special stylesheet links for Monobook only (see bug 14717) -var skinpath = mw.config.get( 'stylepath' ) + '/' + mw.config.get( 'skin' ); -if ( mw.config.get( 'skin' ) === 'monobook' ) { - if ( opera6_bugs ) { - importStylesheetURI( skinpath + '/Opera6Fixes.css' ); - } else if ( opera7_bugs ) { - importStylesheetURI( skinpath + '/Opera7Fixes.css' ); - } else if ( opera95_bugs ) { - importStylesheetURI( skinpath + '/Opera9Fixes.css' ); - } -} +( function ( mw, $ ) { + var msg, + win = window, + ua = navigator.userAgent.toLowerCase(), + isIE6 = ( /msie ([0-9]{1,}[\.0-9]{0,})/.exec( ua ) && parseFloat( RegExp.$1 ) <= 6.0 ), + isGecko = /gecko/.test( ua ) && !/khtml|spoofer|netscape\/7\.0/.test( ua ), + onloadFuncts = []; if ( mw.config.get( 'wgBreakFrames' ) ) { - // Un-trap us from framesets - if ( window.top != window ) { - window.top.location = window.location; - } -} - -window.changeText = function( el, newText ) { - // Safari work around - if ( el.innerText ) { - el.innerText = newText; - } else if ( el.firstChild && el.firstChild.nodeValue ) { - el.firstChild.nodeValue = newText; - } -}; - -window.killEvt = function( evt ) { - evt = evt || window.event || window.Event; // W3C, IE, Netscape - if ( typeof ( evt.preventDefault ) != 'undefined' ) { - evt.preventDefault(); // Don't follow the link - evt.stopPropagation(); - } else { - evt.cancelBubble = true; // IE + // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet) + // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266) + if ( win.top !== win.self ) { + // Un-trap us from framesets + win.top.location = win.location; } - return false; // Don't follow the link (IE) -}; - -window.mwEditButtons = []; -window.mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js - -window.escapeQuotes = function( text ) { - var re = new RegExp( "'", "g" ); - text = text.replace( re, "\\'" ); - re = new RegExp( "\\n", "g" ); - text = text.replace( re, "\\n" ); - return escapeQuotesHTML( text ); -}; - -window.escapeQuotesHTML = function( text ) { - var re = new RegExp( '&', "g" ); - text = text.replace( re, "&" ); - re = new RegExp( '"', "g" ); - text = text.replace( re, """ ); - re = new RegExp( '<', "g" ); - text = text.replace( re, "<" ); - re = new RegExp( '>', "g" ); - text = text.replace( re, ">" ); - return text; -}; - -/** - * Set the accesskey prefix based on browser detection. - */ -window.tooltipAccessKeyPrefix = 'alt-'; -if ( is_opera ) { - tooltipAccessKeyPrefix = 'shift-esc-'; -} else if ( is_chrome ) { - tooltipAccessKeyPrefix = is_chrome_mac ? 'ctrl-option-' : 'alt-'; -} else if ( !is_safari_win && is_safari && webkit_version > 526 ) { - tooltipAccessKeyPrefix = 'ctrl-alt-'; -} else if ( !is_safari_win && ( is_safari - || clientPC.indexOf('mac') != -1 - || clientPC.indexOf('konqueror') != -1 ) ) { - tooltipAccessKeyPrefix = 'ctrl-'; -} else if ( is_ff2 ) { - tooltipAccessKeyPrefix = 'alt-shift-'; } -window.tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/; - -/** - * Add the appropriate prefix to the accesskey shown in the tooltip. - * If the nodeList parameter is given, only those nodes are updated; - * otherwise, all the nodes that will probably have accesskeys by - * default are updated. - * - * @param nodeList Array list of elements to update - */ -window.updateTooltipAccessKeys = function( nodeList ) { - if ( !nodeList ) { - // Rather than scan all links on the whole page, we can just scan these - // containers which contain the relevant links. This is really just an - // optimization technique. - var linkContainers = [ - 'column-one', // Monobook and Modern - 'mw-head', 'mw-panel', 'p-logo' // Vector - ]; - for ( var i in linkContainers ) { - var linkContainer = document.getElementById( linkContainers[i] ); - if ( linkContainer ) { - updateTooltipAccessKeys( linkContainer.getElementsByTagName( 'a' ) ); - } - } - // these are rare enough that no such optimization is needed - updateTooltipAccessKeys( document.getElementsByTagName( 'input' ) ); - updateTooltipAccessKeys( document.getElementsByTagName( 'label' ) ); - return; - } - for ( var i = 0; i < nodeList.length; i++ ) { - var element = nodeList[i]; - var tip = element.getAttribute( 'title' ); - if ( tip && tooltipAccessKeyRegexp.exec( tip ) ) { - tip = tip.replace(tooltipAccessKeyRegexp, - '[' + tooltipAccessKeyPrefix + "$5]"); - element.setAttribute( 'title', tip ); - } - } -}; - -/** - * Add a link to one of the portlet menus on the page, including: - * - * p-cactions: Content actions (shown as tabs above the main content in Monobook) - * p-personal: Personal tools (shown at the top right of the page in Monobook) - * p-navigation: Navigation - * p-tb: Toolbox - * - * This function exists for the convenience of custom JS authors. All - * but the first three parameters are optional, though providing at - * least an id and a tooltip is recommended. - * - * By default the new link will be added to the end of the list. To - * add the link before a given existing item, pass the DOM node of - * that item (easily obtained with document.getElementById()) as the - * nextnode parameter; to add the link _after_ an existing item, pass - * the node's nextSibling instead. - * - * @param portlet String id of the target portlet ("p-cactions", "p-personal", "p-navigation" or "p-tb") - * @param href String link URL - * @param text String link text (will be automatically lowercased by CSS for p-cactions in Monobook) - * @param id String id of the new item, should be unique and preferably have the appropriate prefix ("ca-", "pt-", "n-" or "t-") - * @param tooltip String text to show when hovering over the link, without accesskey suffix - * @param accesskey String accesskey to activate this link (one character, try to avoid conflicts) - * @param nextnode Node the DOM node before which the new item should be added, should be another item in the same list - * - * @return Node -- the DOM node of the new item (an LI element) or null - */ -window.addPortletLink = function( portlet, href, text, id, tooltip, accesskey, nextnode ) { - var root = document.getElementById( portlet ); - if ( !root ) { - return null; - } - var uls = root.getElementsByTagName( 'ul' ); - var node; - if ( uls.length > 0 ) { - node = uls[0]; - } else { - node = document.createElement( 'ul' ); - var lastElementChild = null; - for ( var i = 0; i < root.childNodes.length; ++i ) { /* get root.lastElementChild */ - if ( root.childNodes[i].nodeType == 1 ) { - lastElementChild = root.childNodes[i]; - } - } - if ( lastElementChild && lastElementChild.nodeName.match( /div/i ) ) { - /* Insert into the menu divs */ - lastElementChild.appendChild( node ); - } else { - root.appendChild( node ); - } - } - if ( !node ) { - return null; - } - - // unhide portlet if it was hidden before - root.className = root.className.replace( /(^| )emptyPortlet( |$)/, "$2" ); - - var link = document.createElement( 'a' ); - link.appendChild( document.createTextNode( text ) ); - link.href = href; - - // Wrap in a span - make it work with vector tabs and has no effect on any other portlets - var span = document.createElement( 'span' ); - span.appendChild( link ); - - var item = document.createElement( 'li' ); - item.appendChild( span ); - if ( id ) { - item.id = id; - } - - if ( accesskey ) { - link.setAttribute( 'accesskey', accesskey ); - tooltip += ' [' + accesskey + ']'; - } - if ( tooltip ) { - link.setAttribute( 'title', tooltip ); - } - if ( accesskey && tooltip ) { - updateTooltipAccessKeys( [link] ); - } - - if ( nextnode && nextnode.parentNode == node ) { - node.insertBefore( item, nextnode ); - } else { - node.appendChild( item ); // IE compatibility (?) - } - - return item; -}; - -window.getInnerText = function( el ) { - if ( typeof el == 'string' ) { - return el; - } - if ( typeof el == 'undefined' ) { - return el; - } - // Custom sort value through 'data-sort-value' attribute - // (no need to prepend hidden text to change sort value) - if ( el.nodeType && el.getAttribute( 'data-sort-value' ) !== null ) { - // Make sure it's a valid DOM element (.nodeType) and that the attribute is set (!null) - return el.getAttribute( 'data-sort-value' ); - } - if ( el.textContent ) { - return el.textContent; // not needed but it is faster - } - if ( el.innerText ) { - return el.innerText; // IE doesn't have textContent - } - var str = ''; - - var cs = el.childNodes; - var l = cs.length; - for ( var i = 0; i < l; i++ ) { - switch ( cs[i].nodeType ) { - case 1: // ELEMENT_NODE - str += getInnerText( cs[i] ); - break; - case 3: // TEXT_NODE - str += cs[i].nodeValue; - break; - } - } - return str; -}; - -window.checkboxes = undefined; -window.lastCheckbox = undefined; - -window.setupCheckboxShiftClick = function() { - checkboxes = []; - lastCheckbox = null; - var inputs = document.getElementsByTagName( 'input' ); - addCheckboxClickHandlers( inputs ); -}; - -window.addCheckboxClickHandlers = function( inputs, start ) { - if ( !start ) { - start = 0; - } - - var finish = start + 250; - if ( finish > inputs.length ) { - finish = inputs.length; - } - - for ( var i = start; i < finish; i++ ) { - var cb = inputs[i]; - if ( !cb.type || cb.type.toLowerCase() != 'checkbox' || ( ' ' + cb.className + ' ' ).indexOf( ' noshiftselect ' ) != -1 ) { - continue; - } - var end = checkboxes.length; - checkboxes[end] = cb; - cb.index = end; - addClickHandler( cb, checkboxClickHandler ); - } - - if ( finish < inputs.length ) { - setTimeout( function() { - addCheckboxClickHandlers( inputs, finish ); - }, 200 ); - } -}; - -window.checkboxClickHandler = function( e ) { - if ( typeof e == 'undefined' ) { - e = window.event; - } - if ( !e.shiftKey || lastCheckbox === null ) { - lastCheckbox = this.index; - return true; - } - var endState = this.checked; - var start, finish; - if ( this.index < lastCheckbox ) { - start = this.index + 1; - finish = lastCheckbox; - } else { - start = lastCheckbox; - finish = this.index - 1; - } - for ( var i = start; i <= finish; ++i ) { - checkboxes[i].checked = endState; - if( i > start && typeof checkboxes[i].onchange == 'function' ) { - checkboxes[i].onchange(); // fire triggers - } - } - lastCheckbox = this.index; - return true; -}; - - -/* - Written by Jonathan Snook, http://www.snook.ca/jonathan - Add-ons by Robert Nyman, http://www.robertnyman.com - Author says "The credit comment is all it takes, no license. Go crazy with it!:-)" - From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/ -*/ -window.getElementsByClassName = function( oElm, strTagName, oClassNames ) { - var arrReturnElements = []; - if ( typeof( oElm.getElementsByClassName ) == 'function' ) { - /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ - var arrNativeReturn = oElm.getElementsByClassName( oClassNames ); - if ( strTagName == '*' ) { - return arrNativeReturn; - } - for ( var h = 0; h < arrNativeReturn.length; h++ ) { - if( arrNativeReturn[h].tagName.toLowerCase() == strTagName.toLowerCase() ) { - arrReturnElements[arrReturnElements.length] = arrNativeReturn[h]; - } - } - return arrReturnElements; - } - var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); - var arrRegExpClassNames = []; - if( typeof oClassNames == 'object' ) { - for( var i = 0; i < oClassNames.length; i++ ) { - arrRegExpClassNames[arrRegExpClassNames.length] = - new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"); - } - } else { - arrRegExpClassNames[arrRegExpClassNames.length] = - new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"); - } - var oElement; - var bMatchesAll; - for( var j = 0; j < arrElements.length; j++ ) { - oElement = arrElements[j]; - bMatchesAll = true; - for( var k = 0; k < arrRegExpClassNames.length; k++ ) { - if( !arrRegExpClassNames[k].test( oElement.className ) ) { - bMatchesAll = false; - break; - } - } - if( bMatchesAll ) { - arrReturnElements[arrReturnElements.length] = oElement; - } - } - return ( arrReturnElements ); -}; - -window.redirectToFragment = function( fragment ) { - var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); +win.redirectToFragment = function ( fragment ) { + var webKitVersion, + match = navigator.userAgent.match( /AppleWebKit\/(\d+)/ ); if ( match ) { - var webKitVersion = parseInt( match[1] ); + webKitVersion = parseInt( match[1], 10 ); if ( webKitVersion < 420 ) { // Released Safari w/ WebKit 418.9.1 messes up horribly // Nightlies of 420+ are ok return; } } - if ( window.location.hash == '' ) { - window.location.hash = fragment; + if ( !win.location.hash ) { + win.location.hash = fragment; // Mozilla needs to wait until after load, otherwise the window doesn't // scroll. See <https://bugzilla.mozilla.org/show_bug.cgi?id=516293>. @@ -499,122 +38,211 @@ window.redirectToFragment = function( fragment ) { // version-testing. If Firefox fixes the bug, they'll jump twice, but // better twice than not at all, so make the fix hit future versions as // well. - if ( is_gecko ) { - addOnloadHook(function() { - if ( window.location.hash == fragment ) { - window.location.hash = fragment; + if ( isGecko ) { + $( function () { + if ( win.location.hash === fragment ) { + win.location.hash = fragment; } - }); + } ); } } }; /** - * Add a cute little box at the top of the screen to inform the user of - * something, replacing any preexisting message. + * User-agent sniffing. + * To be removed in MediaWiki 1.23. * - * @deprecated since 1.17 Use the 'mediawiki.notify' module instead. - * @param {String|HTMLElement} message To be put inside the message box. + * @deprecated since 1.17 Use jquery.client instead */ -window.jsMsg = function () { - return mw.util.jsMessage.apply( mw.util, arguments ); -}; + +msg = 'Use feature detection or module jquery.client instead'; + +mw.log.deprecate( win, 'clientPC', ua, msg ); + +// Ignored dummy values +mw.log.deprecate( win, 'is_gecko', false, msg ); +mw.log.deprecate( win, 'is_chrome_mac', false, msg ); +mw.log.deprecate( win, 'is_chrome', false, msg ); +mw.log.deprecate( win, 'webkit_version', false, msg ); +mw.log.deprecate( win, 'is_safari_win', false, msg ); +mw.log.deprecate( win, 'is_safari', false, msg ); +mw.log.deprecate( win, 'webkit_match', false, msg ); +mw.log.deprecate( win, 'is_ff2', false, msg ); +mw.log.deprecate( win, 'ff2_bugs', false, msg ); +mw.log.deprecate( win, 'is_ff2_win', false, msg ); +mw.log.deprecate( win, 'is_ff2_x11', false, msg ); +mw.log.deprecate( win, 'opera95_bugs', false, msg ); +mw.log.deprecate( win, 'opera7_bugs', false, msg ); +mw.log.deprecate( win, 'opera6_bugs', false, msg ); +mw.log.deprecate( win, 'is_opera_95', false, msg ); +mw.log.deprecate( win, 'is_opera_preseven', false, msg ); +mw.log.deprecate( win, 'is_opera', false, msg ); +mw.log.deprecate( win, 'ie6_bugs', false, msg ); /** - * Inject a cute little progress spinner after the specified element + * DOM utilities for handling of events, text nodes and selecting elements + * + * To be removed in MediaWiki 1.23. * - * @param element Element to inject after - * @param id Identifier string (for use with removeSpinner(), below) + * @deprecated since 1.17 Use jQuery instead */ -window.injectSpinner = function( element, id ) { - var spinner = document.createElement( 'img' ); - spinner.id = 'mw-spinner-' + id; - spinner.src = mw.config.get( 'stylepath' ) + '/common/images/spinner.gif'; - spinner.alt = spinner.title = '...'; - if( element.nextSibling ) { - element.parentNode.insertBefore( spinner, element.nextSibling ); +msg = 'Use jQuery instead'; + +// Ignored dummy values +mw.log.deprecate( win, 'doneOnloadHook', undefined, msg ); +mw.log.deprecate( win, 'onloadFuncts', [], msg ); +mw.log.deprecate( win, 'runOnloadHook', $.noop, msg ); +mw.log.deprecate( win, 'changeText', $.noop, msg ); +mw.log.deprecate( win, 'killEvt', $.noop, msg ); +mw.log.deprecate( win, 'addHandler', $.noop, msg ); +mw.log.deprecate( win, 'hookEvent', $.noop, msg ); +mw.log.deprecate( win, 'addClickHandler', $.noop, msg ); +mw.log.deprecate( win, 'removeHandler', $.noop, msg ); +mw.log.deprecate( win, 'getElementsByClassName', function () { return []; }, msg ); +mw.log.deprecate( win, 'getInnerText', function () { return ''; }, msg ); + +// Run a function after the window onload event is fired +mw.log.deprecate( win, 'addOnloadHook', function ( hookFunct ) { + if ( onloadFuncts ) { + onloadFuncts.push(hookFunct); } else { - element.parentNode.appendChild( spinner ); + // If func queue is gone the event has happened already, + // run immediately instead of queueing. + hookFunct(); } -}; +}, msg ); -/** - * Remove a progress spinner added with injectSpinner() - * - * @param id Identifier string - */ -window.removeSpinner = function( id ) { - var spinner = document.getElementById( 'mw-spinner-' + id ); - if( spinner ) { - spinner.parentNode.removeChild( spinner ); - } -}; +$( win ).on( 'load', function () { + var i, functs; -window.runOnloadHook = function() { - // don't run anything below this for non-dom browsers - if ( doneOnloadHook || !( document.getElementById && document.getElementsByTagName ) ) { + // Don't run twice + if ( !onloadFuncts ) { return; } - // set this before running any hooks, since any errors below - // might cause the function to terminate prematurely - doneOnloadHook = true; + // Deference and clear onloadFuncts before running any + // hooks to make sure we don't miss any addOnloadHook + // calls. + functs = onloadFuncts.slice(); + onloadFuncts = undefined; - // Run any added-on functions - for ( var i = 0; i < onloadFuncts.length; i++ ) { - onloadFuncts[i](); + // Execute the queued functions + for ( i = 0; i < functs.length; i++ ) { + functs[i](); } -}; +} ); /** - * Add an event handler to an element + * Toggle checkboxes with shift selection + * + * To be removed in MediaWiki 1.23. * - * @param element Element to add handler to - * @param attach String Event to attach to - * @param handler callable Event handler callback + * @deprecated since 1.17 Use jquery.checkboxShiftClick instead */ -window.addHandler = function( element, attach, handler ) { - if( element.addEventListener ) { - element.addEventListener( attach, handler, false ); - } else if( element.attachEvent ) { - element.attachEvent( 'on' + attach, handler ); - } -}; +msg = 'Use jquery.checkboxShiftClick instead'; +mw.log.deprecate( win, 'checkboxes', [], msg ); +mw.log.deprecate( win, 'lastCheckbox', null, msg ); +mw.log.deprecate( win, 'setupCheckboxShiftClick', $.noop, msg ); +mw.log.deprecate( win, 'addCheckboxClickHandlers', $.noop, msg ); +mw.log.deprecate( win, 'checkboxClickHandler', $.noop, msg ); -window.hookEvent = function( hookName, hookFunct ) { - addHandler( window, hookName, hookFunct ); -}; +/** + * Add a button to the default editor toolbar + * + * To be removed in MediaWiki 1.23. + * + * @deprecated since 1.17 Use mw.toolbar instead + */ +mw.log.deprecate( win, 'mwEditButtons', [], 'Use mw.toolbar instead' ); +mw.log.deprecate( win, 'mwCustomEditButtons', [], 'Use mw.toolbar instead' ); /** - * Add a click event handler to an element + * Spinner creation, injection and removal + * + * To be removed in MediaWiki 1.23. * - * @param element Element to add handler to - * @param handler callable Event handler callback + * @deprecated since 1.18 Use jquery.spinner instead */ -window.addClickHandler = function( element, handler ) { - addHandler( element, 'click', handler ); -}; +mw.log.deprecate( win, 'injectSpinner', $.noop, 'Use jquery.spinner instead' ); +mw.log.deprecate( win, 'removeSpinner', $.noop, 'Use jquery.spinner instead' ); /** - * Removes an event handler from an element + * Escape utilities * - * @param element Element to remove handler from - * @param remove String Event to remove - * @param handler callable Event handler callback to remove + * To be removed in MediaWiki 1.23. + * + * @deprecated since 1.18 Use mw.html instead + */ +mw.log.deprecate( win, 'escapeQuotes', $.noop,'Use mw.html instead' ); +mw.log.deprecate( win, 'escapeQuotesHTML', $.noop,'Use mw.html instead' ); + +/** + * Display a message to the user + * + * To be removed in MediaWiki 1.23. + * + * @deprecated since 1.17 Use mediawiki.notify instead + * @param {string|HTMLElement} message To be put inside the message box + */ +mw.log.deprecate( win, 'jsMsg', mw.util.jsMessage, 'Use mediawiki.notify instead' ); + +/** + * Misc. utilities + * + * To be removed in MediaWiki 1.23. + * + * @deprecated since 1.17 Use mediawiki.util instead + */ +msg = 'Use mediawiki.util instead'; +mw.log.deprecate( win, 'tooltipAccessKeyPrefix', 'alt-', msg ); +mw.log.deprecate( win, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg ); +mw.log.deprecate( win, 'updateTooltipAccessKeys', mw.util.updateTooltipAccessKeys, msg ); +mw.log.deprecate( win, 'addPortletLink', mw.util.addPortletLink, msg ); +mw.log.deprecate( win, 'appendCSS', mw.util.addCSS, msg ); + +/** + * Wikipage import methods */ -window.removeHandler = function( element, remove, handler ) { - if( window.removeEventListener ) { - element.removeEventListener( remove, handler, false ); - } else if( window.detachEvent ) { - element.detachEvent( 'on' + remove, handler ); + +// included-scripts tracker +win.loadedScripts = {}; + +win.importScript = function ( page ) { + var uri = mw.config.get( 'wgScript' ) + '?title=' + + mw.util.wikiUrlencode( page ) + + '&action=raw&ctype=text/javascript'; + return win.importScriptURI( uri ); +}; + +win.importScriptURI = function ( url ) { + if ( win.loadedScripts[url] ) { + return null; } + win.loadedScripts[url] = true; + var s = document.createElement( 'script' ); + s.setAttribute( 'src', url ); + s.setAttribute( 'type', 'text/javascript' ); + document.getElementsByTagName( 'head' )[0].appendChild( s ); + return s; +}; + +win.importStylesheet = function( page ) { + return win.importStylesheetURI( mw.config.get( 'wgScript' ) + '?action=raw&ctype=text/css&title=' + mw.util.wikiUrlencode( page ) ); +}; + +win.importStylesheetURI = function( url, media ) { + var l = document.createElement( 'link' ); + l.rel = 'stylesheet'; + l.href = url; + if ( media ) { + l.media = media; + } + document.getElementsByTagName('head')[0].appendChild( l ); + return l; }; -// note: all skins should call runOnloadHook() at the end of html output, -// so the below should be redundant. It's there just in case. -hookEvent( 'load', runOnloadHook ); -if ( ie6_bugs ) { - importScriptURI( mw.config.get( 'stylepath' ) + '/common/IEFixes.js' ); +if ( isIE6 ) { + win.importScriptURI( mw.config.get( 'stylepath' ) + '/common/IEFixes.js' ); } -}( mediaWiki ) ); +}( mediaWiki, jQuery ) ); diff --git a/skins/common/wikiprintable.css b/skins/common/wikiprintable.css deleted file mode 100644 index 95fcfef3..00000000 --- a/skins/common/wikiprintable.css +++ /dev/null @@ -1,59 +0,0 @@ -/* MediaWiki print stylesheet */ - -body { - color: #000000; - background: #ffffff; -} - -/* MSIE/Win doesn't understand 'inherit' */ -a, -a.external, -a.new, -a.stub { - color: black !important; - text-decoration: none !important; -} -#article { - margin: 0 !important; -} - -/* Continue ... */ -a, -a.external, -a.new, -a.stub { - color: inherit !important; - text-decoration: inherit !important; -} - -/* Hide UI stuff */ -#quickbar, -#topbar, -#logo, -#footer, -#siteNotice, -.editsection, -.toctoggle { - display: none; -} - -/* */ -#article { - position: relative; - margin: inherit !important; -} - -.printfooter { - border-top: solid 1px black; - display: block !important; -} - -/* Old stuff. @todo FIXME: -a.CBlink { color: #0000AA; text-decoration: none; font-size: 12pt; } -a.interwiki, -a.external { color: #3333BB; text-decoration: none; } -h1.pagetitle { padding-bottom: 0; margin-bottom: 0; } -i.link, -u.link { color: #000066; } -p.subtitle { padding-top: 0; margin-top: 0; } -*/ |