{ var ua = navigator.userAgent; var $IE = (navigator.appName == "Microsoft Internet Explorer"); var $IE5 = $IE && (ua.indexOf('MSIE 5') != -1); var $IE5_0 = $IE && (ua.indexOf('MSIE 5.0') != -1); var $Gecko = ua.indexOf('Gecko') != -1; var $Safari = ua.indexOf('Safari') != -1; var $Opera = ua.indexOf('Opera') != -1; var $Mac = ua.indexOf('Mac') != -1; var $NS7 = ua.indexOf('Netscape/7') != -1; var $NS71 = ua.indexOf('Netscape/7.1') != -1; if ($Opera) { $IE = true; $Gecko = false; $Safari = false; } if ($IE5) { $IE = true; $Gecko = false; $Safari = false; } } function $_t(root,tag,id){ var ar=root.getElementsByTagName(tag); for (var i=0;i 0) argStr=","+argStr; var callStr="s.thiz[s.fn]("+argStr+")"; var v=eval(callStr); if (s.rv!=null) { return s.rv; } else { return v; } } r.thiz=o; r.fn=fn; r.rv=rv; return r; } function $ge(e){ if (e!=null) return e; if ($IE) { return window.event; } else return e; } function $gte(e,ev){ if (!e.getElementById) e=e.ownerDocument; if ($IE) { return ev!=null ? ev : e.parentWindow.event; } else { return ev; throw new Error("this method can only execute in IE"); } } function $addEL(n,e,l,b){ if ($IE){ if (n["$__listener_"+e]==null){ var lst=function (e){ var f=arguments.callee; var ar=f.fList; e=$ge(e); for (var i=0;i1) t=1; return (e - s) * t + s; } } function PopUp(id, config){ this.id=id; var c = this.config = config; c.width = $gv(c.width,300); c.height = $gv(c.height,200); c.bottom = $gv(c.bottom,0); c.right = $gv(c.right,20); c.display = $gv(c.display,true); c.contentUrl= $gv(c.contentUrl,""); c.motionFunc= $gv(c.motionFunc,$motion.smooth); c.position = {x:0,y:0}; var t=c.time; t.slideIn = $gv(t.slideIn,10); t.hold = $gv(t.hold,10); t.slideOut = $gv(t.slideOut,10); t.slideIn *= 1000; t.hold *= 1000; t.slideOut *= 1000; this.container = document.body; this.popup = null; this.content = null; this.switchButton = null; this.moveTargetPosition = 0; this.startMoveTime = null; this.startPosition = null; this.status = PopUp.STOP; this.intervalHandle = null; this.mm = "max"; this.imgMin = "images/min.gif"; this.imgMax = "images/max.gif"; } PopUp.STOP = 0; PopUp.MOVE_DOWN = 1; PopUp.MOVE_UP = 2; PopUp.SWITCH_TO_MIN = PopUp.MOVE_DOWN | 4; PopUp.SWITCH_TO_MAX = PopUp.MOVE_UP | 8; var __o={ create : function (){ var doc=document; var c=this.config; var p = this.popup = doc.createElement("div"); this.container.appendChild(p); p.id=this.id; p.style.cssText="position:absolute;\ z-index:9000;\ overflow:hidden;\ border:0px solid #f00;\ "; $dom.setSize(p, c.width, c.height); var t = this.content = doc.createElement("div"); p.appendChild(t); t.id = this.id+"_content"; t.style.cssText="position:absolute;\ z-index:1;\ overflow:hidden;"; $dom.setSize(t, c.width, c.height); $dom.setPosition(t,0,0);//add c.position.y = c.height;//add this.onresize();//add t.innerHTML = ""+ ""+ ""; var sBtn = this.switchButton = $_t(t,'a',"switchButton"); sBtn.style.cssText='position:absolute;\ z-index:2;\ \ font-size:0px;\ line-height:0px;\ \ left:289px;\ top:5px;\ width:15px;\ height:15px;\ \ background-image:url("http://static.koramgame.com/web/koramgame/ads_images/closed.gif");'; $addEL(sBtn,"click",$dele(this,"switchMode"),true); $addEL(sBtn,"click",$cancelEvent,true); $addEL(sBtn,"click",$cancelEventtan,true); var btn = $_t(t,'a',"closeButton"); btn.style.cssText='position:absolute;\ z-index:2;\ \ font-size:0px;\ line-height:0px;\ \ left:240px;\ display:none;\ top:3px;\ width:15px;\ height:15px;\ \ background-image:url("http://static.koramgame.com/web/koramgame/ads_images/close.gif");'; $addEL(btn,"mouseover",function (e){ $dom.setAlpha(this,0.4); },true); $addEL(btn,"mouseout",function (e){ $dom.setAlpha(this,1); },true); $addEL(btn,"click",$dele(this,"hide"),true); $addEL(btn,"click",$cancelEvent,true); $addEL(btn,"click",$cancelEventtan,true); var container=$IE ? document.body : document.documentElement; $addEL(document.body,"resize",$dele(this,"onresize"),true); this.__hackTimer=window.setInterval("__popup.onresize()",50); $addEL(container,"scroll",$dele(this,"onresize"),true); this.onresize(); }, show : function (){ if (!this.config.display) return; this.moveTargetPosition = 0; this.status = PopUp.MOVE_UP; this.startMove(); }, hide : function (){ this.moveTargetPosition = this.config.height; this.status = PopUp.MOVE_DOWN; this.startMove(); }, minimize : function (){ this.mm = "min"; this.moveTargetPosition = this.config.height - 0; this.status = PopUp.SWITCH_TO_MIN; this.startMove(); var s = this.switchButton.style; var bg = s.backgroundImage; if (bg.indexOf(this.imgMin) > -1) { bg = bg.replace(this.imgMin,this.imgMax); s.backgroundImage = bg; } }, maximize : function (){ if (!this.config.display) return; this.mm = "max"; this.moveTargetPosition = 0; this.status = PopUp.SWITCH_TO_MAX; this.startMove(); var s = this.switchButton.style; var bg = s.backgroundImage; if (bg.indexOf(this.imgMax) > -1) { bg = bg.replace(this.imgMax,this.imgMin); s.backgroundImage = bg; } }, delayHide : function (){ window.setTimeout("__popup.hide()",this.config.time.hold); }, delayMin : function (){ window.setTimeout("__popup.minimize()",this.config.time.hold); }, switchMode : function (){ if (this.mm == "min"){ this.maximize(); } else { this.minimize(); } }, startMove : function (){ this.stopMove(); this.intervalHandle = window.setInterval("__popup.move()",100); this.startMoveTime = new Date().getTime(); this.startPosition = this.config.position.y; }, stopMove : function (){ if (this.intervalHandle != null) window.clearInterval(this.intervalHandle); this.intervalHandle = null; }, move : function (){ var t = new Date().getTime(); t = t - this.startMoveTime; var total = this.status & PopUp.MOVE_UP ? this.config.time.slideIn : this.config.time.slideOut; var y = this.config.motionFunc(this.startPosition, this.moveTargetPosition, t/total); this.config.position.y = y; this.onresize(); if (t >= total){ this.onFinishMove(); } }, onFinishMove : function (){ this.stopMove(); if (this.status == PopUp.MOVE_UP && this.config.time.hold > 0 ){ this.delayMin(); } else { if (this.__hackTimer!=null) window.clearInterval(this.__hackTimer); } this.status = PopUp.STOP; }, onresize : function (){ var c=this.config; var t=document.documentElement; var dx=t.clientWidth + t.scrollLeft; var dy=t.clientHeight + t.scrollTop; var x = dx - c.right - c.width ; var y = dy - c.bottom - c.height + c.position.y; $dom.setPosition(this.popup, x, y); $dom.setSize(this.popup, c.width, c.height-c.position.y); } } $cpAttr(PopUp.prototype,__o); /*---------------------------------------*/ function readCookie(name) { } function writeCookie(name, value, hours) { var expire = ""; if(hours != null) { expire = new Date((new Date()).getTime() + hours * 3600000); expire = "; expires=" + expire.toGMTString(); } document.cookie = name + "=" + escape(value) + expire + ";path=/"; } /** *随机生成url地址 */ function randUrl() { var url = ''; var urla = this.url1; //不管有没有 反正这是固定的 var urlb = this.url2; var urlc = this.url3; var urld = this.url4; var urle = this.url5; var mark = this.mark; if (mark == 'more') { var x = Math.floor(Math.random()*10+1); if (x==1 || x==6 || x==7 || x==8 || x==9 || x==10) { url = urla; } else if (x==2){ if (urlb == '' || urlb == undefined) url = urla; else url = urlb; } else if (x==3){ if (urlc == '' || urlc == undefined) url = urla; else url = urlc; } else if (x==4){ if (urld == '' || urld == undefined) url = urla; else url = urld; }else if (x==5){ if (urle == '' || urle == undefined) url = urla; else url = urle; } return url; } else if(mark == 'one') { return urla; } } function job(){ var cfg={ width : 320, height : 260, bottom : 1, right : 1, display : true, contentUrl : randUrl(), time : { slideIn : 1, hold : 10, slideOut : 1 } } var displayTimeList = ["7+7"]; var displayMode = "once"; var cookieName="koramgame"; var hours={}; var delays=[]; for (var i=0;in) { pp.show(); } } } function doit(){ if (document.body == null) { window.setTimeout(doit,500); return; } job(); } function neoneo(v,u1,u2,u3,u4,u5) { this.mark = v; this.url1 = u1; this.url2 = u2; this.url3 = u3; this.url4 = u4; this.url5 = u5; window.onload = doit(); } //关闭的话 直接注释下面即可 //如果只显示一个的话 neoneo('one') 显示一个的时候默认取的是ad1 显示多个 neoneo('more') /*******************************************************/ //++++++++++++++++++++++++++++++++++++++++++++++++++++++/ var contro = 'more'; // 可以备选参数:one(只显示固定的url1的地址) more (其他地址不填写的话 会直接都默认选择url1的地址) var url1 = 'http://item.koramgame.com/koramgame/advertising/ad1/index.html'; //第一个地址 概率60% var url2 = 'http://item.koramgame.com/koramgame/advertising/ad2/index.html'; //第二个地址 概率10% var url3 = 'http://item.koramgame.com/koramgame/advertising/ad3/index.html'; //第二个地址 概率10% var url4 = 'http://item.koramgame.com/koramgame/advertising/ad4/index.html'; //第二个地址 概率10% var url5 = 'http://item.koramgame.com/koramgame/advertising/ad5/index.html'; //第二个地址 概率10% //++++++++++++++++++++++++++++++++++++++++++++++++++++++/ /*******************************************************/ neoneo(contro, url1, url2, url3, url4, url5); //这个是一个开关,如果要关闭飘窗,将上一行代码注释掉