?? main.htm
字號:
if (c == '.') ret += img("space",""); if (c == '/') ret += img("line","");
if (c >= '0' && c <= '9') ret += img(xImgs[c],""); if (!self.compactTree) {
if (c == 'l') ret += img("list",""); if (c == 'L') ret += img("end", "");
if (c == '+') ret += img("listp",ClosedBookHint);
if (c == '*') ret += img("endp", ClosedBookHint);
if (c == '-') ret += img("listm",OpenBookHint);
if (c == '_') ret += img("endm", OpenBookHint); }
if (c == 'r') ret += img("open", TreeRootHint);
if (c == 'R') ret += img("link", TreeRootHint);
if (c == '#') ret += img("leaf", NormalPageHint);
if (c == 'x') ret += img("link", LinkedPageHint);
if (c == 'b') ret += img("book", ClosedBookHint);
if (c == 'o') ret += img("open", OpenBookHint);
} return ret; }
/* removes quotes and HTML-Tags in status-text. */
function unquote (text) {
var pos = myIndexOf(text, "\"");
while (pos > -1) { text = text.substring(0, pos) +"``"+
text.substring(pos+1); pos = myIndexOf(text, "\""); }
var pos = myIndexOf(text, "'");
while (pos > -1) { text = text.substring(0, pos) +"`"+
text.substring(pos+1); pos = myIndexOf(text, "'"); }
var pos = myIndexOf(text, "<"); var pos2 = myIndexOf(text, ">");
while ((pos > -1) && (pos2 > -1) && (pos < pos2)) {
text = text.substring(0, pos) + text.substring(pos2+1);
pos = myIndexOf(text, "<"); pos2 = myIndexOf(text, ">");
} return text; }
/* expands a link */
function lnk (xHref, onOver, misc, xText) { return "<A H"+"REF=\""
+ xHref +"\" ONMOUSEOVER=\"window.status='"+ onOver +"'; return true\" "
+"ONMOUSEOUT=\"window.status=''; return true\""+ misc +">"+ xText +"<\/A>"; }
/* writes tree code, marks active doc, adds link and text */
function wrtEntry (tree, key, link, text) {
var split = myIndexOf(text, "|"); // split text and status
if (split < 0) { var statusText = unquote(text); var tipText = ""; }
else { var statusText = unquote(text.substring(split+1));
var tipText = " TITLE=\""+ statusText +"\"";
text = text.substring(0, split); }
var pos = myIndexOf(text, " "); // make text non-breaking
while (pos > -1) { text = text.substring(0, pos) +" "+
text.substring(pos+1); pos = myIndexOf(text, " "); }
var isCurr = (viewKey == key); if (link)
link = (link.charAt(0) == "|" ? link.substring(1) : DocRoot + link);
if (link && !(isCurr && (isOpera || !LinkCurrPage))) text = lnk(link,
statusText, (isCurr ? " STYLE=\"color:"+ CurrPageFG +";\"" : "") + tipText,
(isCurr ? "<FONT COLOR=\""+ CurrPageFG +"\">"+ text +"<\/FONT>" : text));
tableBeg = "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR>";
return tableBeg +"<TD><FONT SIZE=\"1\"> <\/TD><TD NOWRAP><NOBR>"+ tree
+"<\/NOBR><\/TD><TD><FONT SIZE=\"1\"> <\/TD><TD NOWRAP>"+ tableBeg
+ (!isCurr ? "<TD NOWRAP><NOBR><FONT FACE=\""+ FontFace +"\" SIZE=\"-1\">"
: "<TD BGCOLOR=\""+ CurrPageBG +"\" NOWRAP><NOBR><FONT FACE=\""+ FontFace
+"\" SIZE=\"-1\" COLOR=\""+ CurrPageFG +"\">") +" "+ text
+" <\/FONT><\/NOBR><\/TD><\/TR><\/TABLE><\/TD><\/TR><\/TABLE>"; }
/* performs a reload-index-instruction with the new key */
function index (newKey, currKey, doneMouse) { window.status = waitText;
if (document.all && document.all.waitMsg && !doneMouse) {
document.all.waitMsg.style.top = document.body.scrollTop + 5;
document.all.waitMsg.style.display = "block";
window.setTimeout("index('"+newKey+"','"+currKey+"','true');", 50);
return; } if (!self.currKey) showKey = ""; else showKey = currKey;
if ((!self.currKey && (""+ currKey == "undefined")) || !isDHTML) {
var pos = myIndexOf(newKey, "+");
if (pos < 0) newHash = newKey +"+"+ viewKey; // missing viewKey
else { if (pos > 0) newHash = newKey; // new prm & viewKey
else { // keep prm, new viewKey
var KeyAdd = newKey.substring(1); showKey = KeyAdd;
if (myIndexOf(":"+prm+":", ":"+KeyAdd+":") > -1) newHash = prm + newKey;
else // newKey needs to be added to prm
newHash = ((prm == ".+.") ? "" : prm +":") + KeyAdd + newKey;
}} top.key = newHash; splitPrm(); currKey = ""; TVkeys[viewKey] = true; }
if (!DHTMLTreeView(currKey)) { // need to redisplay
if (isOpera) location.reload(); else
if (document.images) location.replace(location.href);
else location.href = location.href;
} else if (document.all && document.all.waitMsg) {
document.all.waitMsg.style.display = "none"; } window.status = ""; }
/* compute the new prm for a book */
function makePrm (currPrm, add, sub) {
if (myIndexOf(currPrm, " ") > -1) currPrm = ".+."; // catch NS2-bug
if (add != "") // put in a key
var newPrm = ((currPrm == ".+.") ? "" : currPrm +":") + add;
if (sub != "") { // take out a key _and_it's_children_
var newPrm = ":"+currPrm+":"; var cutPos = myIndexOf(newPrm, ":"+sub);
while(cutPos > -1) { newPrm = newPrm.substring(0, cutPos) +
newPrm.substring(myIndexOf(newPrm, ":", cutPos+1));
cutPos = myIndexOf(newPrm, ":"+sub); } if (newPrm == ":") newPrm = ":*:";
newPrm = newPrm.substring(1, newPrm.length-1);
} if (myIndexOf(newPrm, " ") > -1) newPrm = currPrm;
return newPrm; }
/* expands a reload-index-instruction with new prm */
function rld (currKey, newPrm, treecode, hint) {
return lnk("#\" ONCLICK=\"index('"+ newPrm +"+"+ viewKey +"', '"
+ currKey +"');return false\" TARGET=\"_self", hint, "", treecode); }
/* generate the HTML tables */
function wrtIdx (text, key, link, prefix, code) { var idxRet = "";
var pos = myIndexOf(key, " "); if (pos > -1) key = key.substring(0, pos);
var subKey = (key.length > 1 ? key.substring(0, key.length-1) : "");
currIsVisible = (myIndexOf(":"+prm+":", ":"+subKey) > -1);
if (self.viewMatchCnt && subKey != "") currIsVisible
&= (subKey.substring(0, viewMatchCnt)
== viewKey.substring(0, viewMatchCnt));
if (currIsVisible || isDHTML) { var codePos = myIndexOf(code, "|");
if (codePos > -1) { var prefixPos = myIndexOf(prefix, "|"); // isBook
if (myIndexOf(":"+prm+":", ":"+key) < 0) // isCollapsed
idxRet = tree(treePfx + (prefixPos < 0 ? prefix :
prefix.substring(prefixPos+1))) + rld(key, makePrm(prm, key, ""),
tree(code.substring(codePos+1)), ClosedBookStatus);
else idxRet = tree(treePfx + (prefixPos < 0 ? prefix :
prefix.substring(0, prefixPos))) + rld(key, makePrm(prm, "", key),
tree(code.substring(0, codePos)), OpenBookStatus);
} else idxRet = tree(treePfx + prefix + code); // isLeaf
return wrtEntry(idxRet, key, link, text);
} else return ""; }
/* adds the initial TreeView entries */
function idx (text, key, link, prefix, code, opts) {
if (!key) key = "*"; if (!text) text = "";
if (link) link += "\" TARGET=\""+ xTarget(opts); TVcount++;
var retVal = wrtIdx(text, key, link, prefix, code);
if (document.layers) retVal = "<LAYER ID=\"TV"+ TVcount
+"\" TOP=\""+ currPosY +"\" LEFT=\"0\" VISIBILITY=\""
+ (currIsVisible ? "show" : "hide") +"\">"+ retVal +"<\/LAYER>";
if (document.all) retVal = "<DIV ID=\"TV"+ TVcount +"\""
+" STYLE=\"position:absolute; top:"+ currPosY +"px; left:0px; display:"
+ (currIsVisible ? "block" : "none") +";\">"+ retVal +"<\/DIV>";
if (isDHTML) { TVkeys[key] = false; TVentries[TVcount] = new Array
((viewKey != key), text, key, link, treePfx, prefix, code, currIsVisible,
currPosY); TVkeys[key.substring(0, key.length-1)] = currIsVisible; }
wrt(retVal); if (currIsVisible) currPosY += EntryHeight; }
/* a 'clean' version of indexOf */
function myIndexOf(text, srch, start) {
if (!start) start = 0; var pos = (""+ text).indexOf(srch, start);
return (""+ pos != "" ? pos : -1); }
/* write to prnBuffer */
function wrt (text) { printBuffer += text +"\n"; }
/* writes the printBuffer */
function flush () { document.writeln(printBuffer); printBuffer = ""; }
/* test for option */
function is (opts, keyword) { return (myIndexOf(""+ opts, keyword) > -1); }
/* get custom target */
function xTarget (opts) { if (opts && is(opts, "target")) {
opts += ","; startPos = myIndexOf(opts, "target=") + 7;
return opts.substring(startPos, myIndexOf(opts, ",", startPos)); }
else return "main"; }
/* get custom image */
function xImg (opts) { return (opts ? opts.substring
(myIndexOf(opts, "img") + 3, myIndexOf(opts, "img") + 4) : ""); }
/* functions for building the tree with */
function initTree (text, key, link, opts) { initTreeView(); treePfx = "";
idx(text, key, link, (is(opts, "cntd.") ? "/" : (is(opts, "img")
? xImg(opts) : (is(opts, "link") ? "R":"r") ) ), "", opts); }
function sub_Book (text, key, link, opts) {
if (is(opts, "cntd.")) idx(text, key, link, "/|.", "|", opts);
else { idx(text, key, link, "", (is(opts, "img") ? (is(opts, "last")
? "_"+xImg(opts)+"|*"+xImg(opts):"-"+xImg(opts)+"|+"+xImg(opts))
: (is(opts, "last") ? "_o|*b":"-o|+b") ), opts );
treePfx += (is(opts, "last") ? ".":"/"); }}
function lastBook (text, key, link, opts) {
sub_Book(text, key, link, "last,"+ opts); }
function end_Book () { treePfx = treePfx.substring(0, treePfx.length-1); }
function sub_Page (text, key, link, opts) {
idx(text, key, link, "", (is(opts, "cntd.") ? (is(opts, "last")
? "..":"/.") : (is(opts, "last") ? "L":"l") + (is(opts, "img")
? xImg(opts) : (is(opts, "link") ? "x":"#") ) ), opts); }
function lastPage (text, key, link, opts) {
sub_Page(text, key, link, "last,"+ opts); }
function end_Tree () { idx(); if (document.layers) wrt("<LAYER ID=\"bottom\""
+" TOP=\""+ (TVtop + EntryHeight * (TVcount-1)) +"\"> <\/LAYER>");
wrt("<INFO TEXT=\""+ TVversion() +"\">"); flush(); treePfx = ""; }
/* close all subtrees */
function closeAll() { if (isDHTML) {
for (var i = 1; i <= TVcount; i++) if (TVkeys[TVentries[i][2]]) {
TVkeys[TVentries[i][2]] = TVentries[i][0] = false; } index();
if (document.layers) { ScreenTop = window.pageYOffset; scrollMax = 50
+ document.layers["TV"+TVcount].pageY - window.innerHeight;
} else { ScreenTop = document.body.scrollTop; scrollMax = 50
+ document.all["TV"+TVcount].offsetTop - document.body.clientHeight;
} if (ScreenTop > scrollMax) window.scrollTo(0, scrollMax); }}
/* open all subtrees */
function openAll() { if (isDHTML) { for (var i = 1; i <= TVcount; i++)
if ((myIndexOf(TVentries[i][6], "|") > -1) && (!TVkeys[TVentries[i][2]])) {
TVkeys[TVentries[i][2]] = true; TVentries[i][0] = false; } index(); }}
// end-hide -->
</SCRIPT>
<DIV ID="waitMsg" STYLE="cursor:wait; position:absolute; left:1; height:80; width:204; display:none; top:3">
<TABLE HEIGHT="100%" WIDTH="100%"><TR><TD width="100%" height="100%"> </TD></TR></TABLE>
</DIV>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -