النتائج 1 إلى 5 من 5

الموضوع: كود صفحة اجبارية يعمل على جميع المتصفحات

  1. #1
    عضو جديد
    تاريخ التسجيل
    Jan 2009
    المشاركات
    16

    Thumbs up كود صفحة اجبارية يعمل على جميع المتصفحات



    هذا الكود الرهيب هو كود صفحة اجبارية يعمل على جميع المتصفحات حتى على 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

    نكتب في منطقة
    كود:
    <head>
    قبل انتهاءها أي قبل

    كود:
    </head>
    نكتب التالي:

    كود:
    <script type="text/javascript" src="new.js"></script>
    مع مراعاة مسار الملف New.js المشار إليه بالأحمر فيجب أن يكون هو نفس الملف بعدما تقوم برفعه على موقعك.


    ملحوظة: هذا الكود يعمل بالكوكيز لذلك لن يفتح كل مرة تفتح فيها الموقع فقط أول مرة ثم عند مسح ملفات الكوكيز يعمل ثانية.







  2. #2

  3. #3
    عضو جديد
    تاريخ التسجيل
    Jan 2009
    المشاركات
    16


    العفو يا أخي
    أتمنى أنك تكون استفدت






  4. #4
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2005
    المشاركات
    325


    بارك الله فيك أخي ,,
    سوف أقوم بتجربته في وقت لاحق بإذن الله عز وجل
    عند الحاجة
    جزاك الله خير





    __________________
    شبكة النصيرات للفن الإسلامي
    http://www.nnw1.net/media

  5. #5
    عضو سوبر نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    937


    السلام عليكم

    للاسف عزيزي مش شغالة نهائيا
    حتى على الاكسبلورر 6










ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض