• Resolved ofmarconi

    (@ofmarconi)


    Hello, how are you?

    I’d like to understand more about why converting INLINE to BLOB is necessary. Isn’t it already loaded in the HTML?

    What’s happening is that, randomly, the page built with Elementor isn’t initiating the scripts, even with interaction. The DATA-SRC attributes are being changed, but it seems like something in Elementor is delaying or not being called after the interaction. Since this issue occurs randomly, I can’t provide more details. Could it be related to the BLOB? Has anyone else reported something similar with Elementor, or is there a ready-made solution?

    I recorded a capture of the INLINE turning into BLOB, just to be sure we’re talking about the same thing:

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ofmarconi

    (@ofmarconi)

    Ahhh more details are welcome:

    • Cloudflare
    • Cloudflare EdgeCache
    • Elementor Pro
    • JetEngine Crocoblock
    • OpenLitespeed Cyberpanel
    • JS Delayed
    Thread Starter ofmarconi

    (@ofmarconi)

    I would also like to write my own script with custom conditionals so that it does not delay, for example, if the URI contains “#” because it will make the page load in the middle where the animations will probably not run until the interaction.

    Where can I replace this piece of code?

    const litespeed_ui_events=["mouseover","click","keydown","wheel","touchmove","touchstart"];var urlCreator=window.URL||window.webkitURL;function litespeed_load_delayed_js_force(){console.log("[LiteSpeed] Start Load JS Delayed"),litespeed_ui_events.forEach(e=>{window.removeEventListener(e,litespeed_load_delayed_js_force,{passive:!0})}),document.querySelectorAll("iframe[data-litespeed-src]").forEach(e=>{e.setAttribute("src",e.getAttribute("data-litespeed-src"))}),"loading"==document.readyState?window.addEventListener("DOMContentLoaded",litespeed_load_delayed_js):litespeed_load_delayed_js()}litespeed_ui_events.forEach(e=>{window.addEventListener(e,litespeed_load_delayed_js_force,{passive:!0})});async function litespeed_load_delayed_js(){let t=[];for(var d in document.querySelectorAll('script[type="litespeed/javascript"]').forEach(e=>{t.push(e)}),t)await new Promise(e=>litespeed_load_one(t[d],e));document.dispatchEvent(new Event("DOMContentLiteSpeedLoaded")),window.dispatchEvent(new Event("DOMContentLiteSpeedLoaded"))}function litespeed_load_one(t,e){console.log("[LiteSpeed] Load ",t);var d=document.createElement("script");d.addEventListener("load",e),d.addEventListener("error",e),t.getAttributeNames().forEach(e=>{"type"!=e&&d.setAttribute("data-src"==e?"src":e,t.getAttribute(e))});let a=!(d.type="text/javascript");!d.src&&t.textContent&&(d.src=litespeed_inline2src(t.textContent),a=!0),t.after(d),t.remove(),a&&e()}function litespeed_inline2src(t){try{var d=urlCreator.createObjectURL(new Blob([t.replace(/^(?:<!--)?(.*?)(?:-->)?$/gm,"$1")],{type:"text/javascript"}))}catch(e){d="data:text/javascript;base64,"+btoa(t.replace(/^(?:<!--)?(.*?)(?:-->)?$/gm,"$1"))}return d}

    can I override this via Functions.php?
    Dequeueing this one and enqueuing my version?

    Thx so much

    Plugin Support litetim

    (@litetim)

    @ofmarconi hello
    The code there is for JS Delayed.
    JS Delayed is used to run the JS only after interaction with page: mouse move, click , drag, hover(the code you want to change)

    Instead of rewritting the whole JS you can add JS(file or script) to be ignored fore delay run delay: https://docs.litespeedtech.com/lscache/lscwp/pageopt/#js-deferreddelayed-excludes But be carefull on what dependencies need to be loaded

    • This reply was modified 3 months, 3 weeks ago by litetim. Reason: clarify the meaning
    Thread Starter ofmarconi

    (@ofmarconi)

    Yes, I understand JS Delayed, I just don’t understand why INLINE becomes a BLOB if it is already cached by HTML…

    About additional conditions for the script to be executed, this would be feasible, correct? If I want there to be no delay on pages with #.

    if (window.location.hash) {
    litespeed_load_delayed_js_force();
    }

    Plugin Support litetim

    (@litetim)

    We are using: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static to move inline JS to JS source, this mean the JS is ready to run and will be executed
    See: litespeed_inline2src from js_delay.js

    What is your end result? what do you want to achieve?
    When page link contains # to always run an animation? or what do you want to do?

    • This reply was modified 3 months, 3 weeks ago by litetim.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.