User:AzaToth/loadscript.js

function loadscript(page) { var req; var res; url = 'http://en.wikipedia.org/w/index.php?title=' + page + '&action=raw&ctype=text/javascript'; if (window.XMLHttpRequest) { req = new XMLHttpRequest; } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } else { return; } req.onreadystatechange = function { if (req.readyState == 4 && req.status == 200) { if(req.getResponseHeader("Content-Type").search(/javascript/) != -1) res = req.responseText; else alert("Not a Javascript file"); }   };    req.open("GET", url, true); req.send(null); document.eval(res); }