Scripts FiveM

Oups, il n'y a pas encore aucun article ici.

Rechercher
Articles
Pages
document.addEventListener("DOMContentLoaded", function() { const twitterEmbeds = document.querySelectorAll('.twitter-tweet'); let scriptLoaded = false; if (twitterEmbeds.length > 0) { const observerOptions = { root: null, rootMargin: '200px', threshold: 0 }; const observer = new IntersectionObserver((entries, observerInstance) => { entries.forEach(entry => { if (entry.isIntersecting && !scriptLoaded) { loadTwitterScript(); observerInstance.disconnect(); } }); }, observerOptions); twitterEmbeds.forEach(embed => { observer.observe(embed); }); } function loadTwitterScript() { scriptLoaded = true; const script = document.createElement('script'); script.src = 'https://platform.twitter.com/widgets.js'; script.charset = 'utf-8'; script.async = true; document.body.appendChild(script); } });