~todd-deshane/openstack-manuals/working

« back to all changes in this revision

Viewing changes to doc/build/docbook-xsl-1.76.1/slides/browser/overlay.js

  • Committer: Anne Gentle
  • Date: 2011-04-04 17:54:52 UTC
  • Revision ID: anne@openstack.org-20110404175452-gtth3hfrniqhpp5o
Switching from Ant builds to Maven, still working out kinks but should be functional

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Java -*-
2
 
//
3
 
// Overlay.js, adapted from Floating image II on dynamicdrive.com
4
 
/* Usage:
5
 
<html>
6
 
<head>
7
 
<script LANGUAGE="JavaScript1.2" src="overlay.js"></script>
8
 
...rest of head...
9
 
</head>
10
 
<body onload="overlaySetup(corner)">
11
 
<div id="overlayDiv" STYLE="position:absolute;visibility:visible;">
12
 
...body of overlay...
13
 
</div>
14
 
...rest of page...
15
 
*/
16
 
 
17
 
var overlayNS4 = document.layers ? 1 : 0;
18
 
var overlayIE  = document.all ? 1 : 0;
19
 
var overlayNS6 = document.getElementById && !document.all ? 1 : 0;
20
 
 
21
 
var overlayPadX = 15;
22
 
var overlayPadY = 15;
23
 
var overlayDelay = 60;
24
 
 
25
 
var overlayCorner = 'ur'; // ul, ll, ur, lr, uc, lc, cl, cr
26
 
 
27
 
function overlayRefresh() {
28
 
    var overlayLx = 0;
29
 
    var overlayLy = 0;
30
 
 
31
 
    var overlayX = 0;
32
 
    var overlayY = 0;
33
 
    var overlayW = 0;
34
 
    var overlayH = 0;
35
 
    var contentH = 0;
36
 
 
37
 
    var links = document.getElementsByTagName("body")[0];
38
 
 
39
 
    if (overlayIE) {
40
 
        overlayLx = document.body.clientWidth;
41
 
        overlayLy = document.body.clientHeight;
42
 
 
43
 
        if (document.body.parentElement) {
44
 
          // For IE6
45
 
          overlayLx = document.body.parentElement.clientWidth;
46
 
          overlayLy = document.body.parentElement.clientHeight;
47
 
        }
48
 
 
49
 
        overlayH  = overlayDiv.offsetHeight;
50
 
        overlayW  = body.offsetWidth; // overlayDiv.offsetWidth;
51
 
        contentH  = body.offsetHeight;
52
 
    } else if (overlayNS4) {
53
 
        overlayLy = window.innerHeight;
54
 
        overlayLx = window.innerWidth;
55
 
        overlayH  = document.overlayDiv.clip.height;
56
 
        overlayW  = body.clip.width; // document.overlayDiv.clip.width;
57
 
        contentH  = body.clip.height;
58
 
    } else if (overlayNS6) {
59
 
        var odiv = document.getElementById('overlayDiv');
60
 
 
61
 
        overlayLy = window.innerHeight;
62
 
        overlayLx = window.innerWidth;
63
 
        overlayH  = odiv.offsetHeight;
64
 
        overlayW  = odiv.offsetWidth; // body.offsetWidth; 
65
 
        contentH  = odiv.offsetHeight;
66
 
    }
67
 
 
68
 
    if (overlayCorner == 'ul') {
69
 
        overlayX = overlayPadX;
70
 
        overlayY = overlayPadY;
71
 
    } else if (overlayCorner == 'cl') {
72
 
        overlayX = overlayPadX;
73
 
        overlayY = (overlayLy - overlayH) / 2;
74
 
    } else if (overlayCorner == 'll') {
75
 
        overlayX = overlayPadX;
76
 
        overlayY = (overlayLy - overlayH) - overlayPadY;
77
 
    } else if (overlayCorner == 'ur') {
78
 
        overlayX = (overlayLx - overlayW) - overlayPadX;
79
 
        overlayY = overlayPadY;
80
 
    } else if (overlayCorner == 'cr') {
81
 
        overlayX = (overlayLx - overlayW) - overlayPadX;
82
 
        overlayY = (overlayLy - overlayH) / 2;
83
 
    } else if (overlayCorner == 'lr') {
84
 
        overlayX = (overlayLx - overlayW) - overlayPadX;
85
 
        overlayY = (overlayLy - overlayH) - overlayPadY;
86
 
    } else if (overlayCorner == 'uc') {
87
 
        overlayX = (overlayLx - overlayW) / 2;
88
 
        overlayY = overlayPadY;
89
 
    } else { // overlayCorner == 'lc'
90
 
        overlayX = (overlayLx - overlayW) / 2;
91
 
        overlayY = (overlayLy - overlayH) - overlayPadY;
92
 
    }
93
 
 
94
 
    if (overlayIE) {
95
 
        overlayDiv.style.left=overlayX;
96
 
        overlayDiv.style.top=overlayY+document.body.scrollTop;
97
 
 
98
 
        if (contentH > overlayLy) {
99
 
            overlayDiv.style.visibility = "hidden";
100
 
        }
101
 
    } else if (overlayNS4) {
102
 
        document.overlayDiv.pageX=overlayX;
103
 
        document.overlayDiv.pageY=overlayY+window.pageYOffset;
104
 
        document.overlayDiv.visibility="visible";
105
 
 
106
 
        if (contentH > overlayLy) {
107
 
            document.overlayDiv.style.visibility = "hidden";
108
 
        }
109
 
    } else if (overlayNS6) {
110
 
        var div = document.getElementById("overlayDiv");
111
 
        var leftpx = overlayX;
112
 
        var toppx = overlayY+window.pageYOffset;
113
 
        var widthpx = overlayW;
114
 
 
115
 
        div.style.left = leftpx + "px";
116
 
        div.style.top = toppx + "px";
117
 
        div.style.width = widthpx + "px";
118
 
 
119
 
        if (contentH > overlayLy) {
120
 
            div.style.visibility = "hidden";
121
 
        } else {
122
 
            div.style.visibility = "visible";
123
 
        }
124
 
    }
125
 
}
126
 
 
127
 
function onad() {
128
 
    loopfunc();
129
 
}
130
 
 
131
 
function loopfunc() {
132
 
    overlayRefresh();
133
 
    setTimeout('loopfunc()',overlayDelay);
134
 
}
135
 
 
136
 
function overlaySetup(corner) {
137
 
    overlayCorner = corner;
138
 
 
139
 
    if (overlayIE || overlayNS4 || overlayNS6) {
140
 
        onad();
141
 
    }
142
 
}