// Fetches required resources and executes the core payload.
var DEBUG = typeof DEBUG !== 'undefined' && DEBUG === true;
_LOADER = new Object();
(function() {
	var reslistxhr = new XMLHttpRequest();
	reslistxhr.open('GET', 'https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/resources.txt?r=' + Math.random(), false);
	reslistxhr.send();
	if (reslistxhr.status != 200)
	{
		console.error("HTTP " + reslistxhr.status);
		return;
	}
	var rstr = reslistxhr.responseText;
	var resources = rstr.split('\n');
	if (DEBUG)
	{
		console.debug(resources);
	}
	for (var i = 0; i < resources.length; i++)
	{
		var r = resources[i];
		if (r.charAt(0) == '#' || r == '') // Ignore lines starting with '#'
		{
			continue;
		}
		var parts = r.split('.');
		var ext = parts[parts.length - 1];
		if (ext == "png" || ext == "jpg")
		{
			console.warn("Loading images not yet supported!");
		}
		else if (ext == "js")
		{
			if (DEBUG)
			{
				console.debug("loading script at " + r);
			}
			var xhr = new XMLHttpRequest();
			xhr.open('GET', r + '?r=' + Math.random(), false);
			xhr.send();
			if (xhr.status != 200)
			{
				console.error("HTTP " + xhr.status);
				return;
			}
			eval(xhr.responseText);
		}
	}
	_SETUP();
})();

@@ -556,16 +556,74 @@
 es);%0A%09%7D%0A
+%09var headElem = document.getElementsByTagName('head')%5B0%5D;%0A
 %09for (va
@@ -1237,29 +1237,110 @@
 %0A%09%09%09
-eval(xhr.responseText
+var s = document.createElement('script');%0A%09%09%09s.innerHTML = xhr.responseText;%0A%09%09%09headElem.appendChild(s
 );%0A%09

Change loader to not require eval()