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

📄 gui2.moz.js

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 JS
📖 第 1 页 / 共 5 页
字号:
this.add(c);else BiComponent.prototype.addXmlNode.apply(this,arguments);}};_p.dispose=function()
{if(this._disposed)return;BiComponent.prototype.dispose.call(this);this._xulElement=null;delete menuCache[this.id];};function BiMenuButton(sText,oSubMenu){BiMenuItem.call(this,sText,oSubMenu);};_p=_biExtend(BiMenuButton,BiMenuItem,"BiMenuButton");_p._addHtmlElementToParent=function(){};BiMenu.invalidateAll=function(){};function BiMoveEvent(sType,nLeft,nTop)
{if(_biInPrototype)return;BiEvent.call(this,sType);this._left=nLeft;this._top=nTop;}
_p=_biExtend(BiMoveEvent,BiEvent,"BiMoveEvent");BiMoveEvent.prototype.getLeft=function(){return this._left;};BiMoveEvent.prototype.getTop=function(){return this._top;};function BiResizeEvent(sType,nLeft,nTop,nWidth,nHeight)
{if(_biInPrototype)return;BiMoveEvent.call(this,sType,nLeft,nWidth);this._width=nWidth;this._height=nHeight;}
_p=_biExtend(BiResizeEvent,BiMoveEvent,"BiResizeEvent");BiResizeEvent.prototype.getWidth=function(){return this._width;};BiResizeEvent.prototype.getHeight=function(){return this._height;};function BiMoveHandle(oHandleFor){if(_biInPrototype)return;BiComponent.call(this);this.setCursor("move");this._handleFor=oHandleFor||this;this.addEventListener("mousedown",this._startMove,this);}
_p=_biExtend(BiMoveHandle,BiComponent,"BiMoveHandle");_p._handleFor=null;_p._moveDirection="both";BiMoveHandle.prototype.getHandleFor=function(){return this._handleFor;};BiMoveHandle.prototype.setHandleFor=function(v){this._handleFor=v;};BiMoveHandle.prototype.getMoveDirection=function(){return this._moveDirection;};BiMoveHandle.prototype.setMoveDirection=function(v){this._moveDirection=v;};_p.startMove=function(e){this._startMove(e);};_p._startMove=function(e){if(!this._handleFor)return;if(this.dispatchEvent(new BiEvent("movestart"))){var c=this._handleFor;c.addEventListener("mousemove",this._continueMove,this);c.addEventListener("mouseup",this._endMove,this);c.addEventListener("losecapture",this._endMove,this);c.setCapture(true);this._moveData={screenX:e.getScreenX(),screenY:e.getScreenY(),startX:c.getLeft(),startY:c.getTop(),dx:e.getScreenX()-c.getScreenLeft(),dy:e.getScreenY()-c.getScreenTop()};e.preventDefault();}};_p._continueMove=function(e){var c=this._handleFor;var p=c.getParent();var ex=e.getScreenX();var ey=e.getScreenY();var r=p?p._getScreenClientArea():null;ex=Math.max(ex,p?r.left:0);ey=Math.max(ey,p?r.top:0);ex=Math.min(ex,p?r.left+r.width-1:screen.availWidth);ey=Math.min(ey,p?r.top+r.height-1:screen.availHeight);var x=ex-this._moveData.screenX+this._moveData.startX;var y=ey-this._moveData.screenY+this._moveData.startY;if(this.dispatchEvent(new BiMoveEvent("beforemove",x,y))){if(this._moveDirection=="both")
c.setLocation(x,y);else if(this._moveDirection=="horizontal")
c.setLeft(x);else c.setTop(y);this.dispatchEvent(new BiMoveEvent("move",x,y));}
e.preventDefault();};_p._endMove=function(e){var c=this._handleFor;c.removeEventListener("mousemove",this._continueMove,this);c.removeEventListener("mouseup",this._endMove,this);c.removeEventListener("losecapture",this._endMove,this);c.setCapture(false);this._moveData=null;this.dispatchEvent(new BiEvent("moveend"));e.preventDefault();};_p.dispose=function(){if(this._disposed)return;BiComponent.prototype.dispose.call(this);this._handleFor=null;this._moveData=null;};_p.getMoving=function()
{return this._moveData!=null;};_p.setAttribute=function(sName,sValue,oXmlResourceParser)
{switch(sName)
{case"handleFor":if(sValue.charAt(0)=="#")
sValue=sValue.substr(1);var c=oXmlResourceParser.getComponentById(sValue);this.setHandleFor(c);break;default:BiComponent.prototype.setAttribute.apply(this,arguments);}};function BiResizeHandle(oHandleFor){if(_biInPrototype)return;BiComponent.call(this);this.setCssClassName("bi-resize-handle");this._handleChar1=new BiLabel("o");this._handleChar1.setCssClassName("bi-handle-char bi-handle-char-o");this._handleChar1.setRight(0);this._handleChar1.setBottom(0);this.add(this._handleChar1);this._handleChar2=new BiLabel("p");this._handleChar2.setCssClassName("bi-handle-char bi-handle-char-p");this._handleChar2.setRight(0);this._handleChar2.setBottom(0);this.add(this._handleChar2);this.setSize(18,18);this.setRight(0);this.setBottom(0);this._handleFor=oHandleFor||this;this.addEventListener("mousedown",this._startResize,this);}
_p=_biExtend(BiResizeHandle,BiComponent,"BiResizeHandle");_p._handleFor=null;_p._resizeDirection="se";BiResizeHandle.prototype.getHandleFor=function(){return this._handleFor;};BiResizeHandle.prototype.setHandleFor=function(v){this._handleFor=v;};_p.setResizeDirection=function(sDir){this._resizeDirection=sDir;this.setCursor(sDir+"-resize");};BiResizeHandle.prototype.getResizeDirection=function(){return this._resizeDirection;};_p.startResize=function(sDir,e){if(sDir)
this.setResizeDirection(sDir);this._startResize(e);};_p._startResize=function(e){if(!this._handleFor)return;if(this.dispatchEvent(new BiEvent("resizestart"))){var c=this._handleFor;c.addEventListener("mousemove",this._continueResize,this);c.addEventListener("mouseup",this._endResize,this);c.addEventListener("losecapture",this._endResize,this);c.setCapture(true);this._resizeData={screenX:e.getScreenX(),screenY:e.getScreenY(),startX:c.getLeft(),startY:c.getTop(),startW:c.getWidth(),startH:c.getHeight(),dx:e.getScreenX()-c.getScreenLeft(),dy:e.getScreenY()-c.getScreenTop()};e.preventDefault();}};_p._continueResize=function(e){var dir=this._resizeDirection;var c=this._handleFor;var p=c.getParent();var width=this._resizeData.startW;var height=this._resizeData.startH;var left=this._resizeData.startX;var top=this._resizeData.startY;var r=p?p._getScreenClientArea():null;var ex=e.getScreenX();var ey=e.getScreenY();ex=Math.max(ex,p?r.left:0);ey=Math.max(ey,p?r.top:0);ex=Math.min(ex,p?r.left+r.width-1:screen.availWidth);ey=Math.min(ey,p?r.top+r.height-1:screen.availHeight);if(/e/i.test(dir)){width=Math.max(Number(c.getMinimumWidth()),Math.min(Number(c.getMaximumWidth()),ex-(this._resizeData.screenX-this._resizeData.startW)));}
else if(/w/i.test(dir)){width=Math.max(Number(c.getMinimumWidth()),Math.min(Number(c.getMaximumWidth()),this._resizeData.startW+this._resizeData.startX-ex+(this._resizeData.screenX-this._resizeData.startX)));left=this._resizeData.startW+this._resizeData.startX-width;}
if(/s/i.test(dir)){height=Math.max(Number(c.getMinimumHeight()),Math.min(Number(c.getMaximumHeight()),ey-(this._resizeData.screenY-this._resizeData.startH)));}
else if(/n/i.test(dir)){height=Math.max(Number(c.getMinimumHeight()),Math.min(Number(c.getMaximumHeight()),this._resizeData.startH+this._resizeData.startY-ey+(this._resizeData.screenY-this._resizeData.startY)));top=this._resizeData.startH+this._resizeData.startY-height;}
if(this.dispatchEvent(new BiResizeEvent("beforeresize",left,top,width,height))){c.setSize(width,height);c.setLocation(left,top);this.dispatchEvent(new BiResizeEvent("resize",left,top,width,height));}
e.preventDefault();};_p._endResize=function(e){var c=this._handleFor;c.removeEventListener("mousemove",this._continueResize,this);c.removeEventListener("mouseup",this._endResize,this);c.removeEventListener("losecapture",this._endResize,this);c.setCapture(false);this._resizeData=null;this.dispatchEvent(new BiEvent("resizeend"));e.preventDefault();};_p.dispose=function(){if(this._disposed)return;BiComponent.prototype.dispose.call(this);this._handleFor=null;this._resizeData=null;};_p.getResizing=function()
{return this._resizeData!=null;};_p.setAttribute=function(sName,sValue,oXmlResourceParser)
{switch(sName)
{case"handleFor":if(sValue.charAt(0)=="#")
sValue=sValue.substr(1);var c=oXmlResourceParser.getComponentById(sValue);this.setHandleFor(c);break;default:BiComponent.prototype.setAttribute.apply(this,arguments);}};function BiWindow(sCaption){if(_biInPrototype)return;BiComponent.call(this);this.setSize(400,200);this.setTabIndex(0);this.setHideFocus(true);this._focusManager=new BiFocusManager;this._chrome=new BiComponent;this._chrome.setProperties({top:0,left:0,right:0,bottom:0,cssClassName:"bi-window",appearance:"window"});this._commands={};this._windowCaption=new BiComponent;this._windowCaption.setCssClassName("bi-window-caption");this._windowCaption.setAppearance("window-caption");this._windowIcon=new BiImage(this._getDefaultIcon(),16,16);this._captionLabel=new BiLabel(sCaption)
this._minimizeButton=new BiButton();this._minimizeButton._tagName="DIV";this._minimizeButton.setAppearance("window-minimize-button");this._minimizeButton.setTabIndex(-1);this._maximizeButton=new BiButton();this._maximizeButton._tagName="DIV";this._maximizeButton.setAppearance("window-maximize-button");this._maximizeButton.setTabIndex(-1);this._closeButton=new BiButton();this._closeButton._tagName="DIV";this._closeButton.setAppearance("window-close-button");this._closeButton.setTabIndex(-1);this._contentPane=new BiComponent;this._contentPane.setCursor("default");this._windowCaption.add(this._windowIcon);this._windowCaption.add(this._captionLabel);this._windowCaption.add(this._minimizeButton);this._windowCaption.add(this._maximizeButton);this._windowCaption.add(this._closeButton);this._chrome.add(this._windowCaption);this._chrome.add(this._contentPane);BiComponent.prototype.add.call(this,this._chrome);this._fixedLayout();this._resizeHandler=new BiResizeHandle(this);this._moveHandler=new BiMoveHandle(this);this._captionLabel.addEventListener("mousedown",this._onCaptionDown,this);this._minimizeButton.addEventListener("click",this._onMinimizeButtonClick,this);this._maximizeButton.addEventListener("click",this._onMaximizeButtonClick,this);this._closeButton.addEventListener("click",this._onCloseButtonClick,this);this._captionLabel.addEventListener("dblclick",this._onMaximizeButtonClick,this);this._windowIcon.addEventListener("dblclick",this._onCloseButtonClick,this);this.addEventListener("mousemove",this._checkForResize);this.addEventListener("mousedown",this._onEdgeDown);this.addEventListener("focusin",this._onFocusIn);this.addEventListener("focusout",this._onFocusOut);this.addEventListener("focus",this._onFocus);this.addEventListener("mouseover",this._onMouseEvent);this.addEventListener("mousemove",this._onMouseEvent);this.addEventListener("mouseout",this._onMouseEvent);this.addEventListener("mousedown",this._onMouseEvent);this.addEventListener("mouseup",this._onMouseEvent);this.addEventListener("click",this._onMouseEvent);this.addEventListener("dblclick",this._onMouseEvent);this.addEventListener("contextmenu",this._onMouseEvent);this.addEventListener("mousewheel",this._onMouseEvent);this.addEventListener("keydown",this._onkeydown);this.addEventListener("keypress",this._onkeydown);this.addEventListener("keydown",this._onDefaultButtonKeyDown);this.addEventListener("keydown",this._onKeyEvent);this.addEventListener("keypress",this._onKeyEvent);this.addEventListener("keyup",this._onKeyEvent);}
_p=_biExtend(BiWindow,BiComponent,"BiWindow");_p._showIcon=true;_p._showMinimize=true;_p._showMaximize=true;_p._showClose=true;_p._canMinimize=true;_p._resizable=true;_p._movable=true;_p._state="normal";_p._icon=null;_p._activeComponent=null;_p._lastActive=null;_p._hideChrome=false;_p._minimumWidth=120;_p._maximumWidth=Infinity;_p._minimumHeight=27;_p._maximumHeight=Infinity;_p._getDefaultIcon=function()
{return application.getTheme().getAppearanceProperty("window","default-icon");};_p.layoutAllChildren=function(){BiComponent.prototype.layoutAllChildren.call(this);this._layoutChrome();};_p._fixedLayout=function(){this._windowCaption.setLocation(2,2);this._windowCaption.setRight(2);this._windowCaption.setHeight(19);this._windowIcon.setLocation(2,1);this._minimizeButton.setSize(16,14);this._maximizeButton.setSize(16,14);this._closeButton.setSize(16,14);this._minimizeButton.setTop(2);this._maximizeButton.setTop(2);this._closeButton.setTop(2);this._closeButton.setRight(2);this._setContentPaneSize();this._captionLabel.setTop(0);this._captionLabel.setBottom(0);this._windowIcon.setVisible(this._showIcon);this._minimizeButton.setVisible(this._showMinimize);this._maximizeButton.setVisible(this._showMaximize);this._closeButton.setVisible(this._showClose);};_p._layoutChrome=function()
{if(this._showIcon)
this._captionLabel.setLeft(18);else this._captionLabel.setLeft(0);var r=2;if(this._showClose)r+=18;this._maximizeButton.setRight(r);if(this._showMaximize)r+=16;this._minimizeButton.setRight(r);if(this._showMinimize)r+=16;r+=2;this._captionLabel.setRight(r);};BiWindow.prototype.getContentPane=function(){return this._contentPane;};_p.setContentPane=function(oComp){if(oComp&&oComp!=this._contentPane){this._chrome.add(oComp,this._contentPane);this._chrome.remove(this._contentPane);this._contentPane=oComp;this._setContentPaneSize();oComp.setCursor("default");}};BiWindow.prototype.getShowIcon=function(){return this._showIcon;};_p.setShowIcon=function(b){if(this._showIcon!=b){this._showIcon=b;this._windowIcon.setVisible(b);this._layoutChrome();}};BiWindow.prototype.getShowMinimize=function(){return this._showMinimize;};_p.setShowMinimize=function(b){if(this._showMinimize!=b){this._showMinimize=b;this._minimizeButton.setVisible(b);this._layoutChrome();}};BiWindow.prototype.getShowMaximize=function(){return this._showMaximize;};_p.setShowMaximize=function(b){if(this._showMaximize!=b){this._showMaximize=b;this._maximizeButton.setVisible(b);this._layoutChrome();}};BiWindow.prototype.getShowClose=function(){return this._showClose;};_p.setShowClose=function(b){if(this._showClose!=b){this._showClose=b;this._closeButton.setVisible(b);this._layoutChrome();}};_p.setCaption=function(sCaption){var oldCaption=this._captionLabel.getText();this._captionLabel.setText(sCaption);if(oldCaption!=this._captionLabel.getText())
this.dispatchEvent(new BiEvent("captionchanged"));};_p.getCaption=function(){return this._captionLabel.getText();};_p.getIcon=function(){if(this._icon==null)
this._icon=new BiImage(this._windowIcon.getUri(),16,16);return this._icon;};_p.setIcon=function(oImage){if(oImage==null)
oImage=new BiImage(this._getDefaultIcon(),16,16);var oldUri=this.getIcon().getUri();this._windowIcon.setUri(oImage.getUri());this._icon=oImage;if(oldUri!=oImage.getUri())
this.dispatchEvent(new BiEvent("iconchanged"));};BiWindow.prototype.getCanMinimize=function(){return this._canMinimize;};_p.setCanMinimize=function(b){if(this._canMinimize!=b){this._canMinimize=b;this._minimizeButton.setEnabled(b);}};BiWindow.prototype.getHideChrome=function(){return this._hideChrome;};_p.setHideChrome=function(b){if(this._hideChrome!=b){this._hideChrome=b;this._windowCaption.setVisible(!b);this._setContentPaneSize();}};_p._setContentPaneSize=function(){if(this._hideChrome){this._contentPane.setLocation(0,0);this._contentPane.setRight(0);this._contentPane.setBottom(0);}
else{this._contentPane.setLocation(2,21);this._contentPane.setRight(2);this._contentPane.setBottom(2);}};BiWindow.prototype.getResizable=function(){return this._resizable;};_p.setResizable=function(b){if(this._resizable!=b){this._resizable=b;this._maximizeButton.setEnabled(b);}};BiWindow.prototype.setMovable=function(v){this._movable=v;};_p.getMovable=function(){return this.getState()=="normal"&&this._movable;};_p.getPreferredWidth=function(){return this._chrome.getInsetLeft()+this._contentPane.getLeft()+this._contentPane.getPreferredWidth()+this._contentPane.getRight()+this._chrome.getInsetRight();};_p.getPreferredHeight=function(){return this._chrome.getInsetTop()+this._contentPane.getTop()+this._contentPane.getPreferredHeight()+this._contentPane.getBottom()+this._chrome.getInsetBottom();};_p.layoutComponent=function()
{if(this._width!=null)
this._width=Math.max(this.getMinimumWidth(),Math.min(this.getMaximumWidth(),this._width));if(this._height!=null)
this._height=Math.max(this.getMinimumHeight(),Math.min(this.getMaximumHeight(),this._height));BiComponent.prototype.layoutComponent.call(this);};_p.close=function(){var rv=this.dispatchEvent(new BiEvent("beforeclose"));if(rv){if(this._parent)
this._parent.remove(this);this.dispatchEvent(new BiEvent("close"));this.dispose();}};BiWindow.prototype.getState=function(){return this._state;};_p.setState=function(s){if(s=="minimized"&&!this._canMinimize||s=="maximized"&&!this._resizable)
return;if(this._state!=s){if(this._state=="normal"){this._normalWidth=this.getWidth();this._normalHeight=this.getHeight();this._normalLeft=this.getLeft();this._normalTop=this.getTop();if(this._normalLeft==null)
this._normalLeft=0;if(this._normalTop==null)
this._normalTop=0;}
this._state=s;this.setVisible(this._state!="minimized");if(this._state=="maximized"){var h=this.getContentPane().getHeight();this.setLocation(-4,-4);this.setRight(-4);this.setBottom(-4);this._maximizeButton.setAppearance("window-restore-button");}
else if(this._state=="normal"){this.setLocation(this._normalLeft,this._normalTop);this.setRight(null);this.setBottom(null);this.setSize(this._normalWidth,this._normalHeight);this._maximizeButton.setAppearance("window-maximize-button");}
this.dispatchEvent(new BiEvent("statechanged"));}};BiWindow.prototype.getActive=function(){return this._active;};_p.setActive=function(b){if(this._active!=b){this._active=b;this._chrome.setCssClassName("bi-window"+(b?" active":""));if(b){this.bringToFront();this.setFocused(true);this.dispatchEvent(new BiEvent("activated"));}
else{this.setFocused(false);this.dispatchEvent(new BiEvent("deactivated"));}}};_p.bringToFront=function(){var p=this._parent;if(this.getCreated()&&p){var cs=p.getChildren();var max= -Infinity;for(var i=0;i<cs.length;i++)
max=Math.max(max,cs[i].getZIndex());}
this.setZIndex(max+1);};_p.sendToBack=function(){var p=this._parent;if(this.getCreated()&&p){var cs=p.getChildren();var min=Infinity;for(var i=0;i<cs.length;i++)
min=Math.min(min,cs[i].getZIndex());}
this.setZIndex(min-1);};_p.getFocusRoot=function(){return this;};_p.isFocusRoot=function(){return true;};_p.getActiveComponent=function(){if(this._activeComponent&&this._activeComponent.getDisposed())
this._activeComponent=null;return this._activeComponent;};BiWindow.prototype.getAcceptButton=function(){return this._acceptButton;};BiWindow.prototype.setAcceptButton=function(v){this._acceptButton=v;};BiWindow.prototype.getCancelButton=function(){return this._cancelButton;};BiWindow.prototype.setCancelButton=function(v){this._cancelButton=v;};_p.addCommand=function(c){if(c.getOwnerWindow()){c.getOwnerWindow().removeCommand(c);}
this._commands[c.toHashCode()]=c;c._ownerWindow=this;};_p.removeCommand=function(c){delete this._commands[c.toHashCode()];c._ownerWindow=null;};BiWindow.prototype.getOpaque=function(){return this._opaque;};_p.setOpaque=function(b){if(this._opaque!=b){this._opaque=b;if(BiBrowserCheck.ie){if(b){if(!this._opaqueIframe){this._opaqueIframe=new BiIframe;this._opaqueIframe.setHtmlProperty("allowTransparency",false);this._opaqueIframe.setProperties({opacity:0,left:-2,right:-2,top:-2,bottom:-2});this.add(this._opaqueIframe,this.getFirstChild(),true);}}else{if(this._opaqueIframe){this.remove(this._opaqueIframe);this._opaqueIframe.dispose();delete this._opaqueIframe;}}}}};_p.setBorder=function(oBorder){this._chrome.setBorder(oBorder);};_p.getBorder=function(){return this._chrome.getBorder();};_p.setAppearance=function(sName){this._chrome.setAppeance(sName);};_p.getAppearance=function(){return this._chrome.getApperance();};_p._onCloseButtonClick=function(e){this.close();};_p._onMinimizeButtonClick=function(e){if(this._canMinimize)
this.setState("minimized");};_p._onMaximizeButtonClick=function(e){if(this._resizable){if(this.getState()=="normal")
this.setState("maximized");else this.setState("normal");}};_p._onCaptionDown=function(e){this.setActive(true);if(!this.getMovable())return;this._moveHandler.startMove(e);};_p._onMouseEvent=function(e){e.stopPropagation();};_p._checkForResize=function(e){if(this._resizeData)return;this._resizeDir="";if(this._moveData==null&&e.getTarget()==this._chrome){if(this.getResizable()){var oy=e.getOffsetY();if(oy<=20)
this._resizeDir+="n";else if(oy>=this.getHeight()-20)
this._resizeDir+="s";var ox=e.getOffsetX();if(ox<=20)
this._resizeDir+="w";else if(ox>=this.getWidth()-20)
this._resizeDir+="e";}
if(this._resizeDir!="")
this.setCursor(this._resizeDir+"-resize");else this.setCursor("default");}};_p._onEdgeDown=function(e){this.setActive(true);if(this._resizeDir!=""&&e.getTarget()==this._chrome){this._resizeHandler.startResize(this._resizeDir,e);}};_p._onFocus=function(e){if(this._lastActive&&this.contains(this._lastActive)&&this._lastActive.getCanFocus()){this._lastActive.setFocused(true);}};_p._onFocusIn=function(e){if(e.getTarget()!=this)
this._lastActive=e.getTarget();this.setActive(true);e.stopPropagation();};_p._onFocusOut=function(e){if(this.contains(e.getRelatedTarget()))
return;else this.setActive(false);e.stopPropagation();};_p._onkeydown=function(e){this._focusManager.processKeyEvent(this,e);};_p._onDefaultButtonKeyDown=function(e)
{var c;for(var hc in this._commands)
{c=this._commands[hc];if(c.getEnabled()&&c.matchesKeyboardEvent(e))
{if(!c.execute())

⌨️ 快捷键说明

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