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

📄 coreclasses.js

📁 在流览器上仿CS界面的JAVASCRIPT脚本
💻 JS
📖 第 1 页 / 共 5 页
字号:
this._element.releaseCapture();else this.getTopLevelComponent()._eventManager.setCaptureComponent(null);}}};BiComponent.prototype.getCapture=function(){return this._capture;};_p.setAccessKey=function(sAccessKey){this.setHtmlProperty("accessKey",sAccessKey);};_p.getAccessKey=function(){return this.getHtmlProperty("accessKey");};BiComponent.prototype.getContextMenu=function(){return this._contextMenu;};BiComponent.prototype.setContextMenu=function(v){this._contextMenu=v;};BiComponent.prototype.getName=function(){return this._name;};BiComponent.prototype.setName=function(v){this._name=v;};BiComponent.prototype.setToolTip=function(v){this._toolTip=v;};BiComponent.prototype.getToolTipText=function(){return this._toolTipText;};BiComponent.prototype.setToolTipText=function(v){this._toolTipText=v;};_p.getToolTip=function(){if(this._toolTip!=null)
return this._toolTip;if(this._toolTipText!=null)
return BiToolTip.getTextToolTip(this._toolTipText);return null;};_p.setRightToLeft=function(b){if(b==true)
this.setStyleProperty("direction","rtl");else if(b==false)
this.setStyleProperty("direction","ltr");else this.removeStyleProperty("direction");};_p.getRightToLeft=function(){var v=this.getStyleProperty("direction");if(v==null&&this._parent)
return this._parent.getRightToLeft();return v=="rtl";};BiComponent.prototype.getCreated=function(){return this._created;};BiComponent._createEvent=new BiEvent("create");_p._create=function(oDocument){this._document=oDocument||document;var el=this._element=this._document.createElement(this._tagName);el._biComponent=this;this._setHtmlProperties();this._setCssProperties();if(BiBrowserCheck.ie)
{el.onscroll=el.onresize=BiComponent.__oninlineevent;}
else {this._setHtmlAttributes();el.onscroll=el.onfocus=BiComponent.__oninlineevent;}};_p._createChildren=function(oDocument,bLayout){var cs=this._children;var l=cs.length;for(var i=0;i<l;i++){cs[i]._addHtmlElementToParent(this,null,bLayout);}};_p._setCssProperties=function(){var es=this._element.style;var sp=this._style;for(var p in sp){es[p]=sp[p];}};_p._setHtmlProperties=function(){var el=this._element;var hp=this._htmlProperties;for(var p in hp){el[p]=hp[p];}};_p._setHtmlAttributes=function(){var el=this._element;var ha=this._htmlAttributes;for(var n in ha)
el.setAttribute(n,ha[n]);};_p._addHtmlElementToParent=function(oParent,oBefore,bLayout)
{if(this._lazyCreate&&!this.getVisible())
return;if(!this._created)
this._create(oParent._document);if(oBefore&&oBefore._element)
oParent._element.insertBefore(this._element,oBefore._element);else oParent._element.appendChild(this._element);this._created=true;this._createChildren(oParent._document,false);if(bLayout||bLayout==null)
oParent.layoutChild(this);this.dispatchEvent(BiComponent._createEvent);};_p._removeHtmlElement=function(oChild){oChild._removeHtmlElementFromParent(this);};_p._removeHtmlElementFromParent=function(oParent)
{if(this._created&&!(application&&application._disposed))
oParent._element.removeChild(this._element);};_p._oninlineevent=function(e)
{if(this._disposed)return;if(!e)
e=this._document.parentWindow.event;switch(e.type)
{case"losecapture":this._capture=false;this.getTopLevelComponent()._eventManager.setCaptureComponent(null);break;case"focus":if(this.getCanFocus())
this.getTopLevelComponent()._eventManager._mozOnFocus(e,this,this._element);return;}
this.dispatchEvent(new BiEvent(e.type));};_p.dispose=function(){if(this._disposed)return;BiEventTarget.prototype.dispose.call(this);var cs=this._children;for(var i=cs.length-1;i>=0;i--)
cs[i].dispose();if(this._border!=BiComponent.prototype._border)
this._border.dispose();this._border=null;var el=this._element;if(el){el._biComponent=null;el.onscroll=el.onresize=el.onfocus=el.onlosecapture=null;}
this.__oninlineevent=null;this._document=null;this._style=null;this._htmlProperties=null;this._children=null;this._parent=null;this._element=null;this._created=false;};_p.addXmlNode=function(oNode,oParser)
{if(oNode.nodeType==1)
{var c=oParser.fromNode(oNode);if(c instanceof BiComponent)
this.add(c);}};_p.setAttribute=function(sName,sValue,oParser)
{switch(sName)
{case"border":if(sValue.charAt(0)=="#")
{sValue=sValue.substr(1);var b=oParser.getComponentById(sValue);this.setBorder(b);}
else this.setBorder(BiBorder.fromString(sValue));break;case"contextMenu":case"toolTip":case"command":if(sValue.charAt(0)=="#")
sValue=sValue.substr(1);var ref=oParser.getComponentById(sValue);this.setProperty(sName,ref);break;default:BiEventTarget.prototype.setAttribute.apply(this,arguments);}};_p._command=null;BiComponent.prototype.getCommand=function(){return this._command;};_p.setCommand=function(oCommand)
{if(this._command!=oCommand)
{if(this._command)
{this._command.removeEventListener("enabledchanged",this._syncWithCommmand,this);this._command.removeEventListener("checkedchanged",this._syncWithCommmand,this);this._command.removeEventListener("uservaluechanged",this._syncWithCommmand,this);this._command.removeEventListener("shortcutchanged",this._syncWithCommmand,this);}
this._command=oCommand;if(this._command)
{this._syncWithCommmand();this._command.addEventListener("enabledchanged",this._syncWithCommmand,this);this._command.addEventListener("checkedchanged",this._syncWithCommmand,this);this._command.addEventListener("uservaluechanged",this._syncWithCommmand,this);this._command.addEventListener("shortcutchanged",this._syncWithCommmand,this);}}};_p._syncWithCommmand=function()
{if(this._command)
{this.setEnabled(this._command.getEnabled());}};function BiApplicationWindow(){BiComponent.call(this);this.removeHtmlProperty("className");this.removeHtmlProperty("id");this.setRightToLeft(false);this._shownDialogs=[];this._commands={};this._eventManager=new BiEventManager;this._focusManager=new BiFocusManager;this._glassPane=new BiComponent;this._glassPane.setCssClassName("bi-glass-pane");this._glassPane.setLocation(0,0);this._glassPane.setRight(0);this._glassPane.setBottom(0);this.addEventListener("resize",this._onresize);this.addEventListener("keydown",this._ondefaultbuttonkeydown);this.addEventListener("keydown",this._onkeyevent);this.addEventListener("keypress",this._onkeyevent);};var _p=BiApplicationWindow.prototype=new BiComponent;_p._className="BiApplicationWindow";_p._diff=null;_p._insets=null;_p._insetLeft=4;_p._insetRight=4;_p._insetTop=30;_p._insetBottom=4;_p._lastActive=null;_p._activeComponent=null;_p._globalCursor=null;_p.setLeft=function(nLeft){this._window.moveTo(nLeft,this.getTop());};_p.setRight=function(nRight){this.setLeft(this._window.screen.width-this.getWidth()-nRight);};_p.getScreenLeft=_p.getLeft=function(){if(BiBrowserCheck.ie)
return this._window.screenLeft-this._getInsets().left;else return this._window.screenX;};_p.getRight=function(){return this._window.screen.width-this.getLeft()-this.getWidth();};_p.setTop=function(nTop){this._window.moveTo(this.getLeft(),nTop);};_p.setBottom=function(nBottom){this.setTop(this._window.screen.height-this.getHeight()-nBottom);};_p.setLocation=function(nLeft,nTop){this._window.moveTo(nLeft,nTop);};_p.getScreenTop=_p.getTop=function()
{if(BiBrowserCheck.ie)
return this._window.screenTop-this._getInsets().top;else return this._window.screenY;};_p.getBottom=function(){return this._window.screen.height-this.getTop()-this.getHeight();};_p.setWidth=function(nWidth){if(BiBrowserCheck.ie)
this._window.resizeTo(nWidth,this.getHeight());else this._window.outerWidth=nWidth;};_p.getWidth=function(){if(BiBrowserCheck.ie)
return this._getSize().width;else return this._window.outerWidth;};_p.setHeight=function(nHeight)
{if(BiBrowserCheck.ie)
this._window.resizeTo(this.getWidth(),nHeight);else this._window.outerHeight=nHeight;};_p.setSize=function(nWidth,nHeight){this._window.resizeTo(nWidth,nHeight);};_p.getHeight=function(){if(BiBrowserCheck.ie)
return this._getSize().height;else return this._window.outerHeight;};_p.getInsetLeft=function(){return this._getInsets().left+BiComponent.prototype.getInsetLeft.call(this);};_p.getInsetRight=function(){return this.getWidth()-this.getInsetLeft()-this.getClientWidth();};_p.getInsetTop=function(){return this._getInsets().top+BiComponent.prototype.getInsetTop.call(this);};_p.getInsetBottom=function(){return this.getHeight()-this.getInsetTop()-this.getClientHeight();};_p.getClientLeft=function(){return-this.getInsetLeft();};_p.getClientTop=function(){return-this.getInsetTop();};_p._getScreenClientArea=function()
{if(BiBrowserCheck.ie)
return{left:this._window.screenLeft,top:this._window.screenTop,width:this._element.clientWidth,height:this._element.clientHeight};else {var bo=this._document.getBoxObjectFor(this._document.documentElement);return{left:bo.screenX,top:bo.screenY,width:this._element.clientWidth,height:this._element.clientHeight};}};_p.setZIndex=_p.getZIndex=_p.setVisible=_p.getVisible=function(){throw new Error("Not supported");};_p.getTopLevelComponent=function(){return this;};_p.getIsVisible=function(){return true;};_p.getCaption=function(){return this._window.document.title;};_p.setCaption=function(sTitle){this._window.document.title=sTitle;};_p.getFullScreen=function(){throw new Error("Not yet implemented");};_p.getResizable=function(){throw new Error("Not yet implemented");};_p.close=function(){this._window.close();};_p.print=function(){this._window.print();};_p.isFocusRoot=function(){return true;};_p.getFocusRoot=function(){return this;};_p.getActiveComponent=function(){if(this._activeComponent&&this._activeComponent.getDisposed())
this._activeComponent=null;return this._activeComponent;};BiApplicationWindow.prototype.getAcceptButton=function(){return this._acceptButton;};BiApplicationWindow.prototype.setAcceptButton=function(v){this._acceptButton=v;};BiApplicationWindow.prototype.getCancelButton=function(){return this._cancelButton;};BiApplicationWindow.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;};_p.updateGlassPane=function(oDialog,bVisible){this._shownDialogs.remove(oDialog);if(bVisible){this.add(this._glassPane,oDialog);this._glassPane.setZIndex(oDialog.getZIndex());if(BiBrowserCheck.moz)
{oDialog.setZIndex(oDialog.getZIndex()+1);oDialog.setZIndex(oDialog.getZIndex()-1);}
this._shownDialogs.push(oDialog);}
else{if(this._shownDialogs.length==0)
this.remove(this._glassPane);else{var d=this._shownDialogs[this._shownDialogs.length-1];this._glassPane.setZIndex(d.getZIndex());d.setActive(true);}}};BiApplicationWindow.prototype.getGlobalCursor=function(){return this._globalCursor;};_p.setGlobalCursor=function(sCursor){this._globalCursor=sCursor;if(BiBrowserCheck.ie)
{if(!this._cursorStyleEl)
this._cursorStyleEl=this._document.createStyleSheet();if(sCursor==null||sCursor=="")
this._cursorStyleEl.cssText="";else this._cursorStyleEl.cssText="*{cursor:"+sCursor+" !important}";this.setCapture(true);this.setCapture(false);}
else throw new Error("BiApplicationWindow setGlobalCursor is not yet implemented");};_p.getAllowBrowserContextMenu=function()
{return this._eventManager.getAllowBrowserContextMenu();};_p.setAllowBrowserContextMenu=function(b)
{return this._eventManager.setAllowBrowserContextMenu(b);};_p._create=function(oWindow){this._window=oWindow||window;this._document=this._window.document;var el=this._element=this._document.body;el._biComponent=this;this._window._biComponent=this;this._document.documentElement._biComponent=this;this._eventManager.attachToWindow(this._window);this._setHtmlProperties();this._setCssProperties();if(BiBrowserCheck.ie)
el.onscroll=el.onresize=BiComponent.__oninlineevent;else {this._setHtmlAttributes();el.onscroll=el.onfocus=BiComponent.__oninlineevent;}
this._created=true;var cs=this._children;var l=cs.length;for(var i=0;i<l;i++){cs[i]._addHtmlElementToParent(this);}};_p.dispose=function()
{if(this.getDisposed())return;BiComponent.prototype.dispose.call(this);if(this._cursorStyleEl)
{this._cursorStyleEl.disabled=true;this._cursorStyleEl.cssText="";this._cursorStyleEl=null}
for(var i=this._shownDialogs.length-1;i>=0;i--)
this._shownDialogs[i]=null;this._shownDialogs=null;for(var c in this._commands)
delete this._commands;this._commands=null;this._glassPane.dispose();this._window.document.documentElement._biComponent=null;this._window._biComponent=null;this._window=null;};_p._onresize=function(e){(new BiPopupManager).hideAutoHiding();this.layoutAllChildren();};_p._onkeyevent=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.matchesKeyboardEvent(e))
{if(!c.execute())
e.preventDefault();}}
var t=e.getTarget();switch(e.getKeyCode())
{case BiKeyboardEvent.ENTER:if(this._acceptButton&&!t._acceptsEnter&&!e.getAltKey())
{this._acceptButton.dispatchEvent(new BiEvent("action"));if(this._acceptButton.getCommand())
{this._acceptButton.getCommand().execute()}}
break;case BiKeyboardEvent.ESC:if(this._cancelButton&&!t._acceptsEsc)
{this._cancelButton.dispatchEvent(new BiEvent("action"));if(this._cancelButton.getCommand())
{this._cancelButton.getCommand().execute()}}
break;}};_p._getSize=function(){var oldInnerSize=this._getInnerSize();if(this._diff==null)
this._diff={width:Number(this._insetLeft)+Number(this._insetRight),height:Number(this._insetTop)+Number(this._insetBottom)};this._window.resizeTo(oldInnerSize.width+this._diff.width,oldInnerSize.height+this._diff.height);var newInnerSize=this._getInnerSize();var diff={width:oldInnerSize.width-newInnerSize.width+this._diff.width,height:oldInnerSize.height-newInnerSize.height+this._diff.height};this._window.resizeTo(oldInnerSize.width+diff.width,oldInnerSize.height+diff.height);this._diff=diff;return{width:oldInnerSize.width+diff.width,height:oldInnerSize.height+diff.height};};_p._getInnerSize=function(){return{width:this.getClientWidth(),height:this.getClientHeight()};};_p._getInsets=function(){if(BiBrowserCheck.ie)
{var oldScreenLeft=this._window.screenLeft;var oldScreenTop=this._window.screenTop;if(this._insets==null)
this._insets={left:Number(this._insetLeft),top:Number(this._insetTop)};this._window.moveTo(oldScreenLeft-this._insets.left,oldScreenTop-this._insets.top);var newScreenLeft=this._window.screenLeft;var newScreenTop=this._window.screenTop;var res={left:newScreenLeft-oldScreenLeft+this._insets.left,top:newScreenTop-oldScreenTop+this._insets.top};this._window.moveTo(oldScreenLeft-res.left,oldScreenTop-res.top);return this._insets=res;}
else {var bo=this._document.getBoxObjectFor(this._document.documentElement);return{left:bo.screenX-this._window.screenX,top:bo.screenY-this._window.screenY};}};function BiFocusManager(){};var _p=BiFocusManager.prototype=new BiObject;_p._className="BiFocusManager";_p.compareTabOrder=function(c1,c2){if(c1==c2)
return 0;var t1=c1.getTabIndex();var t2=c2.getTabIndex();if(t1!=t2)
return t1-t2;var y1=c1.getScreenTop();var y2=c2.getScreenTop();if(y1!=y2)
return y1-y2;var x1=c1.getScreenLeft();var x2=c2.getScreenLeft();if(x1!=x2)
return x1-x2;var z1=c1.getZIndex();var z2=c2.getZIndex();if(z1!=z2)
return z1-z2;return 0;};_p.getComponentAfter=function(oContainer,oComponent){if(oContainer==oComponent)
return this.getFirstComponent(oContainer);if(oComponent._anonymous)
oComponent=oComponent.getParent();if(oComponent==null)
return[];var all=[];this._getAllAfter(oContainer,oComponent,all);all.sort(this.compareTabOrder);return all.length>0?all[0]:this.getFirstComponent(oContainer);};_p.getComponentBefore=function(oContainer,oComponent){if(oContainer==oComponent)
return this.getLastComponent(oContainer);if(oComponent._anonymous)
oComponent=oComponent.getParent();if(oComponent==null)
return[];var all=[];this._getAllBefore(oContainer,oComponent,all);all.sort(this.compareTabOrder);var l=all.length;return l>0?all[l-1]:this.getLastComponent(oContainer);};_p.processKeyEvent=function(oContainer,e){if(e.getKeyCode()==BiKeyboardEvent.TAB&&(BiBrowserCheck.moz&&e.getType()=="keypress"||BiBrowserCheck.ie&&e.getType()=="keydown"))
{e.preventDefault();e.stopPropagation();var current=oContainer.getActiveComponent();var next;if(!e.getShiftKey())
{if(current)
next=this.getComponentAfter(oContainer,current);else next=this.getFirstComponent(oContainer);}
else {if(current)
next=this.getComponentBefore(oContainer,current);else next=this.getLastComponent(oContainer);}
if(next)
{if(current)
{if(BiBrowserCheck.moz)
{current._blurComponent();}
if(typeof current._deselectOnTabBlur=="function")
current._deselectOnTabBlur();}
next.setFocused(true);next._focusComponent();if(typeof next._selectOnTabFocus=="function")
next._selectOnTabFocus();}}};_p.getFirstComponent=function(oContainer){var oFirst=this._getFirst(oContainer,null);return oFirst;};_p.getLastComponent=function(oContainer){var oLast=this._getLast(oContainer,null);return oLast;};_p._getAllAfter=function(oCont,oComp,oArray){var cs=oCont.getChildren();var l=cs.length;for(var i=0;i<l;i++){if(!(cs[i]instanceof BiComponent))
continue;if(cs[i].getCanFocus()&&cs[i].getTabIndex()>0&&this.compareTabOrder(oComp,cs[i])<0){oArray.push(cs[i]);}

⌨️ 快捷键说明

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