|
|
@ -7,6 +7,14 @@ function Images() { |
|
|
|
this.callback = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
Images.prototype._resolveRelativeUrl = function(url){ |
|
|
|
var img = document.createElement('img'); |
|
|
|
img.src = url; // set string url
|
|
|
|
url = img.src; // get qualified url
|
|
|
|
img.src = null; // no server request
|
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set an onload callback function. This will be called each time an image |
|
|
|
* is loaded |
|
|
@ -52,6 +60,13 @@ Images.prototype.load = function(url, brokenUrl) { |
|
|
|
me.callback(this); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (this.src === me._resolveRelativeUrl(brokenUrl)){ |
|
|
|
console.error("Could not load brokenImage:", brokenUrl); |
|
|
|
delete this.src; |
|
|
|
if (me.callback) { |
|
|
|
me.callback(this); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
this.src = brokenUrl; |
|
|
|
} |
|
|
|