BJ Lazy Load - Version 0.6.7

Version Description

Faster loading and bugfix

Download this release

Release Info

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

Code changes from version 0.6.6 to 0.6.7

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.6.6
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  License: GPL2
@@ -40,7 +40,7 @@ require_once( dirname(__FILE__) . '/scb/load.php' );
40
  if ( ! class_exists( 'BJLL' ) ) {
41
  class BJLL {
42
 
43
- const version = '0.6.6';
44
  protected $_placeholder_url;
45
  protected $_skip_classes;
46
 
@@ -105,12 +105,13 @@ if ( ! class_exists( 'BJLL' ) ) {
105
  $in_footer = false;
106
  }
107
 
108
- wp_enqueue_script( 'jquery.sonar', plugins_url( '/js/jquery.sonar.min.js', __FILE__ ), array( 'jquery' ), self::version, $in_footer );
109
 
110
  if ( defined( 'SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
 
111
  wp_enqueue_script( 'BJLL', plugins_url( '/js/bj-lazy-load.js', __FILE__ ), array( 'jquery', 'jquery.sonar' ), self::version, $in_footer );
112
  } else {
113
- wp_enqueue_script( 'BJLL', plugins_url( '/js/bj-lazy-load.min.js', __FILE__ ), array( 'jquery', 'jquery.sonar' ), self::version, $in_footer );
114
  }
115
 
116
  $bjll_options = array();
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.6.7
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  License: GPL2
40
  if ( ! class_exists( 'BJLL' ) ) {
41
  class BJLL {
42
 
43
+ const version = '0.6.7';
44
  protected $_placeholder_url;
45
  protected $_skip_classes;
46
 
105
  $in_footer = false;
106
  }
107
 
108
+
109
 
110
  if ( defined( 'SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
111
+ wp_enqueue_script( 'jquery.sonar', plugins_url( '/js/jquery.sonar.min.js', __FILE__ ), array( 'jquery' ), self::version, $in_footer );
112
  wp_enqueue_script( 'BJLL', plugins_url( '/js/bj-lazy-load.js', __FILE__ ), array( 'jquery', 'jquery.sonar' ), self::version, $in_footer );
113
  } else {
114
+ wp_enqueue_script( 'BJLL', plugins_url( '/js/combined.min.js', __FILE__ ), array( 'jquery' ), self::version, $in_footer );
115
  }
116
 
117
  $bjll_options = array();
js/bj-lazy-load.js CHANGED
@@ -103,5 +103,6 @@ var BJLL = BJLL || {};
103
  if ( BJLL.infinite_scroll == 'yes' ) {
104
  $( window ).bind( 'scroll', bj_lazy_load_init ); // using .on is more efficient, but requires jQuery 1.7
105
  }
 
106
 
107
  })(jQuery);
103
  if ( BJLL.infinite_scroll == 'yes' ) {
104
  $( window ).bind( 'scroll', bj_lazy_load_init ); // using .on is more efficient, but requires jQuery 1.7
105
  }
106
+ $(window).on("resize", function() { $(document).trigger("scroll"); });
107
 
108
  })(jQuery);
js/bj-lazy-load.min.js DELETED
@@ -1 +0,0 @@
1
- var BJLL=BJLL||{};(function(e){function t(){e(".lazy-hidden").not(".data-lazy-ready").one("scrollin.bj_lazy_load",{distance:200},function(){var t=e(this),r=t.attr("data-lazy-type");if(r=="image"){var i=t.attr("data-lazy-src");if(BJLL.load_responsive=="yes"||BJLL.load_hidpi=="yes"){var s=document.createElement("a");s.href=t.attr("data-lazy-src");if(!s.hostname.length||s.hostname==window.location.hostname){var o=parseInt(t.css("width"));if(window.devicePixelRatio>1&&BJLL.load_hidpi=="yes"){o=Math.ceil(window.devicePixelRatio*o)}i=BJLL.thumb_base+escape(t.attr("data-lazy-src"))+"&w="+o}}t.hide().attr("src",i).removeClass("lazy-hidden").fadeIn()}else if(r=="iframe"){t.replaceWith(n(t.attr("data-lazy-src")))}}).addClass("data-lazy-ready")}function n(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var n,r,i,s,o,u,a,f,l=0,c=0,h="",p=[];if(!e){return e}e+="";do{s=t.indexOf(e.charAt(l++));o=t.indexOf(e.charAt(l++));u=t.indexOf(e.charAt(l++));a=t.indexOf(e.charAt(l++));f=s<<18|o<<12|u<<6|a;n=f>>16&255;r=f>>8&255;i=f&255;if(u==64){p[c++]=String.fromCharCode(n)}else if(a==64){p[c++]=String.fromCharCode(n,r)}else{p[c++]=String.fromCharCode(n,r,i)}}while(l<e.length);h=p.join("");return h}e(document).bind("ready",t);if(BJLL.infinite_scroll=="yes"){e(window).bind("scroll",t)}})(jQuery)
 
js/combined.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(e,t,n,r){e.fn.sonar=function(t,n){if(typeof t==="boolean"){n=t;t=r}return e.sonar(this[0],t,n)};var i=n.body,s=e(t),o="scrollin",u="scrollout",a=function(e,s,o){if(e){i||(i=n.body);var u=e,a=0,f=i.offsetHeight,l=t.innerHeight||n.documentElement.clientHeight||i.clientHeight||0,c=n.documentElement.scrollTop||t.pageYOffset||i.scrollTop||0,h=e.offsetHeight||0;if(!e.sonarElemTop||e.sonarBodyHeight!==f){if(u.offsetParent){do{a+=u.offsetTop}while(u=u.offsetParent)}e.sonarElemTop=a;e.sonarBodyHeight=f}s=s===r?0:s;return!(e.sonarElemTop+(o?0:h)<c-s)&&!(e.sonarElemTop+(o?h:0)>c+l+s)}},f={},l=0,c,h=function(){c&&clearTimeout(c);c=setTimeout(function(){var t,n,r,i,s,o,l;for(r in f){n=f[r];for(o=0,l=n.length;o<l;o++){i=n[o];t=i.elem;s=a(t,i.px,i.full);if(r===u?!s:s){if(!i.tr){if(t["_"+r]){e(t).trigger(r);i.tr=1}else{n.splice(o,1);o--;l--}}}else{i.tr=0}}}},0)},p=function(e,t){e["_"+t]=0},d=function(n,r){var i=r.px,c=r.full,p=r.evt,d=t,v=a(n,i,c),m=0;n["_"+p]=1;if(p===u?!v:v){setTimeout(function(){e(n).trigger(p===u?u:o)},0);m=1}f[p].push({elem:n,px:i,full:c,tr:m});if(!l){s.bind("scroll",h);l=1}};e.sonar=a;f[o]=[];e.event.special[o]={add:function(e){var t=e.data||{},n=this;if(!n[o]){d(this,{px:t.distance,full:t.full,evt:o})}},remove:function(e){p(this,o)}};f[u]=[];e.event.special[u]={add:function(e){var t=e.data||{},n=this;if(!n[u]){d(n,{px:t.distance,full:t.full,evt:u})}},remove:function(e){p(this,u)}}})(jQuery,window,document);var BJLL=BJLL||{};(function(e){function t(){e(".lazy-hidden").not(".data-lazy-ready").one("scrollin.bj_lazy_load",{distance:200},function(){var t=e(this),r=t.attr("data-lazy-type");if(r=="image"){var i=t.attr("data-lazy-src");if(BJLL.load_responsive=="yes"||BJLL.load_hidpi=="yes"){var s=document.createElement("a");s.href=t.attr("data-lazy-src");if(!s.hostname.length||s.hostname==window.location.hostname){var o=parseInt(t.css("width"));if(window.devicePixelRatio>1&&BJLL.load_hidpi=="yes"){o=Math.ceil(window.devicePixelRatio*o)}i=BJLL.thumb_base+escape(t.attr("data-lazy-src"))+"&w="+o}}t.hide().attr("src",i).removeClass("lazy-hidden").fadeIn()}else if(r=="iframe"){t.replaceWith(n(t.attr("data-lazy-src")))}}).addClass("data-lazy-ready")}function n(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var n,r,i,s,o,u,a,f,l=0,c=0,h="",p=[];if(!e){return e}e+="";do{s=t.indexOf(e.charAt(l++));o=t.indexOf(e.charAt(l++));u=t.indexOf(e.charAt(l++));a=t.indexOf(e.charAt(l++));f=s<<18|o<<12|u<<6|a;n=f>>16&255;r=f>>8&255;i=f&255;if(u==64){p[c++]=String.fromCharCode(n)}else if(a==64){p[c++]=String.fromCharCode(n,r)}else{p[c++]=String.fromCharCode(n,r,i)}}while(l<e.length);h=p.join("");return h}e(document).bind("ready",t);if(BJLL.infinite_scroll=="yes"){e(window).bind("scroll",t)}e(window).on("resize",function(){e(document).trigger("scroll")})})(jQuery)
js/jquery.sonar.min.js DELETED
@@ -1,3 +0,0 @@
1
- (function(g,m,l,o){g.fn.sonar=function(a,b){"boolean"===typeof a&&(b=a,a=o);return g.sonar(this[0],a,b)};var k=l.body,r=g(m),j=function(a,b,f){if(a){k||(k=l.body);var c=a,d=0,e=k.offsetHeight,g=m.innerHeight||l.documentElement.clientHeight||k.clientHeight||0,h=l.documentElement.scrollTop||m.pageYOffset||k.scrollTop||0,j=a.offsetHeight||0;if(!a.sonarElemTop||a.sonarBodyHeight!==e){if(c.offsetParent){do d+=c.offsetTop;while(c=c.offsetParent)}a.sonarElemTop=d;a.sonarBodyHeight=e}b=b===o?0:b;return!(a.sonarElemTop+
2
- (f?0:j)<h-b)&&!(a.sonarElemTop+(f?j:0)>h+g+b)}},h={},p=0,n,s=function(){n&&clearTimeout(n);n=setTimeout(function(){var a,b,f,c,d,e,i;for(f in h){b=h[f];for(e=0,i=b.length;e<i;e++)if(c=b[e],a=c.elem,d=j(a,c.px,c.full),"scrollout"===f?!d:d){if(!c.tr)a["_"+f]?(g(a).trigger(f),c.tr=1):(b.splice(e,1),e--,i--)}else c.tr=0}},0)},q=function(a,b){var f=b.px,c=b.full,d=b.evt,e=j(a,f,c),i=0;a["_"+d]=1;if("scrollout"===d?!e:e)setTimeout(function(){g(a).trigger("scrollout"===d?"scrollout":"scrollin")},0),i=1;
3
- h[d].push({elem:a,px:f,full:c,tr:i});p||(r.bind("scroll",s),p=1)};g.sonar=j;h.scrollin=[];g.event.special.scrollin={add:function(a){a=a.data||{};this.scrollin||q(this,{px:a.distance,full:a.full,evt:"scrollin"})},remove:function(){this._scrollin=0}};h.scrollout=[];g.event.special.scrollout={add:function(a){a=a.data||{};this.scrollout||q(this,{px:a.distance,full:a.full,evt:"scrollout"})},remove:function(){this._scrollout=0}}})(jQuery,window,document);
 
 
 
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.5.1
8
- Stable tag: 0.6.6
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
 
@@ -59,6 +59,10 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
59
 
60
  == Changelog ==
61
 
 
 
 
 
62
  = Version 0.6.6 =
63
  * Option to disable BJ Lazy Load for MobilePress
64
 
@@ -154,6 +158,9 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
154
 
155
  == Upgrade Notice ==
156
 
 
 
 
157
  = 0.6.6 =
158
  MobilePress compatible
159
 
5
  Author URI: http://twitter.com/bjornjohansen
6
  Requires at least: 3.3
7
  Tested up to: 3.5.1
8
+ Stable tag: 0.6.7
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
 
59
 
60
  == Changelog ==
61
 
62
+ = Version 0.6.7 =
63
+ * Combined JS files for faster loading
64
+ * Bugfix for when viewport is resized (now triggering scroll event)
65
+
66
  = Version 0.6.6 =
67
  * Option to disable BJ Lazy Load for MobilePress
68
 
158
 
159
  == Upgrade Notice ==
160
 
161
+ = 0.6.7 =
162
+ Faster loading and bugfix
163
+
164
  = 0.6.6 =
165
  MobilePress compatible
166