annotate docs/pycon2010/ui/pycon/slides.js @ 438:a5f3d5a89d6c tip

pyparsing 2.0.0 only if on Python3
author Catherine Devlin <catherine.devlin@gmail.com>
date Tue, 19 Feb 2013 04:33:12 -0500
parents bf314710e64b
children
rev   line source
372
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
1 // S5 v1.1 slides.js -- released into the Public Domain
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
2 // Modified for Docutils (http://docutils.sf.net) by David Goodger
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
3 //
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
4 // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
5 // information about all the wonderful and talented contributors to this code!
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
6
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
7 var undef;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
8 var slideCSS = '';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
9 var snum = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
10 var smax = 1;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
11 var slideIDs = new Array();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
12 var incpos = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
13 var number = undef;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
14 var s5mode = true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
15 var defaultView = 'slideshow';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
16 var controlVis = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
17
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
18 var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
19 var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
20 var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
21
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
22 function hasClass(object, className) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
23 if (!object.className) return false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
24 return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
25 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
26
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
27 function hasValue(object, value) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
28 if (!object) return false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
29 return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
30 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
31
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
32 function removeClass(object,className) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
33 if (!object) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
34 object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
35 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
36
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
37 function addClass(object,className) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
38 if (!object || hasClass(object, className)) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
39 if (object.className) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
40 object.className += ' '+className;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
41 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
42 object.className = className;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
43 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
44 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
45
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
46 function GetElementsWithClassName(elementName,className) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
47 var allElements = document.getElementsByTagName(elementName);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
48 var elemColl = new Array();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
49 for (var i = 0; i< allElements.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
50 if (hasClass(allElements[i], className)) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
51 elemColl[elemColl.length] = allElements[i];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
52 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
53 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
54 return elemColl;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
55 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
56
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
57 function isParentOrSelf(element, id) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
58 if (element == null || element.nodeName=='BODY') return false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
59 else if (element.id == id) return true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
60 else return isParentOrSelf(element.parentNode, id);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
61 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
62
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
63 function nodeValue(node) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
64 var result = "";
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
65 if (node.nodeType == 1) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
66 var children = node.childNodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
67 for (var i = 0; i < children.length; ++i) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
68 result += nodeValue(children[i]);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
69 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
70 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
71 else if (node.nodeType == 3) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
72 result = node.nodeValue;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
73 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
74 return(result);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
75 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
76
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
77 function slideLabel() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
78 var slideColl = GetElementsWithClassName('*','slide');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
79 var list = document.getElementById('jumplist');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
80 smax = slideColl.length;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
81 for (var n = 0; n < smax; n++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
82 var obj = slideColl[n];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
83
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
84 var did = 'slide' + n.toString();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
85 if (obj.getAttribute('id')) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
86 slideIDs[n] = obj.getAttribute('id');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
87 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
88 else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
89 obj.setAttribute('id',did);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
90 slideIDs[n] = did;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
91 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
92 if (isOp) continue;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
93
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
94 var otext = '';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
95 var menu = obj.firstChild;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
96 if (!menu) continue; // to cope with empty slides
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
97 while (menu && menu.nodeType == 3) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
98 menu = menu.nextSibling;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
99 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
100 if (!menu) continue; // to cope with slides with only text nodes
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
101
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
102 var menunodes = menu.childNodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
103 for (var o = 0; o < menunodes.length; o++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
104 otext += nodeValue(menunodes[o]);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
105 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
106 list.options[list.length] = new Option(n + ' : ' + otext, n);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
107 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
108 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
109
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
110 function currentSlide() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
111 var cs;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
112 var footer_nodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
113 var vis = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
114 if (document.getElementById) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
115 cs = document.getElementById('currentSlide');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
116 footer_nodes = document.getElementById('footer').childNodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
117 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
118 cs = document.currentSlide;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
119 footer = document.footer.childNodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
120 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
121 cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
122 '<span id="csSep">\/<\/span> ' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
123 '<span id="csTotal">' + (smax-1) + '<\/span>';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
124 if (snum == 0) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
125 vis = 'hidden';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
126 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
127 cs.style.visibility = vis;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
128 for (var i = 0; i < footer_nodes.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
129 if (footer_nodes[i].nodeType == 1) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
130 footer_nodes[i].style.visibility = vis;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
131 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
132 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
133 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
134
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
135 function go(step) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
136 if (document.getElementById('slideProj').disabled || step == 0) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
137 var jl = document.getElementById('jumplist');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
138 var cid = slideIDs[snum];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
139 var ce = document.getElementById(cid);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
140 if (incrementals[snum].length > 0) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
141 for (var i = 0; i < incrementals[snum].length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
142 removeClass(incrementals[snum][i], 'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
143 removeClass(incrementals[snum][i], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
144 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
145 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
146 if (step != 'j') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
147 snum += step;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
148 lmax = smax - 1;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
149 if (snum > lmax) snum = lmax;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
150 if (snum < 0) snum = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
151 } else
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
152 snum = parseInt(jl.value);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
153 var nid = slideIDs[snum];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
154 var ne = document.getElementById(nid);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
155 if (!ne) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
156 ne = document.getElementById(slideIDs[0]);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
157 snum = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
158 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
159 if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
160 if (incrementals[snum].length > 0 && incpos == 0) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
161 for (var i = 0; i < incrementals[snum].length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
162 if (hasClass(incrementals[snum][i], 'current'))
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
163 incpos = i + 1;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
164 else
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
165 addClass(incrementals[snum][i], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
166 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
167 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
168 if (incrementals[snum].length > 0 && incpos > 0)
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
169 addClass(incrementals[snum][incpos - 1], 'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
170 ce.style.visibility = 'hidden';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
171 ne.style.visibility = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
172 jl.selectedIndex = snum;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
173 currentSlide();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
174 number = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
175 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
176
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
177 function goTo(target) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
178 if (target >= smax || target == snum) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
179 go(target - snum);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
180 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
181
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
182 function subgo(step) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
183 if (step > 0) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
184 removeClass(incrementals[snum][incpos - 1],'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
185 removeClass(incrementals[snum][incpos], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
186 addClass(incrementals[snum][incpos],'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
187 incpos++;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
188 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
189 incpos--;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
190 removeClass(incrementals[snum][incpos],'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
191 addClass(incrementals[snum][incpos], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
192 addClass(incrementals[snum][incpos - 1],'current');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
193 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
194 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
195
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
196 function toggle() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
197 var slideColl = GetElementsWithClassName('*','slide');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
198 var slides = document.getElementById('slideProj');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
199 var outline = document.getElementById('outlineStyle');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
200 if (!slides.disabled) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
201 slides.disabled = true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
202 outline.disabled = false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
203 s5mode = false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
204 fontSize('1em');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
205 for (var n = 0; n < smax; n++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
206 var slide = slideColl[n];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
207 slide.style.visibility = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
208 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
209 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
210 slides.disabled = false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
211 outline.disabled = true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
212 s5mode = true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
213 fontScale();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
214 for (var n = 0; n < smax; n++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
215 var slide = slideColl[n];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
216 slide.style.visibility = 'hidden';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
217 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
218 slideColl[snum].style.visibility = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
219 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
220 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
221
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
222 function showHide(action) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
223 var obj = GetElementsWithClassName('*','hideme')[0];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
224 switch (action) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
225 case 's': obj.style.visibility = 'visible'; break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
226 case 'h': obj.style.visibility = 'hidden'; break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
227 case 'k':
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
228 if (obj.style.visibility != 'visible') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
229 obj.style.visibility = 'visible';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
230 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
231 obj.style.visibility = 'hidden';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
232 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
233 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
234 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
235 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
236
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
237 // 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
238 function keys(key) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
239 if (!key) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
240 key = event;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
241 key.which = key.keyCode;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
242 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
243 if (key.which == 84) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
244 toggle();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
245 return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
246 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
247 if (s5mode) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
248 switch (key.which) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
249 case 10: // return
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
250 case 13: // enter
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
251 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
252 if (key.target && isParentOrSelf(key.target, 'controls')) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
253 if(number != undef) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
254 goTo(number);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
255 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
256 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
257 case 32: // spacebar
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
258 case 34: // page down
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
259 case 39: // rightkey
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
260 case 40: // downkey
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
261 if(number != undef) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
262 go(number);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
263 } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
264 go(1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
265 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
266 subgo(1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
267 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
268 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
269 case 33: // page up
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
270 case 37: // leftkey
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
271 case 38: // upkey
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
272 if(number != undef) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
273 go(-1 * number);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
274 } else if (!incrementals[snum] || incpos <= 0) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
275 go(-1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
276 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
277 subgo(-1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
278 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
279 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
280 case 36: // home
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
281 goTo(0);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
282 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
283 case 35: // end
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
284 goTo(smax-1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
285 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
286 case 67: // c
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
287 showHide('k');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
288 break;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
289 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
290 if (key.which < 48 || key.which > 57) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
291 number = undef;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
292 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
293 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
294 if (key.target && isParentOrSelf(key.target, 'controls')) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
295 number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
296 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
297 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
298 return false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
299 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
300
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
301 function clicker(e) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
302 number = undef;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
303 var target;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
304 if (window.event) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
305 target = window.event.srcElement;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
306 e = window.event;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
307 } else target = e.target;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
308 if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target, 'object')) return true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
309 if (!e.which || e.which == 1) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
310 if (!incrementals[snum] || incpos >= incrementals[snum].length) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
311 go(1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
312 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
313 subgo(1);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
314 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
315 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
316 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
317
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
318 function findSlide(hash) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
319 var target = document.getElementById(hash);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
320 if (target) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
321 for (var i = 0; i < slideIDs.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
322 if (target.id == slideIDs[i]) return i;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
323 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
324 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
325 return null;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
326 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
327
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
328 function slideJump() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
329 if (window.location.hash == null || window.location.hash == '') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
330 currentSlide();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
331 return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
332 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
333 if (window.location.hash == null) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
334 var dest = null;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
335 dest = findSlide(window.location.hash.slice(1));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
336 if (dest == null) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
337 dest = 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
338 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
339 go(dest - snum);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
340 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
341
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
342 function fixLinks() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
343 var thisUri = window.location.href;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
344 thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
345 var aelements = document.getElementsByTagName('A');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
346 for (var i = 0; i < aelements.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
347 var a = aelements[i].href;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
348 var slideID = a.match('\#.+');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
349 if ((slideID) && (slideID[0].slice(0,1) == '#')) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
350 var dest = findSlide(slideID[0].slice(1));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
351 if (dest != null) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
352 if (aelements[i].addEventListener) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
353 aelements[i].addEventListener("click", new Function("e",
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
354 "if (document.getElementById('slideProj').disabled) return;" +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
355 "go("+dest+" - snum); " +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
356 "if (e.preventDefault) e.preventDefault();"), true);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
357 } else if (aelements[i].attachEvent) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
358 aelements[i].attachEvent("onclick", new Function("",
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
359 "if (document.getElementById('slideProj').disabled) return;" +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
360 "go("+dest+" - snum); " +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
361 "event.returnValue = false;"));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
362 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
363 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
364 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
365 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
366 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
367
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
368 function externalLinks() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
369 if (!document.getElementsByTagName) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
370 var anchors = document.getElementsByTagName('a');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
371 for (var i=0; i<anchors.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
372 var anchor = anchors[i];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
373 if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
374 anchor.target = '_blank';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
375 addClass(anchor,'external');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
376 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
377 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
378 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
379
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
380 function createControls() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
381 var controlsDiv = document.getElementById("controls");
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
382 if (!controlsDiv) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
383 var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
384 var hideDiv, hideList = '';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
385 if (controlVis == 'hidden') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
386 hideDiv = hider;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
387 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
388 hideList = hider;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
389 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
390 controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
391 '<div id="navLinks">' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
392 '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
393 '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
394 '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
395 '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
396 '<\/div><\/form>';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
397 if (controlVis == 'hidden') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
398 var hidden = document.getElementById('navLinks');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
399 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
400 var hidden = document.getElementById('jumplist');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
401 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
402 addClass(hidden,'hideme');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
403 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
404
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
405 function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
406 if (!s5mode) return false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
407 var vScale = 22; // both yield 32 (after rounding) at 1024x768
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
408 var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
409 if (window.innerHeight) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
410 var vSize = window.innerHeight;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
411 var hSize = window.innerWidth;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
412 } else if (document.documentElement.clientHeight) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
413 var vSize = document.documentElement.clientHeight;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
414 var hSize = document.documentElement.clientWidth;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
415 } else if (document.body.clientHeight) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
416 var vSize = document.body.clientHeight;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
417 var hSize = document.body.clientWidth;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
418 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
419 var vSize = 700; // assuming 1024x768, minus chrome and such
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
420 var hSize = 1024; // these do not account for kiosk mode or Opera Show
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
421 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
422 var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
423 fontSize(newSize + 'px');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
424 if (isGe) { // hack to counter incremental reflow bugs
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
425 var obj = document.getElementsByTagName('body')[0];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
426 obj.style.display = 'none';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
427 obj.style.display = 'block';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
428 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
429 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
430
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
431 function fontSize(value) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
432 if (!(s5ss = document.getElementById('s5ss'))) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
433 if (!isIE) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
434 document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
435 s5ss.setAttribute('media','screen, projection');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
436 s5ss.setAttribute('id','s5ss');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
437 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
438 document.createStyleSheet();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
439 document.s5ss = document.styleSheets[document.styleSheets.length - 1];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
440 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
441 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
442 if (!isIE) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
443 while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
444 s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
445 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
446 document.s5ss.addRule('body','font-size: ' + value + ' !important;');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
447 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
448 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
449
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
450 function notOperaFix() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
451 slideCSS = document.getElementById('slideProj').href;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
452 var slides = document.getElementById('slideProj');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
453 var outline = document.getElementById('outlineStyle');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
454 slides.setAttribute('media','screen');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
455 outline.disabled = true;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
456 if (isGe) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
457 slides.setAttribute('href','null'); // Gecko fix
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
458 slides.setAttribute('href',slideCSS); // Gecko fix
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
459 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
460 if (isIE && document.styleSheets && document.styleSheets[0]) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
461 document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
462 document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
463 document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
464 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
465 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
466
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
467 function getIncrementals(obj) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
468 var incrementals = new Array();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
469 if (!obj)
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
470 return incrementals;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
471 var children = obj.childNodes;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
472 for (var i = 0; i < children.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
473 var child = children[i];
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
474 if (hasClass(child, 'incremental')) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
475 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
476 removeClass(child, 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
477 for (var j = 0; j < child.childNodes.length; j++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
478 if (child.childNodes[j].nodeType == 1) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
479 addClass(child.childNodes[j], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
480 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
481 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
482 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
483 incrementals[incrementals.length] = child;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
484 removeClass(child,'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
485 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
486 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
487 if (hasClass(child, 'show-first')) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
488 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
489 removeClass(child, 'show-first');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
490 if (child.childNodes[isGe].nodeType == 1) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
491 removeClass(child.childNodes[isGe], 'incremental');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
492 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
493 } else {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
494 incrementals[incrementals.length] = child;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
495 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
496 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
497 incrementals = incrementals.concat(getIncrementals(child));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
498 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
499 return incrementals;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
500 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
501
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
502 function createIncrementals() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
503 var incrementals = new Array();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
504 for (var i = 0; i < smax; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
505 incrementals[i] = getIncrementals(document.getElementById(slideIDs[i]));
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
506 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
507 return incrementals;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
508 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
509
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
510 function defaultCheck() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
511 var allMetas = document.getElementsByTagName('meta');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
512 for (var i = 0; i< allMetas.length; i++) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
513 if (allMetas[i].name == 'defaultView') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
514 defaultView = allMetas[i].content;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
515 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
516 if (allMetas[i].name == 'controlVis') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
517 controlVis = allMetas[i].content;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
518 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
519 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
520 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
521
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
522 // Key trap fix, new function body for trap()
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
523 function trap(e) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
524 if (!e) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
525 e = event;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
526 e.which = e.keyCode;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
527 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
528 try {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
529 modifierKey = e.ctrlKey || e.altKey || e.metaKey;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
530 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
531 catch(e) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
532 modifierKey = false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
533 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
534 return modifierKey || e.which == 0;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
535 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
536
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
537 function startup() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
538 defaultCheck();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
539 if (!isOp) createControls();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
540 slideLabel();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
541 fixLinks();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
542 externalLinks();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
543 fontScale();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
544 if (!isOp) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
545 notOperaFix();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
546 incrementals = createIncrementals();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
547 slideJump();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
548 if (defaultView == 'outline') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
549 toggle();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
550 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
551 document.onkeyup = keys;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
552 document.onkeypress = trap;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
553 document.onclick = clicker;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
554 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
555 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
556
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
557 window.onload = startup;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
558 window.onresize = function(){setTimeout('fontScale()', 50);}