// Execute the queued functions
for ( i = 0; i < functs.length; i++ ) {
- functs[i]();
+ functs[ i ]();
}
} );
* 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 );
- }
-
/**
* @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25.
*/
function importScriptURI( url ) {
- if ( loadedScripts[url] ) {
+ if ( loadedScripts[ url ] ) {
return null;
}
- loadedScripts[url] = true;
+ loadedScripts[ url ] = true;
var s = document.createElement( 'script' );
s.setAttribute( 'src', url );
s.setAttribute( 'type', 'text/javascript' );
- document.getElementsByTagName( 'head' )[0].appendChild( s );
+ document.getElementsByTagName( 'head' )[ 0 ].appendChild( s );
return s;
}
- function importStylesheet( page ) {
+ function importScript( page ) {
var uri = mw.config.get( 'wgScript' ) + '?title=' +
mw.util.wikiUrlencode( page ) +
- '&action=raw&ctype=text/css';
- return importStylesheetURI( uri );
+ '&action=raw&ctype=text/javascript';
+ return importScriptURI( uri );
}
/**
if ( media ) {
l.media = media;
}
- document.getElementsByTagName( 'head' )[0].appendChild( l );
+ document.getElementsByTagName( 'head' )[ 0 ].appendChild( l );
return l;
}
+ function importStylesheet( page ) {
+ var uri = mw.config.get( 'wgScript' ) + '?title=' +
+ mw.util.wikiUrlencode( page ) +
+ '&action=raw&ctype=text/css';
+ return importStylesheetURI( uri );
+ }
+
msg = 'Use mw.loader instead.';
mw.log.deprecate( win, 'loadedScripts', loadedScripts, msg );
mw.log.deprecate( win, 'importScriptURI', importScriptURI, msg );