هذا الكود الرهيب هو كود صفحة اجبارية يعمل على جميع المتصفحات حتى على Google Chrome المعروف بصعوبة بل واستحالة فتح اي صفحة PopUp أثناء التصفح به
الكود يستخدمه موقع MyEgy المنتدى المعروف
وحتى الآن هو الوحيد الذي يفتح أثناء استخدام Google Chrome
نفتح برنامج NotePad أو NotePad++
نضع فيه الكود التالي
الكود هو
**************
كود:
if (ad_url != '') {
var popupintervaldays = 1;
//we haven't opened a popup (until we know we have)
popupdone = false;
//encapsulated event listener function
//this won't allow the suppression of default action on click event in Safari
//but for these purposes that's fine, because we don't want|need to
function attachEventListener(target, eventType, functionRef)
{
if (typeof target.addEventListener != 'undefined')
{
target.addEventListener(eventType, functionRef, false);
}
else if (typeof target.attachEvent != 'undefined')
{
target.attachEvent('on' + eventType, functionRef);
}
return true;
}
//maybe create a popup (depending on whether we have a cookie)
function maybeCreatePopup()
{
//check for existing popup cookie
cookiearray = document.cookie.split(/;\s*/);
for(entry in cookiearray)
{
if(cookiearray[entry] == 'SPcookie=1') { popupdone = true; break; }
if(cookiearray[entry] == 'SPsub=1') { popupdone = true; break; }
}
//if we haven't already done a popup
if(!popupdone)
{
//add statistical identifying information
//the type is popup because this is a non-specific random popup
//the path tells us where in the site it was triggered from
var now = new Date(), uid = now.getTime() + '-' + now.getMilliseconds() + '-' + Math.floor(Math.random() * 10000000);
var popuphref = 'http://www.google.com/intl/en/'
//open the popup
popupnewwindow = window.open(popuphref, 'popme', 'width=800, height=600, location=yes, menubar=yes, status=yes, toolbar=yes, scrollbars=yes, resizable=yes, left=0, top=0');
//if we don't have the reference or it got supressed
//say that we haven't done a popup
if (!popupnewwindow || popupnewwindow.closed)
{
popupdone = false;
}
//otherwise set a cookie to say that we have
//and then set focus on the popup
else
{
var expire = new Date();
expire.setTime(expire.getTime() + (86400000 * popupintervaldays));
document.cookie = 'SPcookie=1; expires=' + expire.toGMTString() + '; path=/';
popupnewwindow.blur()
window.focus();
}
}
}
//test whether we have cookie support
var popupcookiesenabled = false;
var expire = new Date();
expire.setTime(expire.getTime() + (10000));
document.cookie = 'SPtestcookie=1; expires=' + expire.toGMTString() + '; path=/';
cookiearray = document.cookie.split(/;\s*/);
for (entry in cookiearray)
{
if (cookiearray[entry] == 'SPtestcookie=1')
{
popupcookiesenabled = true;
break;
}
}
//so now then, if we still record cookie support
if(popupcookiesenabled)
{
//bind an encapsulated click handler to the document
//to look for clicks on links that are game for triggering a popup
//and route them to maybeCreatePopup
//this handler needs to be encapsulated, and also handle return values carefully,
//in order to play nicely with the new rel-popup scripting
attachEventListener(document, 'click', function(e)
{
//get event target node
//(remembering that e is already event in IE because we're using attachEvent)
var node = e.target ? e.target : e.srcElement;
//if we're not on the front page
//and this click isn't inside a relevant input elements
//iterate to look for a link reference
var havelink = false;
if(node.nodeName.toLowerCase() == 'a')
{
havelink = true;
}
else
{
while(node.parentNode)
{
if(node.nodeName.toLowerCase() == 'a') { havelink = true; break; }
else if(node.nodeName.toLowerCase() == 'body') { break; }
else { node = node.parentNode; }
}
}
//if we have a link reference
if(havelink)
{
//look for a rel attribute that indicates a custom popup or _blank link
//or a target attribute that is _blank (or _new)
//and continue only if we don't have any of those things
//this is to prevent multiple popups being generated at once
//continue on to conditionally creating a regular popup
maybeCreatePopup();
}
//if we don't have a link reference
//continue on to conditionally creating a regular popup
else { maybeCreatePopup(); }
});
}
}
****************
نبحث عن
كود:
http://www.google.com/intl/en/
نستبدلها بالرابط المراد الإساره اليه بالفتحة الإجبارية
نحفظ الملف باسم New.js
ثم نفتح الصفحة الرئيسية لنضيف كود الطلب لملف Java Script
نكتب في منطقة قبل انتهاءها أي قبل
نكتب التالي:
كود:
<script type="text/javascript" src="new.js"></script>
مع مراعاة مسار الملف New.js المشار إليه بالأحمر فيجب أن يكون هو نفس الملف بعدما تقوم برفعه على موقعك.
ملحوظة: هذا الكود يعمل بالكوكيز لذلك لن يفتح كل مرة تفتح فيها الموقع فقط أول مرة ثم عند مسح ملفات الكوكيز يعمل ثانية.