2 * MediaWiki legacy wikibits
7 ua
= navigator
.userAgent
.toLowerCase(),
8 isIE6
= ( /msie ([0-9]{1,}[\.0-9]{0,})/.exec( ua
) && parseFloat( RegExp
.$1 ) <= 6.0 ),
11 if ( mw
.config
.get( 'wgBreakFrames' ) ) {
12 // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
13 // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266)
14 if ( win
.top
!== win
.self
) {
15 // Un-trap us from framesets
16 win
.top
.location
= win
.location
;
21 * User-agent sniffing.
23 * @deprecated since 1.17 Use jquery.client instead
26 msg
= 'Use feature detection or module jquery.client instead.';
28 mw
.log
.deprecate( win
, 'clientPC', ua
, msg
);
30 // Ignored dummy values
31 mw
.log
.deprecate( win
, 'is_gecko', false, msg
);
32 mw
.log
.deprecate( win
, 'is_chrome_mac', false, msg
);
33 mw
.log
.deprecate( win
, 'is_chrome', false, msg
);
34 mw
.log
.deprecate( win
, 'webkit_version', false, msg
);
35 mw
.log
.deprecate( win
, 'is_safari_win', false, msg
);
36 mw
.log
.deprecate( win
, 'is_safari', false, msg
);
37 mw
.log
.deprecate( win
, 'webkit_match', false, msg
);
38 mw
.log
.deprecate( win
, 'is_ff2', false, msg
);
39 mw
.log
.deprecate( win
, 'ff2_bugs', false, msg
);
40 mw
.log
.deprecate( win
, 'is_ff2_win', false, msg
);
41 mw
.log
.deprecate( win
, 'is_ff2_x11', false, msg
);
42 mw
.log
.deprecate( win
, 'opera95_bugs', false, msg
);
43 mw
.log
.deprecate( win
, 'opera7_bugs', false, msg
);
44 mw
.log
.deprecate( win
, 'opera6_bugs', false, msg
);
45 mw
.log
.deprecate( win
, 'is_opera_95', false, msg
);
46 mw
.log
.deprecate( win
, 'is_opera_preseven', false, msg
);
47 mw
.log
.deprecate( win
, 'is_opera', false, msg
);
48 mw
.log
.deprecate( win
, 'ie6_bugs', false, msg
);
51 * DOM utilities for handling of events, text nodes and selecting elements
53 * @deprecated since 1.17 Use jQuery instead
55 msg
= 'Use jQuery instead.';
57 // Ignored dummy values
58 mw
.log
.deprecate( win
, 'doneOnloadHook', undefined, msg
);
59 mw
.log
.deprecate( win
, 'onloadFuncts', [], msg
);
60 mw
.log
.deprecate( win
, 'runOnloadHook', $.noop
, msg
);
61 mw
.log
.deprecate( win
, 'changeText', $.noop
, msg
);
62 mw
.log
.deprecate( win
, 'killEvt', $.noop
, msg
);
63 mw
.log
.deprecate( win
, 'addHandler', $.noop
, msg
);
64 mw
.log
.deprecate( win
, 'hookEvent', $.noop
, msg
);
65 mw
.log
.deprecate( win
, 'addClickHandler', $.noop
, msg
);
66 mw
.log
.deprecate( win
, 'removeHandler', $.noop
, msg
);
67 mw
.log
.deprecate( win
, 'getElementsByClassName', function () { return []; }, msg
);
68 mw
.log
.deprecate( win
, 'getInnerText', function () { return ''; }, msg
);
70 // Run a function after the window onload event is fired
71 mw
.log
.deprecate( win
, 'addOnloadHook', function ( hookFunct
) {
73 onloadFuncts
.push(hookFunct
);
75 // If func queue is gone the event has happened already,
76 // run immediately instead of queueing.
81 $( win
).on( 'load', function () {
85 if ( !onloadFuncts
) {
89 // Deference and clear onloadFuncts before running any
90 // hooks to make sure we don't miss any addOnloadHook
92 functs
= onloadFuncts
.slice();
93 onloadFuncts
= undefined;
95 // Execute the queued functions
96 for ( i
= 0; i
< functs
.length
; i
++ ) {
102 * Toggle checkboxes with shift selection
104 * @deprecated since 1.17 Use jquery.checkboxShiftClick instead
106 msg
= 'Use jquery.checkboxShiftClick instead.';
107 mw
.log
.deprecate( win
, 'checkboxes', [], msg
);
108 mw
.log
.deprecate( win
, 'lastCheckbox', null, msg
);
109 mw
.log
.deprecate( win
, 'setupCheckboxShiftClick', $.noop
, msg
);
110 mw
.log
.deprecate( win
, 'addCheckboxClickHandlers', $.noop
, msg
);
111 mw
.log
.deprecate( win
, 'checkboxClickHandler', $.noop
, msg
);
114 * Add a button to the default editor toolbar
116 * @deprecated since 1.17 Use mw.toolbar instead
118 mw
.log
.deprecate( win
, 'mwEditButtons', [], 'Use mw.toolbar instead.' );
119 mw
.log
.deprecate( win
, 'mwCustomEditButtons', [], 'Use mw.toolbar instead.' );
122 * Spinner creation, injection and removal
124 * @deprecated since 1.18 Use jquery.spinner instead
126 mw
.log
.deprecate( win
, 'injectSpinner', $.noop
, 'Use jquery.spinner instead.' );
127 mw
.log
.deprecate( win
, 'removeSpinner', $.noop
, 'Use jquery.spinner instead.' );
132 * @deprecated since 1.18 Use mw.html instead
134 mw
.log
.deprecate( win
, 'escapeQuotes', $.noop
, 'Use mw.html instead.' );
135 mw
.log
.deprecate( win
, 'escapeQuotesHTML', $.noop
, 'Use mw.html instead.' );
138 * Display a message to the user
140 * @deprecated since 1.17 Use mediawiki.notify instead
141 * @param {string|HTMLElement} message To be put inside the message box
143 mw
.log
.deprecate( win
, 'jsMsg', function ( message
) {
144 if ( !arguments
.length
|| message
=== '' || message
=== null ) {
147 if ( typeof message
!== 'object' ) {
148 message
= $.parseHTML( message
);
150 mw
.notify( message
, { autoHide
: true, tag
: 'legacy' } );
152 }, 'Use mediawiki.notify instead.' );
157 * @deprecated since 1.17 Use mediawiki.util instead
159 msg
= 'Use mediawiki.util instead.';
160 mw
.log
.deprecate( win
, 'updateTooltipAccessKeys', mw
.util
.updateTooltipAccessKeys
, msg
);
161 mw
.log
.deprecate( win
, 'addPortletLink', mw
.util
.addPortletLink
, msg
);
162 mw
.log
.deprecate( win
, 'appendCSS', mw
.util
.addCSS
, msg
);
163 msg
= 'Use jquery.accessKeyLabel instead.';
164 mw
.log
.deprecate( win
, 'tooltipAccessKeyPrefix', 'alt-', msg
);
165 mw
.log
.deprecate( win
, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg
);
168 * Wikipage import methods
171 // included-scripts tracker
172 win
.loadedScripts
= {};
174 win
.importScript = function ( page
) {
175 var uri
= mw
.config
.get( 'wgScript' ) + '?title=' +
176 mw
.util
.wikiUrlencode( page
) +
177 '&action=raw&ctype=text/javascript';
178 return win
.importScriptURI( uri
);
181 win
.importScriptURI = function ( url
) {
182 if ( win
.loadedScripts
[url
] ) {
185 win
.loadedScripts
[url
] = true;
186 var s
= document
.createElement( 'script' );
187 s
.setAttribute( 'src', url
);
188 s
.setAttribute( 'type', 'text/javascript' );
189 document
.getElementsByTagName( 'head' )[0].appendChild( s
);
193 win
.importStylesheet = function ( page
) {
194 var uri
= mw
.config
.get( 'wgScript' ) + '?title=' +
195 mw
.util
.wikiUrlencode( page
) +
196 '&action=raw&ctype=text/css';
197 return win
.importStylesheetURI( uri
);
200 win
.importStylesheetURI = function ( url
, media
) {
201 var l
= document
.createElement( 'link' );
202 l
.rel
= 'stylesheet';
207 document
.getElementsByTagName('head')[0].appendChild( l
);
212 win
.importScriptURI( mw
.config
.get( 'stylepath' ) + '/common/IEFixes.js' );
215 }( mediaWiki
, jQuery
) );