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)
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
22 * Sets a new stylesheet for a single frame.
24 function setStyleSheetForFrame(title, frame_name)
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")) {
32 a.disabled = (a.getAttribute("title") != title);
38 * Sets a new stylesheet for a single document.
40 function setStyleSheetForDocument(title)
43 for(i=0; (a = top.document.getElementsByTagName("link")[i]); i++) {
44 if(a.getAttribute("rel").indexOf("style") != -1
45 && a.getAttribute("title")) {
47 a.disabled = (a.getAttribute("title") != title);
53 * Sets a new stylesheets for all frames.
55 function setStyleSheet(title)
58 num = top.frames.length;
60 for (i=0; i<num; i++) {
61 setStyleSheetForFrame(title, top.frames[i].name);
65 setStyleSheetForDocument(title);
67 top.selectedSheet = title;
72 * Returns the title of the set of stylesheets that is active in the
75 function getActiveStylesheetTitle(frame)
77 for(i=0; (a = frame.document.getElementsByTagName("link")[i]); i++) {
78 if(a.getAttribute("rel").indexOf("style") != -1
79 && a.getAttribute("title")) {
81 return a.getAttribute("title");
89 * Invoked when a page in the main content frame has been loaded.
91 function contentPageLoaded(title)
93 top.document.title = title;
94 if (top.frames.length > 0)
95 setStyleSheet(getActiveStylesheetTitle(top.frames.packages), "content");
96 else if (top.selectedSheet) {
97 setStyleSheet(top.selectedSheet, "content");
102 * Invoked when a page in one of the two frames on the left hand has
105 function secondaryPageLoaded(frame_name)
107 setStyleSheet(getActiveStylesheetTitle(top.frames.packages), frame_name);