File: docbook.js

package info (click to toggle)
docbook-dsssl 1.79-9.2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 3,288 kB
  • sloc: perl: 496; xml: 126; javascript: 61; makefile: 33
file content (86 lines) | stat: -rw-r--r-- 2,130 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function toggleDiv(id) {
  // Find element with ID "id" and toggle its display property.
  // By convention, the ID of the corresponding +/- image is "${id}IMG".
  var div = eval("document.all." + id);
  var img = eval("document.all." + id + "IMG");
  var display = div.style.display;

  if (display != "block") {
    div.style.display = "block";
    img.src = "toc-minus.gif";
  } else {
    div.style.display = "none";
    img.src = "toc-plus.gif";
  }
}

function link_href(rel) {
  // Find the LINK element (in the body document) with the specified REL
  // and return its HREF.  Return "" if no such LINK can be found.
  var body  = parent.frames[1].document;
  var links = body.all.tags("LINK");
  for (i=0; i<links.length; i++) {
    if (links(i).getAttribute("REL") == rel) {
      return links(i).getAttribute("HREF");
    }
  }

  return "";
}

function load_body(href) {
  // Change the body frame to the specified href.  Update the
  // navigation bar. We use the setTimeout() trick to give the browser
  // a chance to load the document...
  var bodyframe = parent.frames[1];
  if (href != "") {
    bodyframe.location = href;
    setTimeout('reset_links()', 50);
  }
}

function goto_link(rel) {
  // Change the body frame to the specified LINK document.
  var href = link_href(rel);
  load_body(href);
}

function link_on(rel) {
  // Turn on the link
  navbar = parent.frames[2].document;
  navbar.all[rel].style.color = "black";
}

function link_off(rel) {
  // Turn off the link
  navbar = parent.frames[2].document;
  navbar.all[rel].style.color = "gray";
}

function set_link(rel) {
  // Set link on if there's somewhere to go, off otherwise
  link_off(rel);

  if (link_href(rel) !=  "") {
    link_on(rel);
  }
}    

function set_links() {
  // Set 'em all
  set_link("HOME");
  set_link("UP");
  set_link("PREVIOUS");
  set_link("NEXT");
}

function reset_links() {
  // Reset the links after a load.  Make sure we wait until the
  // document is loaded.
  var body  = parent.frames[1].document;
  if (body.readyState == 'complete') {
    set_links();
  } else {
    setTimeout('reset_links()', 100);
  }
}