From e824dce312ce66c8a68695a11c248d3eb95cc272 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 10 Dec 2013 21:17:45 +0000 Subject: removed never used javascript git-svn-id: http://piwigo.org/svn/trunk@25923 68402e56-0260-453c-a942-63ccdbb3a9ee --- themes/default/js/image.loader.js | 84 --------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 themes/default/js/image.loader.js (limited to 'themes') diff --git a/themes/default/js/image.loader.js b/themes/default/js/image.loader.js deleted file mode 100644 index cd8b9cc52..000000000 --- a/themes/default/js/image.loader.js +++ /dev/null @@ -1,84 +0,0 @@ - -function ImageLoader(opts) { - this.opts = jQuery.extend( { - maxRequests: 6, - onChanged: jQuery.noop - }, opts||{} ); -} - -ImageLoader.prototype = { - loaded: 0, - errors: 0, - errorEma: 0, - - pause: false, - - current: [], - queue: [], - pool: [], - - remaining: function() { - return this.current.length + this.queue.length; - }, - - add: function(urls) { - this.queue = this.queue.concat( urls ); - this._fireChanged("add"); - this._checkQueue(); - }, - - clear: function() { - this.queue.length = 0; - while (this.current.length) - jQuery( this.current.pop() ).unbind(); - this.loaded = this.errors = this.errorEma = 0; - }, - - pause: function(val) { - if (val !== undefined) - { - this.paused = val; - this._checkQueue(); - } - return this.paused; - }, - - _checkQueue: function() { - while (!this.paused - && this.queue.length - && this.current.length < this.opts.maxRequests) - { - this._processOne( this.queue.shift() ); - } - }, - - _processOne: function(url) { - var img = this.pool.shift() || new Image; - this.current.push(img); - var that = this; - jQuery(img).bind( "load error abort", function(e) { - //img.onload = function(e) { - jQuery(img).unbind(); - img.onload=null; - that.current.splice(jQuery.inArray(img, that.current), 1); - if (e.type==="load") { - that.loaded++; - that.errorEma *= 0.9; - } - else { - that.errors++; - that.errorEma++; - if (that.errorEma>=20 && that.errorEma<21) - that.paused = true; - } - that._fireChanged(e.type, img); - that._checkQueue(); - that.pool.push(img); - } ); - img.src = url; - }, - - _fireChanged: function(type, img) { - this.opts.onChanged(type, img); - } -} \ No newline at end of file -- cgit v1.2.3