Changeset 1492697
- Timestamp:
- 09/08/2016 04:43:13 PM (10 years ago)
- Location:
- smart-image-loader/trunk
- Files:
-
- 5 edited
-
options.php (modified) (2 diffs)
-
plugin.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
smart_image_loader.js (modified) (5 diffs)
-
smart_image_loader.min.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
smart-image-loader/trunk/options.php
r1462043 r1492697 35 35 <tr valign="top"> 36 36 <th style="padding-left: 1em;" scope="row">CSS Selector</th> 37 <td style="padding-left: 1em;"><input type="text" name="sil-selector" id="sil-selector" value="<?php echo get_option('sil-selector', 'img'); ?>" /><br/> (jQuery)CSS Selector for images to affect. Use a class if you want to affect only certain images.</td>37 <td style="padding-left: 1em;"><input type="text" name="sil-selector" id="sil-selector" value="<?php echo get_option('sil-selector', 'img'); ?>" /><br/>CSS Selector for images to affect. Use a class if you want to affect only certain images.</td> 38 38 </tr> 39 39 … … 45 45 <tr valign="top"> 46 46 <th style="padding-left: 1em;" scope="row">Source placeholder</th> 47 <td style="padding-left: 1em;"><input type="text" name="sil-placeholder" value="<?php echo get_option('sil-placeholder', ''); ?>" /><br/>Value of empty image source.</td> 48 </tr> 49 50 <tr valign="top" style="padding-left: 1em;"> 51 <th style="padding-left: 1em;" scope="row">Enhanced accuracy</th> 52 <td style="padding-left: 1em;"><input type="checkbox" name="sil-accuracy" id="sil-accuracy" value="true" <?php checked( "true" == get_option('sil-accuracy') ) ?> /><label for="sil-accuracy">Check the images' actual visibility in addition to their position relative to the viewport.</label></td> 47 <td style="padding-left: 1em;"><input type="text" name="sil-placeholder" value="<?php echo get_option('sil-placeholder', ''); ?>" /><br/>Value of empty image source attribute (default is a base64 encoded transparent pixel).</td> 53 48 </tr> 54 49 -
smart-image-loader/trunk/plugin.php
r1462043 r1492697 4 4 Plugin URI: https://wordpress.org/plugins/smart-image-loader 5 5 Description: Load images visible at page load ('above the fold') first for a fast page loading impression. Optional lazy loading for images 'below the fold'. 6 Version: 0.4. 56 Version: 0.4.6 7 7 Text Domain: smart-image-loader 8 8 Author: Bayer und Preuss … … 114 114 refresh_resize: <?= get_option('sil-refresh-resize', 'false') ? 'true' : 'false' ?>, 115 115 refresh_scroll: <?= get_option('sil-refresh-scroll', 'false') ? 'true' : 'false' ?>, 116 enhanced_accuracy: <?= get_option('sil-accuracy', 'false') ? 'true' : 'false' ?>,117 116 lazy_load_at: <?= get_option('sil-lazy-load-at', '1024') ?>, 118 117 fade: <?= get_option('sil-fade', 'false') ? 'true' : 'false' ?>, … … 171 170 add_option( 'sil-refresh-resize', 'true'); 172 171 add_option( 'sil-refresh-scroll', 'false'); 173 add_option( 'sil-accuracy', 'false');174 172 add_option( 'sil-lazy-load-at', '1024'); 175 173 add_option( 'sil-fade', 'false'); … … 186 184 register_setting( 'sil-settings-group', 'sil-refresh-resize' ); 187 185 register_setting( 'sil-settings-group', 'sil-refresh-scroll' ); 188 register_setting( 'sil-settings-group', 'sil-accuracy' );189 186 register_setting( 'sil-settings-group', 'sil-lazy-load-at' ); 190 187 register_setting( 'sil-settings-group', 'sil-fade' ); -
smart-image-loader/trunk/readme.txt
r1462034 r1492697 5 5 Requires at least: 3.8.3 6 6 Tested up to: 4.5.3 7 Stable tag: 0.4. 57 Stable tag: 0.4.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 32 32 33 33 == Changelog == 34 35 = 0.4.6 = 36 * made enhanced accuracy option mandatory 37 * very minor performance tweaks 34 38 35 39 = 0.4.5 = -
smart-image-loader/trunk/smart_image_loader.js
r1462044 r1492697 1 1 (function($) { 2 2 3 // Version: 0.4. 53 // Version: 0.4.6 4 4 5 5 "use strict"; … … 22 22 // update the images position data on resize event. You can also refresh manually in your script with sil_refresh(). 23 23 refresh_scroll: false, 24 25 // Check the images' actual visibility in addition to their position relative to the viewport.26 enhanced_accuracy: false,27 24 28 25 // Maximum screen width where to switch from priority to lazy loading. Set to 0 for no lazy loading … … 120 117 var element, 121 118 $element, 119 data, 122 120 element_offset_top, 123 121 element_offset_left, … … 129 127 is_not_right_of_screen, 130 128 is_not_left_of_screen, 131 is_not_hidden; 129 is_not_hidden, 130 options; 132 131 133 132 if ( v.nodeType && v.nodeType == 1 ) … … 137 136 element = this; 138 137 139 $element = $(element); 140 141 element_offset_top = $element.data('offsetTop'); 142 element_offset_left = $element.data('offsetLeft'); 143 element_width = $element.data('width'); 144 element_height = $element.data('height'); 145 element_visibile = $element.data('visibility'); 146 147 is_not_above_screen = element_offset_top + element_height > scroll_top - sil_options.meat; 148 is_not_left_of_screen = element_offset_left + element_width > scroll_left - sil_options.meat; 149 is_not_below_screen = element_offset_top < scroll_top + window_height + sil_options.meat; 150 is_not_right_of_screen = element_offset_left < scroll_left + window_width + sil_options.meat; 138 $element = $(element); 139 data = $element.data(); 140 options = sil_options; 141 element_visibile = data['visibility']; 142 143 is_not_above_screen = data['offsetTop'] + data['height'] > scroll_top - options.meat; 144 is_not_left_of_screen = data['offsetLeft'] + data['width'] > scroll_left - options.meat; 145 is_not_below_screen = data['offsetTop'] < scroll_top + window_height + options.meat; 146 is_not_right_of_screen = data['offsetLeft'] < scroll_left + window_width + options.meat; 151 147 152 148 -
smart-image-loader/trunk/smart_image_loader.min.js
r1462043 r1492697 2 2 var V=document,L=window,v=D(V),R,s,A,r,o,e,u,H,c,C,j,g,f,t,n,Q,x,X,T,q=!!(L.matchMedia&&L.matchMedia("(max-device-width: "+W.lazy_load_at+"px)").matches),M=function(){var w=L,d="inner"; 3 3 if(!("innerWidth" in L)){d="client";w=V.documentElement||V.body;}return{width:w[d+"Width"],height:w[d+"Height"]};},N=function(d,w){if(window.getComputedStyle){return document.defaultView.getComputedStyle(d,null)[w]; 4 }if(d.currentStyle){return d.currentStyle[w];}},y=function(){return x!==Q;},S=function(){return T!==X;},I=function(a g){var Y,ah,ab,Z,ac,w,d,ad,aa,ai,af,ae;5 if(a g.nodeType&&ag.nodeType==1){Y=ag;}else{if(this.nodeType&&this.nodeType==1){Y=this;}}ah=D(Y);ab=ah.data("offsetTop");Z=ah.data("offsetLeft");ac=ah.data("width");6 w=ah.data("height");d=ah.data("visibility");ad=ab+w>C-W.meat;af=Z+ac>j-W.meat;aa=ab<C+H+W.meat;ai=Z<j+u+W.meat;return ad&&af&&aa&&ai&&d;},O=function(d){var w,Y;7 if(d.nodeType&&d.nodeType==1){w=d;}else{if(this.nodeType&&this.nodeType==1){w=this;}}Y=D(w).attr("src");return Y==W.placeholder||Y==e;},F=function(d){return typeof d.width=="string"&&d.width.match(/^\d+$/)&&typeof d.height=="string"&&d.height.match(/^\d+$/);4 }if(d.currentStyle){return d.currentStyle[w];}},y=function(){return x!==Q;},S=function(){return T!==X;},I=function(ah){var Z,ai,Y,ac,aa,ad,w,d,ae,ab,ak,ag,af,aj; 5 if(ah.nodeType&&ah.nodeType==1){Z=ah;}else{if(this.nodeType&&this.nodeType==1){Z=this;}}ai=D(Z);Y=ai.data();aj=W;d=Y.visibility;ae=Y.offsetTop+Y.height>C-aj.meat; 6 ag=Y.offsetLeft+Y.width>j-aj.meat;ab=Y.offsetTop<C+H+aj.meat;ak=Y.offsetLeft<j+u+aj.meat;return ae&&ag&&ab&&ak&&d;},O=function(d){var w,Y;if(d.nodeType&&d.nodeType==1){w=d; 7 }else{if(this.nodeType&&this.nodeType==1){w=this;}}Y=D(w).attr("src");return Y==W.placeholder||Y==e;},F=function(d){return typeof d.width=="string"&&d.width.match(/^\d+$/)&&typeof d.height=="string"&&d.height.match(/^\d+$/); 8 8 },a=function(d){d=d||s||D("body").find("noscript").prev(W.selector);d.each(function(){var w=D(this);w.data({offsetTop:w.offset().top,offsetLeft:w.offset().left,width:w.width(),height:w.height(),visibility:N(this,"display")!="none"&&N(this,"visibility")!="hidden"&&N(this,"opacity")!="0"&&w.is(":visible")}); 9 9 });c=D(V).height();},J=function(Z,Y,d){R=D(Z);var w=R.attr("data-sil"),aa=o.filter('[data-sil="'+w+'"]');if(typeof Y=="function"){R.on("load",Y);}if(W.fade&&!d){R.data({opacity:R.css("opacity")}).css({opacity:"0"});
Note: See TracChangeset
for help on using the changeset viewer.