📄 680.js
字号:
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.height);//hide it at first
// create content holder's content.
// a close button & an iframe for loading external content.
/*
t.innerHTML = "<a id='closeButton' href='#'></a>"+
"<a id='switchButton' href='#'></a>"+
"<iframe id='"+this.id+"_content_iframe' src="+c.contentUrl+" frameborder=0 scrolling=no width='100%' height='100%'></iframe>";
*/
//2008-8-30 修改 开始
var html = "<a id='closeButton' href='#'></a>"+
"<a id='switchButton' href='#'></a>"+
"<div id='ifm_div' style='height:190px;'><iframe id='"+this.id+"_content_iframe' src="+c.contentUrl+" frameborder=0 scrolling=no width='100%' height='100%'></iframe></div>";
if(typeof(quitAdSrc)!='undefined' && quitAdSrc!=null && quitAdSrc!=''){
html+='\
<div style="position:absolute;left:0;top:0;z-index:10;visibility:hidden;" id="closeswf_div">\
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="260" height="190" align="middle">\
<param name="allowScriptAccess" value="always" />\
<param name="wmode" value="transparent" />\
<param name="movie" value="'+quitAdSrc+'" />\
<param name="flashvars" value="adlink='+escape(quitAdUrl)+'" />\
<param name="menu" value="false" />\
<param name="quality" value="high" />\
<param name="bgcolor" value="#FFFFFF" />\
<embed src="'+quitAdSrc+'" flashvars="adlink='+escape(quitAdUrl)+'" menu="false" quality="high" bgcolor="#FFFFFF" width="260" height="190" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
</object>\
<div style="position:absolute:left:0;top:0;z-index:1;">'+quitAdCount+'</div>\
</div>';
}
t.innerHTML = html;
//2008-8-30 修改 结束
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("http://i2.sinaimg.cn/blog/mini/08olympic/blogrecommend_hz_004.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("http://i1.sinaimg.cn/blog/mini/08olympic/blogrecommend_hz_003.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();
*/
//2008-8-30 修改 开始
this.status = PopUp.MOVE_DOWN;
this.stopMove();
if(typeof(quitAdSrc)!='undefined' && quitAdSrc!=null && quitAdSrc!='' && this.mm == "max"){
$_t(this.content,'a',"closeButton").style.visibility = 'hidden';
$_t(this.content,'a',"switchButton").style.visibility = 'hidden';
$_t(this.content,'div',"ifm_div").style.visibility = 'hidden';
var closeswf_div = $_t(this.content,'div',"closeswf_div");
closeswf_div.style.visibility = 'visible';
var p = this.popup;
setTimeout(function(){p.innerHTML='';},3500);
}else{
this.moveTargetPosition = this.config.height;
this.status = PopUp.MOVE_DOWN;
this.startMove();
}
//2008-8-30 修改 结束
},
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.imgMin1) > -1) {
bg = bg.replace(this.imgMin1,this.imgMin2);
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.imgMin2) > -1) {
bg = bg.replace(this.imgMin2,this.imgMin1);
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;
}
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=/";
}
/**
* main function to config the pop-up window & run it.
* web deployer change codes here to manipulte popups performance.
* & should not change codes out of this function.
*/
function job(){
/**
* config object
*/
var cfg={
//width & height of the popup window ,these values should be determined debpended on inner contents.
width : 260,
height : 190,
//distance to the bottom & the right edge.
bottom : 2,
right : 1,
//switch of displaying the popup
display : true,
//content url
contentUrl : "http://blog.sina.com.cn/lm/mini/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 number 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 once at the first time 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 NOT be 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] > 23 ? l[i] - 24 : l[i]);
var nextTime = dt.getTime();
if (l[i] > 23) nextTime += f * 24 ;
writeCookie(cookieName, nextTime, 24);
}
}
}
function doit(){
if($IE){
if(document.readyState == 'loaded' || document.readyState == 'complete'){
job();
}else{
window.setTimeout(doit,500);
return;
}
}
else{
job();
}
}
doit();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -