Skip to content

Commit

Permalink
Merge pull request #104 from wp-media/develop
Browse files Browse the repository at this point in the history
2.3.2
  • Loading branch information
remyperona authored Sep 9, 2019
2 parents cfdc558 + b10b076 commit 091eac2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smili
Requires at least: 4.7
Tested up to: 5.2
Requires PHP: 5.6
Stable tag: 2.3.1
Stable tag: 2.3.2

Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.

Expand Down Expand Up @@ -85,6 +85,9 @@ You can also apply it manually. The element you want to apply lazyload on must h
The element must have the class `rocket-lazyload`, and a `data-bg` attribute, which value is the CSS url for the image.

== Changelog ==
= 2.3.2 =
Bugfix: Incorrect characters used in Youtube thumbnail HTML code

= 2.3.1 =
Bugfix: Prevent a conflict with WP Rocket
Bugfix: apply loading="lazy" on Youtube thumbnail
Expand Down
4 changes: 2 additions & 2 deletions rocket-lazy-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Lazy Load by WP Rocket
* Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
* Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
* Version: 2.3.1
* Version: 2.3.2
* Author: WP Rocket
* Author URI: https://wp-rocket.me
* Text Domain: rocket-lazy-load
Expand All @@ -29,7 +29,7 @@

defined('ABSPATH') || die('Cheatin\' uh?');

define('ROCKET_LL_VERSION', '2.3.1');
define('ROCKET_LL_VERSION', '2.3.2');
define('ROCKET_LL_WP_VERSION', '4.7');
define('ROCKET_LL_PHP_VERSION', '5.6');
define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
Expand Down
2 changes: 1 addition & 1 deletion src/Dependencies/RocketLazyload/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function getYoutubeThumbnailScript($args = [])
$image = '<img loading="lazy" data-lazy-src="https://i.ytimg.com/vi/ID/' . $args['resolution'] . '.jpg" alt="" width="' . $allowed_resolutions[ $args['resolution'] ]['width'] . '" height="' . $allowed_resolutions[ $args['resolution'] ]['height'] . '"><noscript><img src="https://i.ytimg.com/vi/ID/' . $args['resolution'] . '.jpg" alt="" width="' . $allowed_resolutions[ $args['resolution'] ]['width'] . '" height="' . $allowed_resolutions[ $args['resolution'] ]['height'] . '"></noscript>';
}

return "<script>function lazyLoadThumb(e){var t='{$image}',a='<div class=\"play\"></div>';return t.replace(\"ID\",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement(\"iframe\"),t=\"https://www.youtube.com/embed/ID?autoplay=1\";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute(\"src\",t.replace(\"ID\",this.dataset.id)),e.setAttribute(\"frameborder\",\"0\"),e.setAttribute(\"allowfullscreen\",\"1\"),e.setAttribute(\allow\, \accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\),this.parentNode.replaceChild(e,this)}document.addEventListener(\"DOMContentLoaded\",function(){var e,t,a=document.getElementsByClassName(\"rll-youtube-player\");for(t=0;t<a.length;t++)e=document.createElement(\"div\"),e.setAttribute(\"data-id\",a[t].dataset.id),e.setAttribute(\"data-query\", a[t].dataset.query),e.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script>";
return "<script>function lazyLoadThumb(e){var t='{$image}',a='<div class=\"play\"></div>';return t.replace(\"ID\",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement(\"iframe\"),t=\"https://www.youtube.com/embed/ID?autoplay=1\";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute(\"src\",t.replace(\"ID\",this.dataset.id)),e.setAttribute(\"frameborder\",\"0\"),e.setAttribute(\"allowfullscreen\",\"1\"),e.setAttribute(\"allow\", \"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"),this.parentNode.replaceChild(e,this)}document.addEventListener(\"DOMContentLoaded\",function(){var e,t,a=document.getElementsByClassName(\"rll-youtube-player\");for(t=0;t<a.length;t++)e=document.createElement(\"div\"),e.setAttribute(\"data-id\",a[t].dataset.id),e.setAttribute(\"data-query\", a[t].dataset.query),e.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script>";
}

/**
Expand Down

0 comments on commit 091eac2

Please sign in to comment.