📄 myft_new.js
字号:
fTversion = "4.72";
evalVersion = false;
//****************************************************************
// This script, found in:
//
// http://www.essence.co.uk/essence/foldertree and other locations on the Essence Associates Ltd. web site,
// was authored by Nigel Goodwin (goodwin@essence.co.uk).
// The design and code remain the intellectual property of
// Essence Associates Ltd. (C) Copyright 1998-1999. All rights reserved.
//
// The evaluation license may be found in the file evallicense.txt
// The full purchase license may be found in the file fulllicense.txt
// The developer license may be found in the file developlicense.txt
// By using this software, you signify that you have read this notice and the license and accept its terms.
//
// This notice must be kept in full at the top of this foldertree code.
//*********************************************************************
error_count = 0;
window.onerror = errorHandler;
var werr;
showmessretry = 0
errmessage = ""
errurl = ""
errline = ""
errstacktrace = ""
errid = 0
errloading = false
function errormessage(){
if (!werr.loaded)
{
errid = setTimeout("errormessage()",200)
showmessretry++;
}
else
{
errloading = false
clearTimeout(errid)
var f = werr.document.errorfrm
var n = navigator;
f.message.value = errmessage;
f.url.value = errurl;
f.line.value = errline
f.useragent.value = n.userAgent
f.bname.value = n.appName
f.bversion.value = n.appVersion
f.bcodename.value = n.appCodeName
if (n.platform) f.platform.value = n.platform
if (n.javaEnabled()) f.java.value = "java: " + n.javaEnabled()
f.fTversion.value = fTversion
f.evalVersion.value = evalVersion
f.stacktrace.value = errstacktrace
if (bV > 0) werr.focus()
}
if (showmessretry > 200) clearTimeout(errid)
}
function errorHandler(message, url, line)
{
if ((!werr || !werr.loaded) && !errloading){
msgText = ""
if (confirm("A JavaScript error has occurred on line " + line + " - " + message + msgText + "\n\nDo you wish to report this error?"))
{
errloading = false
werr = window.open(ftFolder+"fterror.htm","error"+error_count++,"resizable,status,width=625,height=800");
errloading = true
errmessage = message
errurl = url
errline = line
errstacktrace = stacktrace()
errormessage()
}
rewriting = false
if (!javaerror) setTimeout("rewritepage()",500)
javaerror = true;
}
return true;
}
function stacktrace() {
var s = "";
for( a = arguments.caller; a != null; a = a.caller ) {
s += funcname( a ) + "\n";
if( a.caller == a || !a.caller) break;
}
return s;
}
function funcname(f) {
if (f == null) return "anonymous";
if (!f.callee)
func = f
else
func = f.callee
int1 = func.toString().indexOf("function")
int2 = func.toString().indexOf("(")
s = func.toString().substring(int1+9,int2)
if ((s == null) || (s.length == 0)) return "anonymous";
return s;
}
function Node(folderDescription, hreference)
{
this.desc = folderDescription
this.hreference = hreference
this.id = -1
this.navObj = null
this.divObj = null
this.iconImg = null
this.nodeImg = null
this.isLastNode = 0
this.suid = 0
this.targetFrame = -1
this.linkType = -1
this.openIcon = ""
this.closedIcon = ""
this.openIconOver = ""
this.closedIconOver = ""
this.statusText = ""
this.hidden = false
this.userDef = ""
this.isOpen = false
this.checked = true
this.checkBox = true
this.c = new Array()
this.nC = 0
this.nodeLeftSide = ""
this.nodeLevel = 0
this.nodeParent = 0
this.isInitial = false
this.font = ""
this.isFolder = true
this.initialize = initialize
this.setState = setStateFolder
this.moveState = moveStateFolder
this.addChild = addChild
this.createIndex = createEntryIndex
this.hide = hide
this.display = display
this.initMode = initMode
this.reInitMode = reInitMode
this.collExp = collExp
this.initLayer = initLayer
this.setNodeDraw = setNodeDraw
this.setFont = setFont
this.setInitial = setInitial
this.setIcon = setIcon
this.setTarget = setTarget
this.setStatusBar = setStatusBar
this.setUserDef = setUserDef
this.getUserDef = getUserDef
this.setNodeFont = setNodeFont
this.nodeIcon = nodeIcon
this.nodeTIcon = nodeTIcon
this.setCheckBox = setCheckBox
}
function setStateFolder(isOpen)
{
var totalHeight
var fIt = 0
var i=0
this.isOpen = isOpen
if (bV > 0)
propagateChangesInState(this)
}
function moveStateFolder(isOpen)
{
var totalHeight
var fIt = 0
var i=0
var j=0
var subopen = 1
var parent = 0
var thisnode = 0
var found = false
var width = 0
totalHeight = 0
for (i=0; i < this.nC; i++)
{
if (!noDocs || this.c[i].isFolder)
{
totalHeight += this.c[i].navObj.clip.height
if (isOpen)
width = Math.max(width,this.c[i].navObj.clip.width)
}
}
if (!isOpen) totalHeight = - totalHeight
if (isOpen && noFrame && cascade)this.divObj.clip.height = totalHeight
if (!(noFrame && cascade))this.navObj.clip.height += totalHeight
if (isOpen && !(noFrame && cascade)) this.navObj.clip.width = Math.max(width, this.navObj.clip.width)
thisnode = this
parent = thisnode.nodeParent
for (i=0; i < this.nodeLevel ; i++)
{
if (parent.nodeLevel == 0 || !(noFrame && cascade)) parent.navObj.clip.height += totalHeight
if (isOpen)
parent.navObj.clip.width = Math.max(width, parent.navObj.clip.width)
found = false
for (j=0; j < parent.nC; j++)
{
if (!noDocs || parent.c[j].nC != null)
{
if (found && !(noFrame && cascade)) parent.c[j].navObj.moveBy(0,totalHeight)
else if (parent.c[j] == thisnode) found = true
}
}
thisnode = parent
parent = thisnode.nodeParent
}
newHeight= fT.navObj.clip.height + topLayer.layers["header"].clip.height + topLayer.layers["footer"].clip.height
topLayer.clip.height = newHeight
topLayer.clip.width = Math.max(topLayer.clip.width,fT.navObj.clip.width)
newHeight = newHeight + topGap
if (isOpen && !noFrame){
frameHeight = thisFrame.innerHeight
if (doc.height < newHeight)
doc.height = newHeight
else if (newHeight < frameHeight) {
doc.height = frameHeight
thisFrame.scrollTo(0,0)
}
else if (doc.height > newHeight + 0.5*frameHeight){
doc.height = doc.height*0.5 + (newHeight + 0.5*frameHeight)*0.5
}
}
if (!(noFrame && cascade)) topLayer.layers["footer"].top = topLayer.layers["footer"].top + totalHeight
}
function propagateChangesInState(folder)
{
var i=0
if (folder.nC && treeLines == 1)
{
if (!folder.nodeImg)
{
if (bV == 2) folder.nodeImg = folder.navObj.document.images["treeIcon"+folder.id]
else if (bV == 1 || doc.images) folder.nodeImg = doc.images["treeIcon"+folder.id]
}
if (folder.nodeLevel > 0) folder.nodeImg.src = folder.nodeTIcon()
}
if (folder.isOpen && folder.isInitial)
{
if (cascade && noFrame && bV == 1) doc.all["div"+folder.id].style.display = "block"
if (cascade && noFrame && bV == 2) folder.divObj.visibility = "show"
for (i=0; i<folder.nC; i++) {
if (!noDocs || folder.c[i].isFolder)
folder.c[i].display()
}
}
else
{
if (folder.isInitial){
if (cascade && noFrame && bV == 1) doc.all["div"+folder.id].style.display = "none"
if (cascade && noFrame && bV == 2) folder.divObj.visibility = "hidden"
for (i=0; i<folder.nC; i++)
if (!noDocs || folder.c[i].isFolder)
folder.c[i].hide()
}
}
var iA = iNA
if (!folder.iconImg)
{
if (bV == 2) folder.iconImg = folder.navObj.document.images["nodeIcon"+folder.id]
else if (bV == 1 || doc.images) folder.iconImg = doc.images["nodeIcon"+folder.id]
}
folder.iconImg.src = folder.nodeIcon("",iA)
}
function display()
{
var i=0
if (bV == 1)
{
if (!this.navObj) this.navObj = doc.all["node" + this.id]
this.navObj.style.display = "block"
}
else if (bV ==2)
this.navObj.visibility = "show"
if (bV == 2 && cascade && noFrame && this.divObj && (this.isOpen || !this.isFolder)) {
this.divObj.visibility = "show"
}
if (bV == 1 || (bV == 2 && cascade && noFrame)) {
if (this.isInitial && this.isOpen)
for (i=0; i < this.nC; i++) {
if (!noDocs || this.c[i].isFolder || (bV ==2 && cascade && noFrame))
this.c[i].display()
}
}
}
function hide()
{
var i = 0
if (bV == 1)
{
if (!this.navObj) this.navObj = doc.all["node" + this.id]
this.navObj.style.display = "none"
}
else if (bV ==2)
this.navObj.visibility = "hidden"
if (bV == 2 && cascade && noFrame && this.divObj) {
this.divObj.visibility = "hidden"
}
if (bV == 1 || (bV == 2 && cascade && noFrame) ) {
if (this.isInitial)
for (i=this.nC-1; i>-1; i--)
{
if (!noDocs || this.c[i].isFolder)
this.c[i].hide()
}
}
}
function initialize(level, lastNode, leftSide, doc, prior)
{
this.createIndex();
this.nodeLevel = level;
if(!this.isFolder) this.isInitial = true
if (level>0)
{
this.isLastNode = lastNode
if (!(cascade && noFrame)) tmpIcon = this.nodeTIcon()
tmpIcon = this.nodeTIcon()
if (this.isLastNode == 1)
tmp2Icon = iTA["b"].src
else
tmp2Icon = iTA["vl"].src
if (treeLines == 0) tmp2Icon = iTA["b"].src
if (this.hidden == false)
{
if (level == 1 && treeLines == 0 && noTopFolder)
this.setNodeDraw(leftSide, doc, prior)
else
{
if (this.isFolder){
auxEv = "<a href='javascript:void(0);' onClick='return clickOnNode("+this.id+");'"
auxEv += " onMouseOver='return mouseOverNode(0,"+this.id+");'"
auxEv += " onMouseOut='return mouseOutNode(0,"+this.id+");' alt=''>"
if (!(cascade && noFrame)) auxEv += "<img name='treeIcon" + this.id + "' src='" + tmpIcon + "' border=0 alt='' align = 'absmiddle'></a>"
}
else {
if (!(cascade && noFrame)) auxEv = "<img src='" + tmpIcon + "' border=0 align = 'absmiddle'>"
}
this.setNodeDraw(leftSide + auxEv, doc, prior)
if (this.isFolder && !(cascade && noFrame))
leftSide += "<img src='" + tmp2Icon + "' border=0 align = 'absmiddle'>"
}
}
}
else
this.setNodeDraw("", doc, prior)
if (this.isFolder) {
this.nodeLeftSide = leftSide
if (this.nC > 0 && this.isInitial && this.isOpen)
{
level = level + 1
for (var i=0 ; i < this.nC; i++)
{
this.c[i].nodeParent = this
if (noDocs)
{
newLastNode = 1
for (var j=i+1; j < this.nC; j++)
if (this.c[j].isFolder) newLastNode = 0
}
else
{
newLastNode = 0
if (i == this.nC-1) newLastNode = 1
}
if (i==0 && level == 1 && noTopFolder) newLastNode = -1
if (!noDocs || this.c[i].isFolder)
{
this.c[i].initialize(level, newLastNode, leftSide, doc, prior)
}
}
}
}
if (bV == 2 && this.hidden == false && !prior) doc.write("</layer>");
}
function setNodeDraw(leftSide,doc,prior)
{
var strbuf = ""
var font
if (bV == 2)
{
if (!prior)
{
if (noFrame && cascade)
strbuf += "<layer id='node" + this.id + "' visibility='hidden' bgColor='" + menuBackColor + "' width = '" + menuWidth + "' Z-INDEX=1>"
else
strbuf += "<layer id='node" + this.id + "' visibility='hidden' Z-INDEX=1>"
}
else
{
if (noWrap) layWidth = menuWidth
else layWidth = thisFrame.innerWidth - 20
if (noFrame && cascade) layWidth = menuWidth
var testlayer = new Layer(layWidth, prior)
}
}
fullLink = ""
linkFrame = ""
if (this.targetFrame == -1)
targetFrame = defTargetFrame
else
targetFrame = this.targetFrame
if (targetFrame == 0) linkFrame = "target=\"" + baseFrame + "\""
else if (targetFrame == 1) linkFrame = "target=_blank"
else if (targetFrame == 2) linkFrame = "target=_top"
else linkFrame = "target=\"" + targetFrame + "\""
if (noFrame && targetFrame == 0) linkFrame = "target=_top"
if (this.linkType == -1)
linkType = defLinkType
else
linkType = this.linkType
linkURL = ""
if (linkType == 0) linkURL = ""
else if (linkType == 1) linkURL = "http://"
else if (linkType == 2) linkURL = "ftp://"
else if (linkType == 3) linkURL = "telnet://"
if (this.hreference)
{
linkText = commonLink + this.hreference
int1 = linkText.indexOf("this\.id")
if (int1 != -1) {
linkText = linkText.substring(0,int1) + this.id + linkText.substring(int1+7)
}
fullLink = " href='" + linkURL + linkText + "' " + linkFrame
}
else
fullLink = " href='javascript:void(0); ' "
fullLink += " onMouseOver='return mouseOverNode(1,"+this.id+");' onMouseOut='return mouseOutNode(1,"+this.id+");' "
fullLink += " onClick='return clickNode("+this.id+");' "
if (this.statusText == "")
var toolTip= this.desc
else
var toolTip = this.statusText
if (bV > 0) {
eval("toolTip = toolTip.replace(/<[^<>]*>/g,'');");
}
else {
int1 = toolTip.indexOf("<")
toolTip = toolTip.substring(0,int1)
}
fullLink += " TITLE ='" + toolTip + "' "
if (bV == 1)
strbuf += "<div id='node" + this.id + "' style='position:static'>"
if (bV == 2 && noFrame && cascade)
strbuf += "<table border=0 cellspacing=0 cellpadding=0 width='" + menuWidth + "'><tr><td valign = "
else
strbuf += "<table border=0 cellspacing=0 cellpadding=0><tr><td valign = "
if (noWrap) strbuf += " 'middle' "
else strbuf += " 'top' "
strbuf += " nowrap>" + leftSide + "<a " + fullLink + "><img name='nodeIcon" + this.id + "' "
var iA = iNA
tmpIcon = this.nodeIcon("",iA)
strbuf += "src='" + tmpIcon + "' border=0 align = 'absmiddle' alt = '" + toolTip + "'>"
if (this.isFolder)
var space = folderIconSpace
else
var space = documentIconSpace
if (space > 0) {
hspace = parseInt("" + (space/2 + .5) + "")
wspace = 1
if (hspace*2 == space) wspace = 2
hspace = hspace - 1;
strbuf += "<IMG border=0 align = 'absmiddle' height = '" + wspace + "' width = '" + wspace + "' src='" + iTA["b"].src + "' hspace = '" + hspace + "'>"
}
if (!(cascade && noFrame))
strbuf += "</a></td><td valign=middle "
else
strbuf += "</a></td><td valign=middle width = '" + textWidth + "' "
if (noWrap) strbuf += "nowrap>"
else strbuf += ">"
if (checkBox && this.checkBox)
{
strbuf += "<input type=checkbox NAME='" + this.suid + "' VALUE = 'Yes' "
strbuf += "onClick = 'node = indexOfEntries[" + this.id + "];node.checked = !node.checked;' "
if (this.checked == true) strbuf += " checked>"
else strbuf += ">"
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -