📄 whtree.js
字号:
/*************************************************************************
Fly Help Web Help Contents Viewer 1.0
Copyright (c) 2001-2005 Fly Sky Software,Inc.
http://www.flyskysoft.com
Tested with: Internet Explorer 5-6, Opera 6-7, Safari, Mozilla
Best viewed with: Internet Explorer 5+, Mozilla 1.x+, Safari
ATTENTION! You can use this script only with web help system
generated by Fly Help software.
**************************************************************************/
var licons={
'target':'content',
'ic_e':'whfiles/wh_0.gif',
'ic_l':'whfiles/wh_1.gif',
'ic_2':'whfiles/wh_2.gif',
'ic_3':'whfiles/wh_3.gif',
'ic_4':'whfiles/wh_4.gif',
'ic_18':'whfiles/wh_5.gif',
'ic_19':'whfiles/wh_6.gif',
'ic_20':'whfiles/wh_7.gif',
'ic_26':'whfiles/wh_8.gif',
'ic_27':'whfiles/wh_9.gif',
'ic_28':'whfiles/wh_10.gif'
};
var n=true;
var trees=[];
get_element=document.all?
function(s_id){return document.all[s_id]}:
function(s_id){return document.getElementById(s_id)};
function DHTMLSupported(){
try{
var tmp="";
tmp=document.body.innerHTML;
if(tmp.length<=0)return false;
}catch(e){
return false;
}
return true;
}
function GetIcon(ad){
if(!ad){
cur=this.l[2];
if(this.o){
if((cur=='1')||(cur=='2'))cur='2';
if((cur=='3')||(cur=='4'))cur='4';
if((cur=='5')||(cur=='6'))cur='6';
if((cur=='7')||(cur=='8'))cur='8';
};
if(!this.o){
if((cur=='1')||(cur=='2'))cur='1';
if((cur=='3')||(cur=='4'))cur='3';
if((cur=='5')||(cur=='6'))cur='5';
if((cur=='7')||(cur=='8'))cur='7';
};
return'whfiles/'+cur+'.gif';
}else{
return licons['ic_'+(
(this.d.length?16:0)+
(this.d.length&&this.o?8:0)+
(this.is_last()?1:0)+
(this.is_first()?2:0)+2)];
}
}
function TreeNode(k,n_order){
this.n_depth=k.n_depth+1;
this.l=k.l[n_order+(this.n_depth?3:0)];
if(!this.l)return;
this.g=k.g;
this.k=k;
this.n_order=n_order;
this.o=n;
this.n_id=this.g.q.length;
this.g.q[this.n_id]=this;
k.d[n_order]=this;
this.d=[];
for(var i=0;i<this.l.length-2;i++)
new TreeNode(this,i);
this.get_icon=GetIcon;
this.open=OIt;
this.select=FIt;
this.init=IIt;
this.is_last=function(){
return this.n_order==this.k.d.length-1};
this.is_first=function(){
return(this.n_depth==0)&&(this.n_order==0)&&(!this.is_last())};
}
function OIt(z){
var d=[];
var v=get_element('divtree'+this.n_id);
if(!v)return;
if(n){
document.write(d.join(''));
for(var i=0;i<this.d.length;i++){
document.write(this.d[i].init());
this.d[i].open();
}
}else{
if(!v.innerHTML){
for(var i=0;i<this.d.length;i++)
d[i]=this.d[i].init();
v.innerHTML=d.join('');
}
v.style.display=(z?'none':'block');
this.o=!z;
var ab=document.images['j_img'+this.n_id],
p=document.images['i_img'+this.n_id];
if(ab)ab.src=this.get_icon(true);
if(p)p.src=this.get_icon();
}
}
function FIt(u){
if(!u){
var x=this.g.m;
this.g.m=this;
if(x)x.select(true);
webhelptop.whtopframe.pagenum=this.n_id;
}
var p=document.images['i_img'+this.n_id];
if(p)p.src=this.get_icon();
get_element('i_txt'+this.n_id).style.fontWeight=u?'normal':'bold';
return Boolean(this.l[1]);
}
function MakeTree(itm,ac){
n=!DHTMLSupported();this.l=itm;
this.g=this;this.q=[];this.m=null;
this.n_depth=-1;
var aa=new Image(),
o_iconl=new Image();
aa.src=licons['ic_e'];
o_iconl.src=licons['ic_l'];
licons['im_e']=aa;
licons['im_l']=o_iconl;
for(var i=0;i<64;i++)
if(licons['ic_'+i]){
var af=new Image();
licons['im_'+i]=af;
af.src=licons['ic_'+i];
}
this.select=function(n_id)
{
var str=webhelptop.whtopframe.ContentFiles[n_id];
if(str!="" && str!=null)
webhelptop.whtopframe.pageid = str;
return this.q[n_id].select();
};
this.toggle=function(n_id){var ae=this.q[n_id];
ae.open(ae.o)};
this.d=[];
var itm=this.l;
for(var i=0;i<itm.length;i++){
new TreeNode(this,i);
}
this.n_id=trees.length;
trees[this.n_id]=this;
for(var i=0;i<this.d.length;i++){
document.write(this.d[i].init());
if(ac||!DHTMLSupported())this.d[i].open();
}
this.dOpenTreeNode=dOpenTreeNode;
this.OpenTreeNode=OpenTreeNode;
}
function IIt(){
var y=[],
o_current_item=this.k;
for(var i=this.n_depth;i>0;i--){
y[i]='<img src="'+licons[o_current_item.is_last()?'ic_e':'ic_l']+'" border="0" align="absbottom">';
o_current_item=o_current_item.k;
}
return'<a name="#i_txt'+this.n_id+'"></a><table cellpadding="0" cellspacing="0" border="0"><tr><td nowrap>'+
y.join('')+(this.d.length?
(n?'':'<a href="javascript: trees['+this.g.n_id+'].toggle('+this.n_id+
')" >')+'<img src="'+this.get_icon(true)+'" border="0" align="absbottom" name="j_img'+this.n_id+
'">'+
(n?'':'</a>'):'<img src="'+this.get_icon(true)+
'" border="0" align="absbottom">')+
'<a href="'+this.l[1]+
'" target="'+licons['target']+'"'+
' onclick="return trees['+this.g.n_id+'].select('+this.n_id+');" '+
(n?'':' ondblclick="trees['+
this.g.n_id+'].toggle('+this.n_id+')"')+' class="t0i" id="i_txt'+
this.n_id+'"><img src="'+this.get_icon()+'" border="0" align="absbottom" name="i_img'+
this.n_id+'" class="t0im"> '+
this.l[0]+'</td></tr></table>'+(this.d.length?
'<div id="divtree'+this.n_id+'" style="display:none"></div>':'');
}
function OpenTreeNode(filename)
{
if(this.g!=null&&this.g.m!=null&&
this.g.m.l[1]==filename){
return;
}
CheckNode(filename,this);
}
function CheckNode(filename,itm)
{
for(var i=0;i<itm.d.length;i++){
if(itm.d[i].o)
itm.d[i].open(false);
//if(filename==itm.d[i].l[1])
if(itm.d[i].l[1] && filename)
{
if(filename.toLowerCase()==itm.d[i].l[1].toLowerCase())
{
OpenDownTo(itm.d[i]);
itm.d[i].select(false);
}
}
CheckNode(filename,itm.d[i]);
}
}
var OutRes=0;
function dOpenTreeNode(id)
{
if(this.g!=null&&this.g.m!=null&&
this.g.m.n_id==id)return;
OutRes=-1;
dCheckNode(id,this);
return OutRes;
}
function dCheckNode(id,itm,obj)
{
for(var i=0;i<itm.d.length;i++){
if(itm.d[i].o)
itm.d[i].open(false);
if(id==itm.d[i].n_id){
OpenDownTo(itm.d[i]);
itm.d[i].select(false);
OutRes=id;
return;
};
dCheckNode(id,itm.d[i]);
};
}
function OpenDownTo(node)
{
if(!node.n_depth)
return;
OpenDownTo(node.k);
node.k.open(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -