Featured Image From URL - Version 2.3.7

Version Description

  • Improvement: Lazy Load feature will show an animated spinner while image is loading.
Download this release

Release Info

Developer marceljm
Plugin Icon 128x128 Featured Image From URL
Version 2.3.7
Comparing to
See all releases

Code changes from version 2.3.6 to 2.3.7

admin/html/css/menu.css CHANGED
@@ -67,3 +67,24 @@ th {
67
  border: 1px dashed red;
68
  border-radius: 1px;
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  border: 1px dashed red;
68
  border-radius: 1px;
69
  }
70
+
71
+ /* table */
72
+
73
+ #thumbnail-size {
74
+ border-collapse: collapse;
75
+ width: 100%;
76
+ }
77
+
78
+ #thumbnail-size td, #thumbnail-size th {
79
+ border: 1px solid #ddd;
80
+ padding: 8px;
81
+ }
82
+
83
+ #thumbnail-size tr:nth-child(even){background-color: #f2f2f2;}
84
+
85
+ #thumbnail-size th {
86
+ padding-top: 6px;
87
+ padding-bottom: 6px;
88
+ background-color: #23282d;
89
+ color: white;
90
+ }
admin/html/js/menu.js CHANGED
@@ -23,7 +23,7 @@ jQuery(function () {
23
  });
24
  });
25
 
26
- jQuery("#accordion").accordion();
27
  jQuery("#accordionClean").accordion();
28
  jQuery("#tabs").tabs();
29
  jQuery("#tabs-top").tabs();
23
  });
24
  });
25
 
26
+ jQuery("#tabs-flickr").tabs();
27
  jQuery("#accordionClean").accordion();
28
  jQuery("#tabs").tabs();
29
  jQuery("#tabs-top").tabs();
admin/html/menu.html CHANGED
@@ -227,7 +227,7 @@
227
  <div id="tabs-b">
228
  <div class="box">
229
 
230
- <h2>Auto Set Featured Image: configuration</h2>
231
  <div class="greybox">
232
  Perfect for external posts, this option allows to use the first image from a post/page/product content as featured image. It will happen when you click on Publish/Update button.
233
  </div>
@@ -317,7 +317,7 @@
317
 
318
  </div>
319
  <div class="box">
320
- <h2>Auto Set Featured Image: apply to all</h2>
321
  <div class="greybox" id="grad2">
322
  <b>Premium feature</b><br><br>
323
  Enable that to update all your posts/pages/products applying the configuration above.
@@ -1551,34 +1551,162 @@
1551
  </div>
1552
 
1553
  <div class="box">
1554
- <h2>External Thumbnails (<a href="https://www.flickr.com/">Flickr</a> Integration): Your Website Faster Than Ever</h2>
1555
  <div class="greybox" id="grad2">
1556
  <b>Premium feature</b><br><br>
1557
- <div id="accordion">
1558
- <h3>&nbsp;&nbsp;&nbsp;Do you know Flickr?</h3>
1559
- <div>
1560
- - It's free;<br>
1561
- - Offers 1000 GB of space;<br>
1562
- - It's dedicated to store and provide images, probably faster than the most of servers;<br>
1563
- - Creates automatic copies of your images in <b>many different sizes.</b>
1564
- </div>
1565
-
1566
- <h3>&nbsp;&nbsp;&nbsp;How does Featured Image from URL take advantage of Flickr?</h3>
1567
- <div>
1568
- Smaller the images, faster your site. So the plugin will load the images from Flickr in the exactly size your site needs. And the result is...<br><br>
1569
- <b>The images will be shown with the best quality and the shortest time possible.</b>
1570
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1571
  </div>
1572
-
1573
- </br>
1574
- <h3>Getting Flickr URL</h3>
1575
- <div>
1576
- You just need to get one URL (Square 75). Use that to fill the External Featured Image field of your post, page or product. The plugin will handle this URL to provide the image in different sizes.<br><br>
1577
- <img src="https://c1.staticflickr.com/1/745/31593837206_8e081be749_z_d.jpg" style="width:100%"/>
1578
- <br><br>
1579
- <img src="https://c1.staticflickr.com/1/223/30820834393_f869fcff49_z_d.jpg" style="width:100%"/>
1580
- </div>
1581
- </div>
1582
  </div>
1583
  </div>
1584
  <div id="tabs-q">
227
  <div id="tabs-b">
228
  <div class="box">
229
 
230
+ <h2>Configuration</h2>
231
  <div class="greybox">
232
  Perfect for external posts, this option allows to use the first image from a post/page/product content as featured image. It will happen when you click on Publish/Update button.
233
  </div>
317
 
318
  </div>
319
  <div class="box">
320
+ <h2>Apply to all</h2>
321
  <div class="greybox" id="grad2">
322
  <b>Premium feature</b><br><br>
323
  Enable that to update all your posts/pages/products applying the configuration above.
1551
  </div>
1552
 
1553
  <div class="box">
1554
+ <h2><a href="https://www.flickr.com/">Flickr</a> External Thumbnails</h2>
1555
  <div class="greybox" id="grad2">
1556
  <b>Premium feature</b><br><br>
1557
+ <div id="tabs-flickr">
1558
+ <ul>
1559
+ <li><a href="#tabs-flickr-d">Thumbnails Sizes</a></li>
1560
+ <li><a href="#tabs-flickr-a">Do you know Flickr?</a></li>
1561
+ <li><a href="#tabs-flickr-b">How does FIFU take advantage of Flickr?</a></li>
1562
+ <li><a href="#tabs-flickr-c">Getting Flickr URL</a></li>
1563
+
1564
+ <div id="tabs-flickr-a">
1565
+ <br><br><br>
1566
+ - It's free;<br>
1567
+ - Offers 1000 GB of space;<br>
1568
+ - It's dedicated to store and provide images, probably faster than the most of servers;<br>
1569
+ - Creates automatic copies of your images in <b>many different sizes.</b>
1570
+ </div>
1571
+ <div id="tabs-flickr-b">
1572
+ <br><br><br>
1573
+ Smaller the images, faster your site. So the plugin will load the images from Flickr in the exactly size your site needs. And the result is...<br><br>
1574
+ The images will be shown with the <b>best quality</b> and the <b>shortest time possible</b>.
1575
+ </div>
1576
+ <div id="tabs-flickr-c">
1577
+ <br><br><br>
1578
+ You just need to get one URL (Square 75, for example). Use that to fill the Featured Image from URL field of your post, page or product. The plugin will handle this URL to provide the image in different sizes.<br><br>
1579
+ <img src="https://c1.staticflickr.com/1/745/31593837206_8e081be749_z_d.jpg" style="width:100%"/>
1580
+ <br><br>
1581
+ <img src="https://c1.staticflickr.com/1/223/30820834393_f869fcff49_z_d.jpg" style="width:100%"/>
1582
+ </div>
1583
+ <div id="tabs-flickr-d">
1584
+ <br><br><br>
1585
+ You don't need to change anything here to make the images appear. However, some themes can't calculate the sufficient size that an image should have in each place, which is a waste. So if in a post, for example, a 1600px wide image is being loaded in an area that you know that is never larger than 750px wide, you could disable the options 1024 and 1600, which will make your site much faster without losing quality.
1586
+ <br><br>
1587
+ <table id="thumbnail-size">
1588
+ <tr>
1589
+ <th>width</th>
1590
+ <th>75</th>
1591
+ <th>100</th>
1592
+ <th>150</th>
1593
+ <th>240</th>
1594
+ <th>320</th>
1595
+ <th>500</th>
1596
+ <th>640</th>
1597
+ <th>800</th>
1598
+ <th>1024</th>
1599
+ <th>1600</th>
1600
+ </tr>
1601
+ <tr>
1602
+ <td><center>post</center></td>
1603
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-75"></center></td>
1604
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-100"></center></td>
1605
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-150"></center></td>
1606
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-240"></center></td>
1607
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-320"></center></td>
1608
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-500"></center></td>
1609
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-640"></center></td>
1610
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-800"></center></td>
1611
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-1024"></center></td>
1612
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-post-1600"></center></td>
1613
+ </tr>
1614
+ <tr>
1615
+ <td><center>page</center></td>
1616
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-75"></center></td>
1617
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-100"></center></td>
1618
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-150"></center></td>
1619
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-240"></center></td>
1620
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-320"></center></td>
1621
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-500"></center></td>
1622
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-640"></center></td>
1623
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-800"></center></td>
1624
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-1024"></center></td>
1625
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-page-1600"></center></td>
1626
+ </tr>
1627
+ <tr>
1628
+ <td><center>archive</center></td>
1629
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-75"></center></td>
1630
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-100"></center></td>
1631
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-150"></center></td>
1632
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-240"></center></td>
1633
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-320"></center></td>
1634
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-500"></center></td>
1635
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-640"></center></td>
1636
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-800"></center></td>
1637
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-1024"></center></td>
1638
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-arch-1600"></center></td>
1639
+ </tr>
1640
+ <tr>
1641
+ <td><center>cart</center></td>
1642
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-75"></center></td>
1643
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-100"></center></td>
1644
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-150"></center></td>
1645
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-240"></center></td>
1646
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-320"></center></td>
1647
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-500"></center></td>
1648
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-640"></center></td>
1649
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-800"></center></td>
1650
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-1024"></center></td>
1651
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-cart-1600"></center></td>
1652
+ </tr>
1653
+ <tr>
1654
+ <td><center>category</center></td>
1655
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-75"></center></td>
1656
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-100"></center></td>
1657
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-150"></center></td>
1658
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-240"></center></td>
1659
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-320"></center></td>
1660
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-500"></center></td>
1661
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-640"></center></td>
1662
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-800"></center></td>
1663
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-1024"></center></td>
1664
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-ctgr-1600"></center></td>
1665
+ </tr>
1666
+ <tr>
1667
+ <td><center>home</center></td>
1668
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-75"></center></td>
1669
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-100"></center></td>
1670
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-150"></center></td>
1671
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-240"></center></td>
1672
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-320"></center></td>
1673
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-500"></center></td>
1674
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-640"></center></td>
1675
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-800"></center></td>
1676
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-1024"></center></td>
1677
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-home-1600"></center></td>
1678
+ </tr>
1679
+ <tr>
1680
+ <td><center>product</center></td>
1681
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-75"></center></td>
1682
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-100"></center></td>
1683
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-150"></center></td>
1684
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-240"></center></td>
1685
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-320"></center></td>
1686
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-500"></center></td>
1687
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-640"></center></td>
1688
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-800"></center></td>
1689
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-1024"></center></td>
1690
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-prod-1600"></center></td>
1691
+ </tr>
1692
+ <tr>
1693
+ <td><center>shop</center></td>
1694
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-75"></center></td>
1695
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-100"></center></td>
1696
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-150"></center></td>
1697
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-240"></center></td>
1698
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-320"></center></td>
1699
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-500"></center></td>
1700
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-640"></center></td>
1701
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-800"></center></td>
1702
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-1024"></center></td>
1703
+ <td><center><input type="checkbox" onclick="javascript:void(0)" id="cb-shop-1600"></center></td>
1704
+ </tr>
1705
+ </table>
1706
+ </div>
1707
+ </ul>
1708
  </div>
