⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.js

📁 针对wav格式转换为mp3一些相关说明
💻 JS
📖 第 1 页 / 共 3 页
字号:
 */
var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var B,_=0;if(arguments.length>0)if(typeof arguments[0]=="string"){B=arguments[0];_=1}else B=arguments[0]?arguments[0].id:null;if(!B)B="window_"+new Date().getTime();if($(B))alert("Window "+B+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[_]||{});if(this.options.blurClassName)this.options.focusClassName=this.options.className;if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined")this.options.top=this._round(Math.random()*500,this.options.gridY);if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined")this.options.left=this._round(Math.random()*500,this.options.gridX);if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear)this.options.showEffectOptions.to=this.options.opacity}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear)this.options.showEffectOptions.to=this.options.opacity;if(this.options.hideEffect==Effect.Fade)this.options.hideEffectOptions.from=this.options.opacity}if(this.options.hideEffect==Element.hide)this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose)this.destroy()}.bind(this);if(this.options.parent!=document.body)this.options.parent=$(this.options.parent);this.element=this._createWindow(B);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var A=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function($){$.observe("mousedown",A.eventMouseDown);$.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function($){$.observe("mousedown",A.eventMouseDown);$.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex)this.setZIndex(this.options.zIndex);if(this.options.destroyOnClose)this.setDestroyOnClose(true);this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height)this.setSize(this.options.width,this.options.height);this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var _=this.getContent(),A=null;for(var $=0;$<_.childNodes.length;$++){A=_.childNodes[$];if(A.nodeType==1)break;A=null}if(A)this._oldParent.appendChild(A);this._oldParent=null}if(this.sizer)Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);if(this.options.url)this.content.src=null;if(this.iefix)Element.remove(this.iefix);Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function($){this.options.closeCallback=$},getContent:function(){return this.content},setContent:function(F,E,B){var A=$(F);if(null==A)throw"Unable to find element '"+F+"' in DOM";this._oldParent=A.parentNode;var _=null,D=null;if(E)_=Element.getDimensions(A);if(B)D=Position.cumulativeOffset(A);var C=this.getContent();this.setHTMLContent("");C=this.getContent();C.appendChild(A);A.show();if(E)this.setSize(_.width,_.height);if(B)this.setLocation(D[1]-this.heightN,D[0]-this.widthW)},setHTMLContent:function(_){if(this.options.url){this.content.src=null;this.options.url=null;var A="<div id=\""+this.getId()+"_content\" class=\""+this.options.className+"_content\"> </div>";$(this.getId()+"_table_content").innerHTML=A;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=_},setAjaxContent:function(A,B,$,_){this.showFunction=$?"showCenter":"show";this.showModal=_||false;B=B||{};this.setHTMLContent("");this.onComplete=B.onComplete;if(!this._onCompleteHandler)this._onCompleteHandler=this._setAjaxContent.bind(this);B.onComplete=this._onCompleteHandler;new Ajax.Request(A,B);B.onComplete=this.onComplete},_setAjaxContent:function($){Element.update(this.getContent(),$.responseText);if(this.onComplete)this.onComplete($);this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(A){if(this.options.url)this.content.src=null;this.options.url=A;var _="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+A+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=_;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url)$(this.element.getAttribute("id")+"_content").src=this.options.url},setCookie:function(I,J,F,D,$){I=I||this.element.id;this.cookie=[I,J,F,D,$];var _=WindowUtilities.getCookie(I);if(_){var C=_.split(","),K=C[0].split(":"),E=C[1].split(":"),A=parseFloat(C[2]),B=parseFloat(C[3]),G=C[4],H=C[5];this.setSize(A,B);if(G=="true")this.doMinimize=true;else if(H=="true")this.doMaximize=true;this.useLeft=K[0]=="l";this.useTop=E[0]=="t";this.element.setStyle(this.useLeft?{left:K[1]}:{right:K[1]});this.element.setStyle(this.useTop?{top:E[1]}:{bottom:E[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(_,$){this.constraint=_;this.constraintPad=Object.extend(this.constraintPad,$||{});if(this.useTop&&this.useLeft)this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))},_initDrag:function(_){if(Event.element(_)==this.sizer&&this.isMinimized())return;if(Event.element(_)!=this.sizer&&this.isMaximized())return;if(Prototype.Browser.IE&&this.heightN==0)this._getWindowBorderSize();this.pointer=[this._round(Event.pointerX(_),this.options.gridX),this._round(Event.pointerY(_),this.options.gridY)];if(this.options.wiredDrag)this.currentDrag=this._createWiredElement();else this.currentDrag=this.element;if(Event.element(_)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize")}else{this.doResize=false;var A=$(this.getId()+"_close");if(A&&Position.within(A,this.pointer[0],this.pointer[1])){this.currentDrag=null;return}this.toFront();if(!this.options.draggable)return;this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(_)},_round:function($,_){return _==1?$:$=Math.floor($/_)*_},_updateDrag:function(E){var G=[this._round(Event.pointerX(E),this.options.gridX),this._round(Event.pointerY(E),this.options.gridY)],B=G[0]-this.pointer[0],F=G[1]-this.pointer[1];if(this.doResize){var A=this.widthOrg+B,D=this.heightOrg+F;B=this.width-this.widthOrg;F=this.height-this.heightOrg;if(this.useLeft)A=this._updateWidthConstraint(A);else this.currentDrag.setStyle({right:(this.rightOrg-B)+"px"});if(this.useTop)D=this._updateHeightConstraint(D);else this.currentDrag.setStyle({bottom:(this.bottomOrg-F)+"px"});this.setSize(A,D);this._notify("onResize")}else{this.pointer=G;if(this.useLeft){var C=parseFloat(this.currentDrag.getStyle("left"))+B,$=this._updateLeftConstraint(C);this.pointer[0]+=$-C;this.currentDrag.setStyle({left:$+"px"})}else this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-B+"px"});if(this.useTop){var _=parseFloat(this.currentDrag.getStyle("top"))+F,H=this._updateTopConstraint(_);this.pointer[1]+=H-_;this.currentDrag.setStyle({top:H+"px"})}else this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-F+"px"});this._notify("onMove")}if(this.iefix)this._fixIEOverlapping();this._removeStoreLocation();Event.stop(E)},_endDrag:function($){WindowUtilities.enableScreen("__invisible__");if(this.doResize)this._notify("onEndResize");else this._notify("onEndMove");Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop($);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(_){if(this.constraint&&this.useLeft&&this.useTop){var $=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(_<this.constraintPad.left)_=this.constraintPad.left;if(_+this.width+this.widthE+this.widthW>$-this.constraintPad.right)_=$-this.constraintPad.right-this.width-this.widthE-this.widthW}return _},_updateTopConstraint:function($){if(this.constraint&&this.useLeft&&this.useTop){var _=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height,A=this.height+this.heightN+this.heightS;if($<this.constraintPad.top)$=this.constraintPad.top;if($+A>_-this.constraintPad.bottom)$=_-this.constraintPad.bottom-A}return $},_updateWidthConstraint:function(_){if(this.constraint&&this.useLeft&&this.useTop){var $=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width,A=parseFloat(this.element.getStyle("left"));if(A+_+this.widthE+this.widthW>$-this.constraintPad.right)_=$-this.constraintPad.right-A-this.widthE-this.widthW}return _},_updateHeightConstraint:function(A){if(this.constraint&&this.useLeft&&this.useTop){var _=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height,$=parseFloat(this.element.getStyle("top"));if($+A+this.heightN+this.heightS>_-this.constraintPad.bottom)A=_-this.constraintPad.bottom-$-this.heightN-this.heightS}return A},_createWindow:function(G){var E=this.options.className,F=document.createElement("div");F.setAttribute("id",G);F.className="dialog";var D;if(this.options.url)D="<iframe frameborder=\"0\" name=\""+G+"_content\"  id=\""+G+"_content\" src=\""+this.options.url+"\"> </iframe>";else D="<div id=\""+G+"_content\" class=\""+E+"_content\"> </div>";var B=this.options.closable?"<div class='"+E+"_close' id='"+G+"_close' onclick='Windows.close(\""+G+"\", event)'> </div>":"",H=this.options.minimizable?"<div class='"+E+"_minimize' id='"+G+"_minimize' onclick='Windows.minimize(\""+G+"\", event)'> </div>":"",A=this.options.maximizable?"<div class='"+E+"_maximize' id='"+G+"_maximize' onclick='Windows.maximize(\""+G+"\", event)'> </div>":"",C=this.options.resizable?"class='"+E+"_sizer' id='"+G+"_sizer'":"class='"+E+"_se'",_="../themes/default/blank.gif";F.innerHTML=B+H+A+"      <table id='"+G+"_row1' class=\"top table_window\">        <tr>          <td class='"+E+"_nw'></td>          <td class='"+E+"_n'><div id='"+G+"_top' class='"+E+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+E+"_ne'></td>        </tr>      </table>      <table id='"+G+"_row2' class=\"mid table_window\">        <tr>          <td class='"+E+"_w'></td>            <td id='"+G+"_table_content' class='"+E+"_content' valign='top'>"+D+"</td>          <td class='"+E+"_e'></td>        </tr>      </table>        <table id='"+G+"_row3' class=\"bot table_window\">        <tr>          <td class='"+E+"_sw'></td>            <td class='"+E+"_s'><div id='"+G+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+C+"></td>        </tr>      </table>    ";Element.hide(F);this.options.parent.insertBefore(F,this.options.parent.firstChild);Event.observe($(G+"_content"),"load",this.options.onload);return F},changeClassName:function(_){var A=this.options.className,B=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(C){this._toggleClassName($(B+C),A+C,_+C)}.bind(this));this._toggleClassName($(B+"_top"),A+"_title",_+"_title");$$("#"+B+" td").each(function($){$.className=$.className.sub(A,_)});this.options.className=_},_toggleClassName:function($,A,_){if($){$.removeClassName(A);$.addClassName(_)}},setLocation:function($,_){$=this._updateTopConstraint($);_=this._updateLeftConstraint(_);var A=this.currentDrag||this.element;A.setStyle({top:$+"px"});A.setStyle({left:_+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var $={};if(this.useTop)$=Object.extend($,{top:this.element.getStyle("top")});else $=Object.extend($,{bottom:this.element.getStyle("bottom")});if(this.useLeft)$=Object.extend($,{left:this.element.getStyle("left")});else $=Object.extend($,{right:this.element.getStyle("right")});return $},getSize:function(){return{width:this.width,height:this.height}},setSize:function(_,A,C){_=parseFloat(_);A=parseFloat(A);if(!this.minimized&&_<this.options.minWidth)_=this.options.minWidth;if(!this.minimized&&A<this.options.minHeight)A=this.options.minHeight;if(this.options.maxHeight&&A>this.options.maxHeight)A=this.options.maxHeight;if(this.options.maxWidth&&_>this.options.maxWidth)_=this.options.maxWidth;if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&C)new Effect.ResizeWindow(this,null,null,_,A,{duration:Window.resizeEffectDuration});else{this.width=_;this.height=A;var D=this.currentDrag?this.currentDrag:this.element;D.setStyle({width:_+this.widthW+this.widthE+"px"});D.setStyle({height:A+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var B=$(this.element.id+"_content");B.setStyle({height:A+"px"});B.setStyle({width:_+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex)this.setZIndex(Windows.maxZIndex+1);if(this.iefix)this._fixIEOverlapping()},getBounds:function(B){if(!this.width||!this.height||!this.visible)this.computeBounds();var _=this.width,A=this.height;if(!B){_+=this.widthW+this.widthE;A+=this.heightN+this.heightS}var $=Object.extend(this.getLocation(),{width:_+"px",height:A+"px"});return $},computeBounds:function(){if(!this.width||!this.height){var $=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height)this.width=$+5;else this.height=$+5}this.setSize(this.width,this.height);if(this.centered)this._center(this.centerTop,this.centerLeft)},show:function(_){this.visible=true;if(_){if(typeof this.overlayOpacity=="undefined"){var $=this;setTimeout(function(){$.show(_)},10);return}Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else if(!this.element.style.zIndex)this.setZIndex(Windows.maxZIndex+1);if(this.oldStyle)this.getContent().setStyle({overflow:this.oldStyle});this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions)this.options.showEffect(this.element,this.options.showEffectOptions);else this.options.showEffect(this.element);this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(A,$,_){this.centered=true;this.centerTop=$;this.centerLeft=_;this.show(A)},isVisible:function(){return this.visible},_center:function($,_){var A=WindowUtilities.getWindowScroll(this.options.parent),B=WindowUtilities.getPageSize(this.options.parent);if(typeof $=="undefined")$=(B.windowHeight-(this.height+this.heightN+this.heightS))/2;$+=A.top;if(typeof _=="undefined")_=(B.windowWidth-(this.width+this.widthW+this.widthE))/2;_+=A.left;this.setLocation($,_);this.toFront()},_recenter:function(A){if(this.centered){var B=WindowUtilities.getPageSize(this.options.parent),_=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==B.windowWidth&&this.pageSize.windowHeight==B.windowHeight&&this.windowScroll.left==_.left&&this.windowScroll.top==_.top)return;this.pageSize=B;this.windowScroll=_;if($("overlay_modal"))$("overlay_modal").setStyle({height:(B.pageHeight+"px")});if(this.options.recenterAuto)this._center(this.centerTop,this.centerLeft)}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix)this.iefix.hide();if(!this.doNotNotifyHide)this._notify("onHide")},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this))return;if(this.options.destroyOnClose){var $=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var _=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){_();$()}}else this.options.hideEffectOptions.afterFinish=function(){$()}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing)return;var A=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var C=A.getDimensions().height;this.r2Height=C;var _=this.element.getHeight()-C;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)new Effect.ResizeWindow(this,null,null,null,this.height-C,{duration:Window.resizeEffectDuration});else{this.height-=C;this.element.setStyle({height:_+"px"});A.hide()}if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B+C)+"px"})}}else{this.minimized=false;C=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)new Effect.ResizeWindow(this,null,null,null,this.height+C,{duration:Window.resizeEffectDuration});else{_=this.element.getHeight()+C;this.height+=C;this.element.setStyle({height:_+"px"});A.show()}if(!this.useTop){B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B-C)+"px"})}this.toFront()}this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing)return;if(Prototype.Browser.IE&&this.heightN==0)this._getWindowBorderSize();if(this.storedLocation!=null){this._restoreLocation();if(this.iefix)this.iefix.hide()}else{this._storeLocation();Windows.unsetOverflow(this);var D=WindowUtilities.getWindowScroll(this.options.parent),E=WindowUtilities.getPageSize(this.options.parent),C=D.left,_=D.top;if(this.options.parent!=document.body){D={top:0,left:0,bottom:0,right:0};var B=this.options.parent.getDimensions();E.windowWidth=B.width;E.windowHeight=B.height;_=0;C=0}if(this.constraint){E.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);E.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);C+=Math.max(0,this.constraintPad.left);_+=Math.max(0,this.constraintPad.top)}var $=E.windowWidth-this.widthW-this.widthE,A=E.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)new Effect.ResizeWindow(this,_,C,$,A,{duration:Window.resizeEffectDuration});else{this.setSize($,A);this.element.setStyle(this.useLeft?{left:C}:{right:C});this.element.setStyle(this.useTop?{top:_}:{bottom:_})}this.toFront();if(this.iefix)this._fixIEOverlapping()}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function($){if(Element.setOpacity)Element.setOpacity(this.element,$)},setZIndex:function($){this.element.setStyle({zIndex:$});Windows.updateZindex($,this)},setTitle:function($){if(!$||$=="")$="&nbsp;";Element.update(this.element.id+"_top",$)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(_){var A=$(this.getId()+"_bottom");if(typeof(_)=="object"){if(this.bottombar.firstChild)this.bottombar.replaceChild(_,this.bottombar.firstChild);else this.bottombar.appendChild(_)}else this.bottombar.innerHTML=_},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,"<iframe id=\""+this.element.id+"_iefix\" "+"style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" "+"src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>");this.iefix=$(this.element.id+"_iefix")}if(this.iefix)setTimeout(this._fixIEOverlapping.bind(this),50)},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(B){var A=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(A).height;A.parentNode.removeChild(A);A=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(A).height;A.parentNode.removeChild(A);A=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(A).width;A.parentNode.removeChild(A);A=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(A).width;A.parentNode.removeChild(A);A=document.createElement("div");A.className="overlay_"+this.options.className;document.body.appendChild(A);var _=this;setTimeout(function(){_.overlayOpacity=($(A).getStyle("opacity"));A.parentNode.removeChild(A)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420)this.setSize(this.width,this.height);if(this.doMaximize)this.maximize();if(this.doMinimize)this.minimize()},_createHiddenDiv:function($){var _=document.body,A=document.createElement("div");A.setAttribute("id",this.element.id+"_tmp");A.className=$;A.style.display="none";A.innerHTML="";_.insertBefore(A,_.firstChild);return A},_storeLocation:function(){if(this.storedLocation==null)this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration});else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)}Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var $="";if(this.useLeft)$+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"));else $+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"));if(this.useTop)$+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"));else $+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"));$+=","+(this.storedLocation?this.storedLocation.width:this.width);$+=","+(this.storedLocation?this.storedLocation.height:this.height);$+=","+this.isMinimized();$+=","+this.isMaximized();WindowUtilities.setCookie($,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE)this._getWindowBorderSize();var _=document.createElement("div");_.className="wired_frame "+this.options.className+"_wired_frame";_.style.position="absolute";this.options.parent.insertBefore(_,this.options.parent.firstChild);this.wiredElement=$(_)}if(this.useLeft)this.wiredElement.setStyle({left:this.element.getStyle("left")});else this.wiredElement.setStyle({right:this.element.getStyle("right")});if(this.useTop)this.wiredElement.setStyle({top:this.element.getStyle("top")});else this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")});var A=this.element.getDimensions();this.wiredElement.setStyle({width:A.width+"px",height:A.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag)return;if(this.currentDrag==this.element)this.currentDrag=null;else{if(this.useLeft)this.element.setStyle({left:this.currentDrag.getStyle("left")});else this.element.setStyle({right:this.currentDrag.getStyle("right")});if(this.useTop)this.element.setStyle({top:this.currentDrag.getStyle("top")});else this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")});this.currentDrag.hide();this.currentDrag=null;if(this.doResize)this.setSize(this.width,this.height)}},_notify:function($){if(this.options[$])this.options[$](this);else Windows.notify($,this)}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function($){this.removeObserver($);this.observers.push($)},removeObserver:function($){this.observers=this.observers.reject(function(_){return _==$})},notify:function(_,$){this.observers.each(function(A){if(A[_])A[_](_,$)})},getWindow:function($){return this.windows.detect(function(_){return _.getId()==$})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function($){this.windows.push($)},addModalWindow:function(_){if(this.modalWindows.length==0)WindowUtilities.disableScreen(_.options.className,"overlay_modal",_.overlayOpacity,_.getId(),_.options.parent);else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else this.modalWindows.last().element.hide();WindowUtilities._showSelect(_.getId())}this.modalWindows.push(_)},removeModalWindow:function($){this.modalWindows.pop();if(this.modalWindows.length==0)WindowUtilities.enableScreen();else if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else this.modalWindows.last().element.show()},register:function($){this.windows.push($)},unregister:function($){this.windows=this.windows.reject(function(_){return _==$})},closeAll:function(){this.windows.each(function($){Windows.close($.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function($){if($)$.close()})},minimize:function(A,$){var _=this.getWindow(A);if(_&&_.visible)_.minimize();Event.stop($)},maximize:function(A,$){var _=this.getWindow(A);if(_&&_.visible)_.maximize();Event.stop($)},close:function(A,$){var _=this.getWindow(A);if(_)_.close();if($)Event.stop($)},blur:function(_){var $=this.getWindow(_);if(!$)return;if($.options.blurClassName)$.changeClassName($.options.blurClassName);if(this.focusedWindow==$)this.focusedWindow=null;$._notify("onBlur")},focus:function(_){var $=this.getWindow(_);if(!$)return;if(this.focusedWindow)this.blur(this.focusedWindow.getId());if($.options.focusClassName)$.changeClassName($.options.focusClassName);this.focusedWindow=$;$._notify("onFocus")},unsetOverflow:function($){this.windows.each(function($){$.oldOverflow=$.getContent().getStyle("overflow")||"auto";$.getContent().setStyle({overflow:"hidden"})});if($&&$.oldOverflow)$.getContent().setStyle({overflow:$.oldOverflow})},resetOverflow:function(){this.windows.each(function($){if($.oldOverflow)$.getContent().setStyle({overflow:$.oldOverflow})})},updateZindex:function($,_){if($>this.maxZIndex){this.maxZIndex=$;if(this.focusedWindow)this.blur(this.focusedWindow.getId())}this.focusedWindow=_;if(this.focusedWindow)this.focus(this.focusedWindow.getId())}},Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(C,A){if(C&&typeof C!="string"){Dialog._runAjaxRequest(C,A,Dialog.confirm);return}C=C||"";A=A||{};var B=A.okLabel?A.okLabel:"Ok",D=A.cancelLabel?A.cancelLabel:"Cancel";A=Object.extend(A,A.windowParameters||{});A.windowParameters=A.windowParameters||{};A.className=A.className||"alert";var _="class ='"+(A.buttonClass?A.buttonClass+" ":"")+" ok_button'",$="class ='"+(A.buttonClass?A.buttonClass+" ":"")+" cancel_button'",C="      <div class='"+A.className+"_message'>"+C+"</div>        <div class='"+A.className+"_buttons'>          <input type='button' value='"+B+"' onclick='Dialog.okCallback()' "+_+"/>          <input type='button' value='"+D+"' onclick='Dialog.cancelCallback()' "+$+"/>        </div>    ";return this._openDialog(C,A)},alert:function(B,_){if(B&&typeof B!="string"){Dialog._runAjaxRequest(B,_,Dialog.alert);return}B=B||"";_=_||{};var A=_.okLabel?_.okLabel:"Ok";_=Object.extend(_,_.windowParameters||{});_.windowParameters=_.windowParameters||{};_.className=_.className||"alert";var $="class ='"+(_.buttonClass?_.buttonClass+" ":"")+" ok_button'",B="      <div class='"+_.className+"_message'>"+B+"</div>        <div class='"+_.className+"_buttons'>          <input type='button' value='"+A+"' onclick='Dialog.okCallback()' "+$+"/>        </div>";return this._openDialog(B,_)},info:function(_,$){if(_&&typeof _!="string"){Dialog._runAjaxRequest(_,$,Dialog.info);return}_=_||"";$=$||{};$=Object.extend($,$.windowParameters||{});$.windowParameters=$.windowParameters||{};$.className=$.className||"alert";var _="<div id='modal_dialog_message' class='"+$.className+"_message'>"+_+"</div>";if($.showProgress)_+="<div id='modal_dialog_progress' class='"+$.className+"_progress'>  </div>";$.ok=null;$.cancel=null;return this._openDialog(_,$)},setInfoMessage:function(_){$("modal_dialog_message").update(_)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(A,$){var B=$.className;if(!$.height&&!$.width){var E;if($.options&&$.options.parent)E=$.options.parent;else E=document.body;$.width=WindowUtilities.getPageSize(E).pageWidth/2}if($.id)this.dialogId=$.id;else{var _=new Date();this.dialogId="modal_dialog_"+_.getTime();$.id=this.dialogId}if(!$.height||!$.width){var C=WindowUtilities._computeSize(A,this.dialogId,$.width,$.height,5,B);if($.height)$.width=C+5;else $.height=C+5}$.effectOptions=$.effectOptions;$.resizable=$.resizable||false;$.minimizable=$.minimizable||false;$.maximizable=$.maximizable||false;$.draggable=$.draggable||false;$.closable=$.closable||false;var D=new Window($);D.getContent().innerHTML=A;var modal=$['modal']===undefined?true:!!$['modal'];D.showCenter(modal,$.top,$.left);D.setDestroyOnClose();D.cancelCallback=$.onCancel||$.cancel;D.okCallback=$.onOk||$.ok;return D},_getAjaxContent:function($){Dialog.callFunc($.responseText,Dialog.parameters)},_runAjaxRequest:function(_,$,A){if(_.options==null)_.options={};Dialog.onCompleteFunc=_.options.onComplete;Dialog.parameters=$;Dialog.callFunc=A;_.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(_.url,_.options)},okCallback:function(){var $=Windows.focusedWindow;if(!$.okCallback||$.okCallback($)){$$("#"+$.getId()+" input").each(function($){$.onclick=null});$.close()}},cancelCallback:function(){var $=Windows.focusedWindow;$$("#"+$.getId()+" input").each(function($){$.onclick=null});$.close();if($.cancelCallback)$.cancelCallback($)}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function($){var T,L,W,H;$=$||document.body;if($!=document.body){T=$.scrollTop;L=$.scrollLeft;W=$.scrollWidth;H=$.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(E){E=E||document.body;var _,D,$,B;if(E!=document.body){_=E.getWidth();D=E.getHeight();B=E.scrollWidth;$=E.scrollHeight}else{var C,A;if(window.innerHeight&&window.scrollMaxY){C=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){C=document.body.scrollWidth;A=document.body.scrollHeight}else{C=document.body.offsetWidth;A=document.body.offsetHeight}if(self.innerHeight){_=self.innerWidth;D=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){_=document.documentElement.clientWidth;D=document.documentElement.clientHeight}else if(document.body){_=document.body.clientWidth;D=document.body.clientHeight}if(A<D)$=D;else $=A;if(C<_)B=_;else B=C}return{pageWidth:B,pageHeight:$,windowWidth:_,windowHeight:D}},disableScreen:function(B,_,$,A,C){WindowUtilities.initLightbox(_,B,function(){this._disableScreen(B,_,$,A)}.bind(this),C||document.body)},_disableScreen:function(D,A,_,B){var C=$(A),E=WindowUtilities.getPageSize(C.parentNode);if(B&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(B)}C.style.height=(E.pageHeight+"px");C.style.display="none";if(A=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){C.overlayOpacity=_;new Effect.Appear(C,Object.extend({from:0,to:_},Windows.overlayShowEffectOptions))}else C.style.display="block"},enableScreen:function(A){A=A||"overlay_modal";var _=$(A);if(_){if(A=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions)new Effect.Fade(_,Object.extend({from:_.overlayOpacity,to:0},Windows.overlayHideEffectOptions));else{_.style.display="none";_.parentNode.removeChild(_)}if(A!="__invisible__")WindowUtilities._showSelect()}},_hideSelect:function($){if(Prototype.Browser.IE){$=$==null?"":"#"+$+" ";$$($+"select").each(function($){if(!WindowUtilities.isDefined($.oldVisibility)){$.oldVisibility=$.style.visibility?$.style.visibility:"visible";$.style.visibility="hidden"}})}},_showSelect:function($){if(Prototype.Browser.IE){$=$==null?"":"#"+$+" ";$$($+"select").each(function($){if(WindowUtilities.isDefined($.oldVisibility)){try{$.style.visibility=$.oldVisibility}catch(_){$.style.visibility="visible"}$.oldVisibility=null}else if($.style.visibility)$.style.visibility="visible"})}},isDefined:function($){return typeof($)!="undefined"&&$!=null},initLightbox:function(D,B,_,C){if($(D)){Element.setStyle(D,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;_()}else{var A=document.createElement("div");A.setAttribute("id",D);A.className="overlay_"+B;A.style.display="none";A.style.position="absolute";A.style.top="0";A.style.left="0";A.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;A.style.width="100%";C.insertBefore(A,C.firstChild);if(Prototype.Browser.WebKit&&D=="overlay_modal")setTimeout(function(){_()},10);else _()}},setCookie:function(_,$){document.cookie=$[0]+"="+escape(_)+(($[1])?"; expires="+$[1].toGMTString():"")+(($[2])?"; path="+$[2]:"")+(($[3])?"; domain="+$[3]:"")+(($[4])?"; secure":"")},getCookie:function(B){var A=document.cookie,_=B+"=",C=A.indexOf("; "+_);if(C==-1){C=A.indexOf(_);if(C!=0)return null}else C+=2;var $=document.cookie.indexOf(";",C);if($==-1)$=A.length;return unescape(A.substring(C+_.length,$))},_computeSize:function(C,H,A,B,G,D){var F=document.body,_=document.createElement("div");_.setAttribute("id",H);_.className=D+"_content";if(B)_.style.height=B+"px";else _.style.width=A+"px";_.style.position="absolute";_.style.top="0";_.style.left="0";_.style.display="none";_.innerHTML=C;F.insertBefore(_,F.firstChild);var E;if(B)E=$(_).getDimensions().width+G;else E=$(_).getDimensions().height+G;F.removeChild(_);return E}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -