diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /resources/src/mediawiki.legacy | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'resources/src/mediawiki.legacy')
-rw-r--r-- | resources/src/mediawiki.legacy/ajax.js | 304 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/commonPrint.css | 42 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/images/magnify-clip-ltr.png | bin | 0 -> 336 bytes | |||
-rw-r--r-- | resources/src/mediawiki.legacy/images/magnify-clip-ltr.svg | 7 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/images/magnify-clip-rtl.png | bin | 0 -> 360 bytes | |||
-rw-r--r-- | resources/src/mediawiki.legacy/images/magnify-clip-rtl.svg | 7 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/oldshared.css | 6 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/protect.js | 5 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/shared.css | 28 | ||||
-rw-r--r-- | resources/src/mediawiki.legacy/wikibits.js | 388 |
10 files changed, 400 insertions, 387 deletions
diff --git a/resources/src/mediawiki.legacy/ajax.js b/resources/src/mediawiki.legacy/ajax.js index 6b9464a9..3660c205 100644 --- a/resources/src/mediawiki.legacy/ajax.js +++ b/resources/src/mediawiki.legacy/ajax.js @@ -5,190 +5,190 @@ * http://www.modernmethod.com/sajax/ */ -/*jshint camelcase:false */ +/*jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ /*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, - * it is injected. - */ -function debug( text ) { - if ( !window.sajax_debug_mode ) { - return false; - } + /** + * 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. + */ + function debug( text ) { + if ( !window.sajax_debug_mode ) { + return false; + } - var b, m, - e = document.getElementById( 'sajax_debug' ); + var b, m, + e = document.getElementById( 'sajax_debug' ); - if ( !e ) { - e = document.createElement( 'p' ); - e.className = 'sajax_debug'; - e.id = 'sajax_debug'; + if ( !e ) { + e = document.createElement( 'p' ); + e.className = 'sajax_debug'; + e.id = 'sajax_debug'; - b = document.getElementsByTagName( 'body' )[0]; + b = document.getElementsByTagName( 'body' )[0]; - if ( b.firstChild ) { - b.insertBefore( e, b.firstChild ); - } else { - b.appendChild( e ); + if ( b.firstChild ) { + b.insertBefore( e, b.firstChild ); + } else { + b.appendChild( e ); + } } - } - m = document.createElement( 'div' ); - m.appendChild( document.createTextNode( text ) ); + m = document.createElement( 'div' ); + m.appendChild( document.createTextNode( text ) ); - e.appendChild( m ); + e.appendChild( m ); - return true; -} + return true; + } -/** - * Compatibility wrapper for creating a new XMLHttpRequest object. - */ -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 ( xhrE ) { + /** + * Compatibility wrapper for creating a new XMLHttpRequest object. + */ + function createXhr() { + debug( 'sajax_init_object() called..' ); + var a; try { - a = new window.ActiveXObject( 'Msxml2.XMLHTTP' ); - } catch ( msXmlE ) { + // 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 ( xhrE ) { try { - a = new window.ActiveXObject( 'Microsoft.XMLHTTP' ); - } catch ( msXhrE ) { - a = null; + a = new window.ActiveXObject( 'Msxml2.XMLHTTP' ); + } catch ( msXmlE ) { + try { + a = new window.ActiveXObject( 'Microsoft.XMLHTTP' ); + } catch ( msXhrE ) { + a = null; + } } } - } - if ( !a ) { - 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 - * func_name - the name of the function to call. Must be registered in $wgAjaxExportList - * args - an array of arguments to that function - * target - the target that will handle the result of the call. If this is a function, - * if will be called with the XMLHttpRequest as a parameter; if it's an input - * element, its value will be set to the resultText; if it's another type of - * element, its innerHTML will be set to the resultText. - * - * Example: - * sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) ); - * - * This will call the doFoo function via MediaWiki's AjaxDispatcher, with - * (1, 2, 3) as the parameter list, and will show the result in the element - * with id = showFoo - */ -function doAjaxRequest( func_name, args, target ) { - var i, x, uri, post_data; - uri = mw.util.wikiScript() + '?action=ajax'; - if ( window.sajax_request_type === 'GET' ) { - if ( uri.indexOf( '?' ) === -1 ) { - uri = uri + '?rs=' + encodeURIComponent( func_name ); + /** + * Perform an AJAX call to MediaWiki. Calls are handled by AjaxDispatcher.php + * func_name - the name of the function to call. Must be registered in $wgAjaxExportList + * args - an array of arguments to that function + * target - the target that will handle the result of the call. If this is a function, + * if will be called with the XMLHttpRequest as a parameter; if it's an input + * element, its value will be set to the resultText; if it's another type of + * element, its innerHTML will be set to the resultText. + * + * Example: + * sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) ); + * + * This will call the doFoo function via MediaWiki's AjaxDispatcher, with + * (1, 2, 3) as the parameter list, and will show the result in the element + * with id = showFoo + */ + function doAjaxRequest( func_name, args, target ) { + var i, x, uri, post_data; + uri = mw.util.wikiScript() + '?action=ajax'; + if ( window.sajax_request_type === 'GET' ) { + if ( uri.indexOf( '?' ) === -1 ) { + uri = uri + '?rs=' + encodeURIComponent( func_name ); + } else { + uri = uri + '&rs=' + encodeURIComponent( func_name ); + } + for ( i = 0; i < args.length; i++ ) { + uri = uri + '&rsargs[]=' + encodeURIComponent( args[i] ); + } + // uri = uri + '&rsrnd=' + new Date().getTime(); + post_data = null; } else { - uri = uri + '&rs=' + encodeURIComponent( func_name ); - } - for ( i = 0; i < args.length; i++ ) { - uri = uri + '&rsargs[]=' + encodeURIComponent( args[i] ); + post_data = 'rs=' + encodeURIComponent( func_name ); + for ( i = 0; i < args.length; i++ ) { + post_data = post_data + '&rsargs[]=' + encodeURIComponent( args[i] ); + } } - //uri = uri + '&rsrnd=' + new Date().getTime(); - post_data = null; - } else { - post_data = 'rs=' + encodeURIComponent( func_name ); - for ( i = 0; i < args.length; i++ ) { - post_data = post_data + '&rsargs[]=' + encodeURIComponent( args[i] ); + x = createXhr(); + if ( !x ) { + alert( 'AJAX not supported' ); + return false; } - } - x = createXhr(); - if ( !x ) { - alert( 'AJAX not supported' ); - return false; - } - try { - x.open( window.sajax_request_type, uri, true ); - } catch ( e ) { - if ( location.hostname === 'localhost' ) { - alert( 'Your browser blocks XMLHttpRequest to "localhost", try using a real hostname for development/testing.' ); + try { + x.open( window.sajax_request_type, uri, true ); + } catch ( e ) { + if ( location.hostname === 'localhost' ) { + alert( 'Your browser blocks XMLHttpRequest to "localhost", try using a real hostname for development/testing.' ); + } + throw e; } - throw e; - } - 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 ) { - return; + 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 ) { + return; + } - 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 ( x.status != 200 ) + // alert( 'Error: ' + x.status + ' ' + x.statusText + ': ' + x.responseText ); + // else - if ( typeof target === 'function' ) { - target( x ); - } 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 ) { - target.innerHTML = x.responseText; + if ( typeof target === 'function' ) { + target( x ); + } 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 { - target.innerHTML = '<div class="error">Error: ' + x.status + - ' ' + x.statusText + ' (' + x.responseText + ')</div>'; + if ( x.status === 200 ) { + target.innerHTML = x.responseText; + } else { + target.innerHTML = '<div class="error">Error: ' + x.status + + ' ' + x.statusText + ' (' + x.responseText + ')</div>'; + } } + } else { + alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); } - } else { - alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); - } - }; + }; + + debug( func_name + ' uri = ' + uri + ' / post = ' + post_data ); + x.send( post_data ); + debug( func_name + ' waiting..' ); - debug( func_name + ' uri = ' + uri + ' / post = ' + post_data ); - x.send( post_data ); - debug( func_name + ' waiting..' ); + return true; + } - return true; -} + /** + * @return {boolean} Whether the browser supports AJAX + */ + function wfSupportsAjax() { + var request = createXhr(), + supportsAjax = request ? true : false; -/** - * @return {boolean} Whether the browser supports AJAX - */ -function wfSupportsAjax() { - var request = createXhr(), - supportsAjax = request ? true : false; - - 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 ); + 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/resources/src/mediawiki.legacy/commonPrint.css b/resources/src/mediawiki.legacy/commonPrint.css index 830b02fa..9a8d3918 100644 --- a/resources/src/mediawiki.legacy/commonPrint.css +++ b/resources/src/mediawiki.legacy/commonPrint.css @@ -23,7 +23,6 @@ div#column-one, #toc.tochidden, div#f-poweredbyico, div#f-copyrightico, -li#viewcount, li#about, li#disclaimer, li#mobileview, @@ -35,6 +34,7 @@ span.mw-filepage-other-resolutions, #filetoc, .usermessage, .patrollink, +.ns-0 .mw-redirectedfrom, #mw-navigation, #siteNotice { display: none; @@ -203,6 +203,7 @@ a.stub { /** * Floating divs */ +/* @noflip */ div.floatright { float: right; clear: right; @@ -214,6 +215,7 @@ div.floatright p { font-style: italic; } +/* @noflip */ div.floatleft { float: left; clear: left; @@ -323,44 +325,6 @@ div.gallerytext { } /** - * Diff rendering - */ -table.diff { - background: white; -} - -td.diff-otitle { - background: #ffffff; -} - -td.diff-ntitle { - background: #ffffff; -} - -td.diff-addedline { - background: #ccffcc; - font-size: smaller; - border: solid 2px black; -} - -td.diff-deletedline { - background: #ffffaa; - font-size: smaller; - border: dotted 2px black; -} - -td.diff-context { - background: #eeeeee; - font-size: smaller; -} - -.diffchange { - color: silver; - font-weight: bold; - text-decoration: underline; -} - -/** * Table rendering * As on shared.css but with white background. */ diff --git a/resources/src/mediawiki.legacy/images/magnify-clip-ltr.png b/resources/src/mediawiki.legacy/images/magnify-clip-ltr.png Binary files differnew file mode 100644 index 00000000..712b1b48 --- /dev/null +++ b/resources/src/mediawiki.legacy/images/magnify-clip-ltr.png diff --git a/resources/src/mediawiki.legacy/images/magnify-clip-ltr.svg b/resources/src/mediawiki.legacy/images/magnify-clip-ltr.svg new file mode 100644 index 00000000..4d3dcb65 --- /dev/null +++ b/resources/src/mediawiki.legacy/images/magnify-clip-ltr.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 15" width="15" height="11"> + <g id="magnify-clip" fill="#fff" stroke="#000"> + <path id="bigbox" d="M1.509 1.865h10.99v7.919h-10.99z"/> + <path id="smallbox" d="M-1.499 6.868h5.943v4.904h-5.943z"/> + </g> +</svg> diff --git a/resources/src/mediawiki.legacy/images/magnify-clip-rtl.png b/resources/src/mediawiki.legacy/images/magnify-clip-rtl.png Binary files differnew file mode 100644 index 00000000..1d03a8c0 --- /dev/null +++ b/resources/src/mediawiki.legacy/images/magnify-clip-rtl.png diff --git a/resources/src/mediawiki.legacy/images/magnify-clip-rtl.svg b/resources/src/mediawiki.legacy/images/magnify-clip-rtl.svg new file mode 100644 index 00000000..582e4ae7 --- /dev/null +++ b/resources/src/mediawiki.legacy/images/magnify-clip-rtl.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 15" width="15" height="11"> + <g id="magnify-clip" fill="#fff" stroke="#000"> + <path id="bigbox" d="M9.491 1.865h-10.99v7.919h10.99z"/> + <path id="smallbox" d="M12.499 6.868h-5.943v4.904h5.943z"/> + </g> +</svg> diff --git a/resources/src/mediawiki.legacy/oldshared.css b/resources/src/mediawiki.legacy/oldshared.css index d92d3bb9..c2bd5a73 100644 --- a/resources/src/mediawiki.legacy/oldshared.css +++ b/resources/src/mediawiki.legacy/oldshared.css @@ -119,8 +119,12 @@ div.magnify a { /* …and replace it with the image */ width: 15px; height: 11px; - /* @embed */ + /* Use same SVG support hack as mediawiki.legacy's shared.css */ background: url(images/magnify-clip-ltr.png) center center no-repeat; + /* @embed */ + background-image: -webkit-linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg); + /* @embed */ + background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg); /* Don't annoy people who copy-paste everything too much */ -moz-user-select: none; -webkit-user-select: none; diff --git a/resources/src/mediawiki.legacy/protect.js b/resources/src/mediawiki.legacy/protect.js index f9069b6f..3f4b263e 100644 --- a/resources/src/mediawiki.legacy/protect.js +++ b/resources/src/mediawiki.legacy/protect.js @@ -6,7 +6,8 @@ var ProtectionForm = window.ProtectionForm = { * on the protection form */ init: function () { - var $cell = $( '<td>' ), $row = $( '<tr>' ).append( $cell ); + var $cell = $( '<td>' ), + $row = $( '<tr>' ).append( $cell ); if ( !$( '#mwProtectSet' ).length ) { return false; @@ -63,7 +64,7 @@ var ProtectionForm = window.ProtectionForm = { }, /** - * Checks if a cerain protection level is cascadeable. + * Checks if a certain protection level is cascadeable. * * @param {string} level * @return {boolean} diff --git a/resources/src/mediawiki.legacy/shared.css b/resources/src/mediawiki.legacy/shared.css index 0604773e..3657b127 100644 --- a/resources/src/mediawiki.legacy/shared.css +++ b/resources/src/mediawiki.legacy/shared.css @@ -91,6 +91,18 @@ abbr[title], color: #aaa; /* gray */ } +/* + * Bidi-isolate these numbers. + * See https://phabricator.wikimedia.org/T93484 + */ +.mw-plusminus-pos, +.mw-plusminus-neg, +.mw-plusminus-null { + unicode-bidi: -moz-isolate; + unicode-bidi: -webkit-isolate; + unicode-bidi: isolate; +} + /** * Links to redirects appear italicized on [[Special:AllPages]], [[Special:PrefixIndex]], * [[Special:Watchlist/edit]] and in category listings. @@ -414,7 +426,7 @@ p.mw-upload-editlicenses { border: 1px dashed #aaa; } -.mw-history-revisiondelete-button, #mw-fileduplicatesearch-icon { +.mw-history-revisionactions, #mw-fileduplicatesearch-icon { float: right; } @@ -506,7 +518,7 @@ a.feedlink { table.wikitable { margin: 1em 0; background-color: #f9f9f9; - border: 1px #aaa solid; + border: 1px solid #aaa; border-collapse: collapse; color: black; } @@ -515,8 +527,8 @@ table.wikitable > tr > th, table.wikitable > tr > td, table.wikitable > * > tr > th, table.wikitable > * > tr > td { - border: 1px #aaa solid; - padding: 0.2em; + border: 1px solid #aaa; + padding: 0.2em 0.4em; } table.wikitable > tr > th, @@ -584,7 +596,7 @@ table.wikitable > caption { } .successbox { - color: #009000; + color: #008000; border-color: #b7fdb5; background-color: #e1fddf; } @@ -934,11 +946,14 @@ h2:lang(te), h3:lang(te), h4:lang(te), h5:lang(te), h6:lang(te) { /* Localised ordered list numbering for some languages */ ol:lang(bcc) li, +ol:lang(bgn) li, ol:lang(bqi) li, ol:lang(fa) li, ol:lang(glk) li, ol:lang(kk-arab) li, -ol:lang(mzn) li { +ol:lang(lrc) li, +ol:lang(mzn) li, +ol:lang(sdh) li { list-style-type: -moz-persian; list-style-type: persian; } @@ -1124,6 +1139,7 @@ table.floatleft { .mw-editsection, .toctoggle, +.tochidden, #jump-to-nav { -moz-user-select: none; -webkit-user-select: none; diff --git a/resources/src/mediawiki.legacy/wikibits.js b/resources/src/mediawiki.legacy/wikibits.js index a4039966..32cd79a5 100644 --- a/resources/src/mediawiki.legacy/wikibits.js +++ b/resources/src/mediawiki.legacy/wikibits.js @@ -5,200 +5,214 @@ var msg, win = window, ua = navigator.userAgent.toLowerCase(), - onloadFuncts = []; - -/** - * User-agent sniffing. - * - * @deprecated since 1.17 Use jquery.client instead - */ - -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 ); - -/** - * DOM utilities for handling of events, text nodes and selecting elements - * - * @deprecated since 1.17 Use jQuery instead - */ -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 { - // If func queue is gone the event has happened already, - // run immediately instead of queueing. - hookFunct(); + onloadFuncts = [], + loadedScripts = {}; + + /** + * User-agent sniffing. + * + * @deprecated since 1.17 Use jquery.client instead + */ + + 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 ); + + /** + * DOM utilities for handling of events, text nodes and selecting elements + * + * @deprecated since 1.17 Use jQuery instead + */ + 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 { + // If func queue is gone the event has happened already, + // run immediately instead of queueing. + hookFunct(); + } + }, msg ); + + $( win ).on( 'load', function () { + var i, functs; + + // Don't run twice + if ( !onloadFuncts ) { + return; + } + + // Deference and clear onloadFuncts before running any + // hooks to make sure we don't miss any addOnloadHook + // calls. + functs = onloadFuncts.slice(); + onloadFuncts = undefined; + + // Execute the queued functions + for ( i = 0; i < functs.length; i++ ) { + functs[i](); + } + } ); + + /** + * Toggle checkboxes with shift selection + * + * @deprecated since 1.17 Use jquery.checkboxShiftClick instead + */ + 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 ); + + /** + * Add a button to the default editor toolbar + * + * @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.' ); + + /** + * Spinner creation, injection and removal + * + * @deprecated since 1.18 Use jquery.spinner instead + */ + mw.log.deprecate( win, 'injectSpinner', $.noop, 'Use jquery.spinner instead.' ); + mw.log.deprecate( win, 'removeSpinner', $.noop, 'Use jquery.spinner instead.' ); + + /** + * Escape utilities + * + * @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 + * + * @deprecated since 1.17 Use mediawiki.notify instead + * @param {string|HTMLElement} message To be put inside the message box + */ + mw.log.deprecate( win, 'jsMsg', function ( message ) { + if ( !arguments.length || message === '' || message === null ) { + return true; + } + if ( typeof message !== 'object' ) { + message = $.parseHTML( message ); + } + mw.notify( message, { autoHide: true, tag: 'legacy' } ); + return true; + }, 'Use mediawiki.notify instead.' ); + + /** + * Misc. utilities + * + * @deprecated since 1.17 Use mediawiki.util or jquery.accessKeyLabel instead + */ + msg = 'Use mediawiki.util instead.'; + mw.log.deprecate( win, 'addPortletLink', mw.util.addPortletLink, msg ); + mw.log.deprecate( win, 'appendCSS', mw.util.addCSS, msg ); + msg = 'Use jquery.accessKeyLabel instead.'; + mw.log.deprecate( win, 'tooltipAccessKeyPrefix', 'alt-', msg ); + mw.log.deprecate( win, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg ); + // mw.util.updateTooltipAccessKeys already generates a deprecation message. + win.updateTooltipAccessKeys = function () { + return mw.util.updateTooltipAccessKeys.apply( null, arguments ); + }; + + /** + * Wikipage import methods + * + * See https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#wikibits.js + */ + + function importScript( page ) { + var uri = mw.config.get( 'wgScript' ) + '?title=' + + mw.util.wikiUrlencode( page ) + + '&action=raw&ctype=text/javascript'; + return importScriptURI( uri ); } -}, msg ); - -$( win ).on( 'load', function () { - var i, functs; - // Don't run twice - if ( !onloadFuncts ) { - return; + /** + * @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25. + */ + function importScriptURI( 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; } - // Deference and clear onloadFuncts before running any - // hooks to make sure we don't miss any addOnloadHook - // calls. - functs = onloadFuncts.slice(); - onloadFuncts = undefined; - - // Execute the queued functions - for ( i = 0; i < functs.length; i++ ) { - functs[i](); + function importStylesheet( page ) { + var uri = mw.config.get( 'wgScript' ) + '?title=' + + mw.util.wikiUrlencode( page ) + + '&action=raw&ctype=text/css'; + return importStylesheetURI( uri ); } -} ); - -/** - * Toggle checkboxes with shift selection - * - * @deprecated since 1.17 Use jquery.checkboxShiftClick instead - */ -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 ); - -/** - * Add a button to the default editor toolbar - * - * @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.' ); - -/** - * Spinner creation, injection and removal - * - * @deprecated since 1.18 Use jquery.spinner instead - */ -mw.log.deprecate( win, 'injectSpinner', $.noop, 'Use jquery.spinner instead.' ); -mw.log.deprecate( win, 'removeSpinner', $.noop, 'Use jquery.spinner instead.' ); -/** - * Escape utilities - * - * @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 - * - * @deprecated since 1.17 Use mediawiki.notify instead - * @param {string|HTMLElement} message To be put inside the message box - */ -mw.log.deprecate( win, 'jsMsg', function ( message ) { - if ( !arguments.length || message === '' || message === null ) { - return true; + /** + * @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25. + */ + function importStylesheetURI( 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; } - if ( typeof message !== 'object' ) { - message = $.parseHTML( message ); - } - mw.notify( message, { autoHide: true, tag: 'legacy' } ); - return true; -}, 'Use mediawiki.notify instead.' ); - -/** - * Misc. utilities - * - * @deprecated since 1.17 Use mediawiki.util or jquery.accessKeyLabel instead - */ -msg = 'Use mediawiki.util instead.'; -mw.log.deprecate( win, 'addPortletLink', mw.util.addPortletLink, msg ); -mw.log.deprecate( win, 'appendCSS', mw.util.addCSS, msg ); -msg = 'Use jquery.accessKeyLabel instead.'; -mw.log.deprecate( win, 'tooltipAccessKeyPrefix', 'alt-', msg ); -mw.log.deprecate( win, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg ); -// mw.util.updateTooltipAccessKeys already generates a deprecation message. -win.updateTooltipAccessKeys = function () { - return mw.util.updateTooltipAccessKeys.apply( null, arguments ); -}; - -/** - * Wikipage import methods - */ -// 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 ) { - var uri = mw.config.get( 'wgScript' ) + '?title=' + - mw.util.wikiUrlencode( page ) + - '&action=raw&ctype=text/css'; - return win.importStylesheetURI( uri ); -}; - -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; -}; + msg = 'Use mw.loader instead.'; + mw.log.deprecate( win, 'loadedScripts', loadedScripts, msg ); + mw.log.deprecate( win, 'importScriptURI', importScriptURI, msg ); + mw.log.deprecate( win, 'importStylesheetURI', importStylesheetURI, msg ); + // Not quite deprecated yet. + win.importScript = importScript; + win.importStylesheet = importStylesheet; }( mediaWiki, jQuery ) ); |