BJ Lazy Load - Version 0.5.2

Version Description

Added fadeIn effect

Download this release

Release Info

Developer bjornjohansen
Plugin Icon 128x128 BJ Lazy Load
Version 0.5.2
Comparing to
See all releases

Code changes from version 0.5.1 to 0.5.2

Files changed (4) hide show
  1. bj-lazy-load.php +2 -2
  2. js/bj-lazy-load.js +11 -5
  3. js/bj-lazy-load.min.js +1 -1
  4. readme.txt +7 -1
bj-lazy-load.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: BJ Lazy Load
4
  Plugin URI: http://wordpress.org/extend/plugins/bj-lazy-load/
5
  Description: Lazy image loading makes your site load faster and saves bandwidth.
6
- Version: 0.5.1
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  License: GPL2
@@ -31,7 +31,7 @@ require_once( dirname(__FILE__) . '/scb/load.php' );
31
  if ( ! class_exists( 'BJLL' ) ) {
32
  class BJLL {
33
 
34
- const version = '0.5.1';
35
  protected $_placeholder_url;
36
 
37
  protected static $_instance;
3
  Plugin Name: BJ Lazy Load
4
  Plugin URI: http://wordpress.org/extend/plugins/bj-lazy-load/
5
  Description: Lazy image loading makes your site load faster and saves bandwidth.
6
+ Version: 0.5.2
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  License: GPL2
31
  if ( ! class_exists( 'BJLL' ) ) {
32
  class BJLL {
33
 
34
+ const version = '0.5.2';
35
  protected $_placeholder_url;
36
 
37
  protected static $_instance;
js/bj-lazy-load.js CHANGED
@@ -2,18 +2,24 @@
2
 
3
  function bj_lazy_load_init() {
4
 
5
- $('.lazy-hidden').not('[data-lazy-ready]').one( 'scrollin.bj_lazy_load', { distance: 200 }, function() {
6
 
7
  var $el = $( this ),
8
  data_lazy_type = $el.attr( 'data-lazy-type' );
9
 
10
  if ( data_lazy_type == 'image' ) {
11
- $el.attr( 'src', $el.attr( 'data-lazy-src' ) )
12
- .removeClass( 'lazy-hidden' );
 
 
13
  } else if ( data_lazy_type == 'iframe' ) {
14
- $el.replaceWith( bj_lazy_load_base64_decode( $el.attr( 'data-lazy-src' ) ) );
 
 
 
 
15
  }
16
- }).attr( 'data-lazy-ready', 'true' );
17
 
18
  }
19
 
2
 
3
  function bj_lazy_load_init() {
4
 
5
+ $('.lazy-hidden').not('.data-lazy-ready').one( 'scrollin.bj_lazy_load', { distance: 200 }, function() {
6
 
7
  var $el = $( this ),
8
  data_lazy_type = $el.attr( 'data-lazy-type' );
9
 
10
  if ( data_lazy_type == 'image' ) {
11
+ $el.hide()
12
+ .attr( 'src', $el.attr( 'data-lazy-src' ) )
13
+ .removeClass( 'lazy-hidden' )
14
+ .fadeIn();
15
  } else if ( data_lazy_type == 'iframe' ) {
16
+ $el.replaceWith(
17
+ bj_lazy_load_base64_decode(
18
+ $el.attr( 'data-lazy-src' )
19
+ )
20
+ );
21
  }
22
+ }).addClass( 'data-lazy-ready' );
23
 
24
  }
25
 
js/bj-lazy-load.min.js CHANGED
@@ -1 +1 @@
1
- (function($){function bj_lazy_load_init(){$('.lazy-hidden').not('[data-lazy-ready]').one('scrollin.bj_lazy_load',{distance:200},function(){var $el=$(this),data_lazy_type=$el.attr('data-lazy-type');if(data_lazy_type=='image'){$el.attr('src',$el.attr('data-lazy-src')).removeClass('lazy-hidden')}else if(data_lazy_type=='iframe'){$el.replaceWith(bj_lazy_load_base64_decode($el.attr('data-lazy-src')))}}).attr('data-lazy-ready','true')}function bj_lazy_load_base64_decode(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,dec="",tmp_arr=[];if(!data){return data}data+='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64){tmp_arr[ac++]=String.fromCharCode(o1)}else if(h4==64){tmp_arr[ac++]=String.fromCharCode(o1,o2)}else{tmp_arr[ac++]=String.fromCharCode(o1,o2,o3)}}while(i<data.length);dec=tmp_arr.join('');return dec}$(document).bind('ready',bj_lazy_load_init)})(jQuery);
1
+ (function(a){function b(){a(".lazy-hidden").not(".data-lazy-ready").one("scrollin.bj_lazy_load",{distance:200},function(){var b=a(this),d=b.attr("data-lazy-type");if(d=="image"){b.hide().attr("src",b.attr("data-lazy-src")).removeClass("lazy-hidden").fadeIn()}else if(d=="iframe"){b.replaceWith(c(b.attr("data-lazy-src")))}}).addClass("data-lazy-ready")}function c(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var c,d,e,f,g,h,i,j,k=0,l=0,m="",n=[];if(!a){return a}a+="";do{f=b.indexOf(a.charAt(k++));g=b.indexOf(a.charAt(k++));h=b.indexOf(a.charAt(k++));i=b.indexOf(a.charAt(k++));j=f<<18|g<<12|h<<6|i;c=j>>16&255;d=j>>8&255;e=j&255;if(h==64){n[l++]=String.fromCharCode(c)}else if(i==64){n[l++]=String.fromCharCode(c,d)}else{n[l++]=String.fromCharCode(c,d,e)}}while(k<a.length);m=n.join("");return m}a(document).bind("ready",b)})(jQuery)
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: images, iframes, lazy loading, jquery, javascript, optimize, performance,
5
  Author URI: http://twitter.com/bjornjohansen
6
  Requires at least: 3.3
7
  Tested up to: 3.4.1
8
- Stable tag: 0.5.1
9
 
10
  Lazy loading makes your site load faster and saves bandwidth. Uses jQuery and degrades gracefully for non-js users. Works with both images and iframes.
11
 
@@ -56,6 +56,9 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
56
 
57
  == Changelog ==
58
 
 
 
 
59
  = Version 0.5.1 =
60
  * Lowered jQuery version dependency
61
  * New options: More granular control on what content to lazy load
@@ -116,6 +119,9 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
116
 
117
  == Upgrade Notice ==
118
 
 
 
 
119
  = 0.5.0 =
120
  Lazy load images and iframes. Complete rewrite.
121
 
5
  Author URI: http://twitter.com/bjornjohansen
6
  Requires at least: 3.3
7
  Tested up to: 3.4.1
8
+ Stable tag: 0.5.2
9
 
10
  Lazy loading makes your site load faster and saves bandwidth. Uses jQuery and degrades gracefully for non-js users. Works with both images and iframes.
11
 
56
 
57
  == Changelog ==
58
 
59
+ = Version 0.5.2 =
60
+ * Added the fadeIn effect
61
+
62
  = Version 0.5.1 =
63
  * Lowered jQuery version dependency
64
  * New options: More granular control on what content to lazy load
119
 
120
  == Upgrade Notice ==
121
 
122
+ = 0.5.2 =
123
+ Added fadeIn effect
124
+
125
  = 0.5.0 =
126
  Lazy load images and iframes. Complete rewrite.
127