home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / libservlet2.3-java / api / resources / gjdoc.js next >
Encoding:
JavaScript  |  2006-07-07  |  3.1 KB  |  116 lines

  1. /* gjdoc.js
  2.  Copyright (C) 2004 Free Software Foundation, Inc.
  3.  
  4.  This file is part of GNU Classpath.
  5.  
  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.
  10.  
  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.
  15.  
  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. */
  20.  
  21. /**
  22.  *  Sets a new stylesheet for a single frame.
  23.  */
  24. function setStyleSheetForFrame(title, frame_name)
  25. {
  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.    }
  35. }
  36.  
  37. /**
  38.  *  Sets a new stylesheet for a single document.
  39.  */
  40. function setStyleSheetForDocument(title) 
  41. {
  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.    }
  50. }
  51.  
  52. /**
  53.  *  Sets a new stylesheets for all frames.
  54.  */
  55. function setStyleSheet(title)
  56. {
  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;
  69. }
  70.  
  71. /**
  72.  *  Returns the title of the set of stylesheets that is active in the
  73.  *  given frame.
  74.  */
  75. function getActiveStylesheetTitle(frame)
  76.    for(i=0; (a = frame.document.getElementsByTagName("link")[i]); i++) {
  77.       if(a.getAttribute("rel").indexOf("style") != -1
  78.          && a.getAttribute("title")) {
  79.          if (!a.disabled) {
  80.             return a.getAttribute("title");
  81.          }    
  82.       }
  83.    }
  84.    return "";
  85. }
  86.  
  87. /**
  88.  *  Invoked when a page in the main content frame has been loaded.
  89.  */
  90. function contentPageLoaded(title) 
  91.    if (title) {
  92.       top.document.title = title;
  93.    }
  94.    /** 20050204: removed since there is only one stylesheet at the time
  95.    if (top.frames.length > 0) {
  96.       setStyleSheet(getActiveStylesheetTitle(top.frames.packages), "content");
  97.    }
  98.    else if (top.selectedSheet) { 
  99.       setStyleSheet(top.selectedSheet, "content");
  100.    }
  101.    **/
  102. }
  103.  
  104. /**
  105.  *  Invoked when a page in one of the two frames on the left hand has
  106.  *  been loaded.
  107.  */
  108. function secondaryPageLoaded(frame_name)
  109.    /** 20050204: removed since there is only one stylesheet at the time
  110.    setStyleSheet(getActiveStylesheetTitle(top.frames.packages), frame_name);
  111.    **/
  112. }
  113.