(function() {
// بناء الإعلان باستخدام الصورة الشفافة الجديدة
const popupHTML = `
`;
document.body.insertAdjacentHTML('beforeend', popupHTML);
const overlay = document.getElementById('hunters-master-overlay');
const closeBtn = document.getElementById('close-hunters-btn');
const copyBtn = document.getElementById('copy-trigger-btn');
// ملفات الصوت
const soundPop = new Audio('https://notificationsounds.com/storage/sounds/file-sounds-1150-pristine.mp3');
const soundCopy = new Audio('https://notificationsounds.com/storage/sounds/file-sounds-1148-gloomy.mp3');
const unlockAudio = () => {
soundPop.play().then(() => { soundPop.pause(); soundPop.currentTime = 0; }).catch(() => {});
soundCopy.play().then(() => { soundCopy.pause(); soundCopy.currentTime = 0; }).catch(() => {});
document.removeEventListener('click', unlockAudio);
document.removeEventListener('touchstart', unlockAudio);
};
document.addEventListener('click', unlockAudio);
document.addEventListener('touchstart', unlockAudio);
function closePopup() {
overlay.classList.remove('active-popup');
setTimeout(() => {
overlay.style.display = 'none';
sessionStorage.setItem('hunters_vFinal_seen', 'true');
}, 500);
}
if(closeBtn) closeBtn.onclick = closePopup;
if(copyBtn) {
copyBtn.onclick = function() {
const temp = document.createElement('textarea');
temp.value = "صياد";
document.body.appendChild(temp);
temp.select();
document.execCommand('copy');
document.body.removeChild(temp);
soundCopy.play().catch(() => {});
const toast = document.getElementById('copy-success-toast');
toast.style.display = 'block';
setTimeout(() => {
toast.style.display = 'none';
closePopup();
}, 2000);
};
}
setTimeout(() => {
if (!sessionStorage.getItem('hunters_vFinal_seen')) {
overlay.style.display = 'flex';
soundPop.play().catch(() => {});
setTimeout(() => overlay.classList.add('active-popup'), 50);
}
}, 5000);
})();