1709
+ </div>
 
 
 
 
 
 
 
 
 
1710
  </div>
1711
  </div>
1712
  <div id="tabs-q">
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
- * Version: 2.3.6
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
+ * Version: 2.3.7
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/html/js/image.js CHANGED
@@ -1,12 +1,26 @@
1
  jQuery(document).ready(function ($) {
 
 
 
 
 
 
 
2
  disableClick($);
3
- //for all images at single product page
 
4
  setTimeout(function () {
5
  resizeImg($);
6
  jQuery('a.woocommerce-product-gallery__trigger').css('visibility', 'visible');
7
  }, 2500);
8
  });
9
 
 
 
 
 
 
 
10
  jQuery(window).on('load', function () {
11
  jQuery('.flex-viewport').css('height', '100%');
12
  });
1
  jQuery(document).ready(function ($) {
2
+ // lazy load
3
+ jQuery.extend(jQuery.lazyLoadXT, {
4
+ srcAttr: 'data-src',
5
+ visibleOnly: false,
6
+ updateEvent: 'load orientationchange resize scroll touchmove focus hover'
7
+ });
8
+
9
  disableClick($);
10
+
11
+ // for all images at single product page
12
  setTimeout(function () {
13
  resizeImg($);
14
  jQuery('a.woocommerce-product-gallery__trigger').css('visibility', 'visible');
15
  }, 2500);
16
  });
17
 
18
+ jQuery(window).on('ajaxComplete', function () {
19
+ setTimeout(function () {
20
+ jQuery(window).lazyLoadXT();
21
+ }, 300);
22
+ });
23
+
24
  jQuery(window).on('load', function () {
25
  jQuery('.flex-viewport').css('height', '100%');
26
  });
