diff --git a/pointstream.js b/pointstream.js index 3d08bfe..8488b04 100644 --- a/pointstream.js +++ b/pointstream.js @@ -1,12 +1,11 @@ -var ps_include = function(path) { - var lastScript = document.getElementsByTagName("head")[0].lastChild; - var fullUrl = lastScript.src.substring(0, lastScript.src.lastIndexOf('/') + 1) + path; - document.write('<' + 'script'); - document.write(' language="javascript"'); - document.write(' type="text/javascript"'); - document.write(' src="' + fullUrl + '">'); - document.write(''); -} +var ps_include = ((function(lastScript) { + return (function(path) { + var fullUrl = lastScript.src.substring(0, lastScript.src.lastIndexOf('/') + 1) + path; + var newScript = document.createElement("script"); + newScript.src = fullUrl; + document.getElementsByTagName("head")[0].appendChild(newScript); + }); +})(document.getElementsByTagName("head")[0].lastChild)); ps_include('mjs.js'); ps_include('psapi.js');