📄 core.js
字号:
{BiComponent.flushLayoutComponent(this);if(this._element.style.width=="")
{var ps=this._element.parentNode.style;var w=ps.width;var h=ps.height;ps.width=ps.height="9999999px";var res=this._element.offsetWidth;ps.width=w;ps.height=h;return res;}
return this._element.offsetWidth;}
return this._width;};_p.getHeight=function()
{if(this._created)
{BiComponent.flushLayoutComponent(this);if(this._element.style.height=="")
{var ps=this._element.parentNode.style;var w=ps.width;var h=ps.height;ps.width=ps.height="9999999px";var res=this._element.offsetHeight;ps.width=w;ps.height=h;return res;}
return this._element.offsetHeight;}
return this._height;};}
_p.getHasFixedWidth=function()
{return this._width!=null||this._left!=null&&this._right!=null;};_p.getHasFixedHeight=function()
{return this._height!=null||this._top!=null&&this._bottom!=null;};_p.getClientWidth=function()
{if(this._created)
{BiComponent.flushLayoutComponent(this);return this._element.clientWidth;}
throw new Error("Visual property on non created component");};_p.getClientHeight=function()
{if(this._created)
{BiComponent.flushLayoutComponent(this);return this._element.clientHeight;}
throw new Error("Visual property on non created component");};_p.getInsetLeft=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this._element.clientLeft;else {var rtl=this.getRightToLeft();var el=this._element;var cs=this._document.defaultView.getComputedStyle(el,"");if(!rtl)
return parseInt(cs.borderLeftWidth);return el.offsetWidth-el.clientWidth-parseInt(cs.borderRightWidth);}};_p.getInsetRight=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);var el=this._element;if(BiBrowserCheck.ie)
{if(this.getStyleProperty("overflowY")=="hidden"||el.clientWidth==0)
{if(el.currentStyle.borderRightStyle=="none")
return 0;var brw=el.currentStyle.borderRightWidth;if(brw.indexOf("px")!= -1)
return parseInt(brw);}
return Math.max(0,this._element.offsetWidth-this._element.clientLeft-this._element.clientWidth);}
else {var rtl=this.getRightToLeft();var cs=this._document.defaultView.getComputedStyle(el,"");if(rtl)
return parseInt(cs.borderRightWidth);return Math.max(0,el.offsetWidth-el.clientWidth-parseInt(cs.borderLeftWidth));}};_p.getInsetTop=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this._element.clientTop;else {return parseInt(window.getComputedStyle(this._element,"").borderTopWidth);}};_p.getInsetBottom=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);var el=this._element;if(BiBrowserCheck.ie)
{if(this.getStyleProperty("overflowX")=="hidden"||el.clientHeight==0)
{if(el.currentStyle.borderBottomStyle=="none")
return 0;var bbw=el.currentStyle.borderBottomWidth;if(bbw.indexOf("px")!= -1)
return parseInt(bbw);}
return Math.max(0,this._element.offsetHeight-this._element.clientTop-this._element.clientHeight);}
else {var cs=this._document.defaultView.getComputedStyle(el,"");return Math.max(0,el.offsetHeight-el.clientHeight-parseInt(cs.borderTopWidth));}};_p.getClientLeft=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this._element.getBoundingClientRect().left;else {var el=this._element;var doc=this._document;var win=doc.defaultView;var bo=doc.getBoxObjectFor(el);var bl=parseInt(win.getComputedStyle(el,"").borderLeftWidth);var sum=0;var p=this._element.parentNode;while(p.nodeType==1)
{sum+=p.scrollLeft;p=p.parentNode;}
return bo.x-bl-sum;}};_p.getClientTop=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this._element.getBoundingClientRect().top;else {var el=this._element;var doc=this._document;var win=doc.defaultView;var bo=doc.getBoxObjectFor(el);var bt=parseInt(win.getComputedStyle(el,"").borderTopWidth);var sum=0;var p=this._element.parentNode;while(p.nodeType==1)
{sum+=p.scrollTop;p=p.parentNode;}
return bo.y-bt-sum;}};_p.getScreenLeft=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this.getClientLeft()+this._document.parentWindow.screenLeft;else {var sum=0;var p=this._element.parentNode;while(p.nodeType==1)
{sum+=p.scrollLeft;p=p.parentNode;}
return this._document.getBoxObjectFor(this._element).screenX-sum;}};_p.getScreenTop=function()
{if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);if(BiBrowserCheck.ie)
return this.getClientTop()+this._document.parentWindow.screenTop;else {var sum=0;var p=this._element.parentNode;while(p.nodeType==1)
{sum+=p.scrollTop;p=p.parentNode;}
return this._document.getBoxObjectFor(this._element).screenY-sum;}};_p._getScreenClientArea=function()
{return{left:this.getScreenLeft()+this.getInsetLeft(),top:this.getScreenTop()+this.getInsetTop(),width:this.getClientWidth(),height:this.getClientHeight()};};_p.getPreferredWidth=function()
{if(this._preferredWidth!=null)
return this._preferredWidth;if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutQueue();var el=this._element;var w=el.style.width;var h=el.style.height;el.style.width="auto";el.style.height="auto";var sw=el.scrollWidth;var sh=el.scrollHeight;el.style.width=w;el.style.height=h;return this.getInsetLeft()+sw+this.getInsetRight();};_p.getPreferredHeight=function()
{if(this._preferredHeight!=null)
return this._preferredHeight;if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutQueue();var el=this._element;var w=el.style.width;var h=el.style.height;el.style.width="auto";el.style.height="auto";var sw=el.scrollWidth;var sh=el.scrollHeight;el.style.width=w;el.style.height=h;return this.getInsetTop()+sh+this.getInsetBottom();};_p.setPreferredWidth=function(n)
{if(this._preferredWidth!=n)
{this._preferredWidth=n;this.invalidateParentLayout("preferred");}};_p.setPreferredHeight=function(n)
{if(this._preferredHeight!=n)
{this._preferredHeight=n;this.invalidateParentLayout("preferred");}};_p.setPreferredSize=function(nWidth,nHeight){this.setPreferredWidth(nWidth);this.setPreferredHeight(nHeight);};_p.pack=function(){this.setSize(this.getPreferredWidth(),this.getPreferredHeight());};_p.getMinimumWidth=function()
{if(this._minimumWidth!=null)
return this._minimumWidth;return 0;};_p.setMinimumWidth=function(n)
{if(this._minimumWidth!=n)
{this._minimumWidth=n;this.invalidateParentLayout("minimum");}};_p.getMaximumWidth=function()
{if(this._maximumWidth!=null)
return this._maximumWidth;return Infinity;};_p.setMaximumWidth=function(n)
{if(this._maximumWidth!=n)
{this._maximumWidth=n;this.invalidateParentLayout("maximum");}};_p.getMinimumHeight=function()
{if(this._minimumHeight!=null)
return this._minimumHeight;return 0;};_p.setMinimumHeight=function(n)
{if(this._minimumHeight!=n)
{this._minimumHeight=n;this.invalidateParentLayout("minimum");}};_p.getMaximumHeight=function()
{if(this._maximumHeight!=null)
return this._maximumHeight;return Infinity;};_p.setMaximumHeight=function(n)
{if(this._maximumHeight!=n)
{this._maximumHeight=n;this.invalidateParentLayout("maximum");}};_p.setBorder=function(oBorder)
{if(this._border)
this._border.removeBorder(this);this._border=oBorder;if(oBorder)
this._border.paintBorder(this);if(!this.getHasFixedWidth()||!this.getHasFixedHeight())
this.invalidateParentLayout("size");this.invalidateLayout();};_p.getBorder=function()
{return this._border?this._border:new BiBorder;};_p._marginLeft=0;_p._marginRight=0;_p._marginTop=0;_p._marginBottom=0;BiComponent.prototype.getMarginLeft=function(){return this._marginLeft;};_p.setMarginLeft=function(n)
{if(this._marginLeft!=n)
{this._marginLeft=Number(n);this.invalidateParentLayout("margin");}};BiComponent.prototype.getMarginRight=function(){return this._marginRight;};_p.setMarginRight=function(n)
{if(this._marginRight!=n)
{this._marginRight=Number(n);this.invalidateParentLayout("margin");}};BiComponent.prototype.getMarginTop=function(){return this._marginTop;};_p.setMarginTop=function(n)
{if(this._marginTop!=n)
{this._marginTop=Number(n);this.invalidateParentLayout("margin");}};BiComponent.prototype.getMarginBottom=function(){return this._marginBottom;};_p.setMarginBottom=function(n)
{if(this._marginBottom!=n)
{this._marginBottom=Number(n);this.invalidateParentLayout("margin");}};_p.setMargin=function(nLeft,nRight,nTop,nBottom)
{if(arguments.length==1)
{nBottom=nTop=nRight=nLeft;}
else if(arguments.length==2)
{nTop=nBottom=nRight;nRight=nLeft;}
this._marginLeft=Number(nLeft);this._marginRight=Number(nRight);this._marginTop=Number(nTop);this._marginBottom=Number(nBottom);this.invalidateParentLayout("maximum");};_p._clipLeft=null;_p._clipRight=null;_p._clipTop=null;_p._clipBottom=null;_p.setClip=function(nLeft,nTop,nWidth,nHeight)
{if(nLeft=="auto")
nLeft=null;if(nTop=="auto")
nTop=null;if(nWidth=="auto")
nWidth=null;if(nHeight=="auto")
nHeight=null;if(nLeft!=this._clipLeft||nTop!=this._clipTop||nWidth!=this._clipWidth||nHeight!=this._clipHeight)
{this._clipLeft=nLeft;this._clipTop=nTop;this._clipWidth=nWidth;this._clipHeight=nHeight;this._setClipValue();}};BiComponent.prototype.getClipLeft=function(){return this._clipLeft;};_p.setClipLeft=function(nLeft)
{if(nLeft=="auto")
nLeft=null;if(this._clipLeft!=nLeft)
{this._clipLeft=nLeft;this._setClipValue()}};BiComponent.prototype.getClipTop=function(){return this._clipTop;};_p.setClipTop=function(nTop)
{if(nTop=="auto")
nTop=null;if(this._clipTop!=nTop)
{this._clipTop=nTop;this._setClipValue()}};BiComponent.prototype.getClipWidth=function(){return this._clipWidth;};_p.setClipWidth=function(nWidth)
{if(nWidth=="auto")
nWidth=null;if(this._clipWidth!=nWidth)
{this._clipWidth=nWidth;this._setClipValue()}};BiComponent.prototype.getClipHeight=function(){return this._clipHeight;};_p.setClipHeight=function(nHeight)
{if(nHeight=="auto")
nHeight=null;if(this._clipHeight!=nHeight)
{this._clipHeight=nHeight;this._setClipValue();}};_p._setClipValue=function()
{var left=this._clipLeft;var top=this._clipTop;var width=this._clipWidth;var height=this._clipHeight;var right,bottom;if(left==null)
{if(width==null)
right="auto";else right=width+"px";left="auto"}
else {if(width==null)
right="auto";else right=left+width+"px";left=left+"px";}
if(top==null)
{if(height==null)
bottom="auto";else bottom=height+"px";top="auto"}
else {if(height==null)
bottom="auto";else bottom=top+height+"px";top=top+"px";}
this.setStyleProperty("clip","rect("+top+","+right+","+bottom+","+left+")");};_p.setOverflow=function(sOverflow)
{if(BiBrowserCheck.ie)
{this.setOverflowX(sOverflow);this.setOverflowY(sOverflow);}
else {this._overflow=sOverflow;this._overflowX=sOverflow;this._overflowY=sOverflow;if(sOverflow=="hidden")
sOverflow="-moz-scrollbars-none";this.setStyleProperty("overflow",sOverflow);if(!this.getHasFixedWidth()||!this.getHasFixedHeight())
this.invalidateParentLayout("size");this.invalidateLayout();}};_p.getOverflow=function(){if(BiBrowserCheck.ie)
{var x=this.getOverflowX();var y=this.getOverflowY();return x==y?x:null;}
else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-horizontal"||s=="-moz-scrollbars-vertical")
return null;else if(s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.setOverflowX=function(sOverflowX)
{if(this._overflowX!=sOverflowX)
{if(BiBrowserCheck.ie)
{this.setStyleProperty("overflowX",sOverflowX);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -