`, "time": "7", } ] console.clear() class user { constructor(base, ads) { this.base = base; this.ads = ads; this.index = 0; this.strz = false; } startV() { var c = document.createElement('div'); c.classList.add('zfc-ads'); var b = document.querySelector(this.base); b.appendChild(c); c.addEventListener('click', () => { if (this.strz == false) { console.log('str 1') if (sessionStorage.getItem('zfc')) { this.start() this.strz = true; } else { var zsc = false; sessionStorage.setItem('zfc', 'true') window.open(link) window.addEventListener('focus', () => { if (zsc == false) { this.start() this.strz = true; zsc = true } }); } } }) } iframeS(item) { var c = document.createElement('a') c.classList.add('zfc-target') c.innerHTML = ` ${item.link} ` c.querySelector('iframe').addEventListener('load', () => { this.timer = item.time; this.onay = false; var tmr = setInterval(() => { this.timer--; c.querySelector('.zfc-timer').textContent = this.timer; if (this.timer <= 0) { clearInterval(tmr) c.querySelector('.zfc-go-r').textContent = 'Reklamı Geç' this.onay = true } }, 1000); c.querySelector('.zfc-go-r').addEventListener('click', (e) => { if (this.onay == false) { e.preventDefault() } else { document.querySelector('.zfc-ads').innerHTML = '' e.preventDefault() this.start() } }) }) document.querySelector('.zfc-ads').appendChild(c) } videoS(item) { var c = document.createElement('a') c.classList.add('zfc-target') c.href = item.redirect; c.target = '_blank' c.innerHTML = ` ` c.querySelector('video').load() c.querySelector('video').addEventListener('loadeddata', () => { c.querySelector('video').play(); this.timer = item.time; this.onay = false; var tmr = setInterval(() => { this.timer--; c.querySelector('.zfc-timer').textContent = this.timer; if (this.timer <= 0) { clearInterval(tmr) c.querySelector('.zfc-go-r').textContent = 'Reklamı Geç' this.onay = true } }, 1000); c.querySelector('.zfc-go-r').addEventListener('click', (e) => { if (this.onay == false) { e.preventDefault() } else { document.querySelector('.zfc-ads').innerHTML = '' e.preventDefault() this.start() } }) }) document.querySelector('.zfc-ads').appendChild(c) } start() { if (this.index + 1 > zfcAds.length) { document.querySelector('.zfc-ads').remove() } else { if (this.ads[this.index].type == 'iframe') { this.iframeS(this.ads[this.index]) } else { this.videoS(this.ads[this.index]) } this.index++; } } str() { this.startV() } } if (document.querySelector('.video-content .autosize-container')) { var zfc = new user('.video-content .autosize-container', zfcAds); zfc.str(); }