Support » Plugin: Lazy Load by WP Rocket » ‘Replace Youtube videos by thumbnail’ showing an empty div

  • Resolved MultiformeIngegno

    (@lorenzone92)


    Enabling ‘Replace Youtube videos by thumbnail’ only shows an empty div:

    <div class="rll-youtube-player" data-id="SlA9hmrC8DU" data-query="start=23&feature=oembed"></div>
    <noscript><iframe title="Burn After Reading ending" width="500" height="281" src="https://www.youtube.com/embed/SlA9hmrC8DU?start=23&feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></noscript>

    In Chrome’s devtools I see the following error:
    Uncaught SyntaxError: Invalid or unexpected token

    On this line:
    }, false);</script><script data-no-minify="1" async src="https://bombacarta.com/wp-content/plugins/rocket-lazy-load/assets/js/12.0/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="https://www.youtube.com/embed/ID?autoplay=1";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute("src",t.replace("ID",this.dataset.id)),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.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script></div>

    The page is not showing the error at the moment because I unchecked the option ‘Replace Youtube videos by thumbnail’ in the plugin’s settings.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.