MediaWiki:Common.js
From LostRing
(Difference between revisions)
Revision as of 14:33, 19 March 2008 (edit) Thebruce (Talk | contribs) m ← Previous diff |
Current revision (14:42, 19 March 2008) (edit) (undo) Thebruce (Talk | contribs) m |
||
(3 intermediate revisions not shown.) | |||
Line 2: | Line 2: | ||
if (wgUserName=='Thebruce') | if (wgUserName=='Thebruce') | ||
- | importScript('MediaWiki:contentFormatter.js'); | + | importScript('MediaWiki:ContentFormatter.js'); |
+ | |||
+ | |||
+ | function importScript(page){ | ||
+ | var url=wgScriptPath + '/index.php?title=' + escape(page.replace(' ','_')) | ||
+ | + '&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); | ||
+ | } |
Current revision
/* Any JavaScript here will be loaded for all users on every page load. */
if (wgUserName=='Thebruce') importScript('MediaWiki:ContentFormatter.js');
function importScript(page){
var url=wgScriptPath + '/index.php?title=' + escape(page.replace(' ','_')) + '&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);
}