Difference between revisions of "User:Shijun/monobook.js"
Jump to navigation
Jump to search
m |
m (Text replace - "nethack.wikia.com" to "nethackwiki.com") |
||
(5 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | // | + | // from http://en.wikipedia.org/wiki/MediaWiki:Common.js |
− | + | importedScripts = {}; // object keeping track of included scripts, so a script ain't included twice | |
− | + | function importScript( base, page ) | |
− | + | { | |
− | + | if( importedScripts[page] ) { | |
− | function | + | return; |
− | + | } | |
− | + | importedScripts[page] = true; | |
− | + | var url = base | |
− | + | + '/index.php?title=' | |
− | + | + encodeURIComponent( page.replace( / /g, '_' ) ) | |
− | + | + '&action=raw&ctype=text/javascript&dontcountme=s'; | |
− | + | var scriptElem = document.createElement( 'script' ); | |
− | + | scriptElem.setAttribute( 'src' , url ); | |
− | + | scriptElem.setAttribute( 'type' , 'text/javascript' ); | |
− | + | document.getElementsByTagName( 'head' )[0].appendChild( scriptElem ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | // | + | //importScript('http://nethackwiki.com', 'User:Shijun/ajax.js'); |
+ | importScript('http://nethackwiki.com', 'User:Shijun/qpreview.js'); |
Latest revision as of 19:39, 11 November 2010
// from http://en.wikipedia.org/wiki/MediaWiki:Common.js
importedScripts = {}; // object keeping track of included scripts, so a script ain't included twice
function importScript( base, page )
{
if( importedScripts[page] ) {
return;
}
importedScripts[page] = true;
var url = base
+ '/index.php?title='
+ encodeURIComponent( page.replace( / /g, '_' ) )
+ '&action=raw&ctype=text/javascript&dontcountme=s';
var scriptElem = document.createElement( 'script' );
scriptElem.setAttribute( 'src' , url );
scriptElem.setAttribute( 'type' , 'text/javascript' );
document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}
//importScript('http://nethackwiki.com', 'User:Shijun/ajax.js');
importScript('http://nethackwiki.com', 'User:Shijun/qpreview.js');