//JS/UIXv0.44
//(c)mass:werk(N.Landsteiner)2003
//allrightsreserved
//termgui
varconf_term_x=102;
varconf_term_y=34;
varconf_kbd_offset=34;
vartermImgPath='jsuix_support/';
vartermDiv='termDiv';
vartermBgColor='#181818';
vartermFrameColor='#555555';
vartermPageColor='#222222';
varconf_repeat_delay1=320;
varconf_repeat_delay2=170;
vartermKbdDiv='termKbdDiv';
vartermKbdBgColor='#222222';
varkeycapspath='jsuix_support/keycaps/';
vartermSubDivs=false;
vartermLayers=false;
vartermDocNS4=null;
vartermStringStart='';
vartermStringEnd='';
vartermKbdDocNS4=null;
vartermKbdOn=false;
varkeycapsShift=false;
varkeycapsCpslk=false;
varkeycapsShiftRef=newArray();
varkeycapsCpslkRef=newArray();
vartermSpecials=newArray();
termSpecials[0]='';
termSpecials[1]='$';
termSpecials[2]='';
termSpecials[3]='?';
termSpecials[4]='#';
termSpecials[32]='';
termSpecials[34]='"';
termSpecials[38]='&';
termSpecials[60]='<';
termSpecials[62]='>';
termSpecials[127]='◊';
vartermStyles=newArray(1,2,4,8);
vartermStyleOpen=newArray();
vartermStyleClose=newArray();
termStyleOpen[1]='
termStyleClose[1]='';
termStyleOpen[2]='';
termStyleClose[2]='';
termStyleOpen[4]='';
termStyleClose[4]='';
termStyleOpen[8]=''; ';
termStyleClose[8]='
//buttonsUI
vartermImgNames=newArray('left_lo','left_hi','right_lo','right_hi','delete_lo','delete_hi','esc_lo','esc_hi','kbd_show_lo','kbd_show_hi','kbd_hide_lo','kbd_hide_hi');
vartermImages=newArray();
functiontermImgPreload(path,imgnames){
for(vari=0;i
termImages[n]=newImage();
termImages[n].src=path+n+'.gif'
}
}
if(document.images)termImgPreload(termImgPath,termImgNames);
functiontermSetImg(n,v){
if(document.images){
varimg=(termLayers)?termDocNS4.images['term_'+n]:document.images['term_'+n];
varstat=(v)?'_hi':'_lo';
img.src=termImages[n+stat].src
}
}
//UIkeyboard
//keymaps(200=leftshift,202=rightshift,204=CpsLock)
vartermKeyMap=[
[96,49,50,51,52,53,54,55,56,57,48,45,61,8],
[27,113,119,101,114,116,121,117,105,111,112,91,93,13],
[204,97,115,100,102,103,104,106,107,108,59,39,35],
[200,92,122,120,99,118,98,110,109,44,46,47,30,202],
[32,28,31,29]
];
vartermKeyMapShift=[
[126,33,34,35,36,37,94,38,42,40,41,95,43,8],
[27,81,87,69,82,84,89,85,73,79,80,123,125,13],
[204,65,83,68,70,71,72,74,75,76,58,34,64],
[200,124,90,88,67,86,66,78,77,60,62,63,30,202],
[32,28,31,29]
];
vartermKeyMapCpslk=[
[96,49,50,51,52,53,54,55,56,57,48,45,61,8],
[27,81,87,69,82,84,89,85,73,79,80,91,93,13],
[204,65,83,68,70,71,72,74,75,76,59,39,35],
[200,92,90,88,67,86,66,78,77,44,46,47,30,202],
[32,28,31,29]
];
vartermKeyWdth=[
[35,35,35,35,35,35,35,35,35,35,35,35,35,69],
[55,35,35,35,35,35,35,35,35,35,35,35,35,0],
[65,35,35,35,35,35,35,35,35,35,35,35,35],
[49,35,35,35,35,35,35,35,35,35,35,35,35,54],
[252,35,35,35]
];
varkeycapsImgNames=newArray(200,201,202,203,204,205);
functiontermKeyCaps(k){
if((k<28)&&(k>=32)&&(repeatTimer))clearTimeout(repeatTimer);
if(k==204){
keycapsCpslk=(!keycapsCpslk);
varcnr=(keycapsCpslk)?205:204;
termKbdSetImg(204,cnr)
}
elseif((k==200)||(k==202)){
keycapsShift=(!keycapsShift);
varm=(keycapsShift)?1:0;
termKbdSetImg(200,200+m);
termKbdSetImg(202,202+m)
}
else{
varch=0;
if(keycapsShift){
ch=keycapsShiftRef[k]
keycapsShift=false;
termKbdSetImg(200,200);
termKbdSetImg(202,202)
}
elseif(keycapsCpslk)ch=keycapsCpslkRef[k]
elsech=k;
keyHandler({which:ch,jsuix_remapped:true})
}
}
functiontermKbdSetImg(n,v){
if(document.images){
varimg=(termLayers)?termKbdDocNS4.images['key'+n]:document.images['key'+n];
img.src=termImages[v].src
}
}
functiontermSetKbdButton(v){
if(document.images){
varimg=(termLayers)?termDocNS4.images.term_kbd_show:document.images.term_kbd_show;
varn=(termKbdOn)?'kbd_hide':'kbd_show';
varstat=(v)?'_hi':'_lo';
img.src=termImages[n+stat].src
}
}
functiontermKbdShow(){ functiontermMakeKbd(){ functiontermHide(){ functionmakeTerm(){ s+=' s+=' functiontermDisplay(r){ functiontermGuiReady(){ functioncursorKbdRight(){ functiontermKbdBackspace(){ functiontermKbdEsc(){ functiontermKbdClear(){ //UI-buttonrepeat functionrepeatSet(cmd,on){ functionrepeatClear(){ functionrepeatDo(cmd){ functionwriteElement(e,t,d){ functionsetDivXY(d,x,y){ functionsetDivVisibility(d,v){ functiontermGuiElementReady(e,d){ //eof
if(termKbdOn){
setDivVisibility(termKbdDiv,0);
termKbdOn=false;
termSetKbdButton(0)
}
else{
termImgPreload(keycapspath,keycapsImgNames);
keycapsShift=false;
keycapsCpslk=false;
vars='
s+='
s+='
s+'n';
s+=' n';
s+='';
writeElement(termKbdDiv,s);
setDivXY(termKbdDiv,conf_term_x,conf_term_y+conf_kbd_offset+conf_rows*conf_rowheigt);
if(termLayers)termKbdDocNS4=document.layers[termKbdDiv].document;
termKbdOn=true;
setDivVisibility(termKbdDiv,1);
termSetKbdButton(0)
}
}
vars='
for(vari=0;i n';
for(vark=0;k
keycapsShiftRef[kc]=termKeyMapShift[i][k];
keycapsCpslkRef[kc]=termKeyMapCpslk[i][k];
if(kc==13){
s+='
continue
};
if(kc==32)s+='
elseif(kc==28){
s+='
s+='
continue
}
elseif(kc==29){
s+='
continue
}
elseif(kc==8){
s+='
continue
}
s+='
if(kc==35)s+='
};
s+='
};
s+='';
returns
}
//termUI
if(repeatTimer)clearTimeout(repeatTimer);
if(termKbdOn)termKbdShow();
setDivVisibility(termDiv,0)
}
window.status='Buildingterminal...';
termLayers=(document.layers)?true:false;
termSubDivs=(navigator.userAgent.indexOf('Gecko')<0);
vars='';
s+='
s+=' n'; n';
varrstr='';
for(varc=0;c
s+=' n';
};
s+='
s+='n n'; n'; n';
s+='n';
s+=' n';
s+=' n';
s+=' n';
s+=' n';
s+='
s+='n';
if(termLayers){
for(varr=0;r
};
termDocNS4=document.layers[termDiv].document;
termStringStart=' ';
termStringEnd='
}
elseif(termSubDivs){
for(varr=0;r
};
termStringStart=' ';
termStringEnd='
};
writeElement(termDiv,s);
setDivXY(termDiv,conf_term_x,conf_term_y);
setDivVisibility(termDiv,1);
window.status=''
}
vars=termStringStart;
varcurStyle=0;
for(vari=0;i
varcs=termStyle[r][i];
if(cs!=curStyle){
if(curStyle){
for(vark=termStyles.length-1;k>=0;k--){
varst=termStyles[k];
if(curStyle&st)s+=termStyleClose[st];
}
};
curStyle=cs;
for(vark=0;k
if(curStyle&st)s+=termStyleOpen[st];
}
};
s+=(termSpecials[c])?termSpecials[c]:String.fromCharCode(c);
};
if(curStyle>0){
for(vark=termStyles.length-1;k>=0;k--){
varst=termStyles[k];
if(curStyle&st)s+=termStyleClose[st];
}
};
s+=termStringEnd;
writeElement('term_'+r,s,termDocNS4)
}
ready=true;
if(termGuiElementReady(termDiv,self.document)){
for(varr=0;r
ready=false;
break
}
}
}
elseready=false;
returnready
}
functioncursorKbdLeft(){
keyHandler({which:28})
}
keyHandler({which:29})
}
keyHandler({which:8})
}
keyHandler({which:27})
}
if((!cnslLock)&&(!cnslRawMode))cnslReset();
}
if(repeatTimer)clearTimeout(repeatTimer);
repeatTimer=setTimeout('repeatDo("'+cmd+'")',conf_repeat_delay1);
}
if(repeatTimer)clearTimeout(repeatTimer);
}
if(repeatTimer)clearTimeout(repeatTimer);
if(cmd=='left')cursorKbdLeft()
elseif(cmd=='right')cursorKbdRight()
elseif(cmd=='backspace')termKbdBackspace();
repeatTimer=setTimeout('repeatDo("'+cmd+'")',conf_repeat_delay2);
}
//basicdynamics
if(document.layers){
vardoc=(d)?d:self.document;
doc.layers[e].document.open();
doc.layers[e].document.write(t);
doc.layers[e].document.close()
}
elseif(document.getElementById){
varobj=document.getElementById(e);
obj.innerHTML=t
}
elseif(document.all){
document.all[e].innerHTML=t
}
}
if(document.layers){
document.layers[d].moveTo(x,y)
}
elseif(document.getElementById){
varobj=document.getElementById(d);
obj.style.left=x+'px';
obj.style.top=y+'px'
}
elseif(document.all){
document.all[d].style.left=x+'px';
document.all[d].style.top=y+'px'
}
}
if(document.layers){
document.layers[d].visibility=(v)?'show':'hide';
}
elseif(document.getElementById){
varobj=document.getElementById(d);
obj.style.visibility=(v)?'visible':'hidden';
}
elseif(document.all){
document.all[d].style.visibility=(v)?'visible':'hidden';
}
}
if(document.layers){
vardoc=(d)?d:self.document;
return((doc)&&(doc.layers[e]))?true:false
}
elseif(document.getElementById){
return(document.getElementById(e))?true:false
}
elseif(document.all){
return(document.all[e])?true:false
}
elsereturnfalse
} 相关推荐