-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
353 lines (271 loc) · 11.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<!--
Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
http://creativecommons.org/licenses/by-nc-sa/3.0/
-->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="javascripts/jquery.js"></script>
<script type="text/javascript" src="javascripts/jeditable.js"></script>
<script type="text/javascript" src="javascripts/shortcut.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheets/reset-min.css"/>
<link rel="stylesheet" type="text/css" href="stylesheets/buttons.css"/>
<style type="text/css">
.nameEdit {width:150px}
.testing {font-weight:bold;}
body {
background-color: #362311; color: white; height:100%;
font-family: Helvetica, sans-serif;
}
#quizApp {background-color: #362311; padding-top:50px}
#quizControls {position:absolute;top: 20px; right: 40px}
#quizControlsToggle {position:absolute;top: 1px; right: 1px; width: 40px; height:40px}
#logger {display:none;}
#blurimg {margin-bottom: 6px}
#imgCaption {font-family: Helvetica,sans-serif; color: #777777; font-size: 80%; display: none}
a {color:white; text-decoration: none;}
a:visited {color:white;}
#players {margin-top:30px;}
</style>
</head>
<body onload="showBlurStep(document.blur_sequence_index);captureNavKeys();window.setTimeout(prefillCacheForImg, 1000, (document.files[document.file_index]));">
<script type="text/javascript">
//
// CONFIG
//
document.files = [
// general agile pics
"crystal_clear_2_@[email protected]",
"agile_alliance.jpg",
"agile_manifesto.jpg",
// book covers
"books/xp_explained_cover_amazon.jpg ",
"books/agile_coaching_davies_sedley_amazon.jpg",
"books/agile_software_development_cockburn_amazon.jpg",
"books/agile_software_development_w_scrum_schwaber_amazon.jpg",
"books/kanban_anderson_amazon.jpg",
"books/agile_software_development_derby_larsen_amazon.jpg",
"books/leading_lean_software_development_poppendiecks_amazon.jpg",
"books/peopleware_de_marco_amazon.jpg",
"books/pragmatic_programmer_hunt_amazon.jpg",
"books/taiichi_ohno_workplace_management_amazon.jpg",
"books/working_effectively_with_legacy_code_feathers_amazon.jpg",
// persons
"persons/Hudson-CI.jpg",
"persons/Jeff_Sutherland.jpg",
"persons/chuck_norris.jpg",
"persons/cockburn.jpg",
"persons/david_anderson.jpg",
"persons/jefferies.jpg",
"persons/ken_schwaber.jpg",
"persons/martin_fowler.jpg",
"persons/rachel_davis.jpg",
"persons/kent_beck_rdhh10.jpg",
"persons/ohno.jpg"
]
for (i in document.files) {document.files[i] = 'images/converted/' +document.files[i]}
document.file_postfix = ".openi" // i used this to switch between different blur-versions
document.file_index = 0;
document.blur_sequence_index = 0;
document.img_cache = {};
const MAX_I = 16; // maximum number of blur-steps per image (doesnt have to be exact, just an upper limit)
const PRECACHE_IMGS = false; //might make sense if used via web
</script>
<center>
<div id="quizApp">
<img src="" id="blurimg"/><br/>
<span id="imgCaption"></span>
<div id="players" >
<ul>
<li id="player0_name" class="edit nameEdit button blue" >Player 1</li>
<li id="player1_name" class="edit nameEdit button orange">Player 2</li>
<li id="player2_name" class="edit nameEdit button green">Player 3</li>
</ul>
</div>
</div>
</center>
<div id="quizControlsToggle"></div>
<div id="quizControls">
<a href="#" onclick="startShow()">Start</a> |
<a href="#" onclick="stopShow()">Stop</a> |
<a href="#" onclick="resetShow()">Reset</a><br/>
<br/>
<a href="#" onclick="showPreviousBlurStep();">Show previous step</a> |
<a href="#" onclick="showNextBlurStep();">Show next step</a>
<br/>
<br/>
<a href="#" onclick="loadPreviousImageFile();">Skip to previous image</a> |
<a href="#" onclick="loadNextImageFile();">Skip to next image</a><br/>
<br/>
<span id="logger"></span><br/>
<small>
Keyboard-Shortcuts:<br/>
1/2/3 - Player 1/2/3 answers<br/>
4 - Reset buttons and continue slideshow<br/>
right/left - next/prev blur step<br/>
shift+right/left - next/prev image<br/>
a - start slideshow<br/>
s - stop slideshow<br/>
d - reset slideshow<br/>
(click upper right corner to hide/show these infos)
</small>
<br/>
<br/>
</div>
<script type="text/javascript">
function captureNavKeys() {
// buzzer
shortcut.add('1', function() {stopShow();highlightPlayerAsActive(0)}, {'disable_in_input':true})
shortcut.add('2', function() {stopShow();highlightPlayerAsActive(1)}, {'disable_in_input':true})
shortcut.add('3', function() {stopShow();highlightPlayerAsActive(2)}, {'disable_in_input':true})
// buzzer reset
shortcut.add('4', function() {startShow();setAllPlayersAsInactive()}, {'disable_in_input':true})
// slideshow
shortcut.add('a', startShow, {'disable_in_input':true})
shortcut.add('s', stopShow, {'disable_in_input':true})
shortcut.add('d', resetShow, {'disable_in_input':true})
// blur nav
shortcut.add('left', function() {showPreviousBlurStep()}, {'disable_in_input':true})
shortcut.add('right', function() {showNextBlurStep()}, {'disable_in_input':true})
// img nav
shortcut.add('shift+left', loadPreviousImageFile, {'disable_in_input':true})
shortcut.add('shift+right', loadNextImageFile, {'disable_in_input':true})
}
function startShow() {
if (document.timerId) stopShow()
document.timerId = window.setInterval("showNextBlurStep();", 1000);
}
function stopShow() {
window.clearInterval(document.timerId);
document.timerId = null;
}
function resetShow() {
stopShow();
document.blur_sequence_index = 0;
showBlurStep(document.blur_sequence_index);
$('#imgCaption').hide()
}
function imgCacheKey(filename, blur_seq_index) {
return filename+"_"+blur_seq_index;
}
function prefillCacheForImg(filename) {
fillCacheWithImg(filename, 0);
}
function fillCacheWithImg(filename, i) {
if (PRECACHE_IMGS === false || i>=MAX_I) return;
if (document.img_cache[imgCacheKey(filename, i)]!=null) {
fillCacheWithImg(filename, i+1);
}
var img = new Image();
img.onload = function() {
document.img_cache[imgCacheKey(filename, i)] = img;
logger = document.getElementById('logger');
logger.innerHTML = logger.innerHTML = filename + " ("+i+")";
fillCacheWithImg(filename, i+1);
}
img.src = filenameForIndex(filename, i);
img.id="blurimg";
}
function showNextBlurStep() {
document.blur_sequence_index+=1
showBlurStep(document.blur_sequence_index)
}
function showPreviousBlurStep() {
if (document.blur_sequence_index==0) return;
document.blur_sequence_index-=1
showBlurStep(document.blur_sequence_index)
}
function showBlurStep(i) {
filename = document.files[document.file_index];
if ((img = document.img_cache[imgCacheKey(filename, i)]) != null) {
$('#blurimg').replaceWith(img)
} else {
var img = new Image();
img.onload = function() {$('#blurimg').replaceWith(img)};
img.src = filenameForIndex(filename, i);
img.id="blurimg";
}
if (i==MAX_I) showImgCaption(document.file_index)
}
function loadNextImageFile() {
loadImageFile(++document.file_index);
setAllPlayersAsInactive();
}
function loadPreviousImageFile() {
if (document.file_index==0) return;
loadImageFile(--document.file_index)
}
function loadImageFile(i) {
resetShow();
prefillCacheForImg(document.files[i]);
}
function showImgCaption(i) {
filename = document.files[i]
var flickr_author = filename.match(/@(.*)\./)
var caption = ""
if (flickr_author!=null)
caption = "by "+flickr_author[1]+ " (Flickr)"
else if (filename.match(/amazon/))
caption = "by Amazon"
else
caption = ""
$('#imgCaption').empty().append(caption).show()
}
function filenameForIndex(filename, i) {
//return filename
name = filename.replace(/\.jpg/, document.file_postfix+"_"+i+".jpg");
return name
}
//
//
// BUZZER INTEGRATION
//
//
function fillPlayerNames() {
for (i=0;i<3;i++){
elem = document.getElementById("player"+i+"_name");
if (document.active_player == i) {
//
}
else {
if (onePlayerIsActive())
$('#player'+i+'_name').addClass('disabled');
else
$('#player'+i+'_name').removeClass('disabled');
}
}
}
function highlightPlayerAsActive(player_num) {
if (onePlayerIsActive()) return;
document.active_player = player_num;
fillPlayerNames();
}
function setAllPlayersAsInactive() {
document.active_player = null;
fillPlayerNames();
}
function onePlayerIsActive() {
return document.active_player != null;
}
function playerDomId(i) {
return 'player'+i+'_name'
}
$(document).ready(function() {
// no ajax for buttons
$('.edit').editable(function(value, settings) {
return value});
});
$('#quizControlsToggle').toggle(
function() {$('#quizControls').fadeIn("slow")},
function() {$('#quizControls').fadeOut("slow")}
)
</script>
</body>
</html>