Skip to content

Instantly share code, notes, and snippets.

@rc5hack
Created February 8, 2013 08:51
Show Gist options
  • Save rc5hack/4737523 to your computer and use it in GitHub Desktop.
Save rc5hack/4737523 to your computer and use it in GitHub Desktop.
/*
* Code copied from Russian wikipedia (08.02.2012)
*/
window.loadedScripts={};
window.importScriptURI=function(url){
if(loadedScripts[url]){return null;}
loadedScripts[url]=true;
var s=document.createElement('script');
s.setAttribute('src',url);
s.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
return s;
};
window.importScript=function(page){
var uri=mw.config.get('wgScript')+'?title='+mw.util.wikiUrlencode(page)+'&action=raw&ctype=text/javascript';
return importScriptURI(uri);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment