annotate presen/theme/js/slides.js @ 41:8ee3d6448aa6 draft

add css js thema
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 28 Feb 2012 22:31:20 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 function main() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 // Since we don't have the fallback of attachEvent and
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // other IE only stuff we won't try to run JS for IE.
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // It will run though when using Google Chrome Frame
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 if (document.all) { return; }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 var currentSlideNo;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 var notesOn = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 var expanded = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 var hiddenContext = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 var blanked = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 var slides = document.getElementsByClassName('slide');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 var touchStartX = 0;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 var spaces = /\s+/, a1 = [''];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 var tocOpened = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 var helpOpened = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 var overviewActive = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 var modifierKeyDown = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 var scale = 1;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 var showingPresenterView = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 var presenterViewWin = null;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 var isPresenterView = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 var str2array = function(s) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 if (typeof s == 'string' || s instanceof String) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 if (s.indexOf(' ') < 0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 a1[0] = s;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 return a1;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 return s.split(spaces);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 return s;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 var trim = function(str) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 var addClass = function(node, classStr) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 classStr = str2array(classStr);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 var cls = ' ' + node.className + ' ';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 for (var i = 0, len = classStr.length, c; i < len; ++i) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 c = classStr[i];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 if (c && cls.indexOf(' ' + c + ' ') < 0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 cls += c + ' ';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 node.className = trim(cls);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 var removeClass = function(node, classStr) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 var cls;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 if (!node) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 throw 'no node provided';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 if (classStr !== undefined) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 classStr = str2array(classStr);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 cls = ' ' + node.className + ' ';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 for (var i = 0, len = classStr.length; i < len; ++i) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 cls = cls.replace(' ' + classStr[i] + ' ', ' ');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 cls = trim(cls);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 cls = '';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 if (node.className != cls) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 node.className = cls;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 var getSlideEl = function(slideNo) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 if (slideNo > 0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 return slides[slideNo - 1];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 return null;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 var getSlideTitle = function(slideNo) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 var el = getSlideEl(slideNo);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 if (el) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 var headers = el.getElementsByTagName('header');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 if (headers.length > 0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 return el.getElementsByTagName('header')[0].innerText;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 return null;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 var getSlidePresenterNote = function(slideNo) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 var el = getSlideEl(slideNo);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 if (el) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 var n = el.getElementsByClassName('presenter_notes');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 if (n.length > 0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 return n[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 return null;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 var changeSlideElClass = function(slideNo, className) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 var el = getSlideEl(slideNo);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 if (el) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 removeClass(el, 'far-past past current future far-future');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 addClass(el, className);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 var updateSlideClasses = function(updateOther) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 window.location.hash = (isPresenterView ? "presenter" : "slide") + currentSlideNo;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 for (var i=1; i<currentSlideNo-1; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 changeSlideElClass(i, 'far-past');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 changeSlideElClass(currentSlideNo - 1, 'past');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 changeSlideElClass(currentSlideNo, 'current');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 changeSlideElClass(currentSlideNo + 1, 'future');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 for (i=currentSlideNo+2; i<slides.length+1; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 changeSlideElClass(i, 'far-future');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 highlightCurrentTocLink();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 processContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 document.getElementsByTagName('title')[0].innerText = getSlideTitle(currentSlideNo);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 updatePresenterNotes();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 if (updateOther) { updateOtherPage(); }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 var updatePresenterNotes = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 if (!isPresenterView) { return; }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 var existingNote = document.getElementById('current_presenter_notes');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 var currentNote = getSlidePresenterNote(currentSlideNo).cloneNode(true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 currentNote.setAttribute('id', 'presenter_note');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 existingNote.replaceChild(currentNote, document.getElementById('presenter_note'));
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 var highlightCurrentTocLink = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 var toc = document.getElementById('toc');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 if (toc) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 var tocRows = toc.getElementsByTagName('tr');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 for (var i=0; i<tocRows.length; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 removeClass(tocRows.item(i), 'active');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 var currentTocRow = document.getElementById('toc-row-' + currentSlideNo);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 if (currentTocRow) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 addClass(currentTocRow, 'active');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 var updateOtherPage = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 if (!showingPresenterView) { return; }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 var w = isPresenterView ? window.opener : presenterViewWin;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 w.postMessage('slide#' + currentSlideNo, '*');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 var nextSlide = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 if (currentSlideNo < slides.length) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 currentSlideNo++;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 updateSlideClasses(true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 var prevSlide = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 if (currentSlideNo > 1) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 currentSlideNo--;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 updateSlideClasses(true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 var showNotes = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 var notes = getSlideEl(currentSlideNo).getElementsByClassName('notes');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 for (var i = 0, len = notes.length; i < len; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 notes.item(i).style.display = (notesOn) ? 'none':'block';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 notesOn = !notesOn;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 var showSlideNumbers = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 var asides = document.getElementsByClassName('page_number');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 var hidden = asides[0].style.display != 'block';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 for (var i = 0; i < asides.length; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 asides.item(i).style.display = hidden ? 'block' : 'none';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 var showSlideSources = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 var asides = document.getElementsByClassName('source');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 var hidden = asides[0].style.display != 'block';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 for (var i = 0; i < asides.length; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 asides.item(i).style.display = hidden ? 'block' : 'none';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 var showToc = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 if (helpOpened) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 showHelp();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 var toc = document.getElementById('toc');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 if (toc) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 toc.style.marginLeft = tocOpened ? '-' + (toc.clientWidth + 20) + 'px' : '0px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 tocOpened = !tocOpened;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 updateOverview();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 var showHelp = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 if (tocOpened) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 showToc();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 var help = document.getElementById('help');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 if (help) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 help.style.marginLeft = helpOpened ? '-' + (help.clientWidth + 20) + 'px' : '0px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 helpOpened = !helpOpened;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 var showPresenterView = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 if (isPresenterView) { return; }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 if (showingPresenterView) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 presenterViewWin.close();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 presenterViewWin = null;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 showingPresenterView = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 presenterViewWin = open(window.location.pathname + "#presenter" + currentSlideNo, 'presenter_notes',
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 'directories=no,location=no,toolbar=no,menubar=no,copyhistory=no');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 showingPresenterView = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 var switch3D = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 if (document.body.className.indexOf('three-d') == -1) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 document.getElementsByClassName('presentation')[0].style.webkitPerspective = '1000px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 document.body.className += ' three-d';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 window.setTimeout('document.getElementsByClassName(\'presentation\')[0].style.webkitPerspective = \'0\';', 2000);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 document.body.className = document.body.className.replace(/three-d/, '');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 var toggleOverview = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 if (!overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 addClass(document.body, 'expose');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 overviewActive = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 setScale(1);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 removeClass(document.body, 'expose');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 overviewActive = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 if (expanded) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 setScale(scale); // restore scale
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 processContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 updateOverview();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 var updateOverview = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 try {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 var presentation = document.getElementsByClassName('presentation')[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 } catch (e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 return;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 if (isPresenterView) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 var action = overviewActive ? removeClass : addClass;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 action(document.body, 'presenter_view');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 var toc = document.getElementById('toc');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 if (!toc) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 return;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 if (!tocOpened || !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 presentation.style.marginLeft = '0px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 presentation.style.width = '100%';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 presentation.style.marginLeft = toc.clientWidth + 'px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 presentation.style.width = (presentation.clientWidth - toc.clientWidth) + 'px';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 var computeScale = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 var cSlide = document.getElementsByClassName('current')[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 var sx = cSlide.clientWidth / window.innerWidth;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 var sy = cSlide.clientHeight / window.innerHeight;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 return 1 / Math.max(sx, sy);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 var setScale = function(scale) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 var presentation = document.getElementsByClassName('slides')[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 var transform = 'scale(' + scale + ')';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 presentation.style.MozTransform = transform;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 presentation.style.WebkitTransform = transform;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 presentation.style.OTransform = transform;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 presentation.style.msTransform = transform;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 presentation.style.transform = transform;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 var expandSlides = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 if (overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 return;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 if (expanded) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 setScale(1);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 expanded = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 scale = computeScale();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 setScale(scale);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 expanded = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 var showContext = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 try {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 var presentation = document.getElementsByClassName('slides')[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 removeClass(presentation, 'nocontext');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 } catch (e) {}
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 var hideContext = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 try {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 var presentation = document.getElementsByClassName('slides')[0];
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 addClass(presentation, 'nocontext');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 } catch (e) {}
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 var processContext = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 if (hiddenContext) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 hideContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 showContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 var toggleContext = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 hiddenContext = !hiddenContext;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 processContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 var toggleBlank = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 blank_elem = document.getElementById('blank');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 blank_elem.style.display = blanked ? 'none' : 'block';
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 blanked = !blanked;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 var isModifierKey = function(keyCode) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 switch (keyCode) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 case 16: // shift
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 case 17: // ctrl
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 case 18: // alt
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 case 91: // command
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 return true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 default:
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 return false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 var checkModifierKeyUp = function(event) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 if (isModifierKey(event.keyCode)) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 modifierKeyDown = false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 var checkModifierKeyDown = function(event) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 if (isModifierKey(event.keyCode)) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 modifierKeyDown = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 var handleBodyKeyDown = function(event) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 switch (event.keyCode) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 case 13: // Enter
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 if (overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 toggleOverview();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 case 27: // ESC
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 toggleOverview();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 case 37: // left arrow
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 case 33: // page up
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 event.preventDefault();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 prevSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 case 39: // right arrow
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 case 32: // space
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 case 34: // page down
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 event.preventDefault();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 nextSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 case 50: // 2
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 if (!modifierKeyDown) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 showNotes();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 case 51: // 3
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 switch3D();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 case 190: // .
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 case 48: // 0
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 case 66: // b
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 toggleBlank();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 case 67: // c
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 toggleContext();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 case 69: // e
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 expandSlides();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 case 72: // h
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 showHelp();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 case 78: // n
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 showSlideNumbers();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 case 80: // p
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 showPresenterView();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 case 83: // s
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 if (!modifierKeyDown && !overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 showSlideSources();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 case 84: // t
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 showToc();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 break;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 var handleWheel = function(event) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 if (tocOpened || helpOpened || overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 return;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 var delta = 0;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 if (!event) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471 event = window.event;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 if (event.wheelDelta) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 delta = event.wheelDelta/120;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 if (window.opera) delta = -delta;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 } else if (event.detail) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 delta = -event.detail/3;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 if (delta && delta <0) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 nextSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 } else if (delta) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 prevSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 var addSlideClickListeners = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 for (var i=0; i < slides.length; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 var slide = slides.item(i);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 slide.num = i + 1;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 slide.addEventListener('click', function(e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
493 if (overviewActive) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 currentSlideNo = this.num;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 toggleOverview();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 updateSlideClasses(true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 e.preventDefault();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 return false;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 }, true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 var addRemoteWindowControls = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 window.addEventListener("message", function(e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 if (e.data.indexOf("slide#") != -1) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 currentSlideNo = Number(e.data.replace('slide#', ''));
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 updateSlideClasses(false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 }, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 var addTouchListeners = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514 document.addEventListener('touchstart', function(e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 touchStartX = e.touches[0].pageX;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 }, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517 document.addEventListener('touchend', function(e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 var pixelsMoved = touchStartX - e.changedTouches[0].pageX;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 var SWIPE_SIZE = 150;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 if (pixelsMoved > SWIPE_SIZE) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 nextSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 else if (pixelsMoved < -SWIPE_SIZE) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 prevSlide();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 }, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 var addTocLinksListeners = function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 var toc = document.getElementById('toc');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 if (toc) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 var tocLinks = toc.getElementsByTagName('a');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 for (var i=0; i < tocLinks.length; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 tocLinks.item(i).addEventListener('click', function(e) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 currentSlideNo = Number(this.attributes['href'].value.replace('#slide', ''));
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 updateSlideClasses(true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 e.preventDefault();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 }, true);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 };
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 // initialize
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 (function() {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 if (window.location.hash == "") {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 currentSlideNo = 1;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 } else if (window.location.hash.indexOf("#presenter") != -1) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 currentSlideNo = Number(window.location.hash.replace('#presenter', ''));
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 isPresenterView = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 showingPresenterView = true;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 presenterViewWin = window;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 addClass(document.body, 'presenter_view');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 } else {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 currentSlideNo = Number(window.location.hash.replace('#slide', ''));
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 document.addEventListener('keyup', checkModifierKeyUp, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 document.addEventListener('keydown', handleBodyKeyDown, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 document.addEventListener('keydown', checkModifierKeyDown, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 document.addEventListener('DOMMouseScroll', handleWheel, false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 window.onmousewheel = document.onmousewheel = handleWheel;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 window.onresize = expandSlides;
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 for (var i = 0, el; el = slides[i]; i++) {
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 addClass(el, 'slide far-future');
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 }
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 updateSlideClasses(false);
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 // add support for finger events (filter it by property detection?)
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 addTouchListeners();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574 addTocLinksListeners();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 addSlideClickListeners();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 addRemoteWindowControls();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 })();
8ee3d6448aa6 add css js thema
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 }