This update fixes issues with:

  • non .active slide images not loading with the lazyloader module
  • the option of using echo.js vs echo.min.js actually save in admin settings
  • the automated test failing
CommentFileSizeAuthor
0001-lazyloader-patch.patch3.08 KBjon.day

Comments

jon.day created an issue. See original summary.

legolasbo’s picture

Status: Needs review » Needs work

I've just looked at the code, no functional review done.

  1. +++ b/docroot/sites/all/modules/lazyloader/lazyloader.admin.inc
    @@ -24,7 +24,7 @@ function lazyloader_admin_configure() {
       $form['lazyloader_debugging'] = array(
         '#type' => 'checkbox',
         '#title' => t('Use development javascript'),
    -    '#default_value' => variable_get('lazyloader_development', LAZYLOADER_DEBUGGING),
    +    '#default_value' => variable_get('lazyloader_debugging', LAZYLOADER_DEBUGGING),
         '#description' => t('By default lazyloader will use the minified version of the echo library. By checking this option it will use the non-minified version instead.'),
       );
     
    @@ -117,7 +117,7 @@ function lazyloader_admin_configure_submit($form, &$form_state) {
    
    @@ -117,7 +117,7 @@ function lazyloader_admin_configure_submit($form, &$form_state) {
         $form_state['values']['lazyloader_placeholder'] = LAZYLOADER_PLACEHOLDER;
         $form_state['values']['lazyloader_unload'] = LAZYLOADER_UNLOAD;
         $form_state['values']['lazyloader_debounce'] = LAZYLOADER_DEBOUNCE;
    -    $form_state['values']['lazyloader_development'] = LAZYLOADER_DEBUGGING;
    +    $form_state['values']['lazyloader_debugging'] = LAZYLOADER_DEBUGGING;
       }
    

    These changes are out of scope. Please open a new issue for them.

  2. +++ b/docroot/sites/all/modules/lazyloader/lazyloader.js
    @@ -64,7 +64,30 @@
    +// Calls the function to display hidden slider images on load
    +jQuery(window).load(function() {
    +  lazyloaderSlider();
    +});
    

    This should be part of the Drupal behaviours part. Now it won't work for dynamically (AJAX) loaded slideshows.

  3. +++ b/docroot/sites/all/modules/lazyloader/lazyloader.js
    @@ -64,7 +64,30 @@
    +// Calls the function to display all slider images on load
    +jQuery(window).resize(function() {
    +  lazyloaderSlider();
    +	// Displays images of the active content
    +	jQuery.each(jQuery(".active").find("img"), function(ival, iidx) {
    +		if(jQuery(this).css("display") != "none" && jQuery(this).attr("data-echo").length > 0) {
    +			jQuery(this).attr("src", jQuery(this).attr("data-echo"));
    +		}
    +	});
    +});
    +function lazyloaderSlider() {
    +	// Displays the images of the siblings of the active content
    +  jQuery.each(jQuery(".active").siblings(), function(val, idx) {   ¶
    +    jQuery.each(jQuery(this).find("img"), function(ival, iidx) {
    +      if(jQuery(this).css("display") != "none" && jQuery(this).attr("data-echo").length > 0) {
    +        jQuery(this).attr("src", jQuery(this).attr("data-echo"));
    +      }
    +    });
    +  });
    +}
    

    These can probably use echo.render() to be simpler.

darkdante’s picture

How can i accomplish to display hidden images on 1.X version?

legolasbo’s picture

@darkdante,

You can't, because the javascript is not very extensible in 1.x.

oksale’s picture

Hi! I made minor changes to the code:
1. jQuery(this).attr("data-echo") condition added:

if(jQuery(this).css("display") != "none" && jQuery(this).attr("data-echo") && jQuery(this).attr("data-echo").length > 0)
2. In your code placeholder image is still visible, it must be hidden.

jQuery(this).attr("src", jQuery(this).attr("data-echo"));
jQuery(this).next('.lazyloader-icon').remove();
damienmckenna’s picture

Assigned: jon.day » Unassigned

FYI the "assigned" field is for indicating you're actively working on something, when you upload a patch you should set it back to "unassigned".