Tip: You can modify some of the code before running
<p> <meta content= "text/html;charset=gb2312" http-equiv= "Content-type"/></p> <!--<body> Between </body>--><script language= "JavaScript" > {var ua = navigator.useragent; var $IE = (Navigator.appname = = "Microsoft Internet Explorer"); var $IE 5 = $IE && (ua.indexof (' msie 5 ')!=-1); var $IE 5_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 $NS 7 = ua.indexof (' NETSCAPE/7 ')!=-1; var $NS = ua.indexof (' netscape/7.1 ')!=-1; if ($Opera) {$IE = true; $Gecko = false; $Safari = false; } if ($IE 5) {$IE = true; $Gecko = false; $Safari = false; } function $_t (root,tag,id) {var ar=root.getelementsbytagname (tag); for (Var i=0;i<ar.length;i++) {if (ar[i].id==i d) return ar[i]; return null; function _ (Root) {var ids=arguments var i0=0; if Typeof (root) = = ' string ') root = document; else i0=1; for (Var i=i0;i<ids.length;i++) {var s=root.getelementsbytagname ("*"); var Has=false; for (Var j=0;j<s.length;j++) {if (S[j].id==ids[i]) {root=s[j]; Has=true; Break } if (!has) return null; return root; }//util function $dele (O,FN,RV) {var r = function () {var S=arguments.callee; var args = []; for (Var i=0;i<s.length;i++) args[i]=s[i]; var argstr = Args.join (","); if (Argstr.length > 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;} /* Get event for a element; */function $gte (E,ev) {if (!e.getelementbyid) e=e.ownerdocument; if ($IE) {return ev!=null? ev:e.parentwindow.even T else {return EV; throw New ErroR ("This can be 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;i<ar.length;i++) {Ar[i] (e); }} lst.flist=[]; n["$__listener_" +E]=LST; n["on" +e]=n["$__listener_" +e]; var flist=n["$__listener_" +e].flist; Flist[flist.length]=l; else {N.addeventlistener (e,l,b);}} function $cancelEvent (e) {if ($IE) {e.returnvalue = false; E.cancelbubble = true; else E.preventdefault (); }; function $cpAttr (o,p) {for (var i in P) {var s=p[i]; O[i]=s; return o; The function $getValue (v,d) {return v==null? d:v} var $gv = $getValue; var $dom ={Parseint:function (s) {if (s = null | | | s = = ' | | | typeof (s) = ' undefined ') return 0; return parseint (s); }, Getclientsize:function (n) {if ($IE) {//ts ("This is IE"); var s= {x:n.clientleft,y:n.clienttop}; s.l=s.x; S.t=s.y; S.r=n.clientright; S.b=n.clientbottom; S.w=n.clientwidth; S.h=n.clientheight; TR ("Calculated client size"); return s; else {var T=n.style; if (t.borderleftwidth.length==0 | | t.bordertopwidth.length==0 | | t.borderrightwidth.length==0 | | t.borderbottomwidth.length==0) {var l=n.offsetwidth; T.borderleftwidth= "0px"; L-=n.offsetwidth; var r=n.offsetwidth; T.borderrightwidth= "0px"; R-=n.offsetwidth; var o=n.offsetheight; T.bordertopwidth= "0px"; O-=n.offsetheight; var b=n.offsetheight; T.borderbottomwidth= "0px"; B-=n.offsetheight; t.borderleftwidth=l+ "px"; t.bordertopwidth=o+ "px"; t.borderrightwidth=r+ "px"; t.borderbottomwidth=b+ "px"; var s={l:l,r:r,t:o,b:b,x:l,y:o}; return s; else {var s= {x:this.parseint (n.style.borderleftwidth), Y:this.parseint (N.style.bordertopwidth), R:this.parseint (N.style.bordeRrightwidth), B:this.parseint (N.style.borderbottomwidth)}; s.l=s.x; S.t=s.y; return s; }}, Getsize:function (N,withmargin) {var c={x:n.offsetwidth!= null n.offsetwidth:0, Y:N.OFFSE Theight!= null? N.OFFSETHEIGHT:0}; C.x=this.parseint (c.x); C.y=this.parseint (C.Y); TR ("Get size for:" +n.id); TRA (c); if (withmargin) {var m=this.getmargin (n); C.X+=M.L+M.R; C.Y+=M.T+M.B; }//tra (M); TR ("Get size for:" +n.id); TRA (c); return C; }, Setsize:function (Elmt,x,y,withmargin) {//TF ("$dom:: SetSize"); if (elmt==undefined | | elmt.style.display== "NONE") return; if ($IE) {if (withmargin) {var m=this.getmargin (ELMT); X-=M.L+M.R; Y-=M.T+M.B; } elmt.style.width=x; Elmt.style.height=y; else {var clientsize=this.getclientsize (ELMT); var DX=CLIENTSIZE.L+CLIENTSIZE.R; var dy=clientsize.t+clientsize.b; Elmt.style.width=x-dx+ "px"; elmt.style.height=y-dy+ "px"; }, * * Get the context position relative to its parent. * * Getposition:function (Elmt,withmargin) {var C; c={x:elmt.offsetleft, y:elmt.offsettop}; C.x=this.parseint (c.x); C.y=this.parseint (C.Y); if (withmargin) {var m=this.getmargin (ELMT); C.X-=M.L; c.y-=m.t; return C; }, Setposition:function (Elmt,x,y,withmargin) {//TF ("$dom:: SetPosition"); if (withmargin) {//var m=this.getmargin (ELMT); X-=M.L; y-=m.t; } elmt.style.left=x+ "px"; elmt.style.top=y+ "px"; }, Setalpha:function (n,a) {return; N.style.filter = "Progid:DXImageTransform.Microsoft.Alpha (opacity=" +a*100+ ");"; N.style.opacity = A; N.style.mozopacity = A; } var $motion ={smooth:function (S, E, T) {if (t>1) 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 = "Http://www.zzsky.cn/effect/images/200902190925/2007-06-28/U814P346T1D1076F6DT20070725145920.gif"; This.imgmax = "Http://www.zzsky.cn/effect/images/200902190925/2007-06-28/U814P346T1D1076F352DT20070725145920.gif "; } Static members 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; Create popup holder & config it. 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); Create popup content Holder & config it. 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//$dom. SetPosition (t, 0, C.heig HT);//hide it at the I//create content holder ' s content. A close button & an iframe for loading external content. t.innerhtml = "" + "" + "<iframe id= '" +this.id+ "_content_iframe ' src= "+c.contenturl+" frameborder=0 scrolling=no width= ' 100% ' height= ' ></iframe> '; var sbtn = This.switchbutton = $_t (t, ' a ', "Switchbutton"); Sbtn.style.csstext= ' Position:absolute; Z-index:2; font-size:0px; line-height:0px; left:220px; top:6px; width:15px; height:15px; Background-image:url ("Yun_qi_img/u814p346t1d1076f6dt20070725145920.gif"); '; $addEL (SBTN, "click", $dele (This, "Switchmode"), true); $addEL (SBTN, "click", $cancelEvent, True); var btn = $_t (t, ' a ', "CloseButton"); Btn.style.csstext= ' Position:absolute; Z-index:2; font-size:0px; line-height:0px; left:240px; top:6px; width:15px; height:15px; Background-image:url ("Yun_qi_img/u814p346t1d1076f354dt20070725152720.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); 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); Initialize position at once. 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 () {//alert ("minimize"); this.mm = "min"; This.movetargetposition = this.config.height-28; 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 () {//alert ("maximize"); 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 () {//alert ("switch"); 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 = $dom. GetPosition (this.content). Y;//parseint (This.content.style.top); 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.content.style.top = y + "px"; THIS.CONFIG.POSITION.Y = y; This.onresize (); if (t >= total) {this.onfinishmove (); }, Onfinishmove:function () {this.stopmove (); This.content.style.top = this.movetargetposition + "px"; 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 t=document.body; 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) {var cookievalue = ""; var search = name + "="; if (Document.cookie.length > 0) {offset = document.cookie.indexOf (search); if (offset!=-1) {offset + = search.length; End = Document.cookie.indexOf (";", offset); if (end = = 1) end = Document.cookie.length; Cookievalue = unescape (document.cookie.substring (offset, End)}} return cookievalue; The 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 + ";p ath=/"; }/* Main function to config the pop-up window & run it. * Web Deployer change codes this to Manipulte popups performance. * & should not codes the out of this function. */Function Job () {/* Config object/var cfg={//width & height of the popup window, these values should being de termined debpended on inner contents. width:260, height:190,//distance to the bottom & the right edge. Bottom:2, right:19,//switch of displaying the popup display:true,//content URL contentURL : "Http://www.zzsky.cn/effect/images/200902190925/01.html",//time configuration,in seconds time: {Slidein : 1, Hold:60, slideout:1}}//at what time the popup should Display,in-hours:0~23,//the n Umber after Add symbol means after how many the hours to display popup for the next time. var displaytimelist = ["7+7"]; The popup displays each time Thie page reload or only to once at the the "" "Page loaded. Once/eachtime//var DisplayMode = "Once"; var DisplayMode = "Eachtime"; Cookie name storing the next time to display popup var cookiename= "Sina_blog_popup_next_display_time"; * *---------------------from here below, the codes should is modified. * * var hours={}; var delays=[]; for (Var i=0;i<displaytimelist.length;i++) {var o = displaytimelist[i]; var ar = o.split ("+"); var t = parseint (ar[0]); for (Var m=0;m<ar.length-1;m++) {ar[m]=ar[m+1]; } hours[t]=true; for (Var j=0;j<ar.length;j++) {hours[t + parseint (ar[j])]=true; }} displaytimelist=[]; for (var i in hours) {var s = parseint (i); if (isNaN (s)) continue; Displaytimelist[displaytimelist.length]=s; } displaytimelist = Displaytimelist.sort (); Alert (displaytimeList); var pp = new PopUp ("XP", CFG); WINDOW.__POPUP=PP; Pp.create (); Display:var N=readcookie (cookiename); if (displaymode== "Eachtime") pp.show (); else {var tm=new Date (). GetTime (); if (N==null | | tm>n) {pp.show (); Get next display time var hr=new Date (). GetHours (); var f = 60*60*1000; var L = displaytimelist.concat (), len = L.length; for (var i = 0; i < len; i++) L[len + i] = L[i] + 24; for (var i = 0; i < l.length && hr >= l[i]; i++); var dt = new Date (); Dt.sethours (L[i] > L[i]-24:l[i]); var nexttime = Dt.gettime (); if (L[i] >) Nexttime + = f * 24; Writecookie (CookieName, Nexttime, 24); }} function doit () {if (document.readystate = = ' Loaded ' | | | document.readystate = = ' complete ') {Job ()} else{window.settimeout (doit,500); Return } doit (); </script>
Tip: You can modify some of the code before running