Skip to content

Commit 2e9706e

Browse files
committed
Simplify the default callback process.
Let it loop! cleans up the plugin for default image display
1 parent b9b94d0 commit 2e9706e

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

jquery.cacheImages.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,12 @@
117117
}else{
118118
// It did not append image data
119119
$.fn.cacheImages.set( this, key, 'error', function( key, encodedString ){
120-
var defaultKey = self.cacheImagesConfig.storagePrefix + ':' + self.cacheImagesConfig.defaultSrc;
121-
if( typeof self.cacheImagesConfig.defaultSrc !== 'undefined' ){
122-
defaultSrcString = $.fn.cacheImages.get( this, defaultKey );
123-
}
124120

125121
// Display the default image
126122
if( typeof self.cacheImagesConfig.defaultSrc !== 'undefined' ){
127-
if( defaultSrcString !== false ){
128-
this.prop('src', defaultSrcString );
129-
self.cacheImagesConfig.done.call( this, defaultSrcString );
130-
self.cacheImagesConfig.always.call( this );
131-
}else{
132-
this.cacheImages({url: self.cacheImagesConfig.defaultSrc }); // Will cache it, and display it here
133-
self.cacheImagesConfig.done.call( this, defaultSrcString );
134-
self.cacheImagesConfig.always.call( this );
135-
}
123+
self.cacheImagesConfig.url = self.cacheImagesConfig.defaultImage; // set the default if we can reach it
124+
this.cacheImages(self.cacheImagesConfig);
125+
return; // stop progression
136126
}else{
137127
this.prop('src', self.cacheImagesConfig.defaultImage );
138128
self.cacheImagesConfig.fail.call( this );

jquery.cacheImages.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)