slideshow-service 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +71 -0
- data/lib/slideshow/service/public/slideshow-csss/classList.js +116 -0
- data/lib/slideshow/service/public/slideshow-csss/logo.svg +52 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/code-highlight.js +114 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-controls.js +40 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-edit.js +132 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-snippets.js +89 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/incrementable.js +94 -0
- data/lib/slideshow/service/public/slideshow-csss/prefixfree.min.js +10 -0
- data/lib/slideshow/service/public/slideshow-csss/reusable.css +118 -0
- data/lib/slideshow/service/public/slideshow-csss/slides.html +90 -0
- data/lib/slideshow/service/public/slideshow-csss/slideshow.css +282 -0
- data/lib/slideshow/service/public/slideshow-csss/slideshow.js +508 -0
- data/lib/slideshow/service/public/slideshow-csss/style.css +45 -0
- data/lib/slideshow/service/public/slideshow-csss/theme.css +247 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/example.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/example.svg +223 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face1.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face2.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face3.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face4.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-bright.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/icon-blue.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/keys2.jpg +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-bright.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-blue.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-blue.svg +14 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-slanted.jpg +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-white.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-white.svg +14 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html +80 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.ca +52 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.de +96 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.en +81 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.es +52 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.fr +118 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.hu +98 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.nl +82 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pl +76 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pt-br +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pt_br +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.sv +75 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.pt-br.html +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/scripts/slidy.js +2952 -0
- data/lib/slideshow/service/public/slideshow-slidy/slides.blank.html +26 -0
- data/lib/slideshow/service/public/slideshow-slidy/slides.w3c.html +62 -0
- data/lib/slideshow/service/public/slideshow-slidy/styles/slidy.css +401 -0
- data/lib/slideshow/service/public/slideshow-slidy/styles/w3c-blue.css +493 -0
- data/lib/slideshow/service/version.rb +1 -2
- data/lib/slideshow/service/views/_editor.erb +7 -4
- data/lib/slideshow/service.rb +47 -19
- metadata +73 -2
@@ -0,0 +1,2952 @@
|
|
1
|
+
/* slidy.js
|
2
|
+
|
3
|
+
Copyright (c) 2005-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
|
4
|
+
W3C liability, trademark, document use and software licensing
|
5
|
+
rules apply, see:
|
6
|
+
|
7
|
+
http://www.w3.org/Consortium/Legal/copyright-documents
|
8
|
+
http://www.w3.org/Consortium/Legal/copyright-software
|
9
|
+
|
10
|
+
Defines single name "w3c_slidy" in global namespace
|
11
|
+
Adds event handlers without trampling on any others
|
12
|
+
*/
|
13
|
+
|
14
|
+
// the slidy object implementation
|
15
|
+
var w3c_slidy = {
|
16
|
+
// classify which kind of browser we're running under
|
17
|
+
ns_pos: (typeof window.pageYOffset!='undefined'),
|
18
|
+
khtml: ((navigator.userAgent).indexOf("KHTML") >= 0 ? true : false),
|
19
|
+
opera: ((navigator.userAgent).indexOf("Opera") >= 0 ? true : false),
|
20
|
+
ipad: ((navigator.userAgent).indexOf("iPad") >= 0 ? true : false),
|
21
|
+
iphone: ((navigator.userAgent).indexOf("iPhone") >= 0 ? true : false),
|
22
|
+
android: ((navigator.userAgent).indexOf("Android") >= 0 ? true : false),
|
23
|
+
ie: (typeof document.all != "undefined" && !this.opera),
|
24
|
+
ie6: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 6") != -1),
|
25
|
+
ie7: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 7") != -1),
|
26
|
+
ie8: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 8") != -1),
|
27
|
+
ie9: (!this.ns_pos && navigator.userAgent.indexOf("MSIE 9") != -1),
|
28
|
+
|
29
|
+
// data for swipe and double tap detection on touch screens
|
30
|
+
last_tap: 0,
|
31
|
+
prev_tap: 0,
|
32
|
+
start_x: 0,
|
33
|
+
start_y: 0,
|
34
|
+
delta_x: 0,
|
35
|
+
delta_y: 0,
|
36
|
+
|
37
|
+
// are we running as XHTML? (doesn't work on Opera)
|
38
|
+
is_xhtml: /xml/.test(document.contentType),
|
39
|
+
|
40
|
+
slide_number: 0, // integer slide count: 0, 1, 2, ...
|
41
|
+
slide_number_element: null, // element containing slide number
|
42
|
+
slides: [], // set to array of slide div's
|
43
|
+
notes: [], // set to array of handout div's
|
44
|
+
backgrounds: [], // set to array of background div's
|
45
|
+
toolbar: null, // element containing toolbar
|
46
|
+
title: null, // document title
|
47
|
+
last_shown: null, // last incrementally shown item
|
48
|
+
eos: null, // span element for end of slide indicator
|
49
|
+
toc: null, // table of contents
|
50
|
+
outline: null, // outline element with the focus
|
51
|
+
selected_text_len: 0, // length of drag selection on document
|
52
|
+
view_all: 0, // 1 to view all slides + handouts
|
53
|
+
want_toolbar: true, // user preference to show/hide toolbar
|
54
|
+
mouse_click_enabled: true, // enables left click for next slide
|
55
|
+
scroll_hack: 0, // IE work around for position: fixed
|
56
|
+
disable_slide_click: false, // used by clicked anchors
|
57
|
+
|
58
|
+
lang: "en", // updated to language specified by html file
|
59
|
+
|
60
|
+
help_anchor: null, // used for keyboard focus hack in showToolbar()
|
61
|
+
help_page: "http://www.w3.org/Talks/Tools/Slidy2/help/help.html",
|
62
|
+
help_text: "Navigate with mouse click, space bar, Cursor Left/Right, " +
|
63
|
+
"or Pg Up and Pg Dn. Use S and B to change font size.",
|
64
|
+
|
65
|
+
size_index: 0,
|
66
|
+
size_adjustment: 0,
|
67
|
+
sizes: new Array("10pt", "12pt", "14pt", "16pt", "18pt", "20pt",
|
68
|
+
"22pt", "24pt", "26pt", "28pt", "30pt", "32pt"),
|
69
|
+
|
70
|
+
// needed for efficient resizing
|
71
|
+
last_width: 0,
|
72
|
+
last_height: 0,
|
73
|
+
|
74
|
+
|
75
|
+
// Needed for cross browser support for relative width/height on
|
76
|
+
// object elements. The work around is to save width/height attributes
|
77
|
+
// and then to recompute absolute width/height dimensions on resizing
|
78
|
+
objects: [],
|
79
|
+
|
80
|
+
// attach initialiation event handlers
|
81
|
+
set_up: function () {
|
82
|
+
var init = function() { w3c_slidy.init(); };
|
83
|
+
if (typeof window.addEventListener != "undefined")
|
84
|
+
window.addEventListener("load", init, false);
|
85
|
+
else
|
86
|
+
window.attachEvent("onload", init);
|
87
|
+
},
|
88
|
+
|
89
|
+
hide_slides: function () {
|
90
|
+
if (document.body && !w3c_slidy.initialized)
|
91
|
+
document.body.style.visibility = "hidden";
|
92
|
+
else
|
93
|
+
setTimeout(w3c_slidy.hide_slides, 50);
|
94
|
+
},
|
95
|
+
|
96
|
+
// hack to persuade IE to compute correct document height
|
97
|
+
// as needed for simulating fixed positioning of toolbar
|
98
|
+
ie_hack: function () {
|
99
|
+
window.resizeBy(0,-1);
|
100
|
+
window.resizeBy(0, 1);
|
101
|
+
},
|
102
|
+
|
103
|
+
init: function () {
|
104
|
+
//alert("slidy starting test 10");
|
105
|
+
document.body.style.visibility = "visible";
|
106
|
+
this.init_localization();
|
107
|
+
this.add_toolbar();
|
108
|
+
this.wrap_implicit_slides();
|
109
|
+
this.collect_slides();
|
110
|
+
this.collect_notes();
|
111
|
+
this.collect_backgrounds();
|
112
|
+
this.objects = document.body.getElementsByTagName("object");
|
113
|
+
this.patch_anchors();
|
114
|
+
this.slide_number = this.find_slide_number(location.href);
|
115
|
+
window.offscreenbuffering = true;
|
116
|
+
this.size_adjustment = this.find_size_adjust();
|
117
|
+
this.time_left = this.find_duration();
|
118
|
+
this.hide_image_toolbar(); // suppress IE image toolbar popup
|
119
|
+
this.init_outliner(); // activate fold/unfold support
|
120
|
+
this.title = document.title;
|
121
|
+
this.keyboardless = (this.ipad||this.iphone||this.android);
|
122
|
+
|
123
|
+
if (this.keyboardless)
|
124
|
+
{
|
125
|
+
w3c_slidy.remove_class(w3c_slidy.toolbar, "hidden")
|
126
|
+
this.want_toolbar = 0;
|
127
|
+
}
|
128
|
+
|
129
|
+
// work around for opera bug
|
130
|
+
this.is_xhtml = (document.body.tagName == "BODY" ? false : true);
|
131
|
+
|
132
|
+
if (this.slides.length > 0)
|
133
|
+
{
|
134
|
+
var slide = this.slides[this.slide_number];
|
135
|
+
|
136
|
+
if (this.slide_number > 0)
|
137
|
+
{
|
138
|
+
this.set_visibility_all_incremental("visible");
|
139
|
+
this.last_shown = this.previous_incremental_item(null);
|
140
|
+
this.set_eos_status(true);
|
141
|
+
}
|
142
|
+
else
|
143
|
+
{
|
144
|
+
this.last_shown = null;
|
145
|
+
this.set_visibility_all_incremental("hidden");
|
146
|
+
this.set_eos_status(!this.next_incremental_item(this.last_shown));
|
147
|
+
}
|
148
|
+
|
149
|
+
this.set_location();
|
150
|
+
this.add_class(this.slides[0], "first-slide");
|
151
|
+
w3c_slidy.show_slide(slide);
|
152
|
+
}
|
153
|
+
|
154
|
+
this.toc = this.table_of_contents();
|
155
|
+
|
156
|
+
this.add_initial_prompt();
|
157
|
+
|
158
|
+
// bind event handlers without interfering with custom page scripts
|
159
|
+
// Tap events behave too weirdly to support clicks reliably on
|
160
|
+
// iPhone and iPad, so exclude these from click handler
|
161
|
+
|
162
|
+
if (!this.keyboardless)
|
163
|
+
this.add_listener(document.body, "click", this.mouse_button_click);
|
164
|
+
|
165
|
+
this.add_listener(document, "keydown", this.key_down);
|
166
|
+
this.add_listener(document, "keypress", this.key_press);
|
167
|
+
this.add_listener(window, "resize", this.resized);
|
168
|
+
this.add_listener(window, "scroll", this.scrolled);
|
169
|
+
this.add_listener(window, "unload", this.unloaded);
|
170
|
+
|
171
|
+
this.add_listener(document, "touchstart", this.touchstart);
|
172
|
+
this.add_listener(document, "touchmove", this.touchmove);
|
173
|
+
this.add_listener(document, "touchend", this.touchend);
|
174
|
+
|
175
|
+
// this seems to be a debugging hack
|
176
|
+
//if (!document.body.onclick)
|
177
|
+
// document.body.onclick = function () { };
|
178
|
+
|
179
|
+
this.single_slide_view();
|
180
|
+
|
181
|
+
//this.set_location();
|
182
|
+
|
183
|
+
this.resized();
|
184
|
+
|
185
|
+
if (this.ie7)
|
186
|
+
setTimeout(w3c_slidy.ie_hack, 100);
|
187
|
+
|
188
|
+
this.show_toolbar();
|
189
|
+
|
190
|
+
// for back button detection
|
191
|
+
setInterval(function () { w3c_slidy.check_location(); }, 200);
|
192
|
+
w3c_slidy.initialized = true;
|
193
|
+
},
|
194
|
+
|
195
|
+
// create div element with links to each slide
|
196
|
+
table_of_contents: function () {
|
197
|
+
var toc = this.create_element("div");
|
198
|
+
this.add_class(toc, "slidy_toc hidden");
|
199
|
+
//toc.setAttribute("tabindex", "0");
|
200
|
+
|
201
|
+
var heading = this.create_element("div");
|
202
|
+
this.add_class(heading, "toc-heading");
|
203
|
+
heading.innerHTML = this.localize("Table of Contents");
|
204
|
+
|
205
|
+
toc.appendChild(heading);
|
206
|
+
var previous = null;
|
207
|
+
|
208
|
+
for (var i = 0; i < this.slides.length; ++i)
|
209
|
+
{
|
210
|
+
var title = this.has_class(this.slides[i], "title");
|
211
|
+
var num = document.createTextNode((i + 1) + ". ");
|
212
|
+
|
213
|
+
toc.appendChild(num);
|
214
|
+
|
215
|
+
var a = this.create_element("a");
|
216
|
+
a.setAttribute("href", "#(" + (i+1) + ")");
|
217
|
+
|
218
|
+
if (title)
|
219
|
+
this.add_class(a, "titleslide");
|
220
|
+
|
221
|
+
var name = document.createTextNode(this.slide_name(i));
|
222
|
+
a.appendChild(name);
|
223
|
+
a.onclick = w3c_slidy.toc_click;
|
224
|
+
a.onkeydown = w3c_slidy.toc_key_down;
|
225
|
+
a.previous = previous;
|
226
|
+
|
227
|
+
if (previous)
|
228
|
+
previous.next = a;
|
229
|
+
|
230
|
+
toc.appendChild(a);
|
231
|
+
|
232
|
+
if (i == 0)
|
233
|
+
toc.first = a;
|
234
|
+
|
235
|
+
if (i < this.slides.length - 1)
|
236
|
+
{
|
237
|
+
var br = this.create_element("br");
|
238
|
+
toc.appendChild(br);
|
239
|
+
}
|
240
|
+
|
241
|
+
previous = a;
|
242
|
+
}
|
243
|
+
|
244
|
+
toc.focus = function () {
|
245
|
+
if (this.first)
|
246
|
+
this.first.focus();
|
247
|
+
}
|
248
|
+
|
249
|
+
toc.onmouseup = w3c_slidy.mouse_button_up;
|
250
|
+
|
251
|
+
toc.onclick = function (e) {
|
252
|
+
e||(e=window.event);
|
253
|
+
|
254
|
+
if (w3c_slidy.selected_text_len <= 0)
|
255
|
+
w3c_slidy.hide_table_of_contents(true);
|
256
|
+
|
257
|
+
w3c_slidy.stop_propagation(e);
|
258
|
+
|
259
|
+
if (e.cancel != undefined)
|
260
|
+
e.cancel = true;
|
261
|
+
|
262
|
+
if (e.returnValue != undefined)
|
263
|
+
e.returnValue = false;
|
264
|
+
|
265
|
+
return false;
|
266
|
+
};
|
267
|
+
|
268
|
+
document.body.insertBefore(toc, document.body.firstChild);
|
269
|
+
return toc;
|
270
|
+
},
|
271
|
+
|
272
|
+
is_shown_toc: function () {
|
273
|
+
return !w3c_slidy.has_class(w3c_slidy.toc, "hidden");
|
274
|
+
},
|
275
|
+
|
276
|
+
show_table_of_contents: function () {
|
277
|
+
w3c_slidy.remove_class(w3c_slidy.toc, "hidden");
|
278
|
+
var toc = w3c_slidy.toc;
|
279
|
+
toc.focus();
|
280
|
+
|
281
|
+
if (w3c_slidy.ie7 && w3c_slidy.slide_number == 0)
|
282
|
+
setTimeout(w3c_slidy.ie_hack, 100);
|
283
|
+
},
|
284
|
+
|
285
|
+
hide_table_of_contents: function (focus) {
|
286
|
+
w3c_slidy.add_class(w3c_slidy.toc, "hidden");
|
287
|
+
|
288
|
+
if (focus && !w3c_slidy.opera)
|
289
|
+
w3c_slidy.help_anchor.focus();
|
290
|
+
},
|
291
|
+
|
292
|
+
toggle_table_of_contents: function () {
|
293
|
+
if (w3c_slidy.is_shown_toc())
|
294
|
+
w3c_slidy.hide_table_of_contents(true);
|
295
|
+
else
|
296
|
+
w3c_slidy.show_table_of_contents();
|
297
|
+
},
|
298
|
+
|
299
|
+
// called on clicking toc entry
|
300
|
+
toc_click: function (e) {
|
301
|
+
if (!e)
|
302
|
+
e = window.event;
|
303
|
+
|
304
|
+
var target = w3c_slidy.get_target(e);
|
305
|
+
|
306
|
+
if (target && target.nodeType == 1)
|
307
|
+
{
|
308
|
+
var uri = target.getAttribute("href");
|
309
|
+
|
310
|
+
if (uri)
|
311
|
+
{
|
312
|
+
//alert("going to " + uri);
|
313
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
314
|
+
w3c_slidy.hide_slide(slide);
|
315
|
+
w3c_slidy.slide_number = w3c_slidy.find_slide_number(uri);
|
316
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
317
|
+
w3c_slidy.last_shown = null;
|
318
|
+
w3c_slidy.set_location();
|
319
|
+
w3c_slidy.set_visibility_all_incremental("hidden");
|
320
|
+
w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
|
321
|
+
w3c_slidy.show_slide(slide);
|
322
|
+
//target.focus();
|
323
|
+
|
324
|
+
try
|
325
|
+
{
|
326
|
+
if (!w3c_slidy.opera)
|
327
|
+
w3c_slidy.help_anchor.focus();
|
328
|
+
}
|
329
|
+
catch (e)
|
330
|
+
{
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
w3c_slidy.hide_table_of_contents(true);
|
336
|
+
if (w3c_slidy.ie7) w3c_slidy.ie_hack();
|
337
|
+
w3c_slidy.stop_propagation(e);
|
338
|
+
return w3c_slidy.cancel(e);
|
339
|
+
},
|
340
|
+
|
341
|
+
// called onkeydown for toc entry
|
342
|
+
toc_key_down: function (event) {
|
343
|
+
var key;
|
344
|
+
|
345
|
+
if (!event)
|
346
|
+
var event = window.event;
|
347
|
+
|
348
|
+
// kludge around NS/IE differences
|
349
|
+
if (window.event)
|
350
|
+
key = window.event.keyCode;
|
351
|
+
else if (event.which)
|
352
|
+
key = event.which;
|
353
|
+
else
|
354
|
+
return true; // Yikes! unknown browser
|
355
|
+
|
356
|
+
// ignore event if key value is zero
|
357
|
+
// as for alt on Opera and Konqueror
|
358
|
+
if (!key)
|
359
|
+
return true;
|
360
|
+
|
361
|
+
// check for concurrent control/command/alt key
|
362
|
+
// but are these only present on mouse events?
|
363
|
+
|
364
|
+
if (event.ctrlKey || event.altKey)
|
365
|
+
return true;
|
366
|
+
|
367
|
+
if (key == 13)
|
368
|
+
{
|
369
|
+
var uri = this.getAttribute("href");
|
370
|
+
|
371
|
+
if (uri)
|
372
|
+
{
|
373
|
+
//alert("going to " + uri);
|
374
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
375
|
+
w3c_slidy.hide_slide(slide);
|
376
|
+
w3c_slidy.slide_number = w3c_slidy.find_slide_number(uri);
|
377
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
378
|
+
w3c_slidy.last_shown = null;
|
379
|
+
w3c_slidy.set_location();
|
380
|
+
w3c_slidy.set_visibility_all_incremental("hidden");
|
381
|
+
w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
|
382
|
+
w3c_slidy.show_slide(slide);
|
383
|
+
//target.focus();
|
384
|
+
|
385
|
+
try
|
386
|
+
{
|
387
|
+
if (!w3c_slidy.opera)
|
388
|
+
w3c_slidy.help_anchor.focus();
|
389
|
+
}
|
390
|
+
catch (e)
|
391
|
+
{
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
w3c_slidy.hide_table_of_contents(true);
|
396
|
+
|
397
|
+
if (self.ie7)
|
398
|
+
w3c_slidy.ie_hack();
|
399
|
+
|
400
|
+
return w3c_slidy.cancel(event);
|
401
|
+
}
|
402
|
+
|
403
|
+
if (key == 40 && this.next)
|
404
|
+
{
|
405
|
+
this.next.focus();
|
406
|
+
return w3c_slidy.cancel(event);
|
407
|
+
}
|
408
|
+
|
409
|
+
if (key == 38 && this.previous)
|
410
|
+
{
|
411
|
+
this.previous.focus();
|
412
|
+
return w3c_slidy.cancel(event);
|
413
|
+
}
|
414
|
+
|
415
|
+
return true;
|
416
|
+
},
|
417
|
+
|
418
|
+
touchstart: function (e)
|
419
|
+
{
|
420
|
+
//e.preventDefault();
|
421
|
+
this.prev_tap = this.last_tap;
|
422
|
+
this.last_tap = (new Date).getTime();
|
423
|
+
|
424
|
+
var tap_delay = this.last_tap - this.prev_tap;
|
425
|
+
|
426
|
+
if (tap_delay <= 200)
|
427
|
+
{
|
428
|
+
// double tap
|
429
|
+
}
|
430
|
+
|
431
|
+
var touch = e.touches[0];
|
432
|
+
|
433
|
+
this.start_x = touch.pageX;
|
434
|
+
this.start_y = touch.pageY;
|
435
|
+
this.delta_x = this.delta_y = 0;
|
436
|
+
},
|
437
|
+
|
438
|
+
touchmove: function (e)
|
439
|
+
{
|
440
|
+
//e.preventDefault();
|
441
|
+
var touch = e.touches[0];
|
442
|
+
this.delta_x = touch.pageX - this.start_x;
|
443
|
+
this.delta_y = touch.pageY - this.start_y;
|
444
|
+
},
|
445
|
+
|
446
|
+
touchend: function (e)
|
447
|
+
{
|
448
|
+
//e.preventDefault();
|
449
|
+
var delay = (new Date).getTime() - this.last_tap;
|
450
|
+
var dx = this.delta_x;
|
451
|
+
var dy = this.delta_y;
|
452
|
+
var abs_dx = Math.abs(dx);
|
453
|
+
var abs_dy = Math.abs(dy);
|
454
|
+
|
455
|
+
if (delay < 500 && (abs_dx > 100 || abs_dy > 100))
|
456
|
+
{
|
457
|
+
if (abs_dx > 0.5 * abs_dy)
|
458
|
+
{
|
459
|
+
if (dx > 0)
|
460
|
+
w3c_slidy.next_slide(true);
|
461
|
+
else
|
462
|
+
w3c_slidy.previous_slide(true);
|
463
|
+
}
|
464
|
+
else if (abs_dy > 2 * abs_dx)
|
465
|
+
{
|
466
|
+
w3c_slidy.toggle_table_of_contents();
|
467
|
+
}
|
468
|
+
}
|
469
|
+
},
|
470
|
+
|
471
|
+
// ### OBSOLETE ###
|
472
|
+
before_print: function () {
|
473
|
+
this.show_all_slides();
|
474
|
+
this.hide_toolbar();
|
475
|
+
alert("before print");
|
476
|
+
},
|
477
|
+
|
478
|
+
// ### OBSOLETE ###
|
479
|
+
after_print: function () {
|
480
|
+
if (!this.view_all)
|
481
|
+
{
|
482
|
+
this.single_slide_view();
|
483
|
+
this.show_toolbar();
|
484
|
+
}
|
485
|
+
alert("after print");
|
486
|
+
},
|
487
|
+
|
488
|
+
// ### OBSOLETE ###
|
489
|
+
print_slides: function () {
|
490
|
+
this.before_print();
|
491
|
+
window.print();
|
492
|
+
this.after_print();
|
493
|
+
},
|
494
|
+
|
495
|
+
// ### OBSOLETE ?? ###
|
496
|
+
toggle_view: function () {
|
497
|
+
if (this.view_all)
|
498
|
+
{
|
499
|
+
this.single_slide_view();
|
500
|
+
this.show_toolbar();
|
501
|
+
this.view_all = 0;
|
502
|
+
}
|
503
|
+
else
|
504
|
+
{
|
505
|
+
this.show_all_slides();
|
506
|
+
this.hide_toolbar();
|
507
|
+
this.view_all = 1;
|
508
|
+
}
|
509
|
+
},
|
510
|
+
|
511
|
+
// prepare for printing ### OBSOLETE ###
|
512
|
+
show_all_slides: function () {
|
513
|
+
this.remove_class(document.body, "single_slide");
|
514
|
+
this.set_visibility_all_incremental("visible");
|
515
|
+
},
|
516
|
+
|
517
|
+
// restore after printing ### OBSOLETE ###
|
518
|
+
single_slide_view: function () {
|
519
|
+
this.add_class(document.body, "single_slide");
|
520
|
+
this.set_visibility_all_incremental("visible");
|
521
|
+
this.last_shown = this.previous_incremental_item(null);
|
522
|
+
},
|
523
|
+
|
524
|
+
// suppress IE's image toolbar pop up
|
525
|
+
hide_image_toolbar: function () {
|
526
|
+
if (!this.ns_pos)
|
527
|
+
{
|
528
|
+
var images = document.getElementsByTagName("IMG");
|
529
|
+
|
530
|
+
for (var i = 0; i < images.length; ++i)
|
531
|
+
images[i].setAttribute("galleryimg", "no");
|
532
|
+
}
|
533
|
+
},
|
534
|
+
|
535
|
+
unloaded: function (e) {
|
536
|
+
//alert("unloaded");
|
537
|
+
},
|
538
|
+
|
539
|
+
// Safari and Konqueror don't yet support getComputedStyle()
|
540
|
+
// and they always reload page when location.href is updated
|
541
|
+
is_KHTML: function () {
|
542
|
+
var agent = navigator.userAgent;
|
543
|
+
return (agent.indexOf("KHTML") >= 0 ? true : false);
|
544
|
+
},
|
545
|
+
|
546
|
+
// find slide name from first h1 element
|
547
|
+
// default to document title + slide number
|
548
|
+
slide_name: function (index) {
|
549
|
+
var name = null;
|
550
|
+
var slide = this.slides[index];
|
551
|
+
|
552
|
+
var heading = this.find_heading(slide);
|
553
|
+
|
554
|
+
if (heading)
|
555
|
+
name = this.extract_text(heading);
|
556
|
+
|
557
|
+
if (!name)
|
558
|
+
name = this.title + "(" + (index + 1) + ")";
|
559
|
+
|
560
|
+
name.replace(/\&/g, "&");
|
561
|
+
name.replace(/\</g, "<");
|
562
|
+
name.replace(/\>/g, ">");
|
563
|
+
|
564
|
+
return name;
|
565
|
+
},
|
566
|
+
|
567
|
+
// find first h1 element in DOM tree
|
568
|
+
find_heading: function (node) {
|
569
|
+
if (!node || node.nodeType != 1)
|
570
|
+
return null;
|
571
|
+
|
572
|
+
if (node.nodeName == "H1" || node.nodeName == "h1")
|
573
|
+
return node;
|
574
|
+
|
575
|
+
var child = node.firstChild;
|
576
|
+
|
577
|
+
while (child)
|
578
|
+
{
|
579
|
+
node = this.find_heading(child);
|
580
|
+
|
581
|
+
if (node)
|
582
|
+
return node;
|
583
|
+
|
584
|
+
child = child.nextSibling;
|
585
|
+
}
|
586
|
+
|
587
|
+
return null;
|
588
|
+
},
|
589
|
+
|
590
|
+
// recursively extract text from DOM tree
|
591
|
+
extract_text: function (node) {
|
592
|
+
if (!node)
|
593
|
+
return "";
|
594
|
+
|
595
|
+
// text nodes
|
596
|
+
if (node.nodeType == 3)
|
597
|
+
return node.nodeValue;
|
598
|
+
|
599
|
+
// elements
|
600
|
+
if (node.nodeType == 1)
|
601
|
+
{
|
602
|
+
node = node.firstChild;
|
603
|
+
var text = "";
|
604
|
+
|
605
|
+
while (node)
|
606
|
+
{
|
607
|
+
text = text + this.extract_text(node);
|
608
|
+
node = node.nextSibling;
|
609
|
+
}
|
610
|
+
|
611
|
+
return text;
|
612
|
+
}
|
613
|
+
|
614
|
+
return "";
|
615
|
+
},
|
616
|
+
|
617
|
+
// find copyright text from meta element
|
618
|
+
find_copyright: function () {
|
619
|
+
var name, content;
|
620
|
+
var meta = document.getElementsByTagName("meta");
|
621
|
+
|
622
|
+
for (var i = 0; i < meta.length; ++i)
|
623
|
+
{
|
624
|
+
name = meta[i].getAttribute("name");
|
625
|
+
content = meta[i].getAttribute("content");
|
626
|
+
|
627
|
+
if (name == "copyright")
|
628
|
+
return content;
|
629
|
+
}
|
630
|
+
|
631
|
+
return null;
|
632
|
+
},
|
633
|
+
|
634
|
+
find_size_adjust: function () {
|
635
|
+
var name, content, offset;
|
636
|
+
var meta = document.getElementsByTagName("meta");
|
637
|
+
|
638
|
+
for (var i = 0; i < meta.length; ++i)
|
639
|
+
{
|
640
|
+
name = meta[i].getAttribute("name");
|
641
|
+
content = meta[i].getAttribute("content");
|
642
|
+
|
643
|
+
if (name == "font-size-adjustment")
|
644
|
+
return 1 * content;
|
645
|
+
}
|
646
|
+
|
647
|
+
return 1;
|
648
|
+
},
|
649
|
+
|
650
|
+
// <meta name="duration" content="20" /> for 20 minutes
|
651
|
+
find_duration: function () {
|
652
|
+
var name, content, offset;
|
653
|
+
var meta = document.getElementsByTagName("meta");
|
654
|
+
|
655
|
+
for (var i = 0; i < meta.length; ++i)
|
656
|
+
{
|
657
|
+
name = meta[i].getAttribute("name");
|
658
|
+
content = meta[i].getAttribute("content");
|
659
|
+
|
660
|
+
if (name == "duration")
|
661
|
+
return 60000 * content;
|
662
|
+
}
|
663
|
+
|
664
|
+
return null;
|
665
|
+
},
|
666
|
+
|
667
|
+
replace_by_non_breaking_space: function (str) {
|
668
|
+
for (var i = 0; i < str.length; ++i)
|
669
|
+
str[i] = 160;
|
670
|
+
},
|
671
|
+
|
672
|
+
// ### CHECK ME ### is use of "li" okay for text/html?
|
673
|
+
// for XHTML do we also need to specify namespace?
|
674
|
+
init_outliner: function () {
|
675
|
+
var items = document.getElementsByTagName("li");
|
676
|
+
|
677
|
+
for (var i = 0; i < items.length; ++i)
|
678
|
+
{
|
679
|
+
var target = items[i];
|
680
|
+
|
681
|
+
if (!this.has_class(target.parentNode, "outline"))
|
682
|
+
continue;
|
683
|
+
|
684
|
+
target.onclick = this.outline_click;
|
685
|
+
/* ### more work needed for IE6
|
686
|
+
if (!this.ns_pos)
|
687
|
+
{
|
688
|
+
target.onmouseover = this.hover_outline;
|
689
|
+
target.onmouseout = this.unhover_outline;
|
690
|
+
}
|
691
|
+
*/
|
692
|
+
if (this.foldable(target))
|
693
|
+
{
|
694
|
+
target.foldable = true;
|
695
|
+
target.onfocus = function () {w3c_slidy.outline = this;};
|
696
|
+
target.onblur = function () {w3c_slidy.outline = null;};
|
697
|
+
|
698
|
+
if (!target.getAttribute("tabindex"))
|
699
|
+
target.setAttribute("tabindex", "0");
|
700
|
+
|
701
|
+
if (this.has_class(target, "expand"))
|
702
|
+
this.unfold(target);
|
703
|
+
else
|
704
|
+
this.fold(target);
|
705
|
+
}
|
706
|
+
else
|
707
|
+
{
|
708
|
+
this.add_class(target, "nofold");
|
709
|
+
target.visible = true;
|
710
|
+
target.foldable = false;
|
711
|
+
}
|
712
|
+
}
|
713
|
+
},
|
714
|
+
|
715
|
+
foldable: function (item) {
|
716
|
+
if (!item || item.nodeType != 1)
|
717
|
+
return false;
|
718
|
+
|
719
|
+
var node = item.firstChild;
|
720
|
+
|
721
|
+
while (node)
|
722
|
+
{
|
723
|
+
if (node.nodeType == 1 && this.is_block(node))
|
724
|
+
return true;
|
725
|
+
|
726
|
+
node = node.nextSibling;
|
727
|
+
}
|
728
|
+
|
729
|
+
return false;
|
730
|
+
},
|
731
|
+
|
732
|
+
// ### CHECK ME ### switch to add/remove "hidden" class
|
733
|
+
fold: function (item) {
|
734
|
+
if (item)
|
735
|
+
{
|
736
|
+
this.remove_class(item, "unfolded");
|
737
|
+
this.add_class(item, "folded");
|
738
|
+
}
|
739
|
+
|
740
|
+
var node = item ? item.firstChild : null;
|
741
|
+
|
742
|
+
while (node)
|
743
|
+
{
|
744
|
+
if (node.nodeType == 1 && this.is_block(node)) // element
|
745
|
+
{
|
746
|
+
w3c_slidy.add_class(node, "hidden");
|
747
|
+
}
|
748
|
+
|
749
|
+
node = node.nextSibling;
|
750
|
+
}
|
751
|
+
|
752
|
+
item.visible = false;
|
753
|
+
},
|
754
|
+
|
755
|
+
// ### CHECK ME ### switch to add/remove "hidden" class
|
756
|
+
unfold: function (item) {
|
757
|
+
if (item)
|
758
|
+
{
|
759
|
+
this.add_class(item, "unfolded");
|
760
|
+
this.remove_class(item, "folded");
|
761
|
+
}
|
762
|
+
|
763
|
+
var node = item ? item.firstChild : null;
|
764
|
+
|
765
|
+
while (node)
|
766
|
+
{
|
767
|
+
if (node.nodeType == 1 && this.is_block(node)) // element
|
768
|
+
{
|
769
|
+
w3c_slidy.remove_class(node, "hidden");
|
770
|
+
}
|
771
|
+
|
772
|
+
node = node.nextSibling;
|
773
|
+
}
|
774
|
+
|
775
|
+
item.visible = true;
|
776
|
+
},
|
777
|
+
|
778
|
+
outline_click: function (e) {
|
779
|
+
if (!e)
|
780
|
+
e = window.event;
|
781
|
+
|
782
|
+
var rightclick = false;
|
783
|
+
var target = w3c_slidy.get_target(e);
|
784
|
+
|
785
|
+
while (target && target.visible == undefined)
|
786
|
+
target = target.parentNode;
|
787
|
+
|
788
|
+
if (!target)
|
789
|
+
return true;
|
790
|
+
|
791
|
+
if (e.which)
|
792
|
+
rightclick = (e.which == 3);
|
793
|
+
else if (e.button)
|
794
|
+
rightclick = (e.button == 2);
|
795
|
+
|
796
|
+
if (!rightclick && target.visible != undefined)
|
797
|
+
{
|
798
|
+
if (target.foldable)
|
799
|
+
{
|
800
|
+
if (target.visible)
|
801
|
+
w3c_slidy.fold(target);
|
802
|
+
else
|
803
|
+
w3c_slidy.unfold(target);
|
804
|
+
}
|
805
|
+
|
806
|
+
w3c_slidy.stop_propagation(e);
|
807
|
+
e.cancel = true;
|
808
|
+
e.returnValue = false;
|
809
|
+
}
|
810
|
+
|
811
|
+
return false;
|
812
|
+
},
|
813
|
+
|
814
|
+
add_initial_prompt: function () {
|
815
|
+
var prompt = this.create_element("div");
|
816
|
+
prompt.setAttribute("class", "initial_prompt");
|
817
|
+
|
818
|
+
var p1 = this.create_element("p");
|
819
|
+
prompt.appendChild(p1);
|
820
|
+
p1.setAttribute("class", "help");
|
821
|
+
|
822
|
+
if (this.keyboardless)
|
823
|
+
p1.innerHTML = "swipe right to move to next slide";
|
824
|
+
else
|
825
|
+
p1.innerHTML = "Space, Right Arrow or swipe right to move to " +
|
826
|
+
"next slide, click help below for more details";
|
827
|
+
|
828
|
+
this.add_listener(prompt, "click", function (e) {
|
829
|
+
document.body.removeChild(prompt);
|
830
|
+
w3c_slidy.stop_propagation(e);
|
831
|
+
|
832
|
+
if (e.cancel != undefined)
|
833
|
+
e.cancel = true;
|
834
|
+
|
835
|
+
if (e.returnValue != undefined)
|
836
|
+
e.returnValue = false;
|
837
|
+
|
838
|
+
return false;
|
839
|
+
});
|
840
|
+
|
841
|
+
document.body.appendChild(prompt);
|
842
|
+
this.initial_prompt = prompt;
|
843
|
+
setTimeout(function() {document.body.removeChild(prompt);}, 5000);
|
844
|
+
},
|
845
|
+
|
846
|
+
add_toolbar: function () {
|
847
|
+
var counter, page;
|
848
|
+
|
849
|
+
this.toolbar = this.create_element("div");
|
850
|
+
this.toolbar.setAttribute("class", "toolbar");
|
851
|
+
|
852
|
+
// a reasonably behaved browser
|
853
|
+
if (this.ns_pos || !this.ie6)
|
854
|
+
{
|
855
|
+
var right = this.create_element("div");
|
856
|
+
right.setAttribute("style", "float: right; text-align: right");
|
857
|
+
|
858
|
+
counter = this.create_element("span")
|
859
|
+
counter.innerHTML = this.localize("slide") + " n/m";
|
860
|
+
right.appendChild(counter);
|
861
|
+
this.toolbar.appendChild(right);
|
862
|
+
|
863
|
+
var left = this.create_element("div");
|
864
|
+
left.setAttribute("style", "text-align: left");
|
865
|
+
|
866
|
+
// global end of slide indicator
|
867
|
+
this.eos = this.create_element("span");
|
868
|
+
this.eos.innerHTML = "* ";
|
869
|
+
left.appendChild(this.eos);
|
870
|
+
|
871
|
+
var help = this.create_element("a");
|
872
|
+
help.setAttribute("href", this.help_page);
|
873
|
+
help.setAttribute("title", this.localize(this.help_text));
|
874
|
+
help.innerHTML = this.localize("help?");
|
875
|
+
left.appendChild(help);
|
876
|
+
this.help_anchor = help; // save for focus hack
|
877
|
+
|
878
|
+
var gap1 = document.createTextNode(" ");
|
879
|
+
left.appendChild(gap1);
|
880
|
+
|
881
|
+
var contents = this.create_element("a");
|
882
|
+
contents.setAttribute("href", "javascript:w3c_slidy.toggle_table_of_contents()");
|
883
|
+
contents.setAttribute("title", this.localize("table of contents"));
|
884
|
+
contents.innerHTML = this.localize("contents?");
|
885
|
+
left.appendChild(contents);
|
886
|
+
|
887
|
+
var gap2 = document.createTextNode(" ");
|
888
|
+
left.appendChild(gap2);
|
889
|
+
|
890
|
+
var copyright = this.find_copyright();
|
891
|
+
|
892
|
+
if (copyright)
|
893
|
+
{
|
894
|
+
var span = this.create_element("span");
|
895
|
+
span.className = "copyright";
|
896
|
+
span.innerHTML = copyright;
|
897
|
+
left.appendChild(span);
|
898
|
+
}
|
899
|
+
|
900
|
+
this.toolbar.setAttribute("tabindex", "0");
|
901
|
+
this.toolbar.appendChild(left);
|
902
|
+
}
|
903
|
+
else // IE6 so need to work around its poor CSS support
|
904
|
+
{
|
905
|
+
this.toolbar.style.position = (this.ie7 ? "fixed" : "absolute");
|
906
|
+
this.toolbar.style.zIndex = "200";
|
907
|
+
this.toolbar.style.width = "99.9%";
|
908
|
+
this.toolbar.style.height = "1.2em";
|
909
|
+
this.toolbar.style.top = "auto";
|
910
|
+
this.toolbar.style.bottom = "0";
|
911
|
+
this.toolbar.style.left = "0";
|
912
|
+
this.toolbar.style.right = "0";
|
913
|
+
this.toolbar.style.textAlign = "left";
|
914
|
+
this.toolbar.style.fontSize = "60%";
|
915
|
+
this.toolbar.style.color = "red";
|
916
|
+
this.toolbar.borderWidth = 0;
|
917
|
+
this.toolbar.className = "toolbar";
|
918
|
+
this.toolbar.style.background = "rgb(240,240,240)";
|
919
|
+
|
920
|
+
// would like to have help text left aligned
|
921
|
+
// and page counter right aligned, floating
|
922
|
+
// div's don't work, so instead use nested
|
923
|
+
// absolutely positioned div's.
|
924
|
+
|
925
|
+
var sp = this.create_element("span");
|
926
|
+
sp.innerHTML = " * ";
|
927
|
+
this.toolbar.appendChild(sp);
|
928
|
+
this.eos = sp; // end of slide indicator
|
929
|
+
|
930
|
+
var help = this.create_element("a");
|
931
|
+
help.setAttribute("href", this.help_page);
|
932
|
+
help.setAttribute("title", this.localize(this.help_text));
|
933
|
+
help.innerHTML = this.localize("help?");
|
934
|
+
this.toolbar.appendChild(help);
|
935
|
+
this.help_anchor = help; // save for focus hack
|
936
|
+
|
937
|
+
var gap1 = document.createTextNode(" ");
|
938
|
+
this.toolbar.appendChild(gap1);
|
939
|
+
|
940
|
+
var contents = this.create_element("a");
|
941
|
+
contents.setAttribute("href", "javascript:toggleTableOfContents()");
|
942
|
+
contents.setAttribute("title", this.localize("table of contents".localize));
|
943
|
+
contents.innerHTML = this.localize("contents?");
|
944
|
+
this.toolbar.appendChild(contents);
|
945
|
+
|
946
|
+
var gap2 = document.createTextNode(" ");
|
947
|
+
this.toolbar.appendChild(gap2);
|
948
|
+
|
949
|
+
var copyright = this.find_copyright();
|
950
|
+
|
951
|
+
if (copyright)
|
952
|
+
{
|
953
|
+
var span = this.create_element("span");
|
954
|
+
span.innerHTML = copyright;
|
955
|
+
span.style.color = "black";
|
956
|
+
span.style.marginLeft = "0.5em";
|
957
|
+
this.toolbar.appendChild(span);
|
958
|
+
}
|
959
|
+
|
960
|
+
counter = this.create_element("div")
|
961
|
+
counter.style.position = "absolute";
|
962
|
+
counter.style.width = "auto"; //"20%";
|
963
|
+
counter.style.height = "1.2em";
|
964
|
+
counter.style.top = "auto";
|
965
|
+
counter.style.bottom = 0;
|
966
|
+
counter.style.right = "0";
|
967
|
+
counter.style.textAlign = "right";
|
968
|
+
counter.style.color = "red";
|
969
|
+
counter.style.background = "rgb(240,240,240)";
|
970
|
+
|
971
|
+
counter.innerHTML = this.localize("slide") + " n/m";
|
972
|
+
this.toolbar.appendChild(counter);
|
973
|
+
}
|
974
|
+
|
975
|
+
// ensure that click isn't passed through to the page
|
976
|
+
this.toolbar.onclick =
|
977
|
+
function (e) {
|
978
|
+
if (!e)
|
979
|
+
e = window.event;
|
980
|
+
|
981
|
+
var target = e.target;
|
982
|
+
|
983
|
+
if (!target && e.srcElement)
|
984
|
+
target = e.srcElement;
|
985
|
+
|
986
|
+
// work around Safari bug
|
987
|
+
if (target && target.nodeType == 3)
|
988
|
+
target = target.parentNode;
|
989
|
+
|
990
|
+
w3c_slidy.stop_propagation(e);
|
991
|
+
|
992
|
+
if (target && target.nodeName.toLowerCase() != "a")
|
993
|
+
w3c_slidy.mouse_button_click(e);
|
994
|
+
};
|
995
|
+
|
996
|
+
this.slide_number_element = counter;
|
997
|
+
this.set_eos_status(false);
|
998
|
+
document.body.appendChild(this.toolbar);
|
999
|
+
},
|
1000
|
+
|
1001
|
+
// wysiwyg editors make it hard to use div elements
|
1002
|
+
// e.g. amaya loses the div when you copy and paste
|
1003
|
+
// this function wraps div elements around implicit
|
1004
|
+
// slides which start with an h1 element and continue
|
1005
|
+
// up to the next heading or div element
|
1006
|
+
wrap_implicit_slides: function () {
|
1007
|
+
var i, heading, node, next, div;
|
1008
|
+
var headings = document.getElementsByTagName("h1");
|
1009
|
+
|
1010
|
+
if (!headings)
|
1011
|
+
return;
|
1012
|
+
|
1013
|
+
for (i = 0; i < headings.length; ++i)
|
1014
|
+
{
|
1015
|
+
heading = headings[i];
|
1016
|
+
|
1017
|
+
if (heading.parentNode != document.body)
|
1018
|
+
continue;
|
1019
|
+
|
1020
|
+
node = heading.nextSibling;
|
1021
|
+
|
1022
|
+
div = document.createElement("div");
|
1023
|
+
this.add_class(div, "slide");
|
1024
|
+
document.body.replaceChild(div, heading);
|
1025
|
+
div.appendChild(heading);
|
1026
|
+
|
1027
|
+
while (node)
|
1028
|
+
{
|
1029
|
+
if (node.nodeType == 1 && // an element
|
1030
|
+
(node.nodeName == "H1" ||
|
1031
|
+
node.nodeName == "h1" ||
|
1032
|
+
node.nodeName == "DIV" ||
|
1033
|
+
node.nodeName == "div"))
|
1034
|
+
break;
|
1035
|
+
|
1036
|
+
next = node.nextSibling;
|
1037
|
+
node = document.body.removeChild(node);
|
1038
|
+
div.appendChild(node);
|
1039
|
+
node = next;
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
},
|
1043
|
+
|
1044
|
+
// return new array of all slides
|
1045
|
+
collect_slides: function () {
|
1046
|
+
var slides = new Array();
|
1047
|
+
var divs = document.body.getElementsByTagName("div");
|
1048
|
+
|
1049
|
+
for (var i = 0; i < divs.length; ++i)
|
1050
|
+
{
|
1051
|
+
div = divs.item(i);
|
1052
|
+
|
1053
|
+
if (this.has_class(div, "slide"))
|
1054
|
+
{
|
1055
|
+
// add slide to collection
|
1056
|
+
slides[slides.length] = div;
|
1057
|
+
|
1058
|
+
// hide each slide as it is found
|
1059
|
+
this.add_class(div, "hidden");
|
1060
|
+
|
1061
|
+
// add dummy <br/> at end for scrolling hack
|
1062
|
+
var node1 = document.createElement("br");
|
1063
|
+
div.appendChild(node1);
|
1064
|
+
var node2 = document.createElement("br");
|
1065
|
+
div.appendChild(node2);
|
1066
|
+
}
|
1067
|
+
else if (this.has_class(div, "background"))
|
1068
|
+
{ // work around for Firefox SVG reload bug
|
1069
|
+
// which otherwise replaces 1st SVG graphic with 2nd
|
1070
|
+
div.style.display = "block";
|
1071
|
+
}
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
this.slides = slides;
|
1075
|
+
},
|
1076
|
+
|
1077
|
+
// return new array of all <div class="handout">
|
1078
|
+
collect_notes: function () {
|
1079
|
+
var notes = new Array();
|
1080
|
+
var divs = document.body.getElementsByTagName("div");
|
1081
|
+
|
1082
|
+
for (var i = 0; i < divs.length; ++i)
|
1083
|
+
{
|
1084
|
+
div = divs.item(i);
|
1085
|
+
|
1086
|
+
if (this.has_class(div, "handout"))
|
1087
|
+
{
|
1088
|
+
// add note to collection
|
1089
|
+
notes[notes.length] = div;
|
1090
|
+
|
1091
|
+
// and hide it
|
1092
|
+
this.add_class(div, "hidden");
|
1093
|
+
}
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
this.notes = notes;
|
1097
|
+
},
|
1098
|
+
|
1099
|
+
// return new array of all <div class="background">
|
1100
|
+
// including named backgrounds e.g. class="background titlepage"
|
1101
|
+
collect_backgrounds: function () {
|
1102
|
+
var backgrounds = new Array();
|
1103
|
+
var divs = document.body.getElementsByTagName("div");
|
1104
|
+
|
1105
|
+
for (var i = 0; i < divs.length; ++i)
|
1106
|
+
{
|
1107
|
+
div = divs.item(i);
|
1108
|
+
|
1109
|
+
if (this.has_class(div, "background"))
|
1110
|
+
{
|
1111
|
+
// add background to collection
|
1112
|
+
backgrounds[backgrounds.length] = div;
|
1113
|
+
|
1114
|
+
// and hide it
|
1115
|
+
this.add_class(div, "hidden");
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
this.backgrounds = backgrounds;
|
1120
|
+
},
|
1121
|
+
|
1122
|
+
// set click handlers on all anchors
|
1123
|
+
patch_anchors: function () {
|
1124
|
+
var self = w3c_slidy;
|
1125
|
+
var handler = function (event) {
|
1126
|
+
// compare this.href with location.href
|
1127
|
+
// for link to another slide in this doc
|
1128
|
+
|
1129
|
+
if (self.page_address(this.href) == self.page_address(location.href))
|
1130
|
+
{
|
1131
|
+
// yes, so find new slide number
|
1132
|
+
var newslidenum = self.find_slide_number(this.href);
|
1133
|
+
|
1134
|
+
if (newslidenum != self.slide_number)
|
1135
|
+
{
|
1136
|
+
var slide = self.slides[self.slide_number];
|
1137
|
+
self.hide_slide(slide);
|
1138
|
+
self.slide_number = newslidenum;
|
1139
|
+
slide = self.slides[self.slide_number];
|
1140
|
+
self.show_slide(slide);
|
1141
|
+
self.set_location();
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
else
|
1145
|
+
w3c_slidy.stop_propagation(event);
|
1146
|
+
|
1147
|
+
// else if (this.target == null)
|
1148
|
+
// location.href = this.href;
|
1149
|
+
|
1150
|
+
this.blur();
|
1151
|
+
self.disable_slide_click = true;
|
1152
|
+
};
|
1153
|
+
|
1154
|
+
var anchors = document.body.getElementsByTagName("a");
|
1155
|
+
|
1156
|
+
for (var i = 0; i < anchors.length; ++i)
|
1157
|
+
{
|
1158
|
+
if (window.addEventListener)
|
1159
|
+
anchors[i].addEventListener("click", handler, false);
|
1160
|
+
else
|
1161
|
+
anchors[i].attachEvent("onclick", handler);
|
1162
|
+
}
|
1163
|
+
},
|
1164
|
+
|
1165
|
+
// ### CHECK ME ### see which functions are invoked via setTimeout
|
1166
|
+
// either directly or indirectly for use of w3c_slidy vs this
|
1167
|
+
show_slide_number: function () {
|
1168
|
+
var timer = w3c_slidy.get_timer();
|
1169
|
+
w3c_slidy.slide_number_element.innerHTML = timer + w3c_slidy.localize("slide") + " " +
|
1170
|
+
(w3c_slidy.slide_number + 1) + "/" + w3c_slidy.slides.length;
|
1171
|
+
},
|
1172
|
+
|
1173
|
+
// every 200mS check if the location has been changed as a
|
1174
|
+
// result of the user activating the Back button/menu item
|
1175
|
+
// doesn't work for Opera < 9.5
|
1176
|
+
check_location: function () {
|
1177
|
+
var hash = location.hash;
|
1178
|
+
|
1179
|
+
if (w3c_slidy.slide_number > 0 && (hash == "" || hash == "#"))
|
1180
|
+
w3c_slidy.goto_slide(0);
|
1181
|
+
else if (hash.length > 2 && hash != "#("+(w3c_slidy.slide_number+1)+")")
|
1182
|
+
{
|
1183
|
+
var num = parseInt(location.hash.substr(2));
|
1184
|
+
|
1185
|
+
if (!isNaN(num))
|
1186
|
+
w3c_slidy.goto_slide(num-1);
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
if (w3c_slidy.time_left && w3c_slidy.slide_number > 0)
|
1190
|
+
{
|
1191
|
+
w3c_slidy.show_slide_number();
|
1192
|
+
|
1193
|
+
if (w3c_slidy.time_left > 0)
|
1194
|
+
w3c_slidy.time_left -= 200;
|
1195
|
+
}
|
1196
|
+
},
|
1197
|
+
|
1198
|
+
get_timer: function () {
|
1199
|
+
var timer = "";
|
1200
|
+
if (w3c_slidy.time_left)
|
1201
|
+
{
|
1202
|
+
var mins, secs;
|
1203
|
+
secs = Math.floor(w3c_slidy.time_left/1000);
|
1204
|
+
mins = Math.floor(secs / 60);
|
1205
|
+
secs = secs % 60;
|
1206
|
+
timer = (mins ? mins+"m" : "") + secs + "s ";
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
return timer;
|
1210
|
+
},
|
1211
|
+
|
1212
|
+
// this doesn't push location onto history stack for IE
|
1213
|
+
// for which a hidden iframe hack is needed: load page into
|
1214
|
+
// the iframe with script that set's parent's location.hash
|
1215
|
+
// but that won't work for standalone use unless we can
|
1216
|
+
// create the page dynamically via a javascript: URL
|
1217
|
+
set_location: function () {
|
1218
|
+
var uri = w3c_slidy.page_address(location.href);
|
1219
|
+
var hash = "#(" + (w3c_slidy.slide_number+1) + ")";
|
1220
|
+
|
1221
|
+
if (w3c_slidy.slide_number >= 0)
|
1222
|
+
uri = uri + hash;
|
1223
|
+
|
1224
|
+
if (w3c_slidy.ie && (w3c_slidy.ie6 || w3c_slidy.ie7))
|
1225
|
+
w3c_slidy.push_hash(hash);
|
1226
|
+
|
1227
|
+
if (uri != location.href) // && !khtml
|
1228
|
+
location.href = uri;
|
1229
|
+
|
1230
|
+
if (this.khtml)
|
1231
|
+
hash = "(" + (w3c_slidy.slide_number+1) + ")";
|
1232
|
+
|
1233
|
+
if (!this.ie && location.hash != hash && location.hash != "")
|
1234
|
+
location.hash = hash;
|
1235
|
+
|
1236
|
+
document.title = w3c_slidy.title + " (" + (w3c_slidy.slide_number+1) + ")";
|
1237
|
+
w3c_slidy.show_slide_number();
|
1238
|
+
},
|
1239
|
+
|
1240
|
+
page_address: function (uri) {
|
1241
|
+
var i = uri.indexOf("#");
|
1242
|
+
|
1243
|
+
if (i < 0)
|
1244
|
+
i = uri.indexOf("%23");
|
1245
|
+
|
1246
|
+
// check if anchor is entire page
|
1247
|
+
|
1248
|
+
if (i < 0)
|
1249
|
+
return uri; // yes
|
1250
|
+
|
1251
|
+
return uri.substr(0, i);
|
1252
|
+
},
|
1253
|
+
|
1254
|
+
// only used for IE6 and IE7
|
1255
|
+
on_frame_loaded: function (hash) {
|
1256
|
+
location.hash = hash;
|
1257
|
+
var uri = w3c_slidy.page_address(location.href);
|
1258
|
+
location.href = uri + hash;
|
1259
|
+
},
|
1260
|
+
|
1261
|
+
// history hack with thanks to Bertrand Le Roy
|
1262
|
+
push_hash: function (hash) {
|
1263
|
+
if (hash == "") hash = "#(1)";
|
1264
|
+
window.location.hash = hash;
|
1265
|
+
|
1266
|
+
var doc = document.getElementById("historyFrame").contentWindow.document;
|
1267
|
+
doc.open("javascript:'<html></html>'");
|
1268
|
+
doc.write("<html><head><script type=\"text/javascript\">window.parent.w3c_slidy.on_frame_loaded('"+
|
1269
|
+
(hash) + "');</script></head><body>hello mum</body></html>");
|
1270
|
+
doc.close();
|
1271
|
+
},
|
1272
|
+
|
1273
|
+
// find current slide based upon location
|
1274
|
+
// first find target anchor and then look
|
1275
|
+
// for associated div element enclosing it
|
1276
|
+
// finally map that to slide number
|
1277
|
+
find_slide_number: function (uri) {
|
1278
|
+
// first get anchor from page location
|
1279
|
+
|
1280
|
+
var i = uri.indexOf("#");
|
1281
|
+
|
1282
|
+
// check if anchor is entire page
|
1283
|
+
if (i < 0)
|
1284
|
+
return 0; // yes
|
1285
|
+
|
1286
|
+
var anchor = unescape(uri.substr(i+1));
|
1287
|
+
|
1288
|
+
// now use anchor as XML ID to find target
|
1289
|
+
var target = document.getElementById(anchor);
|
1290
|
+
|
1291
|
+
if (!target)
|
1292
|
+
{
|
1293
|
+
// does anchor look like "(2)" for slide 2 ??
|
1294
|
+
// where first slide is (1)
|
1295
|
+
var re = /\((\d)+\)/;
|
1296
|
+
|
1297
|
+
if (anchor.match(re))
|
1298
|
+
{
|
1299
|
+
var num = parseInt(anchor.substring(1, anchor.length-1));
|
1300
|
+
|
1301
|
+
if (num > this.slides.length)
|
1302
|
+
num = 1;
|
1303
|
+
|
1304
|
+
if (--num < 0)
|
1305
|
+
num = 0;
|
1306
|
+
|
1307
|
+
return num;
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
// accept [2] for backwards compatibility
|
1311
|
+
re = /\[(\d)+\]/;
|
1312
|
+
|
1313
|
+
if (anchor.match(re))
|
1314
|
+
{
|
1315
|
+
var num = parseInt(anchor.substring(1, anchor.length-1));
|
1316
|
+
|
1317
|
+
if (num > this.slides.length)
|
1318
|
+
num = 1;
|
1319
|
+
|
1320
|
+
if (--num < 0)
|
1321
|
+
num = 0;
|
1322
|
+
|
1323
|
+
return num;
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
// oh dear unknown anchor
|
1327
|
+
return 0;
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
// search for enclosing slide
|
1331
|
+
|
1332
|
+
while (true)
|
1333
|
+
{
|
1334
|
+
// browser coerces html elements to uppercase!
|
1335
|
+
if (target.nodeName.toLowerCase() == "div" &&
|
1336
|
+
this.has_class(target, "slide"))
|
1337
|
+
{
|
1338
|
+
// found the slide element
|
1339
|
+
break;
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
// otherwise try parent element if any
|
1343
|
+
|
1344
|
+
target = target.parentNode;
|
1345
|
+
|
1346
|
+
if (!target)
|
1347
|
+
{
|
1348
|
+
return 0; // no luck!
|
1349
|
+
}
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
for (i = 0; i < slides.length; ++i)
|
1353
|
+
{
|
1354
|
+
if (slides[i] == target)
|
1355
|
+
return i; // success
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
// oh dear still no luck
|
1359
|
+
return 0;
|
1360
|
+
},
|
1361
|
+
|
1362
|
+
previous_slide: function (incremental) {
|
1363
|
+
if (!w3c_slidy.view_all)
|
1364
|
+
{
|
1365
|
+
var slide;
|
1366
|
+
|
1367
|
+
if ((incremental || w3c_slidy.slide_number == 0) && w3c_slidy.last_shown != null)
|
1368
|
+
{
|
1369
|
+
w3c_slidy.last_shown = w3c_slidy.hide_previous_item(w3c_slidy.last_shown);
|
1370
|
+
w3c_slidy.set_eos_status(false);
|
1371
|
+
}
|
1372
|
+
else if (w3c_slidy.slide_number > 0)
|
1373
|
+
{
|
1374
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1375
|
+
w3c_slidy.hide_slide(slide);
|
1376
|
+
|
1377
|
+
w3c_slidy.slide_number = w3c_slidy.slide_number - 1;
|
1378
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1379
|
+
w3c_slidy.set_visibility_all_incremental("visible");
|
1380
|
+
w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
|
1381
|
+
w3c_slidy.set_eos_status(true);
|
1382
|
+
w3c_slidy.show_slide(slide);
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
w3c_slidy.set_location();
|
1386
|
+
|
1387
|
+
if (!w3c_slidy.ns_pos)
|
1388
|
+
w3c_slidy.refresh_toolbar(200);
|
1389
|
+
}
|
1390
|
+
},
|
1391
|
+
|
1392
|
+
next_slide: function (incremental) {
|
1393
|
+
if (!w3c_slidy.view_all)
|
1394
|
+
{
|
1395
|
+
var slide, last = w3c_slidy.last_shown;
|
1396
|
+
|
1397
|
+
if (incremental || w3c_slidy.slide_number == w3c_slidy.slides.length - 1)
|
1398
|
+
w3c_slidy.last_shown = w3c_slidy.reveal_next_item(w3c_slidy.last_shown);
|
1399
|
+
|
1400
|
+
if ((!incremental || w3c_slidy.last_shown == null) &&
|
1401
|
+
w3c_slidy.slide_number < w3c_slidy.slides.length - 1)
|
1402
|
+
{
|
1403
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1404
|
+
w3c_slidy.hide_slide(slide);
|
1405
|
+
|
1406
|
+
w3c_slidy.slide_number = w3c_slidy.slide_number + 1;
|
1407
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1408
|
+
w3c_slidy.last_shown = null;
|
1409
|
+
w3c_slidy.set_visibility_all_incremental("hidden");
|
1410
|
+
w3c_slidy.show_slide(slide);
|
1411
|
+
}
|
1412
|
+
else if (!w3c_slidy.last_shown)
|
1413
|
+
{
|
1414
|
+
if (last && incremental)
|
1415
|
+
w3c_slidy.last_shown = last;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
w3c_slidy.set_location();
|
1419
|
+
|
1420
|
+
w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
|
1421
|
+
|
1422
|
+
if (!w3c_slidy.ns_pos)
|
1423
|
+
w3c_slidy.refresh_toolbar(200);
|
1424
|
+
}
|
1425
|
+
},
|
1426
|
+
|
1427
|
+
// to first slide with nothing revealed
|
1428
|
+
// i.e. state at start of presentation
|
1429
|
+
first_slide: function () {
|
1430
|
+
if (!w3c_slidy.view_all)
|
1431
|
+
{
|
1432
|
+
var slide;
|
1433
|
+
|
1434
|
+
if (w3c_slidy.slide_number != 0)
|
1435
|
+
{
|
1436
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1437
|
+
w3c_slidy.hide_slide(slide);
|
1438
|
+
|
1439
|
+
w3c_slidy.slide_number = 0;
|
1440
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1441
|
+
w3c_slidy.last_shown = null;
|
1442
|
+
w3c_slidy.set_visibility_all_incremental("hidden");
|
1443
|
+
w3c_slidy.show_slide(slide);
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
w3c_slidy.set_eos_status(
|
1447
|
+
!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
|
1448
|
+
w3c_slidy.set_location();
|
1449
|
+
}
|
1450
|
+
},
|
1451
|
+
|
1452
|
+
// goto last slide with everything revealed
|
1453
|
+
// i.e. state at end of presentation
|
1454
|
+
last_slide: function () {
|
1455
|
+
if (!w3c_slidy.view_all)
|
1456
|
+
{
|
1457
|
+
var slide;
|
1458
|
+
|
1459
|
+
w3c_slidy.last_shown = null; //revealNextItem(lastShown);
|
1460
|
+
|
1461
|
+
if (w3c_slidy.last_shown == null &&
|
1462
|
+
w3c_slidy.slide_number < w3c_slidy.slides.length - 1)
|
1463
|
+
{
|
1464
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1465
|
+
w3c_slidy.hide_slide(slide);
|
1466
|
+
w3c_slidy.slide_number = w3c_slidy.slides.length - 1;
|
1467
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1468
|
+
w3c_slidy.set_visibility_all_incremental("visible");
|
1469
|
+
w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
|
1470
|
+
|
1471
|
+
w3c_slidy.show_slide(slide);
|
1472
|
+
}
|
1473
|
+
else
|
1474
|
+
{
|
1475
|
+
w3c_slidy.set_visibility_all_incremental("visible");
|
1476
|
+
w3c_slidy.last_shown = w3c_slidy.previous_incremental_item(null);
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
w3c_slidy.set_eos_status(true);
|
1480
|
+
w3c_slidy.set_location();
|
1481
|
+
}
|
1482
|
+
},
|
1483
|
+
|
1484
|
+
|
1485
|
+
// ### check this and consider add/remove class
|
1486
|
+
set_eos_status: function (state) {
|
1487
|
+
if (this.eos)
|
1488
|
+
this.eos.style.color = (state ? "rgb(240,240,240)" : "red");
|
1489
|
+
},
|
1490
|
+
|
1491
|
+
// first slide is 0
|
1492
|
+
goto_slide: function (num) {
|
1493
|
+
//alert("going to slide " + (num+1));
|
1494
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1495
|
+
w3c_slidy.hide_slide(slide);
|
1496
|
+
w3c_slidy.slide_number = num;
|
1497
|
+
slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1498
|
+
w3c_slidy.last_shown = null;
|
1499
|
+
w3c_slidy.set_visibility_all_incremental("hidden");
|
1500
|
+
w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));
|
1501
|
+
document.title = w3c_slidy.title + " (" + (w3c_slidy.slide_number+1) + ")";
|
1502
|
+
w3c_slidy.show_slide(slide);
|
1503
|
+
w3c_slidy.show_slide_number();
|
1504
|
+
},
|
1505
|
+
|
1506
|
+
|
1507
|
+
show_slide: function (slide) {
|
1508
|
+
this.sync_background(slide);
|
1509
|
+
window.scrollTo(0,0);
|
1510
|
+
this.remove_class(slide, "hidden");
|
1511
|
+
},
|
1512
|
+
|
1513
|
+
hide_slide: function (slide) {
|
1514
|
+
this.add_class(slide, "hidden");
|
1515
|
+
},
|
1516
|
+
|
1517
|
+
// show just the backgrounds pertinent to this slide
|
1518
|
+
// when slide background-color is transparent
|
1519
|
+
// this should now work with rgba color values
|
1520
|
+
sync_background: function (slide) {
|
1521
|
+
var background;
|
1522
|
+
var bgColor;
|
1523
|
+
|
1524
|
+
if (slide.currentStyle)
|
1525
|
+
bgColor = slide.currentStyle["backgroundColor"];
|
1526
|
+
else if (document.defaultView)
|
1527
|
+
{
|
1528
|
+
var styles = document.defaultView.getComputedStyle(slide,null);
|
1529
|
+
|
1530
|
+
if (styles)
|
1531
|
+
bgColor = styles.getPropertyValue("background-color");
|
1532
|
+
else // broken implementation probably due Safari or Konqueror
|
1533
|
+
{
|
1534
|
+
//alert("defective implementation of getComputedStyle()");
|
1535
|
+
bgColor = "transparent";
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
else
|
1539
|
+
bgColor == "transparent";
|
1540
|
+
|
1541
|
+
if (bgColor == "transparent" ||
|
1542
|
+
bgColor.indexOf("rgba") >= 0 ||
|
1543
|
+
bgColor.indexOf("opacity") >= 0)
|
1544
|
+
{
|
1545
|
+
var slideClass = this.get_class_list(slide);
|
1546
|
+
|
1547
|
+
for (var i = 0; i < this.backgrounds.length; i++)
|
1548
|
+
{
|
1549
|
+
background = this.backgrounds[i];
|
1550
|
+
|
1551
|
+
var bgClass = this.get_class_list(background);
|
1552
|
+
|
1553
|
+
if (this.matching_background(slideClass, bgClass))
|
1554
|
+
this.remove_class(background, "hidden");
|
1555
|
+
else
|
1556
|
+
this.add_class(background, "hidden");
|
1557
|
+
}
|
1558
|
+
}
|
1559
|
+
else // forcibly hide all backgrounds
|
1560
|
+
this.hide_backgrounds();
|
1561
|
+
},
|
1562
|
+
|
1563
|
+
hide_backgrounds: function () {
|
1564
|
+
for (var i = 0; i < this.backgrounds.length; i++)
|
1565
|
+
{
|
1566
|
+
background = this.backgrounds[i];
|
1567
|
+
this.add_class(background, "hidden");
|
1568
|
+
}
|
1569
|
+
},
|
1570
|
+
|
1571
|
+
// compare classes for slide and background
|
1572
|
+
matching_background: function (slideClass, bgClass) {
|
1573
|
+
var i, count, pattern, result;
|
1574
|
+
|
1575
|
+
// define pattern as regular expression
|
1576
|
+
pattern = /\w+/g;
|
1577
|
+
|
1578
|
+
// check background class names
|
1579
|
+
result = bgClass.match(pattern);
|
1580
|
+
|
1581
|
+
for (i = count = 0; i < result.length; i++)
|
1582
|
+
{
|
1583
|
+
if (result[i] == "hidden")
|
1584
|
+
continue;
|
1585
|
+
|
1586
|
+
if (result[i] == "background")
|
1587
|
+
continue;
|
1588
|
+
|
1589
|
+
++count;
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
if (count == 0) // default match
|
1593
|
+
return true;
|
1594
|
+
|
1595
|
+
// check for matches and place result in array
|
1596
|
+
result = slideClass.match(pattern);
|
1597
|
+
|
1598
|
+
// now check if desired name is present for background
|
1599
|
+
for (i = count = 0; i < result.length; i++)
|
1600
|
+
{
|
1601
|
+
if (result[i] == "hidden")
|
1602
|
+
continue;
|
1603
|
+
|
1604
|
+
if (this.has_token(bgClass, result[i]))
|
1605
|
+
return true;
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
return false;
|
1609
|
+
},
|
1610
|
+
|
1611
|
+
resized: function () {
|
1612
|
+
var width = 0;
|
1613
|
+
|
1614
|
+
if ( typeof( window.innerWidth ) == 'number' )
|
1615
|
+
width = window.innerWidth; // Non IE browser
|
1616
|
+
else if (document.documentElement && document.documentElement.clientWidth)
|
1617
|
+
width = document.documentElement.clientWidth; // IE6
|
1618
|
+
else if (document.body && document.body.clientWidth)
|
1619
|
+
width = document.body.clientWidth; // IE4
|
1620
|
+
|
1621
|
+
var height = 0;
|
1622
|
+
|
1623
|
+
if ( typeof( window.innerHeight ) == 'number' )
|
1624
|
+
height = window.innerHeight; // Non IE browser
|
1625
|
+
else if (document.documentElement && document.documentElement.clientHeight)
|
1626
|
+
height = document.documentElement.clientHeight; // IE6
|
1627
|
+
else if (document.body && document.body.clientHeight)
|
1628
|
+
height = document.body.clientHeight; // IE4
|
1629
|
+
|
1630
|
+
if (height && (width/height > 1.05*1024/768))
|
1631
|
+
{
|
1632
|
+
width = height * 1024.0/768;
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
// IE fires onresize even when only font size is changed!
|
1636
|
+
// so we do a check to avoid blocking < and > actions
|
1637
|
+
if (width != w3c_slidy.last_width || height != w3c_slidy.last_height)
|
1638
|
+
{
|
1639
|
+
if (width >= 1100)
|
1640
|
+
w3c_slidy.size_index = 5; // 4
|
1641
|
+
else if (width >= 1000)
|
1642
|
+
w3c_slidy.size_index = 4; // 3
|
1643
|
+
else if (width >= 800)
|
1644
|
+
w3c_slidy.size_index = 3; // 2
|
1645
|
+
else if (width >= 600)
|
1646
|
+
w3c_slidy.size_index = 2; // 1
|
1647
|
+
else if (width)
|
1648
|
+
w3c_slidy.size_index = 0;
|
1649
|
+
|
1650
|
+
// add in font size adjustment from meta element e.g.
|
1651
|
+
// <meta name="font-size-adjustment" content="-2" />
|
1652
|
+
// useful when slides have too much content ;-)
|
1653
|
+
|
1654
|
+
if (0 <= w3c_slidy.size_index + w3c_slidy.size_adjustment &&
|
1655
|
+
w3c_slidy.size_index + w3c_slidy.size_adjustment < w3c_slidy.sizes.length)
|
1656
|
+
w3c_slidy.size_index = w3c_slidy.size_index + w3c_slidy.size_adjustment;
|
1657
|
+
|
1658
|
+
// enables cross browser use of relative width/height
|
1659
|
+
// on object elements for use with SVG and Flash media
|
1660
|
+
w3c_slidy.adjust_object_dimensions(width, height);
|
1661
|
+
|
1662
|
+
if (document.body.style.fontSize != w3c_slidy.sizes[w3c_slidy.size_index])
|
1663
|
+
{
|
1664
|
+
document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
w3c_slidy.last_width = width;
|
1668
|
+
w3c_slidy.last_height = height;
|
1669
|
+
|
1670
|
+
// force reflow to work around Mozilla bug
|
1671
|
+
if (w3c_slidy.ns_pos)
|
1672
|
+
{
|
1673
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1674
|
+
w3c_slidy.hide_slide(slide);
|
1675
|
+
w3c_slidy.show_slide(slide);
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
// force correct positioning of toolbar
|
1679
|
+
w3c_slidy.refresh_toolbar(200);
|
1680
|
+
}
|
1681
|
+
},
|
1682
|
+
|
1683
|
+
scrolled: function () {
|
1684
|
+
if (w3c_slidy.toolbar && !w3c_slidy.ns_pos && !w3c_slidy.ie7)
|
1685
|
+
{
|
1686
|
+
w3c_slidy.hack_offset = w3c_slidy.scroll_x_offset();
|
1687
|
+
// hide toolbar
|
1688
|
+
w3c_slidy.toolbar.style.display = "none";
|
1689
|
+
|
1690
|
+
// make it reappear later
|
1691
|
+
if (w3c_slidy.scrollhack == 0 && !w3c_slidy.view_all)
|
1692
|
+
{
|
1693
|
+
setTimeout(function () {w3c_slidy.show_toolbar(); }, 1000);
|
1694
|
+
w3c_slidy.scrollhack = 1;
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
},
|
1698
|
+
|
1699
|
+
hide_toolbar: function () {
|
1700
|
+
w3c_slidy.add_class(w3c_slidy.toolbar, "hidden");
|
1701
|
+
window.focus();
|
1702
|
+
},
|
1703
|
+
|
1704
|
+
// used to ensure IE refreshes toolbar in correct position
|
1705
|
+
refresh_toolbar: function (interval) {
|
1706
|
+
if (!w3c_slidy.ns_pos && !w3c_slidy.ie7)
|
1707
|
+
{
|
1708
|
+
w3c_slidy.hide_toolbar();
|
1709
|
+
setTimeout(function () {w3c_slidy.show_toolbar(); }, interval);
|
1710
|
+
}
|
1711
|
+
},
|
1712
|
+
|
1713
|
+
// restores toolbar after short delay
|
1714
|
+
show_toolbar: function () {
|
1715
|
+
if (w3c_slidy.want_toolbar)
|
1716
|
+
{
|
1717
|
+
w3c_slidy.toolbar.style.display = "block";
|
1718
|
+
|
1719
|
+
if (!w3c_slidy.ns_pos)
|
1720
|
+
{
|
1721
|
+
// adjust position to allow for scrolling
|
1722
|
+
var xoffset = w3c_slidy.scroll_x_offset();
|
1723
|
+
w3c_slidy.toolbar.style.left = xoffset;
|
1724
|
+
w3c_slidy.toolbar.style.right = xoffset;
|
1725
|
+
|
1726
|
+
// determine vertical scroll offset
|
1727
|
+
//var yoffset = scrollYOffset();
|
1728
|
+
|
1729
|
+
// bottom is doc height - window height - scroll offset
|
1730
|
+
//var bottom = documentHeight() - lastHeight - yoffset
|
1731
|
+
|
1732
|
+
//if (yoffset > 0 || documentHeight() > lastHeight)
|
1733
|
+
// bottom += 16; // allow for height of scrollbar
|
1734
|
+
|
1735
|
+
w3c_slidy.toolbar.style.bottom = 0; //bottom;
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
w3c_slidy.remove_class(w3c_slidy.toolbar, "hidden");
|
1739
|
+
}
|
1740
|
+
|
1741
|
+
w3c_slidy.scrollhack = 0;
|
1742
|
+
|
1743
|
+
|
1744
|
+
// set the keyboard focus to the help link on the
|
1745
|
+
// toolbar to ensure that document has the focus
|
1746
|
+
// IE doesn't always work with window.focus()
|
1747
|
+
// and this hack has benefit of Enter for help
|
1748
|
+
|
1749
|
+
try
|
1750
|
+
{
|
1751
|
+
if (!w3c_slidy.opera)
|
1752
|
+
w3c_slidy.help_anchor.focus();
|
1753
|
+
}
|
1754
|
+
catch (e)
|
1755
|
+
{
|
1756
|
+
}
|
1757
|
+
},
|
1758
|
+
|
1759
|
+
// invoked via F key
|
1760
|
+
toggle_toolbar: function () {
|
1761
|
+
if (!w3c_slidy.view_all)
|
1762
|
+
{
|
1763
|
+
if (w3c_slidy.has_class(w3c_slidy.toolbar, "hidden"))
|
1764
|
+
{
|
1765
|
+
w3c_slidy.remove_class(w3c_slidy.toolbar, "hidden")
|
1766
|
+
w3c_slidy.want_toolbar = 1;
|
1767
|
+
}
|
1768
|
+
else
|
1769
|
+
{
|
1770
|
+
w3c_slidy.add_class(w3c_slidy.toolbar, "hidden")
|
1771
|
+
w3c_slidy.want_toolbar = 0;
|
1772
|
+
}
|
1773
|
+
}
|
1774
|
+
},
|
1775
|
+
|
1776
|
+
scroll_x_offset: function () {
|
1777
|
+
if (window.pageXOffset)
|
1778
|
+
return self.pageXOffset;
|
1779
|
+
|
1780
|
+
if (document.documentElement &&
|
1781
|
+
document.documentElement.scrollLeft)
|
1782
|
+
return document.documentElement.scrollLeft;
|
1783
|
+
|
1784
|
+
if (document.body)
|
1785
|
+
return document.body.scrollLeft;
|
1786
|
+
|
1787
|
+
return 0;
|
1788
|
+
},
|
1789
|
+
|
1790
|
+
scroll_y_offset: function () {
|
1791
|
+
if (window.pageYOffset)
|
1792
|
+
return self.pageYOffset;
|
1793
|
+
|
1794
|
+
if (document.documentElement &&
|
1795
|
+
document.documentElement.scrollTop)
|
1796
|
+
return document.documentElement.scrollTop;
|
1797
|
+
|
1798
|
+
if (document.body)
|
1799
|
+
return document.body.scrollTop;
|
1800
|
+
|
1801
|
+
return 0;
|
1802
|
+
},
|
1803
|
+
|
1804
|
+
// looking for a way to determine height of slide content
|
1805
|
+
// the slide itself is set to the height of the window
|
1806
|
+
optimize_font_size: function () {
|
1807
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1808
|
+
|
1809
|
+
//var dh = documentHeight(); //getDocHeight(document);
|
1810
|
+
var dh = slide.scrollHeight;
|
1811
|
+
var wh = getWindowHeight();
|
1812
|
+
var u = 100 * dh / wh;
|
1813
|
+
|
1814
|
+
alert("window utilization = " + u + "% (doc "
|
1815
|
+
+ dh + " win " + wh + ")");
|
1816
|
+
},
|
1817
|
+
|
1818
|
+
// from document object
|
1819
|
+
get_doc_height: function (doc) {
|
1820
|
+
if (!doc)
|
1821
|
+
doc = document;
|
1822
|
+
|
1823
|
+
if (doc && doc.body && doc.body.offsetHeight)
|
1824
|
+
return doc.body.offsetHeight; // ns/gecko syntax
|
1825
|
+
|
1826
|
+
if (doc && doc.body && doc.body.scrollHeight)
|
1827
|
+
return doc.body.scrollHeight;
|
1828
|
+
|
1829
|
+
alert("couldn't determine document height");
|
1830
|
+
},
|
1831
|
+
|
1832
|
+
get_window_height: function () {
|
1833
|
+
if ( typeof( window.innerHeight ) == 'number' )
|
1834
|
+
return window.innerHeight; // Non IE browser
|
1835
|
+
|
1836
|
+
if (document.documentElement && document.documentElement.clientHeight)
|
1837
|
+
return document.documentElement.clientHeight; // IE6
|
1838
|
+
|
1839
|
+
if (document.body && document.body.clientHeight)
|
1840
|
+
return document.body.clientHeight; // IE4
|
1841
|
+
},
|
1842
|
+
|
1843
|
+
document_height: function () {
|
1844
|
+
var sh, oh;
|
1845
|
+
|
1846
|
+
sh = document.body.scrollHeight;
|
1847
|
+
oh = document.body.offsetHeight;
|
1848
|
+
|
1849
|
+
if (sh && oh)
|
1850
|
+
{
|
1851
|
+
return (sh > oh ? sh : oh);
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
// no idea!
|
1855
|
+
return 0;
|
1856
|
+
},
|
1857
|
+
|
1858
|
+
smaller: function () {
|
1859
|
+
if (w3c_slidy.size_index > 0)
|
1860
|
+
{
|
1861
|
+
--w3c_slidy.size_index;
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
w3c_slidy.toolbar.style.display = "none";
|
1865
|
+
document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
|
1866
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1867
|
+
w3c_slidy.hide_slide(slide);
|
1868
|
+
w3c_slidy.show_slide(slide);
|
1869
|
+
setTimeout(function () {w3c_slidy.show_toolbar(); }, 50);
|
1870
|
+
},
|
1871
|
+
|
1872
|
+
bigger: function () {
|
1873
|
+
if (w3c_slidy.size_index < w3c_slidy.sizes.length - 1)
|
1874
|
+
{
|
1875
|
+
++w3c_slidy.size_index;
|
1876
|
+
}
|
1877
|
+
|
1878
|
+
w3c_slidy.toolbar.style.display = "none";
|
1879
|
+
document.body.style.fontSize = w3c_slidy.sizes[w3c_slidy.size_index];
|
1880
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
1881
|
+
w3c_slidy.hide_slide(slide);
|
1882
|
+
w3c_slidy.show_slide(slide);
|
1883
|
+
setTimeout(function () {w3c_slidy.show_toolbar(); }, 50);
|
1884
|
+
},
|
1885
|
+
|
1886
|
+
// enables cross browser use of relative width/height
|
1887
|
+
// on object elements for use with SVG and Flash media
|
1888
|
+
// with thanks to Ivan Herman for the suggestion
|
1889
|
+
adjust_object_dimensions: function (width, height) {
|
1890
|
+
for( var i = 0; i < w3c_slidy.objects.length; i++ )
|
1891
|
+
{
|
1892
|
+
var obj = this.objects[i];
|
1893
|
+
var mimeType = obj.getAttribute("type");
|
1894
|
+
|
1895
|
+
if (mimeType == "image/svg+xml" || mimeType == "application/x-shockwave-flash")
|
1896
|
+
{
|
1897
|
+
if ( !obj.initialWidth )
|
1898
|
+
obj.initialWidth = obj.getAttribute("width");
|
1899
|
+
|
1900
|
+
if ( !obj.initialHeight )
|
1901
|
+
obj.initialHeight = obj.getAttribute("height");
|
1902
|
+
|
1903
|
+
if ( obj.initialWidth && obj.initialWidth.charAt(obj.initialWidth.length-1) == "%" )
|
1904
|
+
{
|
1905
|
+
var w = parseInt(obj.initialWidth.slice(0, obj.initialWidth.length-1));
|
1906
|
+
var newW = width * (w/100.0);
|
1907
|
+
obj.setAttribute("width",newW);
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
if ( obj.initialHeight &&
|
1911
|
+
obj.initialHeight.charAt(obj.initialHeight.length-1) == "%" )
|
1912
|
+
{
|
1913
|
+
var h = parseInt(obj.initialHeight.slice(0, obj.initialHeight.length-1));
|
1914
|
+
var newH = height * (h/100.0);
|
1915
|
+
obj.setAttribute("height", newH);
|
1916
|
+
}
|
1917
|
+
}
|
1918
|
+
}
|
1919
|
+
},
|
1920
|
+
|
1921
|
+
// needed for Opera to inhibit default behavior
|
1922
|
+
// since Opera delivers keyPress even if keyDown
|
1923
|
+
// was cancelled
|
1924
|
+
key_press: function (event) {
|
1925
|
+
if (!event)
|
1926
|
+
event = window.event;
|
1927
|
+
|
1928
|
+
if (!w3c_slidy.key_wanted)
|
1929
|
+
return w3c_slidy.cancel(event);
|
1930
|
+
|
1931
|
+
return true;
|
1932
|
+
},
|
1933
|
+
|
1934
|
+
// See e.g. http://www.quirksmode.org/js/events/keys.html for keycodes
|
1935
|
+
key_down: function (event) {
|
1936
|
+
var key, target, tag;
|
1937
|
+
|
1938
|
+
w3c_slidy.key_wanted = true;
|
1939
|
+
|
1940
|
+
if (!event)
|
1941
|
+
event = window.event;
|
1942
|
+
|
1943
|
+
// kludge around NS/IE differences
|
1944
|
+
if (window.event)
|
1945
|
+
{
|
1946
|
+
key = window.event.keyCode;
|
1947
|
+
target = window.event.srcElement;
|
1948
|
+
}
|
1949
|
+
else if (event.which)
|
1950
|
+
{
|
1951
|
+
key = event.which;
|
1952
|
+
target = event.target;
|
1953
|
+
}
|
1954
|
+
else
|
1955
|
+
return true; // Yikes! unknown browser
|
1956
|
+
|
1957
|
+
// ignore event if key value is zero
|
1958
|
+
// as for alt on Opera and Konqueror
|
1959
|
+
if (!key)
|
1960
|
+
return true;
|
1961
|
+
|
1962
|
+
// avoid interfering with keystroke
|
1963
|
+
// behavior for non-slidy chrome elements
|
1964
|
+
if (!w3c_slidy.slidy_chrome(target) &&
|
1965
|
+
w3c_slidy.special_element(target))
|
1966
|
+
return true;
|
1967
|
+
|
1968
|
+
// check for concurrent control/command/alt key
|
1969
|
+
// but are these only present on mouse events?
|
1970
|
+
|
1971
|
+
if (event.ctrlKey || event.altKey || event.metaKey)
|
1972
|
+
return true;
|
1973
|
+
|
1974
|
+
// dismiss table of contents if visible
|
1975
|
+
if (w3c_slidy.is_shown_toc() && key != 9 && key != 16 && key != 38 && key != 40)
|
1976
|
+
{
|
1977
|
+
w3c_slidy.hide_table_of_contents(true);
|
1978
|
+
|
1979
|
+
if (key == 27 || key == 84 || key == 67)
|
1980
|
+
return w3c_slidy.cancel(event);
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
if (key == 34) // Page Down
|
1984
|
+
{
|
1985
|
+
if (w3c_slidy.view_all)
|
1986
|
+
return true;
|
1987
|
+
|
1988
|
+
w3c_slidy.next_slide(false);
|
1989
|
+
return w3c_slidy.cancel(event);
|
1990
|
+
}
|
1991
|
+
else if (key == 33) // Page Up
|
1992
|
+
{
|
1993
|
+
if (w3c_slidy.view_all)
|
1994
|
+
return true;
|
1995
|
+
|
1996
|
+
w3c_slidy.previous_slide(false);
|
1997
|
+
return w3c_slidy.cancel(event);
|
1998
|
+
}
|
1999
|
+
else if (key == 32) // space bar
|
2000
|
+
{
|
2001
|
+
w3c_slidy.next_slide(true);
|
2002
|
+
return w3c_slidy.cancel(event);
|
2003
|
+
}
|
2004
|
+
else if (key == 37) // Left arrow
|
2005
|
+
{
|
2006
|
+
w3c_slidy.previous_slide(!event.shiftKey);
|
2007
|
+
return w3c_slidy.cancel(event);
|
2008
|
+
}
|
2009
|
+
else if (key == 36) // Home
|
2010
|
+
{
|
2011
|
+
w3c_slidy.first_slide();
|
2012
|
+
return w3c_slidy.cancel(event);
|
2013
|
+
}
|
2014
|
+
else if (key == 35) // End
|
2015
|
+
{
|
2016
|
+
w3c_slidy.last_slide();
|
2017
|
+
return w3c_slidy.cancel(event);
|
2018
|
+
}
|
2019
|
+
else if (key == 39) // Right arrow
|
2020
|
+
{
|
2021
|
+
w3c_slidy.next_slide(!event.shiftKey);
|
2022
|
+
return w3c_slidy.cancel(event);
|
2023
|
+
}
|
2024
|
+
else if (key == 13) // Enter
|
2025
|
+
{
|
2026
|
+
if (w3c_slidy.outline)
|
2027
|
+
{
|
2028
|
+
if (w3c_slidy.outline.visible)
|
2029
|
+
w3c_slidy.fold(w3c_slidy.outline);
|
2030
|
+
else
|
2031
|
+
w3c_slidy.unfold(w3c_slidy.outline);
|
2032
|
+
|
2033
|
+
return w3c_slidy.cancel(event);
|
2034
|
+
}
|
2035
|
+
}
|
2036
|
+
else if (key == 188) // < for smaller fonts
|
2037
|
+
{
|
2038
|
+
w3c_slidy.smaller();
|
2039
|
+
return w3c_slidy.cancel(event);
|
2040
|
+
}
|
2041
|
+
else if (key == 190) // > for larger fonts
|
2042
|
+
{
|
2043
|
+
w3c_slidy.bigger();
|
2044
|
+
return w3c_slidy.cancel(event);
|
2045
|
+
}
|
2046
|
+
else if (key == 189 || key == 109) // - for smaller fonts
|
2047
|
+
{
|
2048
|
+
w3c_slidy.smaller();
|
2049
|
+
return w3c_slidy.cancel(event);
|
2050
|
+
}
|
2051
|
+
else if (key == 187 || key == 191 || key == 107) // = + for larger fonts
|
2052
|
+
{
|
2053
|
+
w3c_slidy.bigger();
|
2054
|
+
return w3c_slidy.cancel(event);
|
2055
|
+
}
|
2056
|
+
else if (key == 83) // S for smaller fonts
|
2057
|
+
{
|
2058
|
+
w3c_slidy.smaller();
|
2059
|
+
return w3c_slidy.cancel(event);
|
2060
|
+
}
|
2061
|
+
else if (key == 66) // B for larger fonts
|
2062
|
+
{
|
2063
|
+
w3c_slidy.bigger();
|
2064
|
+
return w3c_slidy.cancel(event);
|
2065
|
+
}
|
2066
|
+
else if (key == 90) // Z for last slide
|
2067
|
+
{
|
2068
|
+
w3c_slidy.last_slide();
|
2069
|
+
return w3c_slidy.cancel(event);
|
2070
|
+
}
|
2071
|
+
else if (key == 70) // F for toggle toolbar
|
2072
|
+
{
|
2073
|
+
w3c_slidy.toggle_toolbar();
|
2074
|
+
return w3c_slidy.cancel(event);
|
2075
|
+
}
|
2076
|
+
else if (key == 65) // A for toggle view single/all slides
|
2077
|
+
{
|
2078
|
+
w3c_slidy.toggle_view();
|
2079
|
+
return w3c_slidy.cancel(event);
|
2080
|
+
}
|
2081
|
+
else if (key == 75) // toggle action of left click for next page
|
2082
|
+
{
|
2083
|
+
w3c_slidy.mouse_click_enabled = !w3c_slidy.mouse_click_enabled;
|
2084
|
+
var alert_msg = (w3c_slidy.mouse_click_enabled ?
|
2085
|
+
"enabled" : "disabled") + " mouse click advance";
|
2086
|
+
|
2087
|
+
alert(w3c_slidy.localize(alert_msg));
|
2088
|
+
return w3c_slidy.cancel(event);
|
2089
|
+
}
|
2090
|
+
else if (key == 84 || key == 67) // T or C for table of contents
|
2091
|
+
{
|
2092
|
+
if (w3c_slidy.toc)
|
2093
|
+
w3c_slidy.toggle_table_of_contents();
|
2094
|
+
|
2095
|
+
return w3c_slidy.cancel(event);
|
2096
|
+
}
|
2097
|
+
else if (key == 72) // H for help
|
2098
|
+
{
|
2099
|
+
window.location = w3c_slidy.help_page;
|
2100
|
+
return w3c_slidy.cancel(event);
|
2101
|
+
}
|
2102
|
+
//else alert("key code is "+ key);
|
2103
|
+
|
2104
|
+
return true;
|
2105
|
+
},
|
2106
|
+
|
2107
|
+
// safe for both text/html and application/xhtml+xml
|
2108
|
+
create_element: function (name) {
|
2109
|
+
if (this.xhtml && (typeof document.createElementNS != 'undefined'))
|
2110
|
+
return document.createElementNS("http://www.w3.org/1999/xhtml", name)
|
2111
|
+
|
2112
|
+
return document.createElement(name);
|
2113
|
+
},
|
2114
|
+
|
2115
|
+
get_element_style: function (elem, IEStyleProp, CSSStyleProp) {
|
2116
|
+
if (elem.currentStyle)
|
2117
|
+
{
|
2118
|
+
return elem.currentStyle[IEStyleProp];
|
2119
|
+
}
|
2120
|
+
else if (window.getComputedStyle)
|
2121
|
+
{
|
2122
|
+
var compStyle = window.getComputedStyle(elem, "");
|
2123
|
+
return compStyle.getPropertyValue(CSSStyleProp);
|
2124
|
+
}
|
2125
|
+
return "";
|
2126
|
+
},
|
2127
|
+
|
2128
|
+
// the string str is a whitespace separated list of tokens
|
2129
|
+
// test if str contains a particular token, e.g. "slide"
|
2130
|
+
has_token: function (str, token) {
|
2131
|
+
if (str)
|
2132
|
+
{
|
2133
|
+
// define pattern as regular expression
|
2134
|
+
var pattern = /\w+/g;
|
2135
|
+
|
2136
|
+
// check for matches
|
2137
|
+
// place result in array
|
2138
|
+
var result = str.match(pattern);
|
2139
|
+
|
2140
|
+
// now check if desired token is present
|
2141
|
+
for (var i = 0; i < result.length; i++)
|
2142
|
+
{
|
2143
|
+
if (result[i] == token)
|
2144
|
+
return true;
|
2145
|
+
}
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
return false;
|
2149
|
+
},
|
2150
|
+
|
2151
|
+
get_class_list: function (element) {
|
2152
|
+
if (typeof element.className != 'undefined')
|
2153
|
+
return element.className;
|
2154
|
+
|
2155
|
+
return element.getAttribute("class");
|
2156
|
+
},
|
2157
|
+
|
2158
|
+
has_class: function (element, name) {
|
2159
|
+
if (element.nodeType != 1)
|
2160
|
+
return false;
|
2161
|
+
|
2162
|
+
var regexp = new RegExp("(^| )" + name + "\W*");
|
2163
|
+
|
2164
|
+
if (typeof element.className != 'undefined')
|
2165
|
+
return regexp.test(element.className);
|
2166
|
+
|
2167
|
+
return regexp.test(element.getAttribute("class"));
|
2168
|
+
},
|
2169
|
+
|
2170
|
+
remove_class: function (element, name) {
|
2171
|
+
var regexp = new RegExp("(^| )" + name + "\W*");
|
2172
|
+
var clsval = "";
|
2173
|
+
|
2174
|
+
if (typeof element.className != 'undefined')
|
2175
|
+
{
|
2176
|
+
clsval = element.className;
|
2177
|
+
|
2178
|
+
if (clsval)
|
2179
|
+
{
|
2180
|
+
clsval = clsval.replace(regexp, "");
|
2181
|
+
element.className = clsval;
|
2182
|
+
}
|
2183
|
+
}
|
2184
|
+
else
|
2185
|
+
{
|
2186
|
+
clsval = element.getAttribute("class");
|
2187
|
+
|
2188
|
+
if (clsval)
|
2189
|
+
{
|
2190
|
+
clsval = clsval.replace(regexp, "");
|
2191
|
+
element.setAttribute("class", clsval);
|
2192
|
+
}
|
2193
|
+
}
|
2194
|
+
},
|
2195
|
+
|
2196
|
+
add_class: function (element, name) {
|
2197
|
+
if (!this.has_class(element, name))
|
2198
|
+
{
|
2199
|
+
if (typeof element.className != 'undefined')
|
2200
|
+
element.className += " " + name;
|
2201
|
+
else
|
2202
|
+
{
|
2203
|
+
var clsval = element.getAttribute("class");
|
2204
|
+
clsval = clsval ? clsval + " " + name : name;
|
2205
|
+
element.setAttribute("class", clsval);
|
2206
|
+
}
|
2207
|
+
}
|
2208
|
+
},
|
2209
|
+
|
2210
|
+
// HTML elements that can be used with class="incremental"
|
2211
|
+
// note that you can also put the class on containers like
|
2212
|
+
// up, ol, dl, and div to make their contents appear
|
2213
|
+
// incrementally. Upper case is used since this is what
|
2214
|
+
// browsers report for HTML node names (text/html).
|
2215
|
+
incremental_elements: null,
|
2216
|
+
okay_for_incremental: function (name) {
|
2217
|
+
if (!this.incremental_elements)
|
2218
|
+
{
|
2219
|
+
var inclist = new Array();
|
2220
|
+
inclist["p"] = true;
|
2221
|
+
inclist["pre"] = true;
|
2222
|
+
inclist["li"] = true;
|
2223
|
+
inclist["blockquote"] = true;
|
2224
|
+
inclist["dt"] = true;
|
2225
|
+
inclist["dd"] = true;
|
2226
|
+
inclist["h2"] = true;
|
2227
|
+
inclist["h3"] = true;
|
2228
|
+
inclist["h4"] = true;
|
2229
|
+
inclist["h5"] = true;
|
2230
|
+
inclist["h6"] = true;
|
2231
|
+
inclist["span"] = true;
|
2232
|
+
inclist["address"] = true;
|
2233
|
+
inclist["table"] = true;
|
2234
|
+
inclist["tr"] = true;
|
2235
|
+
inclist["th"] = true;
|
2236
|
+
inclist["td"] = true;
|
2237
|
+
inclist["img"] = true;
|
2238
|
+
inclist["object"] = true;
|
2239
|
+
this.incremental_elements = inclist;
|
2240
|
+
}
|
2241
|
+
return this.incremental_elements[name.toLowerCase()];
|
2242
|
+
},
|
2243
|
+
|
2244
|
+
next_incremental_item: function (node) {
|
2245
|
+
var br = this.is_xhtml ? "br" : "BR";
|
2246
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
2247
|
+
|
2248
|
+
for (;;)
|
2249
|
+
{
|
2250
|
+
node = w3c_slidy.next_node(slide, node);
|
2251
|
+
|
2252
|
+
if (node == null || node.parentNode == null)
|
2253
|
+
break;
|
2254
|
+
|
2255
|
+
if (node.nodeType == 1) // ELEMENT
|
2256
|
+
{
|
2257
|
+
if (node.nodeName == br)
|
2258
|
+
continue;
|
2259
|
+
|
2260
|
+
if (w3c_slidy.has_class(node, "incremental")
|
2261
|
+
&& w3c_slidy.okay_for_incremental(node.nodeName))
|
2262
|
+
return node;
|
2263
|
+
|
2264
|
+
if (w3c_slidy.has_class(node.parentNode, "incremental")
|
2265
|
+
&& !w3c_slidy.has_class(node, "non-incremental"))
|
2266
|
+
return node;
|
2267
|
+
}
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
return node;
|
2271
|
+
},
|
2272
|
+
|
2273
|
+
previous_incremental_item: function (node) {
|
2274
|
+
var br = this.is_xhtml ? "br" : "BR";
|
2275
|
+
var slide = w3c_slidy.slides[w3c_slidy.slide_number];
|
2276
|
+
|
2277
|
+
for (;;)
|
2278
|
+
{
|
2279
|
+
node = w3c_slidy.previous_node(slide, node);
|
2280
|
+
|
2281
|
+
if (node == null || node.parentNode == null)
|
2282
|
+
break;
|
2283
|
+
|
2284
|
+
if (node.nodeType == 1)
|
2285
|
+
{
|
2286
|
+
if (node.nodeName == br)
|
2287
|
+
continue;
|
2288
|
+
|
2289
|
+
if (w3c_slidy.has_class(node, "incremental")
|
2290
|
+
&& w3c_slidy.okay_for_incremental(node.nodeName))
|
2291
|
+
return node;
|
2292
|
+
|
2293
|
+
if (w3c_slidy.has_class(node.parentNode, "incremental")
|
2294
|
+
&& !w3c_slidy.has_class(node, "non-incremental"))
|
2295
|
+
return node;
|
2296
|
+
}
|
2297
|
+
}
|
2298
|
+
|
2299
|
+
return node;
|
2300
|
+
},
|
2301
|
+
|
2302
|
+
// set visibility for all elements on current slide with
|
2303
|
+
// a parent element with attribute class="incremental"
|
2304
|
+
set_visibility_all_incremental: function (value) {
|
2305
|
+
var node = this.next_incremental_item(null);
|
2306
|
+
|
2307
|
+
if (value == "hidden")
|
2308
|
+
{
|
2309
|
+
while (node)
|
2310
|
+
{
|
2311
|
+
w3c_slidy.add_class(node, "invisible");
|
2312
|
+
node = w3c_slidy.next_incremental_item(node);
|
2313
|
+
}
|
2314
|
+
}
|
2315
|
+
else // value == "visible"
|
2316
|
+
{
|
2317
|
+
while (node)
|
2318
|
+
{
|
2319
|
+
w3c_slidy.remove_class(node, "invisible");
|
2320
|
+
node = w3c_slidy.next_incremental_item(node);
|
2321
|
+
}
|
2322
|
+
}
|
2323
|
+
},
|
2324
|
+
|
2325
|
+
// reveal the next hidden item on the slide
|
2326
|
+
// node is null or the node that was last revealed
|
2327
|
+
reveal_next_item: function (node) {
|
2328
|
+
node = w3c_slidy.next_incremental_item(node);
|
2329
|
+
|
2330
|
+
if (node && node.nodeType == 1) // an element
|
2331
|
+
w3c_slidy.remove_class(node, "invisible");
|
2332
|
+
|
2333
|
+
return node;
|
2334
|
+
},
|
2335
|
+
|
2336
|
+
// exact inverse of revealNextItem(node)
|
2337
|
+
hide_previous_item: function (node) {
|
2338
|
+
if (node && node.nodeType == 1) // an element
|
2339
|
+
w3c_slidy.add_class(node, "invisible");
|
2340
|
+
|
2341
|
+
return this.previous_incremental_item(node);
|
2342
|
+
},
|
2343
|
+
|
2344
|
+
// left to right traversal of root's content
|
2345
|
+
next_node: function (root, node) {
|
2346
|
+
if (node == null)
|
2347
|
+
return root.firstChild;
|
2348
|
+
|
2349
|
+
if (node.firstChild)
|
2350
|
+
return node.firstChild;
|
2351
|
+
|
2352
|
+
if (node.nextSibling)
|
2353
|
+
return node.nextSibling;
|
2354
|
+
|
2355
|
+
for (;;)
|
2356
|
+
{
|
2357
|
+
node = node.parentNode;
|
2358
|
+
|
2359
|
+
if (!node || node == root)
|
2360
|
+
break;
|
2361
|
+
|
2362
|
+
if (node && node.nextSibling)
|
2363
|
+
return node.nextSibling;
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
return null;
|
2367
|
+
},
|
2368
|
+
|
2369
|
+
// right to left traversal of root's content
|
2370
|
+
previous_node: function (root, node) {
|
2371
|
+
if (node == null)
|
2372
|
+
{
|
2373
|
+
node = root.lastChild;
|
2374
|
+
|
2375
|
+
if (node)
|
2376
|
+
{
|
2377
|
+
while (node.lastChild)
|
2378
|
+
node = node.lastChild;
|
2379
|
+
}
|
2380
|
+
|
2381
|
+
return node;
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
if (node.previousSibling)
|
2385
|
+
{
|
2386
|
+
node = node.previousSibling;
|
2387
|
+
|
2388
|
+
while (node.lastChild)
|
2389
|
+
node = node.lastChild;
|
2390
|
+
|
2391
|
+
return node;
|
2392
|
+
}
|
2393
|
+
|
2394
|
+
if (node.parentNode != root)
|
2395
|
+
return node.parentNode;
|
2396
|
+
|
2397
|
+
return null;
|
2398
|
+
},
|
2399
|
+
|
2400
|
+
previous_sibling_element: function (el) {
|
2401
|
+
el = el.previousSibling;
|
2402
|
+
|
2403
|
+
while (el && el.nodeType != 1)
|
2404
|
+
el = el.previousSibling;
|
2405
|
+
|
2406
|
+
return el;
|
2407
|
+
},
|
2408
|
+
|
2409
|
+
next_sibling_element: function (el) {
|
2410
|
+
el = el.nextSibling;
|
2411
|
+
|
2412
|
+
while (el && el.nodeType != 1)
|
2413
|
+
el = el.nextSibling;
|
2414
|
+
|
2415
|
+
return el;
|
2416
|
+
},
|
2417
|
+
|
2418
|
+
first_child_element: function (el) {
|
2419
|
+
var node;
|
2420
|
+
|
2421
|
+
for (node = el.firstChild; node; node = node.nextSibling)
|
2422
|
+
{
|
2423
|
+
if (node.nodeType == 1)
|
2424
|
+
break;
|
2425
|
+
}
|
2426
|
+
|
2427
|
+
return node;
|
2428
|
+
},
|
2429
|
+
|
2430
|
+
first_tag: function (element, tag) {
|
2431
|
+
var node;
|
2432
|
+
|
2433
|
+
if (!this.is_xhtml)
|
2434
|
+
tag = tag.toUpperCase();
|
2435
|
+
|
2436
|
+
for (node = element.firstChild; node; node = node.nextSibling)
|
2437
|
+
{
|
2438
|
+
if (node.nodeType == 1 && node.nodeName == tag)
|
2439
|
+
break;
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
return node;
|
2443
|
+
},
|
2444
|
+
|
2445
|
+
hide_selection: function () {
|
2446
|
+
if (window.getSelection) // Firefox, Chromium, Safari, Opera
|
2447
|
+
{
|
2448
|
+
var selection = window.getSelection();
|
2449
|
+
|
2450
|
+
if (selection.rangeCount > 0)
|
2451
|
+
{
|
2452
|
+
var range = selection.getRangeAt(0);
|
2453
|
+
range.collapse (false);
|
2454
|
+
}
|
2455
|
+
}
|
2456
|
+
else // Internet Explorer
|
2457
|
+
{
|
2458
|
+
var textRange = document.selection.createRange ();
|
2459
|
+
textRange.collapse (false);
|
2460
|
+
}
|
2461
|
+
},
|
2462
|
+
|
2463
|
+
get_selected_text: function () {
|
2464
|
+
try
|
2465
|
+
{
|
2466
|
+
if (window.getSelection)
|
2467
|
+
return window.getSelection().toString();
|
2468
|
+
|
2469
|
+
if (document.getSelection)
|
2470
|
+
return document.getSelection().toString();
|
2471
|
+
|
2472
|
+
if (document.selection)
|
2473
|
+
return document.selection.createRange().text;
|
2474
|
+
}
|
2475
|
+
catch (e)
|
2476
|
+
{
|
2477
|
+
}
|
2478
|
+
|
2479
|
+
return "";
|
2480
|
+
},
|
2481
|
+
|
2482
|
+
// make note of length of selected text
|
2483
|
+
// as this evaluates to zero in click event
|
2484
|
+
mouse_button_up: function (e) {
|
2485
|
+
w3c_slidy.selected_text_len = w3c_slidy.get_selected_text().length;
|
2486
|
+
},
|
2487
|
+
|
2488
|
+
// right mouse button click is reserved for context menus
|
2489
|
+
// it is more reliable to detect rightclick than leftclick
|
2490
|
+
mouse_button_click: function (e) {
|
2491
|
+
var rightclick = false;
|
2492
|
+
var leftclick = false;
|
2493
|
+
var middleclick = false;
|
2494
|
+
var target;
|
2495
|
+
|
2496
|
+
if (!e)
|
2497
|
+
var e = window.event;
|
2498
|
+
|
2499
|
+
if (e.target)
|
2500
|
+
target = e.target;
|
2501
|
+
else if (e.srcElement)
|
2502
|
+
target = e.srcElement;
|
2503
|
+
|
2504
|
+
// work around Safari bug
|
2505
|
+
if (target.nodeType == 3)
|
2506
|
+
target = target.parentNode;
|
2507
|
+
|
2508
|
+
if (e.which) // all browsers except IE
|
2509
|
+
{
|
2510
|
+
leftclick = (e.which == 1);
|
2511
|
+
middleclick = (e.which == 2);
|
2512
|
+
rightclick = (e.which == 3);
|
2513
|
+
}
|
2514
|
+
else if (e.button)
|
2515
|
+
{
|
2516
|
+
// Konqueror gives 1 for left, 4 for middle
|
2517
|
+
// IE6 gives 0 for left and not 1 as I expected
|
2518
|
+
|
2519
|
+
if (e.button == 4)
|
2520
|
+
middleclick = true;
|
2521
|
+
|
2522
|
+
// all browsers agree on 2 for right button
|
2523
|
+
rightclick = (e.button == 2);
|
2524
|
+
}
|
2525
|
+
else
|
2526
|
+
leftclick = true;
|
2527
|
+
|
2528
|
+
if (w3c_slidy.selected_text_len > 0)
|
2529
|
+
{
|
2530
|
+
w3c_slidy.stop_propagation(e);
|
2531
|
+
e.cancel = true;
|
2532
|
+
e.returnValue = false;
|
2533
|
+
return false;
|
2534
|
+
}
|
2535
|
+
|
2536
|
+
// dismiss table of contents
|
2537
|
+
w3c_slidy.hide_table_of_contents(false);
|
2538
|
+
|
2539
|
+
// check if target is something that probably want's clicks
|
2540
|
+
// e.g. a, embed, object, input, textarea, select, option
|
2541
|
+
var tag = target.nodeName.toLowerCase();
|
2542
|
+
|
2543
|
+
if (w3c_slidy.mouse_click_enabled && leftclick &&
|
2544
|
+
!w3c_slidy.special_element(target) &&
|
2545
|
+
!target.onclick)
|
2546
|
+
{
|
2547
|
+
w3c_slidy.next_slide(true);
|
2548
|
+
w3c_slidy.stop_propagation(e);
|
2549
|
+
e.cancel = true;
|
2550
|
+
e.returnValue = false;
|
2551
|
+
return false;
|
2552
|
+
}
|
2553
|
+
|
2554
|
+
return true;
|
2555
|
+
},
|
2556
|
+
|
2557
|
+
special_element: function (e) {
|
2558
|
+
var tag = e.nodeName.toLowerCase();
|
2559
|
+
|
2560
|
+
return e.onkeydown ||
|
2561
|
+
e.onclick ||
|
2562
|
+
tag == "a" ||
|
2563
|
+
tag == "embed" ||
|
2564
|
+
tag == "object" ||
|
2565
|
+
tag == "video" ||
|
2566
|
+
tag == "audio" ||
|
2567
|
+
tag == "input" ||
|
2568
|
+
tag == "textarea" ||
|
2569
|
+
tag == "select" ||
|
2570
|
+
tag == "option";
|
2571
|
+
},
|
2572
|
+
|
2573
|
+
slidy_chrome: function (el) {
|
2574
|
+
while (el)
|
2575
|
+
{
|
2576
|
+
if (el == w3c_slidy.toc ||
|
2577
|
+
el == w3c_slidy.toolbar ||
|
2578
|
+
w3c_slidy.has_class(el, "outline"))
|
2579
|
+
return true;
|
2580
|
+
|
2581
|
+
el = el.parentNode;
|
2582
|
+
}
|
2583
|
+
|
2584
|
+
return false;
|
2585
|
+
},
|
2586
|
+
|
2587
|
+
get_key: function (e)
|
2588
|
+
{
|
2589
|
+
var key;
|
2590
|
+
|
2591
|
+
// kludge around NS/IE differences
|
2592
|
+
if (typeof window.event != "undefined")
|
2593
|
+
key = window.event.keyCode;
|
2594
|
+
else if (e.which)
|
2595
|
+
key = e.which;
|
2596
|
+
|
2597
|
+
return key;
|
2598
|
+
},
|
2599
|
+
|
2600
|
+
get_target: function (e) {
|
2601
|
+
var target;
|
2602
|
+
|
2603
|
+
if (!e)
|
2604
|
+
e = window.event;
|
2605
|
+
|
2606
|
+
if (e.target)
|
2607
|
+
target = e.target;
|
2608
|
+
else if (e.srcElement)
|
2609
|
+
target = e.srcElement;
|
2610
|
+
|
2611
|
+
if (target.nodeType != 1)
|
2612
|
+
target = target.parentNode;
|
2613
|
+
|
2614
|
+
return target;
|
2615
|
+
},
|
2616
|
+
|
2617
|
+
// does display property provide correct defaults?
|
2618
|
+
is_block: function (elem) {
|
2619
|
+
var tag = elem.nodeName.toLowerCase();
|
2620
|
+
|
2621
|
+
return tag == "ol" || tag == "ul" || tag == "p" ||
|
2622
|
+
tag == "li" || tag == "table" || tag == "pre" ||
|
2623
|
+
tag == "h1" || tag == "h2" || tag == "h3" ||
|
2624
|
+
tag == "h4" || tag == "h5" || tag == "h6" ||
|
2625
|
+
tag == "blockquote" || tag == "address";
|
2626
|
+
},
|
2627
|
+
|
2628
|
+
add_listener: function (element, event, handler) {
|
2629
|
+
if (window.addEventListener)
|
2630
|
+
element.addEventListener(event, handler, false);
|
2631
|
+
else
|
2632
|
+
element.attachEvent("on"+event, handler);
|
2633
|
+
},
|
2634
|
+
|
2635
|
+
// used to prevent event propagation from field controls
|
2636
|
+
stop_propagation: function (event) {
|
2637
|
+
event = event ? event : window.event;
|
2638
|
+
event.cancelBubble = true; // for IE
|
2639
|
+
|
2640
|
+
if (event.stopPropagation)
|
2641
|
+
event.stopPropagation();
|
2642
|
+
|
2643
|
+
return true;
|
2644
|
+
},
|
2645
|
+
|
2646
|
+
cancel: function (event) {
|
2647
|
+
if (event)
|
2648
|
+
{
|
2649
|
+
event.cancel = true;
|
2650
|
+
event.returnValue = false;
|
2651
|
+
|
2652
|
+
if (event.preventDefault)
|
2653
|
+
event.preventDefault();
|
2654
|
+
}
|
2655
|
+
|
2656
|
+
w3c_slidy.key_wanted = false;
|
2657
|
+
return false;
|
2658
|
+
},
|
2659
|
+
|
2660
|
+
// for each language define an associative array
|
2661
|
+
// and also the help text which is longer
|
2662
|
+
|
2663
|
+
strings_es: {
|
2664
|
+
"slide":"pág.",
|
2665
|
+
"help?":"Ayuda",
|
2666
|
+
"contents?":"Índice",
|
2667
|
+
"table of contents":"tabla de contenidos",
|
2668
|
+
"Table of Contents":"Tabla de Contenidos",
|
2669
|
+
"restart presentation":"Reiniciar presentación",
|
2670
|
+
"restart?":"Inicio"
|
2671
|
+
},
|
2672
|
+
help_es:
|
2673
|
+
"Utilice el ratón, barra espaciadora, teclas Izda/Dcha, " +
|
2674
|
+
"o Re pág y Av pág. Use S y B para cambiar el tamaño de fuente.",
|
2675
|
+
|
2676
|
+
strings_ca: {
|
2677
|
+
"slide":"pàg..",
|
2678
|
+
"help?":"Ajuda",
|
2679
|
+
"contents?":"Índex",
|
2680
|
+
"table of contents":"taula de continguts",
|
2681
|
+
"Table of Contents":"Taula de Continguts",
|
2682
|
+
"restart presentation":"Reiniciar presentació",
|
2683
|
+
"restart?":"Inici"
|
2684
|
+
},
|
2685
|
+
help_ca:
|
2686
|
+
"Utilitzi el ratolí, barra espaiadora, tecles Esq./Dta. " +
|
2687
|
+
"o Re pàg y Av pàg. Usi S i B per canviar grandària de font.",
|
2688
|
+
|
2689
|
+
strings_cs: {
|
2690
|
+
"slide":"snímek",
|
2691
|
+
"help?":"nápověda",
|
2692
|
+
"contents?":"obsah",
|
2693
|
+
"table of contents":"obsah prezentace",
|
2694
|
+
"Table of Contents":"Obsah prezentace",
|
2695
|
+
"restart presentation":"znovu spustit prezentaci",
|
2696
|
+
"restart?":"restart"
|
2697
|
+
},
|
2698
|
+
help_cs:
|
2699
|
+
"Prezentaci můžete procházet pomocí kliknutí myši, mezerníku, " +
|
2700
|
+
"šipek vlevo a vpravo nebo kláves PageUp a PageDown. Písmo se " +
|
2701
|
+
"dá zvětšit a zmenšit pomocí kláves B a S.",
|
2702
|
+
|
2703
|
+
strings_nl: {
|
2704
|
+
"slide":"pagina",
|
2705
|
+
"help?":"Help?",
|
2706
|
+
"contents?":"Inhoud?",
|
2707
|
+
"table of contents":"inhoudsopgave",
|
2708
|
+
"Table of Contents":"Inhoudsopgave",
|
2709
|
+
"restart presentation":"herstart presentatie",
|
2710
|
+
"restart?":"Herstart?"
|
2711
|
+
},
|
2712
|
+
help_nl:
|
2713
|
+
"Navigeer d.m.v. het muis, spatiebar, Links/Rechts toetsen, " +
|
2714
|
+
"of PgUp en PgDn. Gebruik S en B om de karaktergrootte te veranderen.",
|
2715
|
+
|
2716
|
+
strings_de: {
|
2717
|
+
"slide":"Seite",
|
2718
|
+
"help?":"Hilfe",
|
2719
|
+
"contents?":"Übersicht",
|
2720
|
+
"table of contents":"Inhaltsverzeichnis",
|
2721
|
+
"Table of Contents":"Inhaltsverzeichnis",
|
2722
|
+
"restart presentation":"Präsentation neu starten",
|
2723
|
+
"restart?":"Neustart"
|
2724
|
+
},
|
2725
|
+
help_de:
|
2726
|
+
"Benutzen Sie die Maus, Leerschlag, die Cursortasten links/rechts oder " +
|
2727
|
+
"Page up/Page Down zum Wechseln der Seiten und S und B für die Schriftgrösse.",
|
2728
|
+
|
2729
|
+
strings_pl: {
|
2730
|
+
"slide":"slajd",
|
2731
|
+
"help?":"pomoc?",
|
2732
|
+
"contents?":"spis treści?",
|
2733
|
+
"table of contents":"spis treści",
|
2734
|
+
"Table of Contents":"Spis Treści",
|
2735
|
+
"restart presentation":"Restartuj prezentację",
|
2736
|
+
"restart?":"restart?"
|
2737
|
+
},
|
2738
|
+
help_pl:
|
2739
|
+
"Zmieniaj slajdy klikając myszą, naciskając spację, strzałki lewo/prawo" +
|
2740
|
+
"lub PgUp / PgDn. Użyj klawiszy S i B, aby zmienić rozmiar czczionki.",
|
2741
|
+
|
2742
|
+
strings_fr: {
|
2743
|
+
"slide":"page",
|
2744
|
+
"help?":"Aide",
|
2745
|
+
"contents?":"Index",
|
2746
|
+
"table of contents":"table des matières",
|
2747
|
+
"Table of Contents":"Table des matières",
|
2748
|
+
"restart presentation":"Recommencer l'exposé",
|
2749
|
+
"restart?":"Début"
|
2750
|
+
},
|
2751
|
+
help_fr:
|
2752
|
+
"Naviguez avec la souris, la barre d'espace, les flèches " +
|
2753
|
+
"gauche/droite ou les touches Pg Up, Pg Dn. Utilisez " +
|
2754
|
+
"les touches S et B pour modifier la taille de la police.",
|
2755
|
+
|
2756
|
+
strings_hu: {
|
2757
|
+
"slide":"oldal",
|
2758
|
+
"help?":"segítség",
|
2759
|
+
"contents?":"tartalom",
|
2760
|
+
"table of contents":"tartalomjegyzék",
|
2761
|
+
"Table of Contents":"Tartalomjegyzék",
|
2762
|
+
"restart presentation":"bemutató újraindítása",
|
2763
|
+
"restart?":"újraindítás"
|
2764
|
+
},
|
2765
|
+
help_hu:
|
2766
|
+
"Az oldalak közti lépkedéshez kattintson az egérrel, vagy " +
|
2767
|
+
"használja a szóköz, a bal, vagy a jobb nyíl, illetve a Page Down, " +
|
2768
|
+
"Page Up billentyűket. Az S és a B billentyűkkel változtathatja " +
|
2769
|
+
"a szöveg méretét.",
|
2770
|
+
|
2771
|
+
strings_it: {
|
2772
|
+
"slide":"pag.",
|
2773
|
+
"help?":"Aiuto",
|
2774
|
+
"contents?":"Indice",
|
2775
|
+
"table of contents":"indice",
|
2776
|
+
"Table of Contents":"Indice",
|
2777
|
+
"restart presentation":"Ricominciare la presentazione",
|
2778
|
+
"restart?":"Inizio"
|
2779
|
+
},
|
2780
|
+
help_it:
|
2781
|
+
"Navigare con mouse, barra spazio, frecce sinistra/destra o " +
|
2782
|
+
"PgUp e PgDn. Usare S e B per cambiare la dimensione dei caratteri.",
|
2783
|
+
|
2784
|
+
strings_el: {
|
2785
|
+
"slide":"σελίδα",
|
2786
|
+
"help?":"βοήθεια;",
|
2787
|
+
"contents?":"περιεχόμενα;",
|
2788
|
+
"table of contents":"πίνακας περιεχομένων",
|
2789
|
+
"Table of Contents":"Πίνακας Περιεχομένων",
|
2790
|
+
"restart presentation":"επανεκκίνηση παρουσίασης",
|
2791
|
+
"restart?":"επανεκκίνηση;"
|
2792
|
+
},
|
2793
|
+
help_el:
|
2794
|
+
"Πλοηγηθείτε με το κλίκ του ποντικιού, το space, τα βέλη αριστερά/δεξιά, " +
|
2795
|
+
"ή Page Up και Page Down. Χρησιμοποιήστε τα πλήκτρα S και B για να αλλάξετε " +
|
2796
|
+
"το μέγεθος της γραμματοσειράς.",
|
2797
|
+
|
2798
|
+
strings_ja: {
|
2799
|
+
"slide":"スライド",
|
2800
|
+
"help?":"ヘルプ",
|
2801
|
+
"contents?":"目次",
|
2802
|
+
"table of contents":"目次を表示",
|
2803
|
+
"Table of Contents":"目次",
|
2804
|
+
"restart presentation":"最初から再生",
|
2805
|
+
"restart?":"最初から"
|
2806
|
+
},
|
2807
|
+
help_ja:
|
2808
|
+
"マウス左クリック ・ スペース ・ 左右キー " +
|
2809
|
+
"または Page Up ・ Page Downで操作, S ・ Bでフォントサイズ変更",
|
2810
|
+
|
2811
|
+
strings_zh: {
|
2812
|
+
"slide":"幻灯片",
|
2813
|
+
"help?":"帮助?",
|
2814
|
+
"contents?":"内容?",
|
2815
|
+
"table of contents":"目录",
|
2816
|
+
"Table of Contents":"目录",
|
2817
|
+
"restart presentation":"重新启动展示",
|
2818
|
+
"restart?":"重新启动?"
|
2819
|
+
},
|
2820
|
+
help_zh:
|
2821
|
+
"用鼠标点击, 空格条, 左右箭头, Pg Up 和 Pg Dn 导航. " +
|
2822
|
+
"用 S, B 改变字体大小.",
|
2823
|
+
|
2824
|
+
strings_ru: {
|
2825
|
+
"slide":"слайд",
|
2826
|
+
"help?":"помощь?",
|
2827
|
+
"contents?":"содержание?",
|
2828
|
+
"table of contents":"оглавление",
|
2829
|
+
"Table of Contents":"Оглавление",
|
2830
|
+
"restart presentation":"перезапустить презентацию",
|
2831
|
+
"restart?":"перезапуск?"
|
2832
|
+
},
|
2833
|
+
help_ru:
|
2834
|
+
"Перемещайтесь кликая мышкой, используя клавишу пробел, стрелки" +
|
2835
|
+
"влево/вправо или Pg Up и Pg Dn. Клавиши S и B меняют размер шрифта.",
|
2836
|
+
|
2837
|
+
strings_sv: {
|
2838
|
+
"slide":"sida",
|
2839
|
+
"help?":"hjälp",
|
2840
|
+
"contents?":"innehåll",
|
2841
|
+
"table of contents":"innehållsförteckning",
|
2842
|
+
"Table of Contents":"Innehållsförteckning",
|
2843
|
+
"restart presentation":"visa presentationen från början",
|
2844
|
+
"restart?":"börja om"
|
2845
|
+
},
|
2846
|
+
help_sv:
|
2847
|
+
"Bläddra med ett klick med vänstra musknappen, mellanslagstangenten, " +
|
2848
|
+
"vänster- och högerpiltangenterna eller tangenterna Pg Up, Pg Dn. " +
|
2849
|
+
"Använd tangenterna S och B för att ändra textens storlek.",
|
2850
|
+
|
2851
|
+
strings: { },
|
2852
|
+
|
2853
|
+
localize: function (src) {
|
2854
|
+
if (src == "")
|
2855
|
+
return src;
|
2856
|
+
|
2857
|
+
// try full language code, e.g. en-US
|
2858
|
+
var s, lookup = w3c_slidy.strings[w3c_slidy.lang];
|
2859
|
+
|
2860
|
+
if (lookup)
|
2861
|
+
{
|
2862
|
+
s = lookup[src];
|
2863
|
+
|
2864
|
+
if (s)
|
2865
|
+
return s;
|
2866
|
+
}
|
2867
|
+
|
2868
|
+
// strip country code suffix, e.g.
|
2869
|
+
// try en if undefined for en-US
|
2870
|
+
var lg = w3c_slidy.lang.split("-");
|
2871
|
+
|
2872
|
+
if (lg.length > 1)
|
2873
|
+
{
|
2874
|
+
lookup = w3c_slidy.strings[lg[0]];
|
2875
|
+
|
2876
|
+
if (lookup)
|
2877
|
+
{
|
2878
|
+
s = lookup[src];
|
2879
|
+
|
2880
|
+
if (s)
|
2881
|
+
return s;
|
2882
|
+
}
|
2883
|
+
}
|
2884
|
+
|
2885
|
+
// otherwise string as is
|
2886
|
+
return src;
|
2887
|
+
},
|
2888
|
+
|
2889
|
+
init_localization: function () {
|
2890
|
+
var i18n = w3c_slidy;
|
2891
|
+
var help_text = w3c_slidy.help_text;
|
2892
|
+
|
2893
|
+
// each such language array is declared in the localize array
|
2894
|
+
// this is used as in w3c_slidy.localize("foo");
|
2895
|
+
this.strings = {
|
2896
|
+
"es":this.strings_es,
|
2897
|
+
"ca":this.strings_ca,
|
2898
|
+
"cs":this.strings_cs,
|
2899
|
+
"nl":this.strings_nl,
|
2900
|
+
"de":this.strings_de,
|
2901
|
+
"pl":this.strings_pl,
|
2902
|
+
"fr":this.strings_fr,
|
2903
|
+
"hu":this.strings_hu,
|
2904
|
+
"it":this.strings_it,
|
2905
|
+
"el":this.strings_el,
|
2906
|
+
"jp":this.strings_ja,
|
2907
|
+
"zh":this.strings_zh,
|
2908
|
+
"ru":this.strings_ru,
|
2909
|
+
"sv":this.strings_sv
|
2910
|
+
},
|
2911
|
+
|
2912
|
+
i18n.strings_es[help_text] = i18n.help_es;
|
2913
|
+
i18n.strings_ca[help_text] = i18n.help_ca;
|
2914
|
+
i18n.strings_cs[help_text] = i18n.help_cs;
|
2915
|
+
i18n.strings_nl[help_text] = i18n.help_nl;
|
2916
|
+
i18n.strings_de[help_text] = i18n.help_de;
|
2917
|
+
i18n.strings_pl[help_text] = i18n.help_pl;
|
2918
|
+
i18n.strings_fr[help_text] = i18n.help_fr;
|
2919
|
+
i18n.strings_hu[help_text] = i18n.help_hu;
|
2920
|
+
i18n.strings_it[help_text] = i18n.help_it;
|
2921
|
+
i18n.strings_el[help_text] = i18n.help_el;
|
2922
|
+
i18n.strings_ja[help_text] = i18n.help_ja;
|
2923
|
+
i18n.strings_zh[help_text] = i18n.help_zh;
|
2924
|
+
i18n.strings_ru[help_text] = i18n.help_ru;
|
2925
|
+
i18n.strings_sv[help_text] = i18n.help_sv;
|
2926
|
+
|
2927
|
+
w3c_slidy.lang = document.body.parentNode.getAttribute("lang");
|
2928
|
+
|
2929
|
+
if (!w3c_slidy.lang)
|
2930
|
+
w3c_slidy.lang = document.body.parentNode.getAttribute("xml:lang");
|
2931
|
+
|
2932
|
+
if (!w3c_slidy.lang)
|
2933
|
+
w3c_slidy.lang = "en";
|
2934
|
+
}
|
2935
|
+
};
|
2936
|
+
|
2937
|
+
// hack for back button behavior
|
2938
|
+
if (w3c_slidy.ie6 || w3c_slidy.ie7)
|
2939
|
+
{
|
2940
|
+
document.write("<iframe id='historyFrame' " +
|
2941
|
+
"src='javascript:\"<html"+"></"+"html>\"' " +
|
2942
|
+
"height='1' width='1' " +
|
2943
|
+
"style='position:absolute;left:-800px'></iframe>");
|
2944
|
+
}
|
2945
|
+
|
2946
|
+
// attach event listeners for initialization
|
2947
|
+
w3c_slidy.set_up();
|
2948
|
+
|
2949
|
+
// hide the slides as soon as body element is available
|
2950
|
+
// to reduce annoying screen mess before the onload event
|
2951
|
+
setTimeout(w3c_slidy.hide_slides, 50);
|
2952
|
+
|