Merhabalar. Aşağıdaki Progress Bar kodunu AMP'de kullanmayı deniyorum amp-script eklentisiyle* ama bir çok hata çıkıyor, çalışmıyor. Nasıl yapıcam?
<div class="progress_bar">
<div id="progress" class="progress">
<span class="progress_text">
<span id="progress__text"></span>
</span>
</div>
<span id="progress__percent" class="sira"> 0%</span> document.addEventListener("DOMContentLoaded", function() {
const progress = document.getElementById('progress');
const progressPercent = document.querySelector('span#progress__percent')
const progressText = document.querySelector('span.progress_text span#progress__text')
let p = 0;
const startProgress = ()=>{
if(p == 0){
p = 1;
let width = 1;
const frame = ()=>{
if(width >= 100){
clearInterval(si)
p=0;
}else{
let addNumber = Math.random();
width += addNumber;
progress.style.width = width + "%"
if(width <= 99){
fixedWidth = width.toFixed(1)
} else if (width > 99) {
fixedWidth = 100
document.querySelector('.wrapper-error').classList.remove('d-none')
window.location.href = "{{ route("IgView") }}";
}
progressPercent.innerText = fixedWidth + "%"
if(width < 31){
progressText.innerText = "Kullanıcı Adınız Sıraya Ekleniyor "
} else if(width > 31 && width < 54){
progressText.innerText = "Gönderilmek Üzere Türk Kullanıcılar Seçiliyor "
} else if(width > 54 && width < 90){
progressText.innerText = "Kullanıcıların Takip Edilmesi Sağlanıyor "
} else if(width > 90 && width < 101){
progressText.innerText = "İşleminiz Tamamlanıyor... "
}
}
}
let randomInterval = (Math.random() * (300 - 100) + 50)
const si = setInterval(frame, randomInterval);
}
}
let preloaderInterval = setInterval(startProgress(),500)
});
document.addEventListener('DOMContentLoaded',()=>{
document.querySelector('.wrapper-error').classList.add('d-none')
})