Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author WP Media

    (@wp_media)

    Hi @camilo517,

    Thank you for this feedback, I have passed it to our developers.

    Best Regards,
    Jurica

    Hi @wp_media,

    Any chance this will be updated soon?

    Also wondering if the inline <script> that the plugin puts into every page can be minified? (would save 1.5k per pageload)

    Thanks very much!

    Plugin Author WP Media

    (@wp_media)

    Hi @roam92 !

    Thank you for your questions!

    Yes, we have a high priority for the update. You can follow this GitHub thread for the updates: https://github.com/wp-media/wp-rocket/issues/3510

    The inline script is already minified (here is a screenshot of the markup: https://jmp.sh/AX9SqbQ), as well as the lazyload.min.js which is loaded at the footer asynchronously.

    Best regards,
    Natalia

    Hi @wp_media – thank you for your fast response!

    That’s great news that the script update is coming and is high priority.

    Regarding the minification, I don’t see that in the current version 2.3.4… When I view source on any page of my site, the inline script is not minified.

    Screenshot here: https://prnt.sc/10oa5vi

    So, at a loss to explain why you’re seeing it but I’m not? Any possible reason?

    Thanks again!

    Plugin Contributor WP Rocket

    (@wp_rocket)

    Hi @roam92!

    Jorge from WP Rocket here. Thank you for taking the time to contact support.

    To be able to check that, would you please provide the whole script from the starting <script> tag and so we’re able to check why this is happening?

    Thank you for your time and patience on this matter. I’ll be waiting for your reply. I hope you have a great day!

    Regards,

    Sure, here it is, straight from “View Source” – and inline (unminified) at the very bottom of each page on my site:

    <script>window.lazyLoadOptions = {
                    elements_selector: "img[data-lazy-src],.rocket-lazyload,iframe[data-lazy-src]",
                    data_src: "lazy-src",
                    data_srcset: "lazy-srcset",
                    data_sizes: "lazy-sizes",
                    class_loading: "lazyloading",
                    class_loaded: "lazyloaded",
                    threshold: 300,
                    callback_loaded: function(element) {
                        if ( element.tagName === "IFRAME" && element.dataset.rocketLazyload == "fitvidscompatible" ) {
                            if (element.classList.contains("lazyloaded") ) {
                                if (typeof window.jQuery != "undefined") {
                                    if (jQuery.fn.fitVids) {
                                        jQuery(element).parent().fitVids();
                                    }
                                }
                            }
                        }
                    }};
            window.addEventListener('LazyLoad::Initialized', function (e) {
                var lazyLoadInstance = e.detail.instance;
    
                if (window.MutationObserver) {
                    var observer = new MutationObserver(function(mutations) {
                        var image_count = 0;
                        var iframe_count = 0;
                        var rocketlazy_count = 0;
    
                        mutations.forEach(function(mutation) {
                            for (i = 0; i < mutation.addedNodes.length; i++) {
                                if (typeof mutation.addedNodes[i].getElementsByTagName !== 'function') {
                                    return;
                                }
    
                               if (typeof mutation.addedNodes[i].getElementsByClassName !== 'function') {
                                    return;
                                }
    
                                images = mutation.addedNodes[i].getElementsByTagName('img');
                                is_image = mutation.addedNodes[i].tagName == "IMG";
                                iframes = mutation.addedNodes[i].getElementsByTagName('iframe');
                                is_iframe = mutation.addedNodes[i].tagName == "IFRAME";
                                rocket_lazy = mutation.addedNodes[i].getElementsByClassName('rocket-lazyload');
    
                                image_count += images.length;
    			                iframe_count += iframes.length;
    			                rocketlazy_count += rocket_lazy.length;
    
                                if(is_image){
                                    image_count += 1;
                                }
    
                                if(is_iframe){
                                    iframe_count += 1;
                                }
                            }
                        } );
    
                        if(image_count > 0 || iframe_count > 0 || rocketlazy_count > 0){
                            lazyLoadInstance.update();
                        }
                    } );
    
                    var b      = document.getElementsByTagName("body")[0];
                    var config = { childList: true, subtree: true };
    
                    observer.observe(b, config);
                }
            }, false);</script><script async data-no-minify="1" async src="/wp-content/plugins/rocket-lazy-load/assets/js/16.1/lazyload.min.js"></script><script>function lazyLoadThumb(e){var t='<img loading="lazy" data-lazy-src="https://i.ytimg.com/vi/ID/hqdefault.jpg" alt="" width="480" height="360"><noscript><img src="https://i.ytimg.com/vi/ID/hqdefault.jpg" alt="" width="480" height="360"></noscript>',a='<div class="play"></div>';return t.replace("ID",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement("iframe"),t="ID?autoplay=1";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute("src",t.replace("ID",this.dataset.src)),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.setAttribute("data-src", a[t].dataset.src),e.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script>
    Plugin Contributor WP Rocket

    (@wp_rocket)

    Hi @roam92!

    We don’t indeed minify the inline script. There is no minification method on our plugin.

    We try to keep things simple ??

    I just added it as a feature request – https://github.com/wp-media/rocket-lazy-load/issues/122

    It’s up to the product team to decide ??

    Best regards,

    Adame

    Hello Adame,

    Appreciate that – thank you for the clarification, and for the update with feature request!

    Also looking forward to the next release of the plugin with the latest version of the Verlok script, as soon as you can complete it. ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Script version’ is closed to new replies.