Version Description
- Bugfix: Prevent matching with the wrong data when a data-style attribute is on a div for background images
- Remove data-cfasync="false" by default
- Enhancement: Add filter rocket_lazyload_script_tag to modify the lazyload script HTML if needed
- Enhancement: Add data-no-minify attribute to the lazyload script tag to prevent it from being combined by JS combiners
- Enhancement: Improve MutationObserver code to only call the lazyload update method if an image/iframe or element with .rocket-lazyload is contained in the new node(s) added to the DOM
Download this release
Release Info
| Developer | wp_media |
| Plugin | |
| Version | 2.1.5 |
| Comparing to | |
| See all releases | |
Code changes from version 2.1.4 to 2.1.5
composer.lock
CHANGED
|
@@ -273,16 +273,16 @@
|
|
| 273 |
},
|
| 274 |
{
|
| 275 |
"name": "wp-media/rocket-lazyload-common",
|
| 276 |
-
"version": "v2.2.
|
| 277 |
"source": {
|
| 278 |
"type": "git",
|
| 279 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
| 280 |
-
"reference": "
|
| 281 |
},
|
| 282 |
"dist": {
|
| 283 |
"type": "zip",
|
| 284 |
-
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/
|
| 285 |
-
"reference": "
|
| 286 |
"shasum": ""
|
| 287 |
},
|
| 288 |
"require": {
|
|
@@ -317,7 +317,7 @@
|
|
| 317 |
}
|
| 318 |
],
|
| 319 |
"description": "Common Code between WP Rocket and Lazyload by WP Rocket",
|
| 320 |
-
"time": "2019-03-
|
| 321 |
}
|
| 322 |
],
|
| 323 |
"packages-dev": [
|
|
@@ -364,16 +364,16 @@
|
|
| 364 |
},
|
| 365 |
{
|
| 366 |
"name": "brain/monkey",
|
| 367 |
-
"version": "2.2.
|
| 368 |
"source": {
|
| 369 |
"type": "git",
|
| 370 |
"url": "https://github.com/Brain-WP/BrainMonkey.git",
|
| 371 |
-
"reference": "
|
| 372 |
},
|
| 373 |
"dist": {
|
| 374 |
"type": "zip",
|
| 375 |
-
"url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/
|
| 376 |
-
"reference": "
|
| 377 |
"shasum": ""
|
| 378 |
},
|
| 379 |
"require": {
|
|
@@ -424,7 +424,7 @@
|
|
| 424 |
"test",
|
| 425 |
"testing"
|
| 426 |
],
|
| 427 |
-
"time": "
|
| 428 |
},
|
| 429 |
{
|
| 430 |
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
|
@@ -494,27 +494,29 @@
|
|
| 494 |
},
|
| 495 |
{
|
| 496 |
"name": "doctrine/instantiator",
|
| 497 |
-
"version": "1.
|
| 498 |
"source": {
|
| 499 |
"type": "git",
|
| 500 |
"url": "https://github.com/doctrine/instantiator.git",
|
| 501 |
-
"reference": "
|
| 502 |
},
|
| 503 |
"dist": {
|
| 504 |
"type": "zip",
|
| 505 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/
|
| 506 |
-
"reference": "
|
| 507 |
"shasum": ""
|
| 508 |
},
|
| 509 |
"require": {
|
| 510 |
"php": "^7.1"
|
| 511 |
},
|
| 512 |
"require-dev": {
|
| 513 |
-
"
|
| 514 |
"ext-pdo": "*",
|
| 515 |
"ext-phar": "*",
|
| 516 |
-
"
|
| 517 |
-
"
|
|
|
|
|
|
|
| 518 |
},
|
| 519 |
"type": "library",
|
| 520 |
"extra": {
|
|
@@ -539,12 +541,12 @@
|
|
| 539 |
}
|
| 540 |
],
|
| 541 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
| 542 |
-
"homepage": "https://
|
| 543 |
"keywords": [
|
| 544 |
"constructor",
|
| 545 |
"instantiate"
|
| 546 |
],
|
| 547 |
-
"time": "
|
| 548 |
},
|
| 549 |
{
|
| 550 |
"name": "hamcrest/hamcrest-php",
|
|
@@ -1986,16 +1988,16 @@
|
|
| 1986 |
},
|
| 1987 |
{
|
| 1988 |
"name": "squizlabs/php_codesniffer",
|
| 1989 |
-
"version": "3.4.
|
| 1990 |
"source": {
|
| 1991 |
"type": "git",
|
| 1992 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
| 1993 |
-
"reference": "
|
| 1994 |
},
|
| 1995 |
"dist": {
|
| 1996 |
"type": "zip",
|
| 1997 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
| 1998 |
-
"reference": "
|
| 1999 |
"shasum": ""
|
| 2000 |
},
|
| 2001 |
"require": {
|
|
@@ -2028,25 +2030,25 @@
|
|
| 2028 |
}
|
| 2029 |
],
|
| 2030 |
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
| 2031 |
-
"homepage": "
|
| 2032 |
"keywords": [
|
| 2033 |
"phpcs",
|
| 2034 |
"standards"
|
| 2035 |
],
|
| 2036 |
-
"time": "
|
| 2037 |
},
|
| 2038 |
{
|
| 2039 |
"name": "symfony/polyfill-ctype",
|
| 2040 |
-
"version": "v1.
|
| 2041 |
"source": {
|
| 2042 |
"type": "git",
|
| 2043 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
| 2044 |
-
"reference": "
|
| 2045 |
},
|
| 2046 |
"dist": {
|
| 2047 |
"type": "zip",
|
| 2048 |
-
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/
|
| 2049 |
-
"reference": "
|
| 2050 |
"shasum": ""
|
| 2051 |
},
|
| 2052 |
"require": {
|
|
@@ -2058,7 +2060,7 @@
|
|
| 2058 |
"type": "library",
|
| 2059 |
"extra": {
|
| 2060 |
"branch-alias": {
|
| 2061 |
-
"dev-master": "1.
|
| 2062 |
}
|
| 2063 |
},
|
| 2064 |
"autoload": {
|
|
@@ -2091,7 +2093,7 @@
|
|
| 2091 |
"polyfill",
|
| 2092 |
"portable"
|
| 2093 |
],
|
| 2094 |
-
"time": "
|
| 2095 |
},
|
| 2096 |
{
|
| 2097 |
"name": "symfony/yaml",
|
| 273 |
},
|
| 274 |
{
|
| 275 |
"name": "wp-media/rocket-lazyload-common",
|
| 276 |
+
"version": "v2.2.8",
|
| 277 |
"source": {
|
| 278 |
"type": "git",
|
| 279 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
| 280 |
+
"reference": "d42f4f59227dfe6bd1e5075b44679e12507cfa4a"
|
| 281 |
},
|
| 282 |
"dist": {
|
| 283 |
"type": "zip",
|
| 284 |
+
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/d42f4f59227dfe6bd1e5075b44679e12507cfa4a",
|
| 285 |
+
"reference": "d42f4f59227dfe6bd1e5075b44679e12507cfa4a",
|
| 286 |
"shasum": ""
|
| 287 |
},
|
| 288 |
"require": {
|
| 317 |
}
|
| 318 |
],
|
| 319 |
"description": "Common Code between WP Rocket and Lazyload by WP Rocket",
|
| 320 |
+
"time": "2019-03-30T12:54:54+00:00"
|
| 321 |
}
|
| 322 |
],
|
| 323 |
"packages-dev": [
|
| 364 |
},
|
| 365 |
{
|
| 366 |
"name": "brain/monkey",
|
| 367 |
+
"version": "2.2.1",
|
| 368 |
"source": {
|
| 369 |
"type": "git",
|
| 370 |
"url": "https://github.com/Brain-WP/BrainMonkey.git",
|
| 371 |
+
"reference": "326a537bf518edd61bc57ab275e8b075ebb8a1a9"
|
| 372 |
},
|
| 373 |
"dist": {
|
| 374 |
"type": "zip",
|
| 375 |
+
"url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/326a537bf518edd61bc57ab275e8b075ebb8a1a9",
|
| 376 |
+
"reference": "326a537bf518edd61bc57ab275e8b075ebb8a1a9",
|
| 377 |
"shasum": ""
|
| 378 |
},
|
| 379 |
"require": {
|
| 424 |
"test",
|
| 425 |
"testing"
|
| 426 |
],
|
| 427 |
+
"time": "2019-03-15T13:42:24+00:00"
|
| 428 |
},
|
| 429 |
{
|
| 430 |
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
| 494 |
},
|
| 495 |
{
|
| 496 |
"name": "doctrine/instantiator",
|
| 497 |
+
"version": "1.2.0",
|
| 498 |
"source": {
|
| 499 |
"type": "git",
|
| 500 |
"url": "https://github.com/doctrine/instantiator.git",
|
| 501 |
+
"reference": "a2c590166b2133a4633738648b6b064edae0814a"
|
| 502 |
},
|
| 503 |
"dist": {
|
| 504 |
"type": "zip",
|
| 505 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
|
| 506 |
+
"reference": "a2c590166b2133a4633738648b6b064edae0814a",
|
| 507 |
"shasum": ""
|
| 508 |
},
|
| 509 |
"require": {
|
| 510 |
"php": "^7.1"
|
| 511 |
},
|
| 512 |
"require-dev": {
|
| 513 |
+
"doctrine/coding-standard": "^6.0",
|
| 514 |
"ext-pdo": "*",
|
| 515 |
"ext-phar": "*",
|
| 516 |
+
"phpbench/phpbench": "^0.13",
|
| 517 |
+
"phpstan/phpstan-phpunit": "^0.11",
|
| 518 |
+
"phpstan/phpstan-shim": "^0.11",
|
| 519 |
+
"phpunit/phpunit": "^7.0"
|
| 520 |
},
|
| 521 |
"type": "library",
|
| 522 |
"extra": {
|
| 541 |
}
|
| 542 |
],
|
| 543 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
| 544 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
| 545 |
"keywords": [
|
| 546 |
"constructor",
|
| 547 |
"instantiate"
|
| 548 |
],
|
| 549 |
+
"time": "2019-03-17T17:37:11+00:00"
|
| 550 |
},
|
| 551 |
{
|
| 552 |
"name": "hamcrest/hamcrest-php",
|
| 1988 |
},
|
| 1989 |
{
|
| 1990 |
"name": "squizlabs/php_codesniffer",
|
| 1991 |
+
"version": "3.4.1",
|
| 1992 |
"source": {
|
| 1993 |
"type": "git",
|
| 1994 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
| 1995 |
+
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa"
|
| 1996 |
},
|
| 1997 |
"dist": {
|
| 1998 |
"type": "zip",
|
| 1999 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa",
|
| 2000 |
+
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa",
|
| 2001 |
"shasum": ""
|
| 2002 |
},
|
| 2003 |
"require": {
|
| 2030 |
}
|
| 2031 |
],
|
| 2032 |
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
| 2033 |
+
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
| 2034 |
"keywords": [
|
| 2035 |
"phpcs",
|
| 2036 |
"standards"
|
| 2037 |
],
|
| 2038 |
+
"time": "2019-03-19T03:22:27+00:00"
|
| 2039 |
},
|
| 2040 |
{
|
| 2041 |
"name": "symfony/polyfill-ctype",
|
| 2042 |
+
"version": "v1.11.0",
|
| 2043 |
"source": {
|
| 2044 |
"type": "git",
|
| 2045 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
| 2046 |
+
"reference": "82ebae02209c21113908c229e9883c419720738a"
|
| 2047 |
},
|
| 2048 |
"dist": {
|
| 2049 |
"type": "zip",
|
| 2050 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
|
| 2051 |
+
"reference": "82ebae02209c21113908c229e9883c419720738a",
|
| 2052 |
"shasum": ""
|
| 2053 |
},
|
| 2054 |
"require": {
|
| 2060 |
"type": "library",
|
| 2061 |
"extra": {
|
| 2062 |
"branch-alias": {
|
| 2063 |
+
"dev-master": "1.11-dev"
|
| 2064 |
}
|
| 2065 |
},
|
| 2066 |
"autoload": {
|
| 2093 |
"polyfill",
|
| 2094 |
"portable"
|
| 2095 |
],
|
| 2096 |
+
"time": "2019-02-06T07:57:58+00:00"
|
| 2097 |
},
|
| 2098 |
{
|
| 2099 |
"name": "symfony/yaml",
|
readme.txt
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
Contributors: wp_rocket, wp_media
|
| 3 |
Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
|
| 4 |
Requires at least: 4.7
|
| 5 |
-
Tested up to: 5.
|
| 6 |
Requires PHP: 5.4
|
| 7 |
-
Stable tag: 2.1.
|
| 8 |
|
| 9 |
Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
|
| 10 |
|
|
@@ -85,6 +85,13 @@ You can also apply it manually. The element you want to apply lazyload on must h
|
|
| 85 |
The element must have the class `rocket-lazyload`, and a `data-bg` attribute, which value is the CSS url for the image.
|
| 86 |
|
| 87 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
= 2.1.4 =
|
| 89 |
* Regression fix: Correctly exclude scripts from lazyload again
|
| 90 |
|
| 2 |
Contributors: wp_rocket, wp_media
|
| 3 |
Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
|
| 4 |
Requires at least: 4.7
|
| 5 |
+
Tested up to: 5.2
|
| 6 |
Requires PHP: 5.4
|
| 7 |
+
Stable tag: 2.1.5
|
| 8 |
|
| 9 |
Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
|
| 10 |
|
| 85 |
The element must have the class `rocket-lazyload`, and a `data-bg` attribute, which value is the CSS url for the image.
|
| 86 |
|
| 87 |
== Changelog ==
|
| 88 |
+
= 2.1.5 =
|
| 89 |
+
* Bugfix: Prevent matching with the wrong data when a data-style attribute is on a div for background images
|
| 90 |
+
* Remove data-cfasync="false" by default
|
| 91 |
+
* Enhancement: Add filter rocket_lazyload_script_tag to modify the lazyload script HTML if needed
|
| 92 |
+
* Enhancement: Add data-no-minify attribute to the lazyload script tag to prevent it from being combined by JS combiners
|
| 93 |
+
* Enhancement: Improve MutationObserver code to only call the lazyload update method if an image/iframe or element with .rocket-lazyload is contained in the new node(s) added to the DOM
|
| 94 |
+
|
| 95 |
= 2.1.4 =
|
| 96 |
* Regression fix: Correctly exclude scripts from lazyload again
|
| 97 |
|
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: 2.1.
|
| 7 |
* Author: WP Rocket
|
| 8 |
* Author URI: https://wp-rocket.me
|
| 9 |
* Text Domain: rocket-lazy-load
|
|
@@ -29,7 +29,7 @@
|
|
| 29 |
|
| 30 |
defined('ABSPATH') || die('Cheatin\' uh?');
|
| 31 |
|
| 32 |
-
define('ROCKET_LL_VERSION', '2.1.
|
| 33 |
define('ROCKET_LL_WP_VERSION', '4.7');
|
| 34 |
define('ROCKET_LL_PHP_VERSION', '5.4');
|
| 35 |
define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
|
| 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: 2.1.5
|
| 7 |
* Author: WP Rocket
|
| 8 |
* Author URI: https://wp-rocket.me
|
| 9 |
* Text Domain: rocket-lazy-load
|
| 29 |
|
| 30 |
defined('ABSPATH') || die('Cheatin\' uh?');
|
| 31 |
|
| 32 |
+
define('ROCKET_LL_VERSION', '2.1.5');
|
| 33 |
define('ROCKET_LL_WP_VERSION', '4.7');
|
| 34 |
define('ROCKET_LL_PHP_VERSION', '5.4');
|
| 35 |
define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
|
vendor/composer/installed.json
CHANGED
|
@@ -274,17 +274,17 @@
|
|
| 274 |
},
|
| 275 |
{
|
| 276 |
"name": "wp-media/rocket-lazyload-common",
|
| 277 |
-
"version": "v2.2.
|
| 278 |
-
"version_normalized": "2.2.
|
| 279 |
"source": {
|
| 280 |
"type": "git",
|
| 281 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
| 282 |
-
"reference": "
|
| 283 |
},
|
| 284 |
"dist": {
|
| 285 |
"type": "zip",
|
| 286 |
-
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/
|
| 287 |
-
"reference": "
|
| 288 |
"shasum": ""
|
| 289 |
},
|
| 290 |
"require": {
|
|
@@ -302,7 +302,7 @@
|
|
| 302 |
"symfony/yaml": "2.8.*",
|
| 303 |
"wp-coding-standards/wpcs": "^2.0.0"
|
| 304 |
},
|
| 305 |
-
"time": "2019-03-
|
| 306 |
"type": "library",
|
| 307 |
"installation-source": "dist",
|
| 308 |
"autoload": {
|
| 274 |
},
|
| 275 |
{
|
| 276 |
"name": "wp-media/rocket-lazyload-common",
|
| 277 |
+
"version": "v2.2.8",
|
| 278 |
+
"version_normalized": "2.2.8.0",
|
| 279 |
"source": {
|
| 280 |
"type": "git",
|
| 281 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
| 282 |
+
"reference": "d42f4f59227dfe6bd1e5075b44679e12507cfa4a"
|
| 283 |
},
|
| 284 |
"dist": {
|
| 285 |
"type": "zip",
|
| 286 |
+
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/d42f4f59227dfe6bd1e5075b44679e12507cfa4a",
|
| 287 |
+
"reference": "d42f4f59227dfe6bd1e5075b44679e12507cfa4a",
|
| 288 |
"shasum": ""
|
| 289 |
},
|
| 290 |
"require": {
|
| 302 |
"symfony/yaml": "2.8.*",
|
| 303 |
"wp-coding-standards/wpcs": "^2.0.0"
|
| 304 |
},
|
| 305 |
+
"time": "2019-03-30T12:54:54+00:00",
|
| 306 |
"type": "library",
|
| 307 |
"installation-source": "dist",
|
| 308 |
"autoload": {
|
vendor/wp-media/rocket-lazyload-common/phpcs.xml
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<ruleset name="Rocket Lazyload">
|
| 3 |
-
<description>Rocket Lazyload Coding Standards</description>
|
| 4 |
-
|
| 5 |
-
<config name="testVersion" value="5.4-" />
|
| 6 |
-
<rule ref="PHPCompatibilityWP">
|
| 7 |
-
<include-pattern>*\.php$</include-pattern>
|
| 8 |
-
</rule>
|
| 9 |
-
<rule ref="PSR2">
|
| 10 |
-
<exclude name="Generic.Files.LineLength.TooLong" />
|
| 11 |
-
</rule>
|
| 12 |
-
<rule ref="WordPress">
|
| 13 |
-
<exclude name="WordPress.Files.FileName" />
|
| 14 |
-
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
|
| 15 |
-
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing" />
|
| 16 |
-
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
|
| 17 |
-
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing" />
|
| 18 |
-
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
|
| 19 |
-
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
|
| 20 |
-
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
|
| 21 |
-
<exclude name="PEAR.Functions.FunctionCallSignature" />
|
| 22 |
-
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" />
|
| 23 |
-
</rule>
|
| 24 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/wp-media/rocket-lazyload-common/src/Assets.php
CHANGED
|
@@ -81,7 +81,21 @@ class Assets
|
|
| 81 |
if (window.MutationObserver) {
|
| 82 |
var observer = new MutationObserver(function(mutations) {
|
| 83 |
mutations.forEach(function(mutation) {
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
} );
|
| 86 |
} );
|
| 87 |
|
|
@@ -91,8 +105,16 @@ class Assets
|
|
| 91 |
observer.observe(b, config);
|
| 92 |
}
|
| 93 |
}, false);
|
| 94 |
-
</script>
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
return $script;
|
| 98 |
}
|
| 81 |
if (window.MutationObserver) {
|
| 82 |
var observer = new MutationObserver(function(mutations) {
|
| 83 |
mutations.forEach(function(mutation) {
|
| 84 |
+
mutation.addedNodes.forEach(function(node) {
|
| 85 |
+
if (typeof node.getElementsByTagName !== \'function\') {
|
| 86 |
+
return;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
imgs = node.getElementsByTagName(\'img\');
|
| 90 |
+
iframes = node.getElementsByTagName(\'iframe\');
|
| 91 |
+
rocket_lazy = node.getElementsByClassName(\'rocket-lazyload\');
|
| 92 |
+
|
| 93 |
+
if ( 0 === imgs.length && 0 === iframes.length && 0 === rocket_lazy.length ) {
|
| 94 |
+
return;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
lazyLoadInstance.update();
|
| 98 |
+
} );
|
| 99 |
} );
|
| 100 |
} );
|
| 101 |
|
| 105 |
observer.observe(b, config);
|
| 106 |
}
|
| 107 |
}, false);
|
| 108 |
+
</script>';
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Filters the script tag for the lazyload script
|
| 112 |
+
*
|
| 113 |
+
* @since 2.2.6
|
| 114 |
+
*
|
| 115 |
+
* @param $script_tag HTML tag for the lazyload script.
|
| 116 |
+
*/
|
| 117 |
+
$script .= apply_filters('rocket_lazyload_script_tag', '<script data-no-minify="1" async src="' . $args['base_url'] . $args['version'] . '/lazyload' . $min . '.js"></script>');
|
| 118 |
|
| 119 |
return $script;
|
| 120 |
}
|
vendor/wp-media/rocket-lazyload-common/src/Image.php
CHANGED
|
@@ -59,7 +59,7 @@ class Image
|
|
| 59 |
*/
|
| 60 |
public function lazyloadBackgroundImages($html, $buffer)
|
| 61 |
{
|
| 62 |
-
if (! preg_match_all('#<div\s+(?<before>[^>]
|
| 63 |
return $html;
|
| 64 |
}
|
| 65 |
|
|
@@ -71,7 +71,7 @@ class Image
|
|
| 71 |
if (! preg_match('#background-image\s*:\s*(?<attr>\s*url\s*\((?<url>[^)]+)\))\s*;?#is', $element['styles'], $url)) {
|
| 72 |
continue;
|
| 73 |
}
|
| 74 |
-
|
| 75 |
$url['url'] = trim($url['url'], '\'" ');
|
| 76 |
|
| 77 |
if ($this->isExcluded($url['url'], $this->getExcludedSrc())) {
|
|
@@ -116,7 +116,7 @@ class Image
|
|
| 116 |
*/
|
| 117 |
public function lazyloadPictures($html, $buffer)
|
| 118 |
{
|
| 119 |
-
if (! preg_match_all('#<picture(?:.*)?>(?<sources>.*)</picture>#iUs', $buffer, $pictures, PREG_SET_ORDER)
|
| 120 |
return $html;
|
| 121 |
}
|
| 122 |
|
| 59 |
*/
|
| 60 |
public function lazyloadBackgroundImages($html, $buffer)
|
| 61 |
{
|
| 62 |
+
if (! preg_match_all('#<div\s+(?<before>[^>]+[\'"\s])?style\s*=\s*([\'"])(?<styles>.*?)\2(?<after>[^>]*)>#is', $buffer, $elements, PREG_SET_ORDER)) {
|
| 63 |
return $html;
|
| 64 |
}
|
| 65 |
|
| 71 |
if (! preg_match('#background-image\s*:\s*(?<attr>\s*url\s*\((?<url>[^)]+)\))\s*;?#is', $element['styles'], $url)) {
|
| 72 |
continue;
|
| 73 |
}
|
| 74 |
+
|
| 75 |
$url['url'] = trim($url['url'], '\'" ');
|
| 76 |
|
| 77 |
if ($this->isExcluded($url['url'], $this->getExcludedSrc())) {
|
| 116 |
*/
|
| 117 |
public function lazyloadPictures($html, $buffer)
|
| 118 |
{
|
| 119 |
+
if (! preg_match_all('#<picture(?:.*)?>(?<sources>.*)</picture>#iUs', $buffer, $pictures, PREG_SET_ORDER)) {
|
| 120 |
return $html;
|
| 121 |
}
|
| 122 |
|
