📄 19-1.js
字号:
if(l<0){w+=l;l=0;}
if(w<this.minW){l=l+w-this.minW;w=this.minW;}
}
if(xxx=="e"){
w=this.w0+e.clientX-this.x0;
w=w<this.minW?this.minW:w;
}
if(yyy=="n"){
t=this.y1+e.clientY - this.y0;
h=this.h0+this.y0-e.clientY;
if(t<0){h+=t;t=0;}
if(h<this.minH){t=t+h-this.minH;h=this.minH;}
}
if(yyy=="s"){
h=this.h0+e.clientY-this.y0;
h=h<this.minH?this.minH:h;
}
this.MoveTo(l,t);
this.ResizeTo(w,h);
return(true);
}
if(this._windowState=="normal"){
var cc="";
x=window.getRealLeft(this);
y=window.getRealTop(this);
w=parseInt(this.offsetWidth);
h=parseInt(this.offsetHeight);
if(e.clientY-y<5)cc+="n";
if(y+h-e.clientY<5)cc+="s";
if(e.clientX-x<5)cc+="w";
if(x+w-e.clientX<5)cc+="e";
if(cc!=""){
this.style.cursor=cc+"-resize";
return(true);
}
if(this.style.cursor!="default"){
this.style.cursor="default";
}
}
}
function _xWin_event_doClick(evt){
var e=evt?evt:window.event;
var eSrc=e.srcElement?e.srcElement:e.target;
switch(eSrc){
}
}
function _xWin_event_doSelect(evt){
var e=evt?evt:window.event;
var eSrc=e.srcElement?e.srcElement:e.target;
if(eSrc==this.oTitle||this.oTitle.contains(eSrc)){
e.cancelBubble=true;
e.returnValue=false;
return(false);
}
}
function _xWinParentNode_event_doScroll(evt){
if(!this.minimizedWindows)return(true);
for(var i=0;i<this.minimizedWindows.length;i++){
this.minimizedWindows[i].Min(true);
}
}
//**方法函数区******
function _xWin_method_Close(){
this.Destroy();
}
function _xWin_method_Destroy(){
if(this.minIndex){
this.parentNode.minimizedWindows[this.minIndex]=null;
this.minIndex=null;
}
this.panrentnNode.removeChild(this);
}
function _xWin_method_GetSetting(attributeName){
var settingString=this.settingNode.innerHTML;
if(!attributeName)return(settingString);
var regE=new RegExp(attributeName+"=[ \t]*\"?([^\"]*)","i");
var re=settingString.match(regE);
if(re){
return(re[1]);
}else{
return(re);
}
}
function _xWin_method_Max(reV){
if(this._windowState=="maximize"&&(!reV)){
//还原父节点overflow属性
this.parentNode.style.overflow=this.parentNode.restoredStyle_overflow;
this.MoveTo(this._restoredWinRect.l,this._restoredWinRect.t);
this.ResizeTo(this._restoredWinRect.w,this._restoredWinRect.h);
this.oTitleMButton.value = this.minButton;
this.oTitleMaButton.value = this.maxButton;
this._windowState="normal";
}else{
if(this._windowState=="normal"){
this._restoredWinRect.l=this._winRect.l;this._restoredWinRect.t=this._winRect.t;
this._restoredWinRect.w=this._winRect.w;this._restoredWinRect.h=this._winRect.h;
}
if(this.minIndex!=null){
this.parentNode.minimizedWindows[this.minIndex]=null;
this.minIndex=null;
}
if(this.minTimeHandle!=null){
__xSeriaTimer__.pop(this.minTimeHandle);
this.minTimeHandle=null;
}
//纪录父节点overflow属性
this.parentNode.restoredStyle_overflow=this.parentNode.style.overflow;
//改变父节点overflow属性
this.parentNode.style.overflow="hidden";
this.MoveTo(0,0);
if(this.parentNode!=document.body){
w=this.parentNode.clientWidth-5;
h=this.parentNode.clientHeight-4;
}else{
w=document.documentElement.clientWidth-5;
h=document.documentElement.clientHeight-4;
}
this.ResizeTo(w,h);
this.oTitleMButton.value = this.minButton;
this.oTitleMaButton.value = this.normalButton;
this._windowState="maximize";
this.scrollIntoView();
}
}
function _xWin_method_Min(reV){
if(this._windowState=="minimize"&&(!reV)){
this.MoveTo(this._restoredWinRect.l,this._restoredWinRect.t);
this.ResizeTo(this._restoredWinRect.w,this._restoredWinRect.h);
this.oTitleMButton.value = this.minButton;
this.oTitleMaButton.value = this.maxButton;
this._windowState="normal";
this.parentNode.minimizedWindows[this.minIndex]=null;
this.minIndex=null;
if(this.minTimeHandle!=null){
__xSeriaTimer__.pop(this.minTimeHandle);
this.minTimeHandle=null;
}
}else{
if(this._windowState=="normal"){
this._restoredWinRect.l=this._winRect.l;this._restoredWinRect.t=this._winRect.t;
this._restoredWinRect.w=this._winRect.w;this._restoredWinRect.h=this._winRect.h;
}else{
//还原父节点overflow属性
try{
this.parentNode.style.overflow=this.parentNode.restoredStyle_overflow;
}catch(e){}
}
if(!this.parentNode.minimizedWindows)this.parentNode.minimizedWindows=new Array();
if(this._windowState!="minimize"){
for(var i=0;i<this.parentNode.minimizedWindows.length;i++){
if(this.parentNode.minimizedWindows[i]==null)break;
}
this.parentNode.minimizedWindows[i]=this;
}else{
i=this.minIndex;
}
this.ResizeTo(0,0);
var w=this.offsetWidth;
var h=this.offsetHeight;
var mw=getParentRect(this).mw;
var mh=getParentRect(this).mh;
var n=parseInt(mw/w);
var t=parseInt(i/n)+1;
this.MoveTo(w*(i%n),mh-t*h-1);
if(mh>getParentRect(this).mh){
this.MoveTo(w*(i%n),mh-t*h-200);
mh=getParentRect(this).mh;
this.MoveTo(w*(i%n),mh-t*h-1);
}
this.minIndex=i;
this.oTitleMButton.value = this.normalButton;
this.oTitleMaButton.value = this.maxButton;
this._windowState="minimize";
if(this.minTimeHandle==null){
this.minTimeHandle=__xSeriaTimer__.push("Min(true)",this);
this.scrollIntoView();
}
}
}
function _xWin_method_MoveTo(x,y){
var win = this.oTitle.parentNode;
var sha = win.nextSibling;
x=isNaN(x)?0:parseInt(x);
y=isNaN(y)?0:parseInt(y);
x=x<0?0:x;
y=y<0?0:y;
this.style.left=x+"px";
this.style.top=y+"px";
sha.style.left = parseInt(win.style.left) + ((this.moveable||this.resizable)?this.offx:0)+"px";
sha.style.top = parseInt(win.style.top) + ((this.moveable||this.resizable)?this.offy:0)+"px";
this._winRect.l=x;
this._winRect.t=y;
}
function _xWin_method_ResizeTo(w,h){
var win = this;
var sha = win.nextSibling;
var w=isNaN(w)?this.minW:parseInt(w);
var h=isNaN(h)?this.minH:parseInt(h);
var w=w<this.minW?this.minW:w;
var h=h<this.minH?this.minH:h;
this.style.width=w+"px";
this.style.height=h+"px";
this.oTitle.style.width=parseInt(this.clientWidth)+"px";
var wTC=this.clientWidth;
for(var i=0;i<this.oTitle.childNodes.length;i++){
if(this.oTitle.childNodes[i]!=this.oTitleContent){wTC-=this.oTitle.childNodes[i].offsetWidth;}
}
wTC-=8;
this.oTitleContent.style.width=(wTC<1?1:wTC)+"px";
var wC=this.clientHeight-this.oTitle.offsetHeight-6;
this.oContent.style.height=(wC<1?1:wC)+"px";
this.oContent.style.width=parseInt(this.clientWidth-6)+"px";
sha.style.left = parseInt(win.style.left) + ((this.moveable||this.resizable)?this.offx:0)+"px";
sha.style.top = parseInt(win.style.top) + ((this.moveable||this.resizable)?this.offy:0)+"px";
sha.style.width = parseInt(win.style.width)+"px";
sha.style.height = parseInt(win.style.height)+"px";
this._winRect.w=w;
this._winRect.h=h;
}
function _xWin_method_SetContent(v){
if(this.oContent){
if(v==null||v==undefined||v==""){this._body=this.oContent.innerHTML="";return(this.oContent);}
if(typeof(v)=="string"){
this._body=this.oContent.innerHTML=v;
return(this.oContent);
}else{
try{
this.oContent.innerHTML="";
this._body=this.oContent.appendChild(v);
return(this.oContent);
}catch(e){
throw(e);
}
}
}else{
this._body=v;
return(null);
}
}
function _xWin_method_SetTitle(strT){
this._title=strT==null?this._title:strT;
if(this.oTitleContent){
setInnerText(this.oTitleContent,this._title);
}
}
function _xWin_method_ShowHide(dis){
var bdisplay = (dis==null)?((this.style.display=="none")?"":"none"):dis;
this.style.display = bdisplay;
this.nextSibling.style.display = bdisplay;
if(bdisplay=="none"){
if(this._windowState=="minimize"){
this.parentNode.minimizedWindows[this.minIndex]=null;
this.minIndex=null;
}
}else{
if(this._windowState=="minimize"){
this.Min();
}
}
}
//**通用函数区***
function getRealLeft(o){
var l=o.offsetLeft-o.scrollLeft;
while(o=o.offsetParent){
l+=o.offsetLeft-o.scrollLeft;
}
return(l);
}
function getRealTop(o){
var t=o.offsetTop-o.scrollTop;
while(o=o.offsetParent){
t+=o.offsetTop-o.scrollTop;
}
return(t);
}
function setInnerText(obj,text){
switch(BROWSERNAME){
case "ns":
obj.textContent=text;
break;
case "ie":
default:
obj.innerText=text;
}
}
function getElementByClassName(obj,className){
for(var i=0;i<obj.childNodes.length;i++){
if(obj.childNodes[i].className==className)return(obj.childNodes[i]);
}
return(null);
}
function getParentRect(obj){
var re=new Object();
if(obj.parentNode!=document.body){
re.mw=Math.max(obj.parentNode.scrollWidth,obj.parentNode.clientWidth);
re.mh=Math.max(obj.parentNode.scrollHeight,obj.parentNode.clientHeight);
}else{
re.mw=Math.max(document.documentElement.scrollWidth,document.documentElement.clientWidth);
re.mh=Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight);
}
return(re);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -