WordPress.org

Plugin Directory

Changeset 594270


Ignore:
Timestamp:
09/04/12 03:27:42 (20 months ago)
Author:
batmoo
Message:

Sync with WP.com VIP repo:

  • Jetpack Carousel compat
  • Don't lazy load in admin
Location:
lazy-load/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lazy-load/trunk/js/lazy-load.js

    r567472 r594270  
    44 
    55    function lazy_load_init() { 
    6         jQuery( 'img[data-lazy-src]' ).bind( 'scrollin', { distance: 200 }, function() { 
    7             var img = this, 
    8                 $img = jQuery(img), 
    9                 src = $img.attr( 'data-lazy-src' ); 
    10             $img.unbind( 'scrollin' ) // remove event binding 
    11                 .hide() 
    12                 .removeAttr( 'data-lazy-src' ) 
    13                 .attr( 'data-lazy-loaded', 'true' );; 
    14             img.src = src; 
    15             $img.fadeIn(); 
     6        $( 'img[data-lazy-src]' ).bind( 'scrollin', { distance: 200 }, function() { 
     7            lazy_load_image( this ); 
    168        }); 
     9 
     10        // We need to force load gallery images in Jetpack Carousel and give up lazy-loading otherwise images don't show up correctly 
     11        $( '[data-carousel-extra]' ).each( function() { 
     12            $( this ).find( 'img[data-lazy-src]' ).each( function() { 
     13                lazy_load_image( this ); 
     14            } );         
     15        } ); 
     16    } 
     17 
     18    function lazy_load_image( img ) { 
     19        var $img = jQuery( img ), 
     20            src = $img.attr( 'data-lazy-src' ); 
     21 
     22        $img.unbind( 'scrollin' ) // remove event binding 
     23            .hide() 
     24            .removeAttr( 'data-lazy-src' ) 
     25            .attr( 'data-lazy-loaded', 'true' ); 
     26 
     27        img.src = src; 
     28        $img.fadeIn(); 
    1729    } 
    1830})(jQuery); 
  • lazy-load/trunk/lazy-load.php

    r576393 r594270  
    33 * Plugin Name: Lazy Load 
    44 * Description: Lazy load images to improve page load times. Uses jQuery.sonar to only load an image when it's visible in the viewport. 
    5  * Version: 0.4 
     5 * Version: 0.5 
    66 * 
    77 * Code by the WordPress.com VIP team, TechCrunch 2011 Redesign team, and Jake Goldman (10up LLC). 
     
    1515class LazyLoad_Images { 
    1616 
    17     const version = '0.4'; 
     17    const version = '0.5'; 
    1818 
    1919    static function init() { 
     20        if ( is_admin() ) 
     21            return; 
     22 
    2023        add_action( 'wp_enqueue_scripts', array( __CLASS__, 'add_scripts' ) ); 
    2124        add_filter( 'the_content', array( __CLASS__, 'add_image_placeholders' ), 99 ); // run this later, so other content filters have run, including image_add_wh on WP.com 
  • lazy-load/trunk/readme.txt

    r576430 r594270  
    44Requires at least: 3.2 
    55Tested up to: 3.4.1 
    6 Stable tag: 0.4 
     6Stable tag: 0.5 
    77 
    88Lazy load images to improve page load times and server bandwidth. Images are loaded only when visible to the user. 
     
    6363* Fix lazyload_images_add_placeholders by adding missing return, props Kevin Smith 
    6464* Lazy load avatars, props i8ramin 
     65* Don't lazy load images in the Dashboard 
     66* Better compatibility with Jetpack Carousel 
    6567 
    6668= 0.4 = 
Note: See TracChangeset for help on using the changeset viewer.