includes/html/js/jquery.lazyloadxt.extra.js DELETED
@@ -1,343 +0,0 @@
1
- /*! Lazy Load XT v1.1.0 2016-01-12
2
- * http://ressio.github.io/lazy-load-xt
3
- * (C) 2016 RESS.io
4
- * Licensed under MIT */
5
-
6
- (function ($, window, document, undefined) {
7
- // options
8
- var lazyLoadXT = 'lazyLoadXT',
9
- dataLazied = 'lazied',
10
- load_error = 'load error',
11
- classLazyHidden = 'lazy-hidden',
12
- docElement = document.documentElement || document.body,
13
- // force load all images in Opera Mini and some mobile browsers without scroll event or getBoundingClientRect()
14
- forceLoad = (window.onscroll === undefined || !!window.operamini || !docElement.getBoundingClientRect),
15
- options = {
16
- autoInit: true, // auto initialize in $.ready
17
- selector: 'img[data-src]', // selector for lazyloading elements
18
- blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'.concat(Math.random().toString(36).substr(2)),
19
- throttle: 99, // interval (ms) for changes check
20
- forceLoad: forceLoad, // force auto load all images
21
-
22
- //loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
23
- updateEvent: 'load orientationchange resize scroll touchmove focus', // page-modified events
24
- forceEvent: 'lazyloadall', // force loading of all elements
25
-
26
- //onstart: null,
27
- oninit: {removeClass: 'lazy'}, // init handler
28
- onshow: {addClass: classLazyHidden}, // start loading handler
29
- onload: {removeClass: classLazyHidden, addClass: 'lazy-loaded'}, // load success handler
30
- onerror: {removeClass: classLazyHidden}, // error handler
31
- //oncomplete: null, // complete handler
32
-
33
- //scrollContainer: undefined,
34
- checkDuplicates: true
35
- },
36
- elementOptions = {
37
- srcAttr: 'data-src',
38
- edgeX: 0,
39
- edgeY: 512,
40
- visibleOnly: true
41
- },
42
- $window = $(window),
43
- $isFunction = $.isFunction,
44
- $extend = $.extend,
45
- $data = $.data || function (el, name) {
46
- return $(el).data(name);
47
- },
48
- elements = [],
49
- topLazy = 0,
50
- /*
51
- waitingMode=0 : no setTimeout
52
- waitingMode=1 : setTimeout, no deferred events
53
- waitingMode=2 : setTimeout, deferred events
54
- */
55
- waitingMode = 0;
56
-
57
- $[lazyLoadXT] = $extend(options, elementOptions, $[lazyLoadXT]);
58
-
59
- /**
60
- * Return options.prop if obj.prop is undefined, otherwise return obj.prop
61
- * @param {*} obj
62
- * @param {*} prop
63
- * @returns *
64
- */
65
- function getOrDef(obj, prop) {
66
- return obj[prop] === undefined ? options[prop] : obj[prop];
67
- }
68
-
69
- /**
70
- * @returns {number}
71
- */
72
- function scrollTop() {
73
- var scroll = window.pageYOffset;
74
- return (scroll === undefined) ? docElement.scrollTop : scroll;
75
- }
76
-
77
- /**
78
- * Add new elements to lazy-load list:
79
- * $(elements).lazyLoadXT() or $(window).lazyLoadXT()
80
- *
81
- * @param {object} [overrides] override global options
82
- */
83
- $.fn[lazyLoadXT] = function (overrides) {
84
- overrides = overrides || {};
85
-
86
- var blankImage = getOrDef(overrides, 'blankImage'),
87
- checkDuplicates = getOrDef(overrides, 'checkDuplicates'),
88
- scrollContainer = getOrDef(overrides, 'scrollContainer'),
89
- forceShow = getOrDef(overrides, 'show'),
90
- elementOptionsOverrides = {},
91
- prop;
92
-
93
- // empty overrides.scrollContainer is supported by both jQuery and Zepto
94
- $(scrollContainer).on('scroll', queueCheckLazyElements);
95
-
96
- for (prop in elementOptions) {
97
- elementOptionsOverrides[prop] = getOrDef(overrides, prop);
98
- }
99
-
100
- return this.each(function (index, el) {
101
- if (el === window) {
102
- $(options.selector).lazyLoadXT(overrides);
103
- } else {
104
- var duplicate = checkDuplicates && $data(el, dataLazied),
105
- $el = $(el).data(dataLazied, forceShow ? -1 : 1);
106
-
107
- // prevent duplicates
108
- if (duplicate) {
109
- queueCheckLazyElements();
110
- return;
111
- }
112
-
113
- if (blankImage && el.tagName === 'IMG' && !el.src) {
114
- el.src = blankImage;
115
- }
116
-
117
- // clone elementOptionsOverrides object
118
- $el[lazyLoadXT] = $extend({}, elementOptionsOverrides);
119
-
120
- triggerEvent('init', $el);
121
-
122
- elements.push($el);
123
- queueCheckLazyElements();
124
- }
125
- });
126
- };
127
-
128
-
129
- /**
130
- * Process function/object event handler
131
- * @param {string} event suffix
132
- * @param {jQuery} $el
133
- */
134
- function triggerEvent(event, $el) {
135
- var handler = options['on' + event];
136
- if (handler) {
137
- if ($isFunction(handler)) {
138
- handler.call($el[0]);
139
- } else {
140
- if (handler.addClass) {
141
- $el.addClass(handler.addClass);
142
- }
143
- if (handler.removeClass) {
144
- $el.removeClass(handler.removeClass);
145
- }
146
- }
147
- }
148
-
149
- $el.trigger('lazy' + event, [$el]);
150
-
151
- // queue next check as images may be resized after loading of actual file
152
- queueCheckLazyElements();
153
- }
154
-
155
-
156
- /**
157
- * Trigger onload/onerror handler
158
- * @param {Event} e
159
- */
160
- function triggerLoadOrError(e) {
161
- triggerEvent(e.type, $(this).off(load_error, triggerLoadOrError));
162
- }
163
-
164
-
165
- /**
166
- * Load visible elements
167
- * @param {bool} [force] loading of all elements
168
- */
169
- function checkLazyElements(force) {
170
- if (!elements.length) {
171
- return;
172
- }
173
-
174
- force = force || options.forceLoad;
175
-
176
- topLazy = Infinity;
177
-
178
- var viewportTop = scrollTop(),
179
- viewportHeight = window.innerHeight || docElement.clientHeight,
180
- viewportWidth = window.innerWidth || docElement.clientWidth,
181
- i,
182
- length;
183
-
184
- for (i = 0, length = elements.length; i < length; i++) {
185
- var $el = elements[i],
186
- el = $el[0],
187
- objData = $el[lazyLoadXT],
188
- removeNode = false,
189
- visible = force || $data(el, dataLazied) < 0,
190
- topEdge;
191
-
192
- // remove items that are not in DOM
193
- if (!$.contains(docElement, el)) {
194
- removeNode = true;
195
- } else if (force || !objData.visibleOnly || el.offsetWidth || el.offsetHeight) {
196
-
197
- if (!visible) {
198
- var elPos = el.getBoundingClientRect(),
199
- edgeX = objData.edgeX,
200
- edgeY = objData.edgeY;
201
-
202
- topEdge = (elPos.top + viewportTop - edgeY) - viewportHeight;
203
-
204
- visible = (topEdge <= viewportTop && elPos.bottom > -edgeY &&
205
- elPos.left <= viewportWidth + edgeX && elPos.right > -edgeX);
206
- }
207
-
208
- if (visible) {
209
- $el.on(load_error, triggerLoadOrError);
210
-
211
- triggerEvent('show', $el);
212
-
213
- var srcAttr = objData.srcAttr,
214
- src = $isFunction(srcAttr) ? srcAttr($el) : el.getAttribute(srcAttr);
215
-
216
- if (src) {
217
- el.src = src;
218
- }
219
-
220
- removeNode = true;
221
- } else {
222
- if (topEdge < topLazy) {
223
- topLazy = topEdge;
224
- }
225
- }
226
- }
227
-
228
- if (removeNode) {
229
- $data(el, dataLazied, 0);
230
- elements.splice(i--, 1);
231
- length--;
232
- }
233
- }
234
-
235
- if (!length) {
236
- triggerEvent('complete', $(docElement));
237
- }
238
- }
239
-
240
-
241
- /**
242
- * Run check of lazy elements after timeout
243
- */
244
- function timeoutLazyElements() {
245
- if (waitingMode > 1) {
246
- waitingMode = 1;
247
- checkLazyElements();
248
- setTimeout(timeoutLazyElements, options.throttle);
249
- } else {
250
- waitingMode = 0;
251
- }
252
- }
253
-
254
-
255
- /**
256
- * Queue check of lazy elements because of event e
257
- * @param {Event} [e]
258
- */
259
- function queueCheckLazyElements(e) {
260
- if (!elements.length) {
261
- return;
262
- }
263
-
264
- // fast check for scroll event without new visible elements
265
- if (e && e.type === 'scroll' && e.currentTarget === window) {
266
- if (topLazy >= scrollTop()) {
267
- return;
268
- }
269
- }
270
-
271
- if (!waitingMode) {
272
- setTimeout(timeoutLazyElements, 0);
273
- }
274
- waitingMode = 2;
275
- }
276
-
277
-
278
- /**
279
- * Initialize list of hidden elements
280
- */
281
- function initLazyElements() {
282
- $window.lazyLoadXT();
283
- }
284
-
285
-
286
- /**
287
- * Loading of all elements
288
- */
289
- function forceLoadAll() {
290
- checkLazyElements(true);
291
- }
292
-
293
-
294
- /**
295
- * Initialization
296
- */
297
- $(document).ready(function () {
298
- triggerEvent('start', $window);
299
-
300
- $window
301
- .on(options.updateEvent, queueCheckLazyElements)
302
- .on(options.forceEvent, forceLoadAll);
303
-
304
- $(document).on(options.updateEvent, queueCheckLazyElements);
305
-
306
- if (options.autoInit) {
307
- $window.on(options.loadEvent, initLazyElements);
308
- initLazyElements(); // standard initialization
309
- }
310
- });
311
-
312
- })(window.jQuery || window.Zepto || window.$, window, document);
313
-
314
-
315
- (function ($) {
316
- var options = $.lazyLoadXT;
317
-
318
- options.selector += ',video,iframe[data-src]';
319
- options.videoPoster = 'data-poster';
320
-
321
- $(document).on('lazyshow', 'video', function (e, $el) {
322
- var srcAttr = $el.lazyLoadXT.srcAttr,
323
- isFuncSrcAttr = $.isFunction(srcAttr),
324
- changed = false;
325
-
326
- $el.attr('poster', $el.attr(options.videoPoster));
327
- $el.children('source,track')
328
- .each(function (index, el) {
329
- var $child = $(el),
330
- src = isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr);
331
- if (src) {
332
- $child.attr('src', src);
333
- changed = true;
334
- }
335
- });
336
-
337
- // reload video
338
- if (changed) {
339
- this.load();
340
- }
341
- });
342
-
343
- })(window.jQuery || window.Zepto || window.$);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/thumbnail.php CHANGED
@@ -7,8 +7,10 @@ add_filter('wp_head', 'fifu_apply_css');
7
 
8
  function fifu_add_js() {
9
  if (fifu_is_on('fifu_lazy')) {
10
- wp_register_script('lazyload', plugins_url('/html/js/jquery.lazyloadxt.extra.js', __FILE__), array('jquery'));
11
- wp_enqueue_script('lazyload');
 
 
12
  }
13
  include 'html/script.html';
14
  }
7
 
8
  function fifu_add_js() {
9
  if (fifu_is_on('fifu_lazy')) {
10
+ wp_enqueue_style('lazyload-spinner', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.spinner.min.css');
11
+ wp_enqueue_script('lazyload', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.min.js');
12
+ wp_enqueue_script('lazyload-extra', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.extra.min.js');
13
+ wp_enqueue_script('lazyload-srcset', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.srcset.min.js');
14
  }
15
  include 'html/script.html';
16
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marceljm
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, priority, seo, variable, tumblr, variation, product variation, shortcode
5
  Requires at least: 4.0
6
- Tested up to: 5.1.0
7
- Stable tag: 5.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -157,6 +157,9 @@ Features:
157
 
158
  == Changelog ==
159
 
 
 
 
160
  = 2.3.6 =
161
  * Improvement: you can buy the Premium version with Bitcoins now.
162
 
@@ -535,6 +538,9 @@ was removed. To finish, a Premium version is now been presented.
535
 
536
  == Upgrade Notice ==
537
 
 
 
 
538
  = 2.3.6 =
539
  * Improvement: you can buy the Premium version with Bitcoins now.
540
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, priority, seo, variable, tumblr, variation, product variation, shortcode
5
  Requires at least: 4.0
6
+ Tested up to: 5.1.1
7
+ Stable tag: 5.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
157
 
158
  == Changelog ==
159
 
160
+ = 2.3.7 =
161
+ * Improvement: Lazy Load feature will show an animated spinner while image is loading.
162
+
163
  = 2.3.6 =
164
  * Improvement: you can buy the Premium version with Bitcoins now.
165
 
538
 
539
  == Upgrade Notice ==
540
 
541
+ = 2.3.7 =
542
+ * Improvement: Lazy Load feature will show an animated spinner while image is loading.
543
+
544
  = 2.3.6 =
545
  * Improvement: you can buy the Premium version with Bitcoins now.
546