1function ImageLoader() 2{ 3 this.TIMER_DURATION = 50; 4 this.image = null; 5 this.timer = null; 6 this.onEndFunction = null; 7}; 8 9ImageLoader.prototype.TIMER_DURATION = 50; 10ImageLoader.prototype.image = null; 11ImageLoader.prototype.timer = null; 12ImageLoader.prototype.onEndFunction = null; 13 14ImageLoader.prototype.setOnEndFunction = function(onEndFunction) 15{ 16 this.onEndFunction = onEndFunction; 17}; 18 19ImageLoader.prototype.loadImage = function(source) 20{ 21 if (this.timer != null) 22 { 23 clearTimeout(this.timer); 24 } 25 var _this = this; 26 this.image = new Image(); 27 this.image.onerror = function() 28 { 29 clearTimeout(_this.timer); 30 if (_this.onEndFunction != null) 31 { 32 _this.onEndFunction.call(this, false, 0, 0); 33 } 34 }; 35 this.image.src = source; 36 this.timer = setTimeout(function() { _this._waitLoad(); }, 10); 37}; 38 39ImageLoader.prototype._waitLoad = function() 40{ 41 if (this.image.complete) 42 { 43 if (this.onEndFunction != null) 44 { 45 var isLoaded = true; 46 var width = this.image.width; 47 var height = this.image.height; 48 if ((width <= 0) || (height <= 0)) 49 { 50 isLoaded = false; 51 width = 0; 52 height = 0; 53 } 54 this.onEndFunction.call(this, isLoaded, width, height); 55 } 56 } 57 else 58 { 59 var _this = this; 60 this.timer = setTimeout(function() { _this._waitLoad(); }, this.TIMER_DURATION); 61 } 62}; 63 64/* 65ImageLoader.prototype._onLoadError = function() 66{ 67 clearTimeout(this.timer); 68 if (this.onEndFunction != null) 69 { 70 this.onEndFunction.call(this, false, 0, 0); 71 } 72}; 73*/ 74
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.