libjava/ChangeLog:
[official-gcc.git] / libjava / classpath / tools / resource / gnu / classpath / tools / gjdoc / htmldoclet / gjdoc.js
blob91f8ba2ac395907ab0c42c7a78823b88a640ad54
1 /* gjdoc.js
2  Copyright (C) 2004 Free Software Foundation, Inc.
4  This file is part of GNU Classpath.
6  GNU Classpath is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
11  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  General Public License for more details.
16  You should have received a copy of the GNU General Public License
17  along with GNU Classpath; see the file COPYING.  If not, write to the
18  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  02111-1307 USA. */
21 /**
22  *  Sets a new stylesheet for a single frame.
23  */
24 function setStyleSheetForFrame(title, frame_name)
26    var i, num, a, main;
27    f = eval("top.frames." + frame_name);
28    for(i=0; (a = f.document.getElementsByTagName("link")[i]); i++) {
29       if(a.getAttribute("rel").indexOf("style") != -1
30          && a.getAttribute("title")) {
31          a.disabled = true;
32          a.disabled = (a.getAttribute("title") != title);
33       }
34    }
37 /**
38  *  Sets a new stylesheet for a single document.
39  */
40 function setStyleSheetForDocument(title) 
42    var i, num, a, main;
43    for(i=0; (a = top.document.getElementsByTagName("link")[i]); i++) {
44       if(a.getAttribute("rel").indexOf("style") != -1
45          && a.getAttribute("title")) {
46          a.disabled = true;
47          a.disabled = (a.getAttribute("title") != title);        
48       }
49    }
52 /**
53  *  Sets a new stylesheets for all frames.
54  */
55 function setStyleSheet(title)
57    var i, num, a, main;
58    num = top.frames.length;
59    if (num > 0) {
60       for (i=0; i<num; i++) {
61          setStyleSheetForFrame(title, top.frames[i].name);
62       }
63    }
64    else {
65       setStyleSheetForDocument(title);
66    }
67    top.selectedSheet = title;
68    return false;
71 /**
72  *  Returns the title of the set of stylesheets that is active in the
73  *  given frame.
74  */
75 function getActiveStylesheetTitle(frame)
76
77    for(i=0; (a = frame.document.getElementsByTagName("link")[i]); i++) {
78       if(a.getAttribute("rel").indexOf("style") != -1
79          && a.getAttribute("title")) {
80          if (!a.disabled) {
81             return a.getAttribute("title");
82          }    
83       }
84    }
85    return "";
88 /**
89  *  Invoked when a page in the main content frame has been loaded.
90  */
91 function contentPageLoaded(title) 
92
93    if (title) {
94       top.document.title = title;
95    }
96    /** 20050204: removed since there is only one stylesheet at the time
97    if (top.frames.length > 0) {
98       setStyleSheet(getActiveStylesheetTitle(top.frames.packages), "content");
99    }
100    else if (top.selectedSheet) { 
101       setStyleSheet(top.selectedSheet, "content");
102    }
103    **/
107  *  Invoked when a page in one of the two frames on the left hand has
108  *  been loaded.
109  */
110 function secondaryPageLoaded(frame_name)
112    /** 20050204: removed since there is only one stylesheet at the time
113    setStyleSheet(getActiveStylesheetTitle(top.frames.packages), frame_name);
114    **/