abcdeaa CCYYysssss
关注数: 1 粉丝数: 91 发帖数: 2,773 关注贴吧数: 10
if(!Array.prototype.push){Array.prototype.push=function (){var startLength=this.length;for(var i=0;i#000000",bColor:"#FFFFFF",tColor:"#709CD2",wColor:"#FFFFFF"}; this.winform = null; this.winbox = null; this.overlay = null; this.dropClass = null; this.someToHidden=[]; if(!this.config.isHaveTitle)this.config.isSupportDraging=false; this.iniBuild(); }, setContent:function (arrt,val){ if(val!=''){ switch(arrt){ case 'width':this.config.width=val; break; case 'height':this.config.height=val;break; case 'title':this.info.title=val;break; case 'contentUrl':this.info.contentUrl=val;break; case 'contentHtml':this.info.contentHtml=val;break; case 'callBack':this.info.callBack=val;break; case 'parameter':this.info.parameter=val;break; case 'confirmCon':this.info.confirmCon=val;break; case 'alertCon':this.info.alertCon=val;break; case 'someHiddenTag':this.info.someHiddenTag=val;break; case 'someHiddenEle':this.info.someHiddenEle=val;break; case 'overlay':this.info.overlay=val;break; case 'framename':this.info.framename=val;break; case 'boxstyle':this.config.boxstyle=val;break; }; }; }, setContents:function(options){ if(null == options || {} == options) return; for(var key in options) this.setContent(key, options[key]); }, iniBuild:function (){ this.winform = document.createElement('div'); document.body.appendChild(this.winform); }, build:function (){ var pos = this.getPos(); var barheight = this.config.boxstyle=='gray' ? 31 : 40; this.config.height += this.config.boxstyle=='gray' ? 0 : 18; var poshandley = barheight/2; var bordercolor = this.config.boxstyle=='gray' ? '#c6c6c6' : '#9dccf6'; var formstyle = 'z-index:10000;position:absolute;top:0;left:0;width:100%;height:100%;'; var winstyle = 'z-index:2;position:absolute;top:'+pos.y+'px;left:'+pos.x+'px;width:'+this.config.width+'px;height:'+this.config.height+'px;' var boxstyle = 'z-index:2;position:absolute;top:0;left:0;width:'+this.config.width+'px;height:'+this.config.height+'px;background:#fff;border:1px solid '+bordercolor+';'; var barstyle = this.config.boxstyle=='gray' ? 'position:relative;height:20ppx;padding:5px 10px;overflow:hidden;border-bottom:1px solid #c6c6c6;background:#e6e6e6 url() repeat-x 0 -1568px;': 'position:relative;height:20px;padding:10px;overflow:hidden;' var handlestyle = 'cursor:pointer;position:absolute;right:10px;top:'+poshandley+'px;margin-top:-9px;width:18px;height:18px;overflow:hidden;background:url() no-repeat -192px -172px;'; var shadowstyle = 'z-index:1;position:absolute;top:6px;left:6px;width:'+this.config.width+'px;height:'+this.config.height+'px;background:#c3c3c3;' if(this.info.title == undefined || this.info.title==null){this.info.title="";} this.winform.style.cssText = formstyle; this.winbox = document.createElement('div'); this.winbox.style.cssText = winstyle; // overlay this.overlay = document.createElement('div'); var opacity='filter:alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';'; this.overlay.style.cssText = 'position:fixed;_position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:1;'+opacity+'background-color:'+this.color.cColor+';'; this.overlay.style.height=document.body.scrollHeight + 'px'; // winhandle this.winhandle = document.createElement('div'); this.winhandle.style.cssText = handlestyle; this.titlebar = document.createElement('div'); this.titlebar.style.cssText = barstyle; this.titlebar.innerHTML = '<h3>'+this.info.title+'</h3>'; // box this.conbox = document.createElement('div'); this.conbox.style.cssText = boxstyle; // shadow this.winshadow = document.createElement('div'); this.winshadow.style.cssText = shadowstyle; // iframe this.winframe = document.createElement('iframe'); this.winframe.scrolling = 'no'; this.winframe.frameBorder = '0'; this.winframe.src = this.info.contentUrl; this.winframe.name = this.info.framename; this.winframe.style.cssText = 'width:100%;height:'+(this.config.height-barheight)+'px'; // this.titlebar.appendChild(this.winhandle); this.conbox.appendChild(this.titlebar); this.conbox.appendChild(this.winframe); this.winbox.appendChild(this.conbox); this.winbox.appendChild(this.winshadow); this.winform.appendChild(this.overlay); this.winform.appendChild(this.winbox); var _this = this; Event.observe(this.winhandle,"click",this.reset.bindAsEventListener(this),false); Event.observe(window,'resize',function(){ _this.posx(); _this.resizeOverlay(); }, false); //Event.observe(document,"keypress",this.keydown.bindAsEventListener(this),false); return this; }, keydown:function(event){ if(event.keyCode==27){this.close();} }, forCallback:function (){return this.info.callBack(this.info.parameter);}, resizeOverlay: function(){ var range = this.getScrollRange(); this.overlay.style.width = range.width + 'px'; }, getScrollRange: function(){ var w = 0, h = 0; w = document.documentElement ? document.documentElement.scrollWidth : document.body.scrollWidth; h = document.documentElement ? document.documentElement.scrollHeight : document.body.scrollHeight; return {'width': w, 'height': h}; }, getClientRange: function(){ var w = 0, h = 0; w = document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth; h = document.documentElement ? document.documentElement.clientHeight : document.body.clientHeight; return {'width': w, 'height': h}; }, posx:function (){ var pos = this.getPos(); this.winbox.style.left = pos.x + 'px' }, posxy:function (){ var pos = this.getPos(); this.winbox.style.left = pos.x + 'px'; this.winbox.style.top = pos.y + 'px'; }, getPos:function (){ var x = 0, y = 0; var range = this.getClientRange(); var scrollTop = document.documentElement ? document.documentElement.scrollTop + document.body.scrollTop : document.body.scrollTop; var scrollLeft = document.documentElement ? document.documentElement.scrollLeft + document.body.scrollLeft : document.body.scrollLeft; x = (range.width -this.config.width)/2 + scrollLeft; y = (range.height-this.config.height)/2 + scrollTop; if(y < 15){ y=15; } if(x < 15){ x=15; } return {'x': x, 'y': y}; }, reset:function (){ if(this.config.isReloadOnClose){top.location.reload();}; this.close(); }, show:function (){ this.hiddenSome(); this.winform.style.display='block'; this.posxy(); }, close:function (){ //this.winform.style.display='none'; if (this.winform) { this.winform.style.display = 'none'; var iframe = this.winform.getElementsByTagName('iframe')[0]; iframe.parentNode.removeChild(iframe); this.winform.parentNode.removeChild(this.winform); this.winform = null; } this.showSome(); }, hiddenSome:function (){ var tag=this.info.someHiddenTag.split(","); if(tag.length==1&&tag[0]=="")tag.length=0; for(var i=0;i<tag.length;i++){this.hiddenTag(tag[i]);}; var ids=this.info.someHiddenEle.split(","); if(ids.length==1&&ids[0]=="")ids.length=0; for(var i=0;i<ids.length;i++){this.hiddenEle(ids[i]);}; space("begin"); }, hiddenTag:function (tagName){ var ele=document.getElementsByTagName(tagName); if(ele!=null){ for(var i=0;i<ele.length;i++){ if(ele[i].style.display!="none"&&ele[i].style.visibility!='hidden'){ ele[i].style.visibility='hidden'; if(ele[i].tagName.toUpperCase()=="VIDEO"){ ele[i].style.display='none'; ele[i].pause(); }; this.someToHidden.push(ele[i]); }; }; }; }, hiddenEle:function (id){ var ele=document.getElementById(id); if(typeof(ele)!="undefined"&&ele!=null){ ele.style.visibility='hidden'; if(ele.tagName.toUpperCase()=="VIDEO"){ ele.style.display='none'; ele.pause(); }; this.someToHidden.push(ele); } }, showSome:function (){ for(var i=0;i<this.someToHidden.length;i++){ this.someToHidden[i].style.visibility='visible'; if(this.someToHidden[i].tagName.toUpperCase()=="VIDEO"){ this.someToHidden[i].style.display='block'; this.someToHidden[i].play(); }; }; space("end"); } };
首页 1 2 下一页