📄 ftiens4.js
字号:
}
function gLnk(optionFlags, description, linkData)
{
if (optionFlags>=0) { //is numeric (old style) or empty (error)
//Target changed from numeric to string in Aug 2002, and support for numeric style was entirely dropped in Mar 2004
alert("Change your Treeview configuration file to use the new style of target argument in gLnk");
return;
}
newItem = new Item(description);
setItemLink(newItem, optionFlags, linkData);
return newItem;
}
function setItemLink(item, optionFlags, linkData) {
var targetFlag = "";
var target = "";
var protocolFlag = "";
var protocol = "";
targetFlag = optionFlags.charAt(0)
if (targetFlag=="B")
target = "_blank"
if (targetFlag=="P")
target = "_parent"
if (targetFlag=="R")
target = "basefrm"
if (targetFlag=="S")
target = "_self"
if (targetFlag=="T")
target = "_top"
if (optionFlags.length > 1) {
protocolFlag = optionFlags.charAt(1)
if (protocolFlag=="h")
protocol = "http://"
if (protocolFlag=="s")
protocol = "https://"
if (protocolFlag=="f")
protocol = "ftp://"
if (protocolFlag=="m")
protocol = "mailto:"
}
item.link = protocol+linkData;
item.target = target
}
//Function created for backwards compatibility purposes
//Function contents voided in March 2004
function oldGLnk(target, description, linkData)
{
}
function preLoadIcons() {
arImageSrc = new Array (
"ftv2vertline.gif",
"ftv2mlastnode.gif",
"ftv2mnode.gif",
"ftv2plastnode.gif",
"ftv2pnode.gif",
"ftv2blank.gif",
"ftv2lastnode.gif",
"ftv2node.gif",
"ftv2folderclosed.gif",
"ftv2folderopen.gif",
"ftv2doc.gif"
)
arImageList = new Array ();
for (counter in arImageSrc) {
arImageList[counter] = new Image();
arImageList[counter].src = ICONPATH + arImageSrc[counter];
}
}
//Open some folders for initial layout, if necessary
function setInitialLayout() {
if (browserVersion > 0 && !STARTALLOPEN)
clickOnNodeObj(foldersTree);
if (!STARTALLOPEN && (browserVersion > 0) && PRESERVESTATE)
PersistentFolderOpening();
}
//Used with NS4 and STARTALLOPEN
function renderAllTree(nodeObj, parent) {
var i=0;
nodeObj.renderOb(parent)
if (supportsDeferral)
for (i=nodeObj.nChildren-1; i>=0; i--)
renderAllTree(nodeObj.children[i], nodeObj.navObj)
else
for (i=0 ; i < nodeObj.nChildren; i++)
renderAllTree(nodeObj.children[i], null)
}
function hideWholeTree(nodeObj, hideThisOne, nodeObjMove) {
var i=0;
var heightContained=0;
var childrenMove=nodeObjMove;
if (hideThisOne)
nodeObj.escondeBlock()
if (browserVersion == 2)
nodeObj.navObj.moveBy(0, 0-nodeObjMove)
for (i=0 ; i < nodeObj.nChildren; i++) {
heightContainedInChild = hideWholeTree(nodeObj.children[i], true, childrenMove)
if (browserVersion == 2) {
heightContained = heightContained + heightContainedInChild + nodeObj.children[i].navObj.clip.height
childrenMove = childrenMove + heightContainedInChild
}
}
return heightContained;
}
// Simulating inserAdjacentHTML on NS6
// Code by thor@jscript.dk
// ******************************************
if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode)
{
switch (where){
case 'beforeBegin':
this.parentNode.insertBefore(parsedNode,this)
break;
case 'afterBegin':
this.insertBefore(parsedNode,this.firstChild);
break;
case 'beforeEnd':
this.appendChild(parsedNode);
break;
case 'afterEnd':
if (this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
else this.parentNode.appendChild(parsedNode);
break;
}
}
HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
{
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var parsedHTML = r.createContextualFragment(htmlStr);
this.insertAdjacentElement(where,parsedHTML)
}
}
function getElById(idVal) {
if (document.getElementById != null)
return document.getElementById(idVal)
if (document.all != null)
return document.all[idVal]
alert("Problem getting element by id")
return null
}
// Functions for cookies
// Note: THESE FUNCTIONS ARE OPTIONAL. No cookies are used unless
// the PRESERVESTATE variable is set to 1 (default 0)
// The separator currently in use is ^ (chr 94)
// ***********************************************************
function PersistentFolderOpening()
{
var stateInCookie;
var fldStr=""
var fldArr
var fldPos=0
var id
var nodeObj
stateInCookie = GetCookie("clickedFolder");
SetCookie('clickedFolder', "") //at the end of function it will be back, minus null cases
if(stateInCookie!=null)
{
fldArr = stateInCookie.split(cookieCutter)
for (fldPos=0; fldPos<fldArr.length; fldPos++)
{
fldStr=fldArr[fldPos]
if (fldStr != "") {
nodeObj = findObj(fldStr)
if (nodeObj!=null) //may have been deleted
if (nodeObj.setState) {
nodeObj.forceOpeningOfAncestorFolders()
clickOnNodeObj(nodeObj);
}
else
alert("Internal id is not pointing to a folder anymore.\nConsider giving an ID to the tree and external IDs to the individual nodes.")
}
}
}
}
function storeAllNodesInClickCookie(treeNodeObj)
{
var currentOpen
var i = 0
if (typeof treeNodeObj.setState != "undefined") //is folder
{
currentOpen = GetCookie("clickedFolder")
if (currentOpen == null)
currentOpen = ""
if (treeNodeObj.getID() != foldersTree.getID())
SetCookie("clickedFolder", currentOpen+treeNodeObj.getID()+cookieCutter)
for (i=0; i < treeNodeObj.nChildren; i++)
storeAllNodesInClickCookie(treeNodeObj.children[i])
}
}
function CookieBranding(name) {
if (typeof foldersTree.treeID != "undefined")
return name+foldersTree.treeID //needed for multi-tree sites. make sure treeId does not contain cookieCutter
else
return name
}
function GetCookie(name)
{
name = CookieBranding(name)
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie(name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
//var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
var path = "/"; //allows the tree to remain open across pages with diff names & paths
name = CookieBranding(name)
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function ExpireCookie (name)
{
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
name = CookieBranding(name)
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//To customize the tree, overwrite these variables in the configuration file (demoFramesetNode.js, etc.)
var USETEXTLINKS = 0;
var STARTALLOPEN = 0;
var USEFRAMES = 1;
var USEICONS = 1;
var WRAPTEXT = 0;
var PERSERVESTATE = 0; //backward compatibility
var PRESERVESTATE = 0;
var ICONPATH = '';
var HIGHLIGHT = 0;
var HIGHLIGHT_COLOR = 'white';
var HIGHLIGHT_BG = 'blue';
var BUILDALL = 0;
var GLOBALTARGET = "R"; // variable only applicable for addChildren uses
//Other variables
var lastClicked = null;
var lastClickedColor;
var lastClickedBgColor;
var indexOfEntries = new Array
var nEntries = 0
var browserVersion = 0
var selectedFolder=0
var lastOpenedFolder=null
var t=5
var doc = document
var supportsDeferral = false
var cookieCutter = '^' //You can change this if you need to use ^ in your xID or treeID values
doc.yPos = 0
// Main function
// *************
// This function uses an object (navigator) defined in
// ua.js, imported in the main html page (left frame).
function initializeDocument()
{
preLoadIcons();
switch(navigator.family)
{
case 'ie4':
browserVersion = 1 //Simply means IE > 3.x
break;
case 'opera':
browserVersion = (navigator.version > 6 ? 1 : 0); //opera7 has a good DOM
break;
case 'nn4':
browserVersion = 2 //NS4.x
break;
case 'gecko':
browserVersion = 3 //NS6.x
break;
case 'safari':
browserVersion = 1 //Safari Beta 3 seems to behave like IE in spite of being based on Konkeror
break;
default:
browserVersion = 0 //other, possibly without DHTML
break;
}
// backward compatibility
if (PERSERVESTATE)
PRESERVESTATE = 1;
supportsDeferral = ((navigator.family=='ie4' && navigator.version >= 5 && navigator.OS != "mac") || browserVersion == 3);
supportsDeferral = supportsDeferral & (!BUILDALL)
if (!USEFRAMES && browserVersion == 2)
browserVersion = 0;
eval(String.fromCharCode(116,61,108,100,40,41))
//If PRESERVESTATE is on, STARTALLOPEN can only be effective the first time the page
//loads during the session. For subsequent (re)loads the PRESERVESTATE data stored
//in cookies takes over the control of the initial expand/collapse
if (PRESERVESTATE && GetCookie("clickedFolder") != null)
STARTALLOPEN = 0
//foldersTree (with the site's data) is created in an external .js (demoFramesetNode.js, for example)
foldersTree.initialize(0, true, "")
if (supportsDeferral && !STARTALLOPEN) {
foldersTree.renderOb(null) //delay construction of nodes
}
else {
renderAllTree(foldersTree, null);
if (PRESERVESTATE && STARTALLOPEN)
storeAllNodesInClickCookie(foldersTree)
//To force the scrollable area to be big enough
if (browserVersion == 2)
doc.write("<layer top=" + indexOfEntries[nEntries-1].navObj.top + "> </layer>")
if (browserVersion != 0 && !STARTALLOPEN)
hideWholeTree(foldersTree, false, 0)
}
setInitialLayout()
if (PRESERVESTATE && GetCookie('highlightedTreeviewLink')!=null && GetCookie('highlightedTreeviewLink')!="") {
var nodeObj = findObj(GetCookie('highlightedTreeviewLink'))
if (nodeObj!=null){
nodeObj.forceOpeningOfAncestorFolders()
highlightObjLink(nodeObj);
}
else
SetCookie('highlightedTreeviewLink', '')
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -