(function () { var loaded = {}; var tasks = [ { key:"intercom", src:"https://widget.intercom.io/widget/rhfku4dt", maxDelay: 5000 }, { key:"lemcal", src:"https://cdn.lemcal.com/lemcal-integrations.min.js", maxDelay: 3000 } ]; function injectOnce(t) { if (loaded[t.key]) return; loaded[t.key] = true; var s = document.createElement("script"); s.src = t.src; s.async = true; document.head.appendChild(s); } function userIntentLoad() { tasks.forEach(injectOnce); window.removeEventListener("scroll", userIntentLoad); window.removeEventListener("pointerdown", userIntentLoad); window.removeEventListener("keydown", userIntentLoad); } function schedule() { // intent immédiat window.addEventListener("scroll", userIntentLoad, { passive: true, once: true }); window.addEventListener("pointerdown", userIntentLoad, { once: true }); window.addEventListener("keydown", userIntentLoad, { once: true }); // fallback timeouts tasks.forEach(function (t) { setTimeout(function () { injectOnce(t); }, t.maxDelay); }); } if (document.readyState === "complete") schedule(); else window.addEventListener("load", schedule, { once: true }); })();