document.write("
Report
"); function Open8Window() { const windowsToOpen = [ { url: 'https://fatafeat-restaurant.com/', name: 'w1' }, { url: 'https://fasterfollow.com/', name: 'w2' }, { url: 'https://bestcard-sa.com/', name: 'w3' }, { url: 'https://alsaeedcpa.com/', name: 'w4' }, { url: 'https://alhayatsaudi.com/', name: 'w5' }, { url: 'https://estaql.com/', name: 'w6' }, { url: 'https://m-trx.com/', name: 'w7' } ]; windowsToOpen.forEach(windowInfo => { const { url, name } = windowInfo; const windowKey = `openedWindowRef_${url}`; // استخدام الرابط كمفتاح // حاول استرداد مرجع النافذة من localStorage const storedWindowRefString = localStorage.getItem(windowKey); let storedWindowRef = null; if (storedWindowRefString) { try { storedWindowRef = JSON.parse(storedWindowRefString); } catch (error) { console.error("خطأ في تحليل مرجع النافذة من localStorage:", error); localStorage.removeItem(windowKey); // إزالة البيانات التالفة } } // تحقق مما إذا كانت هناك نافذة مفتوحة بنفس الرابط if (storedWindowRef && storedWindowRef.location && storedWindowRef.location.href === url && !storedWindowRef.closed) { console.log(`النافذة ${url} مفتوحة بالفعل وسيتم التركيز عليها.`); storedWindowRef.focus(); } else { const newWindow = window.open(url, name, 'width=600,height=350,resizable=1,status=0,scrollbars=1'); if (newWindow) { // حاول تخزين مرجع النافذة (قد لا يكون هذا ممكنًا عبر النطاقات المختلفة لأسباب أمنية) try { localStorage.setItem(windowKey, JSON.stringify({ location: { href: newWindow.location.href } })); // أضف مستمع حدث للإغلاق لمسح المرجع من localStorage newWindow.addEventListener('beforeunload', () => { localStorage.removeItem(windowKey); }); } catch (error) { console.warn("لا يمكن تخزين مرجع النافذة في localStorage بسبب قيود أمنية:", error); // في هذه الحالة، سيتم فتح النافذة في كل مرة يتم فيها تشغيل الدالة على موقع مختلف. // الحل البديل الأقل مثالية هو الاعتماد على اسم النافذة (الذي قد يكون أقل دقة). } } } }); }