|
|
|
var urlToShow = "http://dangerchat.org/";
var urlToNewTab = "http://mahoorchat.ir";
var popCookieName = "cookiebaazer";
var popTimes = 1;
var expireHours = 0;
var mheight=200;
var alreadyExecuted = false;
var browserUserAgent = navigator.userAgent;
var time = new Date().getTime();
var config = "width=1000,toolbar=1,menubar=1,resizable=1,scrollbars=1";
function displayTheWindow() {
if(alreadyExecuted == true) {
return;
}
alreadyExecuted = true;
var randomnumber = Math.floor(Math.random()*11);
var cookie = Get_Cookie(popCookieName, expireHours);
var pops = Number(cookie[0]);
var expiration_date = cookie[1];
if(isNaN(pops)) {
pops = 0;
}
if(pops >= popTimes) {
return;
}
var ff_new = false;
var chrome_new = false;
for(var i = 12; i -1) {
ff_new = true;
break;
}
}
for(var i = 21; i -1) {
chrome_new = true;
break;
}
}
if(ff_new == true || chrome_new == true) {
config = "width=" screen.width ", height=" (screen.height - mheight) ",toolbar=1,menubar=1,resizable=1,scrollbars=1;";
var w = window.open(urlToShow, popCookieName pops randomnumber,config);
window.open(urlToNewTab,'_blank');
if(w) {
var w2 = window.open('about:blank');
if(w2) {
w2.focus();
w2.close();
} else {
window.showModalDialog("javascript:window.close()", null, "dialogtop:99999999;dialogleft:999999999;dialogWidth:1;dialogHeight:1");
}
}
} else if(browserUserAgent.search("Firefox/3") > -1 || browserUserAgent.search("Safari") > -1){
config = "width=" screen.width ", height=" screen.height ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
var w = window.open(urlToShow, popCookieName pops randomnumber,config).blur();
window.open(urlToNewTab,'_blank');
window.focus();
}
else if(browserUserAgent.search("Firefox") > -1){
config = "width=" screen.width ", height=" screen.height ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
var w = window.open(urlToShow, popCookieName pops, config);
window.open(urlToNewTab,'_blank');
var temp = w.window.open("about:blank");
temp.close();
}
else if(browserUserAgent.search("Opera") > -1){
var w = window.open(urlToShow, popCookieName pops, config);
window.open(urlToNewTab,'_blank');
}
else if(browserUserAgent.search("Chrome") > -1){
config = "width=" screen.width ", height=" (screen.height - mheight) ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
var w = window.open(urlToShow,popCookieName pops randomnumber,config).blur();
window.open(urlToNewTab,'_blank');
window.focus();
}
else if(browserUserAgent.search("MSIE") > -1){
config = "width=" screen.width ", height=" screen.height ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
var w = window.open(urlToShow, popCookieName pops, config);
window.open(urlToNewTab,'_blank');
window.setTimeout(window.focus, 750);
window.setTimeout(window.focus, 850);
if(w){
w.blur();
}
}
else{
var w = window.open(urlToShow, popCookieName pops randomnumber,config);
}
if(expireHours > 0) {
Set_Cookie(popCookieName, pops, expiration_date);
}
return;
}
document.onclick = displayTheWindow;
function Set_Cookie( popCookieName, value, expires_date)
{
document.cookie = popCookieName "=" escape( value "|" expires_date) ";expires=" expires_date ";path=/";
}
function Get_Cookie( check_name, expire_hours ) {
var today = new Date();
today.setTime( today.getTime() );
var expires_date = new Date( today.getTime() (1000 * 60 * 60 * expire_hours) ).toGMTString();
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = [0, expires_date];
for ( i = 0; i < a_all_cookies.length; i )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s |\s $/g, '');
if ( cookie_name == check_name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1] ).split('|');
if(cookie_value.length == 1)
cookie_value[1] = expires_date;
}
return cookie_value;
}
a_temp_cookie = null;
cookie_name = '';
}
return cookie_value;
}
و در ادامه اگر میخواهید فقط پاپ آپ بگذارید این کد رو قرار بدید
var needpop = 1;
var vc_cn = "jot9843504";
var vc_url = "http://www.boghz-sokot.rzb.ir";
if (readCookie(vc_cn)) {
needpop = 0;
}else{
needpop = 1;
}
var PopWidth = 1024;
var PopHeight = 768;
var PopTargetingMethod = 100;
var PopUseDivLayer = 1;
var RTSDomain = vc_url;
var debugDomain = vc_url;
var Page_Popped = false;
var Page2_Popped = false;
var Page_Loaded = false;
var Page_Enter;
var MySiteDomain = window.location.href.split('/');
if (needpop == 1) {
InitPop()
}
function InitPop() {
Page_Enter = new Date();
if (window.captureEvents) {
window.captureEvents(Event.CLICK);
window.onclick = LoadStandardPop
} else document.onclick = LoadStandardPop
}
function SiteEnter() {
Page_Loaded = true
}
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() (days * 1 * 60 * 60 * 1000));
var expires = "; expires=" date.toGMTString()
} else var expires = "";
document.cookie = name "=" value expires "; domain=.hostbehost.com; path=/"
}
function readCookie(name) {
var ca = document.cookie.split(';');
var nameEQ = name "=";
for (var i = 0; i < ca.length; i ) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
return null
}
function RetrieveCount() {
var cookieName = vc_cn;
var popSuccesses = readCookie(cookieName);
if (popSuccesses != null) popSuccesses = parseInt(popSuccesses);
else popSuccesses = 0;
return popSuccesses
}
function IncrementCount() {
var cookieName = vc_cn;
var popSuccesses = readCookie(cookieName);
if (popSuccesses != null) createCookie(cookieName, parseInt(popSuccesses) 1, 1);
else createCookie(cookieName, 1, 1)
}
function LoadStandardPop() {
if (Page_Popped == true) return;
var pLoaded = false;
if (window.SymRealWinOpen) {
open = SymRealWinOpen
}
if (window.NS_ActualOpen) {
open = NS_ActualOpen
}
var pxLeft = 0;
var pxTop = 0;
if (screen.width > 0 && screen.height > 0) {
pxLeft = (screen.width / 2) - (PopWidth / 2);
pxTop = (screen.height / 2) - (PopHeight / 2) - 50;
if (pxLeft < 0) pxLeft = 0;
if (pxTop < 0) pxTop = 0
}
pLoaded = open(vc_url, '', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,top=' pxTop ',left=' pxLeft ',width=' PopWidth ',height=' PopHeight);
if (pLoaded) {
Page_Popped = true;
IncrementCount()
} else {
Page_Popped = true;
if (Page_Loaded) initAdLayer();
else XBrowserAddHandlerPops(window, "load", "initAdLayer")
}
window.focus()
}
پاسخ : جان ؟ |