📄 node.js
字号:
// node start
function Node(activeToc, description, info,icon,showCheckBox)
{
// Data member
this.id = -1
this.toc = activeToc
this.desc = description
this.info = info
this.showCheckBox = showCheckBox;
this.layer = 0
this.iconImg = 0
this.iconSrc = this.toc.iconItem
if (icon)
this.iconSrc = icon
// Methods
this.initialize = nodeInitialize
this.draw = nodeDraw
this.hide = nodeHide
this.createIndex = treeCreateIndex
this.display = nodeDisplay
this.totalHeight = ItemTotalHeight
}
// nodeInitialize
//
function nodeInitialize(level, lastNode, leftSide){
this.createIndex()
if (level>0){
if (lastNode){
if (this.toc.showIcons) {
this.draw(leftSide + "<img src='" + this.toc.iconLine1 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
leftSide = leftSide + "<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">"
}else
this.draw(leftSide +"<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
}// end fo lastNode
else {
if (this.toc.showIcons) {
this.draw(leftSide + "<img src='" + this.toc.iconLine2 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
leftSide = leftSide + "<img src='" + this.toc.iconLine3 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">"
} else
this.draw(leftSide +"<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
} // end of if else(lastNode)
} else // end of if (level>0)
this.draw('')
}
// nodeDraw
//
function nodeDraw(leftSide){
var sHTML = "";
sHTML +="<table "
sHTML +=" id='" + this.toc.name + "item" + this.id + "' style='position:block;' "
sHTML +=" border=0 cellspacing=0 cellpadding=0>\n"
sHTML +='<tr><td>'
sHTML +=leftSide
if (this.toc.showIcons) {
sHTML +="<img id='" + this.toc.name + "itemIcon" + this.id +"' src='"+ this.iconSrc +"' border=0>"
}
sHTML +='</td><td valign=middle nowrap>'
if(this.showCheckBox ==1){
sHTML +="<input name='checkboxName' type='checkbox' value='"+this.id+"' onClick='javascript:checkboxClick(\""+this.id+"\",\""+this.info+"\",\""+this.desc+"\")'>"
}
sHTML +="<a style='CURSOR: hand' onclick='javascript:" + this.toc.name +".infoClicked(\""+this.info+"\",\"descriptionStyle"+this.id+"\")' onDblClick='javascript:" + this.toc.name +".infoDoubleClicked(\""+this.info+"\",\"descriptionStyle"+this.id+"\")'>"
sHTML +="<font id='descriptionStyle" + this.id+ "'size='2' COLOR='#000000'>" + this.desc + "</font>"
sHTML +="</a></td></tr>"
sHTML +="</table>\n"
//alert(sHTML)
document.write(sHTML)
this.layer = eval(this.toc.name + "item" + this.id)
if (this.toc.showIcons)
this.iconImg = eval(this.toc.name + "itemIcon"+ this.id)
}
// nodeHide
//
function nodeHide()
{
if (this.layer.style.display == 'none')
return
this.layer.style.display = 'none'
}
// nodeDisplay
//
function nodeDisplay()
{
if (this.layer){
this.layer.style.display = 'block'
}
}
// treeCreateIndex
//
function treeCreateIndex()
{
this.id = this.toc.nodesCounter
this.toc.nodesIndex[this.toc.nodesCounter] = this
this.toc.nodesCounter++
}
// ItemTotalHeight
//
function ItemTotalHeight()
{
var h = this.layer.clip.height
return h
}
// node end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -