cleanup demo html pages

This commit is contained in:
nightwing 2014-04-16 23:13:40 +04:00
commit efea2a755b
13 changed files with 180 additions and 106 deletions

View file

@ -111,14 +111,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
};
this.$normalizePath = function(path) {
if (!location.host) // needed for file:// protocol
return path;
path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
path = location.protocol + "//" + location.host
// paths starting with a slash are relative to the root (host)
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
return net.qualifyURL(path);
};
this.terminate = function() {
@ -184,7 +177,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
this.$workerBlob = function(workerUrl) {
// workerUrl can be protocol relative
// importScripts only takes fully qualified urls
var script = "importScripts('" + net.qualifyURL( workerUrl ) + "');";
var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
try {
return new Blob([script], {"type": "application/javascript"});
} catch (e) { // Backwards-compatibility