2 * MediaWiki legacy wikibits
7 ua = navigator.userAgent.toLowerCase(),
11 * User-agent sniffing.
13 * @deprecated since 1.17 Use jquery.client instead
16 msg = 'Use feature detection or module jquery.client instead.';
18 mw.log.deprecate( win, 'clientPC', ua, msg );
20 // Ignored dummy values
21 mw.log.deprecate( win, 'is_gecko', false, msg );
22 mw.log.deprecate( win, 'is_chrome_mac', false, msg );
23 mw.log.deprecate( win, 'is_chrome', false, msg );
24 mw.log.deprecate( win, 'webkit_version', false, msg );
25 mw.log.deprecate( win, 'is_safari_win', false, msg );
26 mw.log.deprecate( win, 'is_safari', false, msg );
27 mw.log.deprecate( win, 'webkit_match', false, msg );
28 mw.log.deprecate( win, 'is_ff2', false, msg );
29 mw.log.deprecate( win, 'ff2_bugs', false, msg );
30 mw.log.deprecate( win, 'is_ff2_win', false, msg );
31 mw.log.deprecate( win, 'is_ff2_x11', false, msg );
32 mw.log.deprecate( win, 'opera95_bugs', false, msg );
33 mw.log.deprecate( win, 'opera7_bugs', false, msg );
34 mw.log.deprecate( win, 'opera6_bugs', false, msg );
35 mw.log.deprecate( win, 'is_opera_95', false, msg );
36 mw.log.deprecate( win, 'is_opera_preseven', false, msg );
37 mw.log.deprecate( win, 'is_opera', false, msg );
38 mw.log.deprecate( win, 'ie6_bugs', false, msg );
41 * DOM utilities for handling of events, text nodes and selecting elements
43 * @deprecated since 1.17 Use jQuery instead
45 msg = 'Use jQuery instead.';
47 // Ignored dummy values
48 mw.log.deprecate( win, 'doneOnloadHook', undefined, msg );
49 mw.log.deprecate( win, 'onloadFuncts', [], msg );
50 mw.log.deprecate( win, 'runOnloadHook', $.noop, msg );
51 mw.log.deprecate( win, 'changeText', $.noop, msg );
52 mw.log.deprecate( win, 'killEvt', $.noop, msg );
53 mw.log.deprecate( win, 'addHandler', $.noop, msg );
54 mw.log.deprecate( win, 'hookEvent', $.noop, msg );
55 mw.log.deprecate( win, 'addClickHandler', $.noop, msg );
56 mw.log.deprecate( win, 'removeHandler', $.noop, msg );
57 mw.log.deprecate( win, 'getElementsByClassName', function () { return []; }, msg );
58 mw.log.deprecate( win, 'getInnerText', function () { return ''; }, msg );
60 // Run a function after the window onload event is fired
61 mw.log.deprecate( win, 'addOnloadHook', function ( hookFunct ) {
63 onloadFuncts.push( hookFunct );
65 // If func queue is gone the event has happened already,
66 // run immediately instead of queueing.
71 $( win ).on( 'load', function () {
75 if ( !onloadFuncts ) {
79 // Deference and clear onloadFuncts before running any
80 // hooks to make sure we don't miss any addOnloadHook
82 functs = onloadFuncts.slice();
83 onloadFuncts = undefined;
85 // Execute the queued functions
86 for ( i = 0; i < functs.length; i++ ) {
92 * Toggle checkboxes with shift selection
94 * @deprecated since 1.17 Use jquery.checkboxShiftClick instead
96 msg = 'Use jquery.checkboxShiftClick instead.';
97 mw.log.deprecate( win, 'checkboxes', [], msg );
98 mw.log.deprecate( win, 'lastCheckbox', null, msg );
99 mw.log.deprecate( win, 'setupCheckboxShiftClick', $.noop, msg );
100 mw.log.deprecate( win, 'addCheckboxClickHandlers', $.noop, msg );
101 mw.log.deprecate( win, 'checkboxClickHandler', $.noop, msg );
104 * Add a button to the default editor toolbar
106 * @deprecated since 1.17 Use mw.toolbar instead
108 mw.log.deprecate( win, 'mwEditButtons', [], 'Use mw.toolbar instead.' );
109 mw.log.deprecate( win, 'mwCustomEditButtons', [], 'Use mw.toolbar instead.' );
112 * Spinner creation, injection and removal
114 * @deprecated since 1.18 Use jquery.spinner instead
116 mw.log.deprecate( win, 'injectSpinner', $.noop, 'Use jquery.spinner instead.' );
117 mw.log.deprecate( win, 'removeSpinner', $.noop, 'Use jquery.spinner instead.' );
122 * @deprecated since 1.18 Use mw.html instead
124 mw.log.deprecate( win, 'escapeQuotes', $.noop, 'Use mw.html instead.' );
125 mw.log.deprecate( win, 'escapeQuotesHTML', $.noop, 'Use mw.html instead.' );
128 * Display a message to the user
130 * @deprecated since 1.17 Use mediawiki.notify instead
131 * @param {string|HTMLElement} message To be put inside the message box
133 mw.log.deprecate( win, 'jsMsg', function ( message ) {
134 if ( !arguments.length || message === '' || message === null ) {
137 if ( typeof message !== 'object' ) {
138 message = $.parseHTML( message );
140 mw.notify( message, { autoHide: true, tag: 'legacy' } );
142 }, 'Use mediawiki.notify instead.' );
147 * @deprecated since 1.17 Use mediawiki.util or jquery.accessKeyLabel instead
149 msg = 'Use mediawiki.util instead.';
150 mw.log.deprecate( win, 'addPortletLink', mw.util.addPortletLink, msg );
151 mw.log.deprecate( win, 'appendCSS', mw.util.addCSS, msg );
152 msg = 'Use jquery.accessKeyLabel instead.';
153 mw.log.deprecate( win, 'tooltipAccessKeyPrefix', 'alt-', msg );
154 mw.log.deprecate( win, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg );
155 // mw.util.updateTooltipAccessKeys already generates a deprecation message.
156 win.updateTooltipAccessKeys = function () {
157 return mw.util.updateTooltipAccessKeys.apply( null, arguments );
161 * Wikipage import methods
164 // included-scripts tracker
165 win.loadedScripts = {};
167 win.importScript = function ( page ) {
168 var uri = mw.config.get( 'wgScript' ) + '?title=' +
169 mw.util.wikiUrlencode( page ) +
170 '&action=raw&ctype=text/javascript';
171 return win.importScriptURI( uri );
174 win.importScriptURI = function ( url ) {
175 if ( win.loadedScripts[url] ) {
178 win.loadedScripts[url] = true;
179 var s = document.createElement( 'script' );
180 s.setAttribute( 'src', url );
181 s.setAttribute( 'type', 'text/javascript' );
182 document.getElementsByTagName( 'head' )[0].appendChild( s );
186 win.importStylesheet = function ( page ) {
187 var uri = mw.config.get( 'wgScript' ) + '?title=' +
188 mw.util.wikiUrlencode( page ) +
189 '&action=raw&ctype=text/css';
190 return win.importStylesheetURI( uri );
193 win.importStylesheetURI = function ( url, media ) {
194 var l = document.createElement( 'link' );
195 l.rel = 'stylesheet';
200 document.getElementsByTagName( 'head' )[0].appendChild( l );
204 }( mediaWiki, jQuery ) );