📄 labels.js
字号:
if (o.layer!=null)
o.layer.style.display=sh?'':'none'
}
function MenuItem_invert(lyr,inv)
{
var c=lyr.childNodes,y=0,len=c.length,idx=lyr._boIndex
var o=_menusItems[idx]
if (o.disabled)
inv=0
else
{
if (inv)
{
o.par.nextSub=o.menuIndex
MenuItem_callShowSub(idx,true)
if (o.par.par)
{
if (o.par.par.par)
{
o.par.par.par.nextSub=o.par.par.menuIndex
}
}
}
}
var isLeft=true
for (var i=0;i<len;i++)
{
var ce=c[i]
if (ce.tagName!=null)
{
if (inv)
y+=24
changeOffset(ce,0,y+((o.checked&&isLeft)?96:0))
isLeft=false
}
}
}
function MenuItem_click(lyr,e)
{
eventCancelBubble(e)
var idx=lyr._boIndex,o=_menusItems[idx]
o.layer=lyr
if (!o.disabled)
{
if (o.sub)
{
o.par.nextSub=o.menuIndex
MenuItem_callShowSub(idx)
}
else
{
o.par.show(false,0,0,true)
if (o.isCheck)
{
if (o.par.uncheckAll)
o.par.uncheckAll()
o.check(!o.checked)
}
MenuItem_invert(lyr,0,idx)
o.par.nextSub=-1
if (o.cb)
setTimeout("MenuItem_delayedClick("+idx+")",1)
}
}
}
function MenuItem_callShowSub(idx,delayed)
{
var o=_menusItems[idx]
if (delayed)
setTimeout('MenuItem_delayedShowSub('+idx+')',500)
else
MenuItem_delayedShowSub(idx)
}
function MenuItem_delayedShowSub(idx)
{
var o=_menusItems[idx]
o.par.showSub()
}
function MenuItem_noBubble(e)
{
eventCancelBubble(e)
}
function MenuItem_delayedClick(idx)
{
var item=_menusItems[idx]
if (item.cb)
item.cb()
}
function MenuItem_getHTMLPart(part)
{
var o=this
switch(part)
{
case 0:
var im=null
if (o.isCheck&&(o.icon==null))
im=imgOffset(_skin+"menus.gif",16,16,0,o.checked?144:0,(o.par.id+'_item_icon_'+o.id))
else
im=o.icon?imgOffset(o.icon,16,16,o.disabled?o.disDx:o.dx,o.disabled?o.disDy:o.dy,(o.par.id+'_item_icon_'+o.id)):(_saf?getSpace(16,24):'')
return im
case 1:
var div1=_saf?'<div style="height:19px;padding-top:5px">':'',div2=_saf?'</div>':''
return div1+convStr(o.text)+div2
case 2:
return imgOffset(_skin+"menus.gif",16,16,0,o.sub?160:0,o.par.id+'_item_arrow_'+o.id)
case 3:
return '<table width="100%" height="3" cellpadding="0" cellspacing="0" border="0" style="'+backImgOffset(_skin+"menus.gif",0,176)+';"><tbody><tr><td></td></tr></tbody></table>'
}
}
function MenuItem_getHTML()
{
var o=this
if ((o.icon!=null)||(o.text!=null))
{
var invertCbs=' onclick="'+_codeWinName+'.MenuItem_click(this,event);return true" oncontextmenu="'+_codeWinName+'.MenuItem_click(this,event);return false" onmouseover="'+_codeWinName+'.MenuItem_invert(this,1)" onmouseout="'+_codeWinName+'.MenuItem_invert(this,0);" '
return '<tr onmousedown="'+_codeWinName+'.MenuItem_noBubble(event)" onmouseup="'+_codeWinName+'.MenuItem_noBubble(event)" id="'+(o.par.id+'_item_'+o.id)+'" style="'+(!o.isShown?'display:none;':'')+'height:24px;width:24px;cursor:'+(o.disabled?'default':_hand)+'" '+invertCbs+' valign="middle" align="left">'+
'<td id="'+(o.par.id+'_item_td_'+o.id)+'" style="width:24px;height:24px;'+backImgOffset(_skin+"menus.gif",0,o.checked?96:0)+'" align="center" class="menuLeftPart">'+
o.getHTMLPart(0)+
'</td>'+
'<td '+(o.centered?' align="center" ':'')+' style="height:24px;'+backImgOffset(_skin+"menus.gif",0,0)+'" id="'+(o.par.id+'_text_'+o.id)+'" class="menuTextPart'+(o.disabled?'Disabled':'')+'">'+
o.getHTMLPart(1)+
'</td>'+
'<td align="center" style="width:24px;height:24px;'+backImgOffset(_skin+"menus.gif",0,0)+'">'+
o.getHTMLPart(2)+
'</td>'+
'</tr>'
}
else
{
return '<tr onmousedown="'+_codeWinName+'.MenuItem_noBubble(event)" onclick="'+_codeWinName+'.MenuItem_noBubble(event)" id="'+(o.par.id+'_item_'+o.id)+'" onmouseup="'+_codeWinName+'.MenuItem_noBubble(event)" style="height:3px">'+
'<td class="menuLeftPart" style="width:24px;height:3px"></td>'+
'<td colspan="2" style="padding-left:5px;padding-right:5px;">'+
o.getHTMLPart(3)+
'</td></tr>'
}
}
function MenuItem_clickCallTrue(event)
{
MenuItem_click(this,event)
return true
}
function MenuItem_clickCallFalse(event)
{
MenuItem_click(this,event)
return false
}
function MenuItem_invertCall0(event)
{
MenuItem_invert(this,0)
}
function MenuItem_invertCall1(event)
{
MenuItem_invert(this,1)
}
function MenuItem_dynHTML()
{
var o=this
if (o.par.layer==null)
return
var tbody=o.par.layer.childNodes[0],tr=tbody.insertRow(tbody.rows.length),st=tr.style
tr.onmousedown=MenuItem_noBubble
tr.onmouseup=MenuItem_noBubble
tr.id=(o.par.id+'_item_'+o.id)
if ((o.icon!=null)||(o.text!=null))
{
var td1=tr.insertCell(0),td2=tr.insertCell(1),td3=tr.insertCell(2),st1=td1.style,st2=td2.style,st3=td3.style
tr.onclick=MenuItem_clickCallTrue
tr.oncontextmenu=MenuItem_clickCallFalse
tr.onmouseover=MenuItem_invertCall1
tr.onmouseout=MenuItem_invertCall0
st.height="24px"
st.width="24px"
st.cursor=(o.disabled?'default':_hand)
td1.id=(o.par.id+'_item_td_'+o.id)
st1.width="24px"
st1.height="24px"
changeOffset(td1,0,o.checked?96:0,_skin+"menus.gif")
td1.innerHTML=o.getHTMLPart(0)
td1.align="center"
td1.className="menuLeftPart"
if (o.centered)
td2.align="center"
st2.height="24px"
changeOffset(td2,0,0,_skin+"menus.gif")
td2.id=(o.par.id+'_text_'+o.id)
td2.className="menuTextPart"+(o.disabled?'Disabled':'')
td2.innerHTML=o.getHTMLPart(1)
td3.align="center"
st3.width="24px"
st3.height="24px"
changeOffset(td3,0,0,_skin+"menus.gif")
td3.innerHTML=o.getHTMLPart(2)
o.init()
}
else
{
tr.onclick=MenuItem_noBubble
tr.style.height="3px"
var td1=tr.insertCell(0),td2=tr.insertCell(1),st1=td1.style,st2=td2.style
td1.className="menuLeftPart"
st1.width="24px"
st1.height="3px"
td2.colSpan="2"
st2.paddingLeft="5px"
st2.paddingRight="5px"
td2.innerHTML=o.getHTMLPart(3)
}
}
function newMenuColorWidget(id,hideCB)
{
var o=newMenuWidget(id,hideCB)
o.addSeparator=null
o.lastUsedTxt=""
o.lastUsedColorsAr=null
o.addColor=MenuColorWidget_addColor
o.addLastUsed=MenuColorWidget_addLastUsed
o.getHTML=MenuColorWidget_getHTML
o.uncheckAll=MenuColorWidget_uncheckAll
return o
}
function MenuColorWidget_addColor(tooltip,color,cb)
{
var o=this,i=o.items.length
var ret=o.items[i]=newColorMenuItem(o,color,tooltip,cb)
ret.menuIndex=i
return ret
}
function MenuColorWidget_addLastUsed(text,lastUsedColorsAr,cb, beforeShowCB)
{
var o=this
o.lastUsedTxt = text
o.lastUsedColorsAr = lastUsedColorsAr
o.beforeShowCB = MenuColorWidget_beforeShowCB
colorsMax = 8
len = o.items.length
var it = null
for (var c = 0; c < colorsMax; c++)
{
it = newLastUsedColorMenuItem(o,c,"",cb)
it.isLast = (c == colorsMax-1) ? true : false
o.items[len + c] = it
}
}
function MenuColorWidget_getHTML()
{
var o=this,items=o.items
var j = 0
var s = new Array
s[j++] = '<div style="display:none;filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius=\'2\', MakeShadow=\'false\', ShadowOpacity=\'0.75\')" class="menuShadow" id="menuShadow_'+o.id+'"></div>'
s[j++] = '<table style="display:none;" class="menuFrame" id="'+o.id+'" cellspacing="0" cellpadding="0" border="0"><tbody>'
var sep = '<tr class="menuLeftPart" style="height:3px"><td colspan="8" style="padding-left:5px;padding-right:5px;"><table width="100%" height="3" cellpadding="0" cellspacing="0" border="0" style="'+backImgOffset(_skin+"menus.gif",0,176)+';"><tbody><tr><td></td></tr></tbody></table></td></tr>'
var len = items.length
lastUsedCol=""
lastUsedColIconsNb = 0
lastUsedColIconsMaxLine = 3
for (var i in items)
{
var item=items[i]
switch (item.menuItemType)
{
case _isColor:
s[j++] = item.getHTML()
break;
case _isLastUsedColor:
lastUsedCol += item.getHTML()
lastUsedCol += (lastUsedColIconsNb++ == lastUsedColIconsMaxLine)? "</tr><tr>":""
if (item.isLast)
{
s[j++] = sep
s[j++] = '<tr class="menuLeftPart"><td colspan="8">'
s[j++] ='<table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr>'
s[j++] ='<td width="50%" class="menuTextPart">' + convStr(o.lastUsedTxt) + '</td>'
s[j++] ='<td><table border="0" cellspacing="0" cellpadding="0"><tbody><tr>'
s[j++] =lastUsedCol
s[j++] ='</tr></tbody></table></td>'
s[j++] ='</tr></tbody></table>'
s[j++] = '</td></tr>'
s[j++] = sep
}
break;
case _isNotColor:
item.centered=true
s[j++] ='<tr><td colspan="8" class="menuLeftPart"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr>'+item.getHTML()+'</tr></tbody></table></td></tr>'
s[j++] = (i == 0 )? sep:""
}
}
s[j++] ='</tbody></table></div>'
return s.join("")
}
function MenuColorWidget_beforeShowCB()
{
var o=this, j=0
lenLastUsed = o.lastUsedColorsAr.length
for (var i in o.items)
{
var item=o.items[i]
if (item.menuItemType == _isLastUsedColor)
{
if (j < lenLastUsed)
{
item.color = o.lastUsedColorsAr[j++]
item.layer.childNodes[0].childNodes[0].style.backgroundColor = 'rgb(' + item.color + ')'
item.show(true)
} else {
item.show(false)
}
}
}
}
function MenuColor_invert(lyr,inv)
{
var o=_menusItems[lyr._boIndex]
if (o && o.checked)
inv=1
lyr.childNodes[0].className="menuColor"+(inv?"sel":"")
}
function MenuColorWidget_uncheckAll()
{
var o=this,items=o.items
for (var i in items)
{
var item=items[i]
if (item.checked)
item.check(false)
}
}
function MenuColor_click(lyr,e)
{
eventCancelBubble(e)
var idx=lyr._boIndex,o=_menusItems[idx]
o.par.uncheckAll()
MenuColor_invert(lyr,1,idx)
o.checked=true
o.par.show(false,0,0,true)
if (o.cb)
setTimeout("MenuItem_delayedClick("+idx+")",1)
}
function newColorMenuItem(par,color,text,cb)
{
var o=newMenuItem(par,"color_"+color,text,cb)
o.color=color
o.attachSubMenu=null
o.getHTML=ColorMenuItem_getHTML
o.check=ColorMenuItem_check
o.menuItemType=_isColor
return o
}
function ColorMenuItem_check(check)
{
var o=this
if (o.checked!=check)
{
o.checked=check
if (o.layer)
MenuColor_invert(o.layer,o.checked?1:0)
}
}
function ColorMenuItem_getHTML()
{
var o=this,s="",d=_moz?10:12,lenTotal=o.par.items.length,index=o.menuIndex - 1;col=index%8
var len=0
for (var i = 0; i <lenTotal; i++)
{
if (o.par.items[i].menuItemType == _isColor) len++
}
var first=(col==0)
var last=(col==7)
var firstL=(index<8)
var lastL=(index>=(Math.floor((len-1)/8)*8))
var cbs=' onclick="'+_codeWinName+'.MenuColor_click(this,event);return true" oncontextmenu="'+_codeWinName+'.MenuColor_click(this,event);return false" onmousedown="'+_codeWinName+'.MenuItem_noBubble(event)" onmouseup="'+_codeWinName+'.MenuItem_noBubble(event)" onmouseover="'+_codeWinName+'.MenuColor_invert(this,1)" onmouseout="'+_codeWinName+'.MenuColor_invert(this,0);" '
if (first)
s+='<tr class="menuLeftPart" valign="middle" align="center">'
s+='<td id="'+(o.par.id+'_item_'+o.id)+'" class="menuLeftPart" '+cbs+' style="padding-top:'+(firstL?2:0)+'px;padding-bottom:'+(lastL?2:0)+'px;padding-left:'+(first?3:1)+'px;padding-right:'+(last?3:1)+'px"><div class="menuColor'+(o.checked?'sel':'')+'"><div style="border:1px solid #4A657B;width:'+d+'px;height:'+d+'px;background-color:rgb('+o.color+');">'+img(_skin+'../transp.gif',10,10,null,null,o.text)+'</div></div></td>'
/*if (o.menuIndex==len-1)
{
for (var i=col;i<8;i++)
s+='<td class="menuLeftPart"></td>'
}*/
if (last)
s+='</tr>'
return s
}
function newLastUsedColorMenuItem(par,color,text,cb)
{
var o=newMenuItem(par,"lastUsed_color_"+color,text,cb)
o.color=color
o.menuItemType = _isLastUsedColor
o.attachSubMenu=null
o.check=ColorMenuItem_check
o.getHTML=LastUsedColorMenuItem_getHTML
return o
}
function LastUsedColorMenuItem_getHTML()
{
var o=this,s="",d=_moz?10:12
var cbs=' onclick="'+_codeWinName+'.MenuColor_click(this,event);return true" oncontextmenu="'+_codeWinName+'.MenuColor_click(this,event);return false" onmousedown="'+_codeWinName+'.MenuItem_noBubble(event)" onmouseup="'+_codeWinName+'.MenuItem_noBubble(event)" onmouseover="'+_codeWinName+'.MenuColor_invert(this,1)" onmouseout="'+_codeWinName+'.MenuColor_invert(this,0);" '
s+='<td id="'+(o.par.id+'_item_'+o.id)+'" width="18" class="menuLeftPart" '+cbs+' style="padding-top:0px;padding-bottom:0px;padding-left:1px;padding-right:1px"><div class="menuColor'+(o.checked?'sel':'')+'"><div style="border:1px solid #4A657B;width:'+d+'px;height:'+d+'px;background-color:rgb('+o.color+');">'+img(_skin+'../transp.gif',10,10,null,null,o.text)+'</div></div></td>'
return s
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -