Lazy Load by WP Rocket - Version 1.4.7

Version Description

  • Fix compatibility with infinite scroll
  • Prevent lazyload on masterSlider images
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Lazy Load by WP Rocket
Version 1.4.7
Comparing to
See all releases

Code changes from version 1.4.6 to 1.4.7

Files changed (2) hide show
  1. readme.txt +6 -2
  2. rocket-lazy-load.php +23 -5
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: creativejuiz, tabrisrp, wp_media
3
  Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar
4
  Requires at least: 3.0
5
- Tested up to: 4.8
6
  Requires PHP: 5.3
7
- Stable tag: 1.4.6
8
 
9
  The tiny Lazy Load script for WordPress without jQuery, works for images and iframes.
10
 
@@ -64,6 +64,10 @@ add_filter( 'rocket_lazyload_threshold', 'rocket_lazyload_custom_threshold' );
64
  Some plugins are not compatible without lazy loading. Please open a support thread, and we will see how we can solve the issue by excluding lazy loading for this plugin.
65
 
66
  == Changelog ==
 
 
 
 
67
  = 1.4.6 =
68
  * Correctly include version 8.5.2 of lazyload script
69
  * Prevent 404 error on lazyload script if URL contains "-v"
2
  Contributors: creativejuiz, tabrisrp, wp_media
3
  Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar
4
  Requires at least: 3.0
5
+ Tested up to: 4.9
6
  Requires PHP: 5.3
7
+ Stable tag: 1.4.7
8
 
9
  The tiny Lazy Load script for WordPress without jQuery, works for images and iframes.
10
 
64
  Some plugins are not compatible without lazy loading. Please open a support thread, and we will see how we can solve the issue by excluding lazy loading for this plugin.
65
 
66
  == Changelog ==
67
+ = 1.4.7 =
68
+ * Fix compatibility with infinite scroll
69
+ * Prevent lazyload on masterSlider images
70
+
71
  = 1.4.6 =
72
  * Correctly include version 8.5.2 of lazyload script
73
  * Prevent 404 error on lazyload script if URL contains "-v"
rocket-lazy-load.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
- * Version: 1.4.6
7
  * Author: WP Media
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
@@ -26,7 +26,7 @@
26
  */
27
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
28
 
29
- define( 'ROCKET_LL_VERSION', '1.4.6' );
30
  define( 'ROCKET_LL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . '/' );
31
  define( 'ROCKET_LL_3RD_PARTY_PATH', ROCKET_LL_PATH . '3rd-party/' );
32
  define( 'ROCKET_LL_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' );
@@ -121,8 +121,7 @@ function rocket_lazyload_script() {
121
  var b = d.getElementsByTagName("body")[0];
122
  var s = d.createElement("script"); s.async = true;
123
  var v = !("IntersectionObserver" in w) ? "8.5.2" : "10.3.5";
124
- s.src = "' . ROCKET_LL_FRONT_JS_URL . 'lazyload-v' . $suffix . '.js";
125
- s.src = s.src.replace( "lazyload-v", "lazyload-" + v );
126
  w.lazyLoadOptions = {
127
  elements_selector: "img, iframe",
128
  data_src: "lazy-src",
@@ -144,7 +143,25 @@ function rocket_lazyload_script() {
144
  }
145
  };
146
  b.appendChild(s);
147
- }(window, document));</script>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
  if ( rocket_lazyload_get_option( 'youtube' ) ) {
150
  echo <<<HTML
@@ -222,6 +239,7 @@ function rocket_lazyload_replace_callback( $matches ) {
222
  'data-no-lazy=',
223
  'data-lazy-original=',
224
  'data-lazy-src=',
 
225
  'data-lazysrc=',
226
  'data-lazyload=',
227
  'data-bgposition=',
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
+ * Version: 1.4.7
7
  * Author: WP Media
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
26
  */
27
  defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
28
 
29
+ define( 'ROCKET_LL_VERSION', '1.4.7' );
30
  define( 'ROCKET_LL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . '/' );
31
  define( 'ROCKET_LL_3RD_PARTY_PATH', ROCKET_LL_PATH . '3rd-party/' );
32
  define( 'ROCKET_LL_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' );
121
  var b = d.getElementsByTagName("body")[0];
122
  var s = d.createElement("script"); s.async = true;
123
  var v = !("IntersectionObserver" in w) ? "8.5.2" : "10.3.5";
124
+ s.src = "' . ROCKET_LL_FRONT_JS_URL . 'lazyload-" + v + "' . $suffix . '.js";
 
125
  w.lazyLoadOptions = {
126
  elements_selector: "img, iframe",
127
  data_src: "lazy-src",
143
  }
144
  };
145
  b.appendChild(s);
146
+ }(window, document));
147
+
148
+ // Listen to the Initialized event
149
+ window.addEventListener(\'LazyLoad::Initialized\', function (e) {
150
+ // Get the instance and puts it in the lazyLoadInstance variable
151
+ var lazyLoadInstance = e.detail.instance;
152
+
153
+ var observer = new MutationObserver(function(mutations) {
154
+ mutations.forEach(function(mutation) {
155
+ lazyLoadInstance.update();
156
+ } );
157
+ } );
158
+
159
+ var b = document.getElementsByTagName("body")[0];
160
+ var config = { childList: true, subtree: true };
161
+
162
+ observer.observe(b, config);
163
+ }, false);
164
+ </script>';
165
 
166
  if ( rocket_lazyload_get_option( 'youtube' ) ) {
167
  echo <<<HTML
239
  'data-no-lazy=',
240
  'data-lazy-original=',
241
  'data-lazy-src=',
242
+ 'data-src=',
243
  'data-lazysrc=',
244
  'data-lazyload=',
245
  'data-bgposition=',