📄 menu.js
字号:
/*Window script - Copyrighted 2001 Thomas Brattli. This script will come as a stand-alone script in a while*/
var oWin=new Array; oWin.zIndex=10; oWin.dragobj=-1; oWin.resizeobj=-1; oWin.zIndex=100
var isFront;
function winit(w,is,w1,h1,x1,y1){
wins=w
win_init()
winpage=lib_doc_size()
for(i=0;i<wins;i++){
create_window(i,0,0,1)
}
oWin.currwins=i
if(is){
isFront=1
setWindows()
}
if(w1){
j=0
for(i=2;i<arguments.length;i+=4){
oWin[j].resize(arguments[i],arguments[i+1])
oWin[j].origw=arguments[i]; oWin[0].origh=arguments[i+1]
oWin[j].moveIt(eval(arguments[i+2]),arguments[i+3])
oWin[j].checkscroll()
oWin[j].showIt()
j++
}
}
}
function create_window(i,link,heading,SYSTEM){
oWin[i]=new lib_obj('divWin'+i,'','','',i)
oWin[i].oWindow=new lib_obj('divWindow'+i,'divWin'+i)
oWin[i].oText=new lib_obj('divWinText'+i,'divWin'+i,'divWindow'+i)
oWin[i].oHead=new lib_obj('divWinHead'+i,'divWin'+i)
oWin[i].oButtons=new lib_obj('divWinButtons'+i,'divWin'+i)
oWin[i].oResize=new lib_obj('divWinResize'+i,'divWin'+i)
//Events
oWin[i].oHead.evnt.onmouseover=new Function("w_mmover("+i+")")
oWin[i].oHead.evnt.onmouseout=new Function("w_mmout()")
if(!bw.ns4) oWin[i].oHead.evnt.ondblclick=new Function("mdblclick(0,"+i+")")
oWin[i].oResize.evnt.onmouseover=new Function("w_mmover("+i+",1)")
oWin[i].oResize.evnt.onmouseout=new Function("w_mmout()")
//Styles
if(!bw.ns4){
oWin[i].oHead.css.cursor="move"
oWin[i].oResize.css.cursor="w-resize"
if(!bw.opera5){
oWin[i].oWindow.css.overflow="hidden"
oWin[i].css.overflow="hidden"
}
}
//Scroll
oWin[i].oUp=new lib_obj('divWinUp'+i,'divWin'+i)
oWin[i].oDown=new lib_obj('divWinDown'+i,'divWin'+i)
//If loader
if(link){
//Loader
if(!bw.ns4) oWin[i].oLoader=new lib_obj('ifrWin'+i,'divWin'+i)
if(!bw.ns6&&!bw.ns4) oWin[i].oIfr=document.frames['ifrWin'+i]
}
oWin[i].lastx=oWin[i].x
oWin[i].lasty=oWin[i].y
oWin[i].origw=250
oWin[i].origh=250
//Functions
oWin[i].resize=win_resize;
oWin[i].close=win_close;
oWin[i].maximize=win_maximize;
oWin[i].minimize=win_minimize;
oWin[i].regwin=win_regwin
oWin[i].checkscroll=win_checkscroll;
oWin[i].up=win_up;
oWin[i].load=win_load;
oWin[i].down=win_down;
oWin[i].addZ=win_addZ;
oWin[i].state="reg"
oWin[i].heading=heading?heading:""
if(link){
oWin[i].resize(250,250)
oWin[i].load(link)
oWin[i].moveIt(20,150)
}
if(!SYSTEM){
oWin[i].showIt()
}
}
//Window functions
function win_regwin(){
this.oResize.css.visibility="inherit"
this.resize(this.origw,this.origh)
this.slideIt(this.lastx,this.lasty,30,10)
this.state="reg"
if(bw.ns4) this.load(this.url)
this.addZ()
this.checkscroll()
}
function win_maximize(){
if(this.state!="max"){
if(this.state!="min"){this.lastx=this.x; this.lasty=this.y}
mw=winpage.x2 - 10
mh=winpage.y2 - 10 - 140
this.slideIt(5,143,30,10,this.obj+'.resize('+mw+','+mh+'); if(bw.ns4) this.load(this.url)')
this.state="max"
this.addZ()
}else this.regwin()
}
function win_minimize(){
if(this.state!="min"){
couns=0
if(this.state!="max"){this.lastx=this.x; this.lasty=this.y}
y=winpage.y2-16; ox=winpage.x2-126
a=0
for(i=0;i<wins;i++){
x=i*125; ok=a
if(a*125>ox){
if(ox>126) i=0
a=0; y-=15; x=0
}
for(j=0;j<wins;j++){
couns++
//self.status=oWin[j].x + "=" + x + " - " + oWin[j].y + "=" + y
if(oWin[j].x==x && oWin[j].y==y) a++
}
if(a==ok) break;
}
x=a*125;
this.slideIt(x,y,30,10)
this.oResize.hideIt()
this.state="min"
this.resize(125,14)
}else this.regwin()
}
function win_close(){
this.hideIt()
this.oUp.hideIt()
this.oDown.hideIt()
}
function win_resize(w,h){
this.oButtons.moveIt(w-39,0)
this.oResize.moveIt(w-13,h-9)
this.oWindow.clipTo(0,w-2,h-23,0,1)
this.clipTo(0,w,h,0,1)
this.oHead.clipTo(0,w,14,0,1)
this.oText.moveIt(2,3)
this.oUp.hideIt()
this.oDown.hideIt()
}
function win_checkscroll(w,h){
this.oText.height=this.oText.evnt.offsetHeight||this.oText.css.pixelHeight||this.oText.ref.height||0
w=this.cr
h=this.cb
if(this.oText.height>h-28 && this.state!="min"){
this.oWindow.clipTo(0,w-14,h-23,0,1)
this.oUp.moveIt(w-12,14)
this.oUp.clipTo(0,11,h-30,0,1)
this.oDown.moveIt(w-12,h-21)
this.oDown.clipTo(0,11,12,0,1)
this.oUp.showIt()
this.oDown.showIt()
}else{
this.oUp.hideIt()
this.oDown.hideIt()
}
}
var sctim=100;
var winScroll;
function win_up(){
clearTimeout(sctim);
if(this.oText.y>=this.oWindow.cb-this.oText.height-10 && winScroll){
this.oText.moveBy(0,-8);
setTimeout(this.obj+".up()",30)
}
}
function win_down(){
clearTimeout(sctim);
if(this.oText.y<=0 && winScroll){
this.oText.moveBy(0,8);
setTimeout(this.obj+".down()",30)
}
}
function noScroll(){clearTimeout(sctim);winScroll=false}
//Loading functions
function win_load(url,heading){
if(!url) return
if(!heading) heading=this.heading
if(!bw.ns4) this.oHead.writeIt(" "+heading,"<span class='clHeadTxt'>","</span>")
this.heading=heading
if(bw.ns4){
url+="?addtop=1"
this.oText.css.load(url,this.oWindow.cr-4)
}else{
this.oLoader.evnt.src=url
}
setTimeout("checkloaded("+this.num+")",500)
this.url=url
if(bw.opera) return true
return false
}
function checkloaded(id){
if(bw.ns4) oWin[id].checkscroll()
else if(bw.opera) alert('Sorry but Opera doesn\'t support this feature at this time.')
else if(bw.ns6){
oWin[id].oText.evnt.innerHTML=parent.frames[oWin[id].num].document.getElementsByTagName("body")[0].innerHTML
}else{
oWin[id].oText.evnt.innerHTML=oWin[id].oIfr.document.body.innerHTML
}
}
function win_addZ(){
oWin.zIndex++
this.css.zIndex=oWin.zIndex
}
//Initiating winpage
function win_init(){
if(document.layers){
document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK)
document.ondblclick=mdblclick;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -