| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/lyon/components/com_community/assets/postbox/js/utils/ |
Upload File : |
define('utils/image',[],function() {
function Preloader( images, callback ) {
this.images = [];
this.loaded = [];
this.processed = 0;
this.callback = callback;
if ( !images || !images.length ) {
images = [];
}
// sanitize url
var rUrl = /^(http:|https:)?\/\/([a-z0-9-]+\.)+[a-z]{2,18}\/.*$/i;
for ( var i = 0; i < images.length; i++ ) {
if ( images[i].match( rUrl ) )
this.images.push( images[i] );
}
}
Preloader.prototype.load = function() {
if ( !this.images || !this.images.length ) {
this.callback([]);
return;
}
for ( var i = 0, img; i < this.images.length; i++ ) {
img = new Image();
img.onload = this.onload;
img.onerror = this.onerror;
img.onabort = this.onabort;
img.preloader = this;
img.src = img._src = this.images[i];
}
};
Preloader.prototype.onload = function() {
this.preloader.loaded.push( this._src );
this.preloader.oncomplete();
};
Preloader.prototype.onerror = function() {
this.preloader.oncomplete();
};
Preloader.prototype.onabort = function() {
this.preloader.oncomplete();
};
Preloader.prototype.oncomplete = function() {
var i, images = [];
this.processed++;
if ( this.processed >= this.images.length ) {
for ( i = 0; i < this.images.length; i++ )
if ( this.loaded.indexOf( this.images[ i ] ) > -1 )
images.push( this.images[ i ] );
this.callback( images );
}
};
function preload( images, callback ) {
var pre = new Preloader( images, callback );
pre.load();
}
return {
preload: preload
};
});