parade 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +42 -14
- data/bin/parade +1 -19
- data/lib/parade.rb +2 -2
- data/lib/parade/parsers/dsl.rb +0 -1
- data/lib/parade/renderers/columns_renderer.rb +1 -3
- data/lib/parade/renderers/command_line_renderer.rb +18 -2
- data/lib/parade/section.rb +8 -0
- data/lib/parade/server.rb +6 -2
- data/lib/parade/slide.rb +7 -13
- data/lib/parade/slide_post_renderers.rb +24 -0
- data/lib/parade/slide_pre_renderers.rb +19 -0
- data/lib/parade/version.rb +1 -1
- data/lib/public/css/default.css +3 -0
- data/lib/public/css/parade.css +16 -13
- data/lib/public/js/fg.menu.js +607 -571
- data/lib/public/js/keyboard.js +39 -33
- data/lib/public/js/parade-command-input.js +14 -2
- data/lib/public/js/parade-command-visor.js +15 -18
- data/lib/public/js/parade-keyboard-input.js +69 -15
- data/lib/public/js/parade.js +137 -84
- data/lib/templates/{showoff.erb → parade.erb} +0 -0
- data/lib/views/header.erb +2 -0
- data/lib/views/slide.erb +6 -2
- metadata +5 -2
data/lib/public/js/keyboard.js
CHANGED
@@ -8,12 +8,17 @@
|
|
8
8
|
* Licenced under the BSD License.
|
9
9
|
* See https://raw.github.com/RobertWHurst/KeyboardJS/master/license.txt
|
10
10
|
*/
|
11
|
-
|
11
|
+
|
12
|
+
window.KeyboardCreate = function(name) {
|
13
|
+
createKeyboard(name,this,keyboardFactory);
|
14
|
+
}
|
15
|
+
|
16
|
+
createKeyboard = function(name, context, factory) {
|
12
17
|
var namespaces = [], previousValues = {}, library;
|
13
18
|
if(typeof define === 'function' && define.amd) {
|
14
19
|
define(function() { return factory('amd'); });
|
15
20
|
} else {
|
16
|
-
library = factory('global');
|
21
|
+
library = factory('global',name);
|
17
22
|
library.noConflict = function( ) {
|
18
23
|
var args, nI;
|
19
24
|
newNamespaces = Array.prototype.slice.apply(arguments);
|
@@ -33,10 +38,12 @@
|
|
33
38
|
namespaces = newNamespaces;
|
34
39
|
return namespaces;
|
35
40
|
};
|
36
|
-
library.noConflict(
|
41
|
+
library.noConflict(name);
|
37
42
|
}
|
38
|
-
}
|
39
|
-
|
43
|
+
};
|
44
|
+
|
45
|
+
keyboardFactory = function(env) {
|
46
|
+
var keyboardJS = {}, locales, locale, map, macros, activeKeys = [], bindings = [], activeBindings = [], activeMacros = [];
|
40
47
|
|
41
48
|
//INDEXOF POLLYFILL
|
42
49
|
[].indexOf||(Array.prototype.indexOf=function(a,b,c){for(c=this.length,b=(c+~~b)%c;b<c&&(!(b in this)||this[b]!==a);b++);return b^c?b:-1;});
|
@@ -218,7 +225,7 @@
|
|
218
225
|
}
|
219
226
|
|
220
227
|
//If you create a new locale please submit it as a pull request or post it in the issue tracker at
|
221
|
-
// http://github.com/RobertWhurst/
|
228
|
+
// http://github.com/RobertWhurst/keyboardJS/issues/
|
222
229
|
};
|
223
230
|
locale = 'us';
|
224
231
|
map = locales[locale].map;
|
@@ -235,39 +242,39 @@
|
|
235
242
|
throw new Error('Cannot bind to keydown event. Both addEventListener and attachEvent are unsupported by your browser.');
|
236
243
|
}
|
237
244
|
|
238
|
-
|
239
|
-
|
245
|
+
keyboardJS.enable = function() {
|
246
|
+
keyboardJS.enabled = true;
|
240
247
|
};
|
241
248
|
|
242
|
-
|
243
|
-
|
249
|
+
keyboardJS.disable = function() {
|
250
|
+
keyboardJS.enabled = false;
|
244
251
|
};
|
245
252
|
|
246
|
-
|
247
|
-
|
253
|
+
keyboardJS.toggle = function() {
|
254
|
+
keyboardJS.enabled = !keyboardJS.enabled;
|
248
255
|
};
|
249
256
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
257
|
+
keyboardJS.enabled = true;
|
258
|
+
keyboardJS.activeKeys = getActiveKeys;
|
259
|
+
keyboardJS.on = createBinding;
|
260
|
+
keyboardJS.clear = removeBindingByKeyCombo;
|
261
|
+
keyboardJS.clear.key = removeBindingByKeyName;
|
262
|
+
keyboardJS.locale = getSetLocale;
|
263
|
+
keyboardJS.locale.register = registerLocale;
|
264
|
+
keyboardJS.macro = createMacro;
|
265
|
+
keyboardJS.macro.remove = removeMacro;
|
266
|
+
keyboardJS.getKey = getKeyName;
|
267
|
+
keyboardJS.combo = {};
|
268
|
+
keyboardJS.combo.parse = parseKeyCombo;
|
269
|
+
keyboardJS.combo.stringify = stringifyKeyCombo;
|
263
270
|
|
264
271
|
window.map = map;
|
265
272
|
window.macros = macros;
|
266
273
|
|
267
|
-
return
|
274
|
+
return keyboardJS;
|
268
275
|
|
269
276
|
function keydown(event) {
|
270
|
-
if (!
|
277
|
+
if (!keyboardJS.enabled) { return; }
|
271
278
|
|
272
279
|
var keyNames, kI;
|
273
280
|
keyNames = getKeyName(event.keyCode);
|
@@ -279,7 +286,6 @@
|
|
279
286
|
executeBindings(event);
|
280
287
|
}
|
281
288
|
function keyup(event) {
|
282
|
-
if (!KeyboardJS.enabled) { return; }
|
283
289
|
|
284
290
|
var keyNames, kI;
|
285
291
|
keyNames = getKeyName(event.keyCode);
|
@@ -287,13 +293,13 @@
|
|
287
293
|
for(kI = 0; kI < keyNames.length; kI += 1) {
|
288
294
|
removeActiveKey(keyNames[kI]);
|
289
295
|
}
|
296
|
+
if (!keyboardJS.enabled) { return; }
|
290
297
|
pruneMacros();
|
291
298
|
pruneBindings(event);
|
292
299
|
}
|
293
300
|
function blur(event) {
|
294
|
-
if (!KeyboardJS.enabled) { return; }
|
295
|
-
|
296
301
|
activeKeys = [];
|
302
|
+
if (!keyboardJS.enabled) { return; }
|
297
303
|
pruneMacros();
|
298
304
|
pruneBindings(event);
|
299
305
|
}
|
@@ -423,7 +429,7 @@
|
|
423
429
|
function removeBindingByKeyCombo(keyCombo) {
|
424
430
|
var bI, binding, keyName;
|
425
431
|
for(bI = 0; bI < bindings.length; bI += 1) {
|
426
|
-
binding = bindings[
|
432
|
+
binding = bindings[bI];
|
427
433
|
if(compareCombos(keyCombo, binding.keyCombo)) {
|
428
434
|
bindings.splice(bI, 1); bI -= 1;
|
429
435
|
}
|
@@ -723,11 +729,11 @@
|
|
723
729
|
function getSetLocale(localeName) {
|
724
730
|
if(!localeName) {
|
725
731
|
if(typeof localeName !== 'string') { throw new Error('Cannot set locale. The locale name must be a string.'); }
|
726
|
-
if(!locales[localeName]) { throw new Error('Cannot set locale to ' + localeName + ' because it does not exist. If you would like to submit a ' + localeName + ' locale map for
|
732
|
+
if(!locales[localeName]) { throw new Error('Cannot set locale to ' + localeName + ' because it does not exist. If you would like to submit a ' + localeName + ' locale map for keyboardJS please submit it at https://github.com/RobertWHurst/keyboardJS/issues.'); }
|
727
733
|
locale = localeName;
|
728
734
|
map = locales[locale].map;
|
729
735
|
macros = locales[locale].macros;
|
730
736
|
}
|
731
737
|
return locale;
|
732
738
|
}
|
733
|
-
}
|
739
|
+
};
|
@@ -8,8 +8,20 @@ $(document).ready(function() {
|
|
8
8
|
next : publishCommand('presentation:slide:next'),
|
9
9
|
previous : publishCommand('presentation:slide:previous'),
|
10
10
|
goto : function(tokens) {
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
var gotoSlideNumber = undefined;
|
13
|
+
|
14
|
+
if ( parseInt(tokens[0]) > 0 && parseInt(tokens[0]) < presentation.slideTotal()) {
|
15
|
+
gotoSlideNumber = parseInt(tokens[0]) - 1;
|
16
|
+
} else if (tokens[0] == 'start') {
|
17
|
+
gotoSlideNumber = 0;
|
18
|
+
} else if (tokens[0] == 'end') {
|
19
|
+
gotoSlideNumber = presentation.slideTotal() - 1;
|
20
|
+
} else {
|
21
|
+
gotoSlideNumber = presentation.slides.findClosestToQuery(presentation.currentSlide.sequence,tokens[0]) - 1;
|
22
|
+
}
|
23
|
+
|
24
|
+
$.publish('presentation:slide:location:change',gotoSlideNumber);
|
13
25
|
}
|
14
26
|
};
|
15
27
|
|
@@ -22,23 +22,20 @@
|
|
22
22
|
var self = this;
|
23
23
|
self.terminal = this.find('.td').terminal(eval, settings);
|
24
24
|
var focus = false;
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
});
|
40
|
-
}
|
41
|
-
});
|
25
|
+
|
26
|
+
self.toggle = function(focus) {
|
27
|
+
self.slideToggle('fast');
|
28
|
+
self.terminal.set_command('');
|
29
|
+
self.terminal.focus(focus);
|
30
|
+
|
31
|
+
self.terminal.attr({
|
32
|
+
scrollTop: self.terminal.attr("scrollHeight")
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
$.subscribe("console:show", function() { self.toggle(true); });
|
37
|
+
$.subscribe("console:hidden", function() { self.toggle(false); });
|
38
|
+
|
42
39
|
$('body').data('tilda', this);
|
43
40
|
this.hide();
|
44
41
|
return self;
|
@@ -76,7 +73,7 @@ $(document).ready(function() {
|
|
76
73
|
},
|
77
74
|
commands: TerminalCommands
|
78
75
|
}
|
79
|
-
|
76
|
+
|
80
77
|
$('#tilda').tilda(function(command, terminal) {
|
81
78
|
if (command.length == 0) { return; }
|
82
79
|
|
@@ -4,51 +4,105 @@
|
|
4
4
|
|
5
5
|
$(document).ready(function() {
|
6
6
|
|
7
|
-
|
8
|
-
KeyboardJS.disable();
|
9
|
-
});
|
7
|
+
KeyboardCreate('MainKeyboard');
|
10
8
|
|
11
|
-
|
12
|
-
|
9
|
+
MainKeyboard.on('graveaccent',function(){
|
10
|
+
$.publish("console:show");
|
13
11
|
});
|
14
12
|
|
15
|
-
|
13
|
+
MainKeyboard.on('space, right, pagedown, down', function(){
|
16
14
|
$.publish("presentation:slide:next");
|
17
15
|
});
|
18
16
|
|
19
|
-
|
17
|
+
MainKeyboard.on('shift + space, left, pageup, up', function(){
|
20
18
|
$.publish("presentation:slide:previous");
|
21
19
|
});
|
22
20
|
|
23
|
-
|
21
|
+
MainKeyboard.on('h, ?', function(){
|
24
22
|
$.publish("help:toggle");
|
25
23
|
});
|
26
24
|
|
27
|
-
|
25
|
+
MainKeyboard.on('b, f', function(){
|
28
26
|
$.publish("presentation:footer:toggle");
|
29
27
|
});
|
30
28
|
|
31
|
-
|
29
|
+
MainKeyboard.on('t, c', function(){
|
30
|
+
$.publish("navigation:show");
|
31
|
+
});
|
32
|
+
|
33
|
+
MainKeyboard.on('d', function(){
|
32
34
|
$.publish("debug:toggle");
|
33
35
|
});
|
34
36
|
|
35
|
-
|
37
|
+
MainKeyboard.on('n', function(){
|
36
38
|
$.publish("presentation:speaker:notes:toggle");
|
37
39
|
});
|
38
40
|
|
39
|
-
|
41
|
+
MainKeyboard.on('shift + p', function(){
|
40
42
|
$.publish("presentation:pause:toggle");
|
41
43
|
});
|
42
44
|
|
43
|
-
|
45
|
+
MainKeyboard.on('p', function(){
|
44
46
|
$.publish("presentation:preshow:toggle");
|
45
47
|
});
|
46
48
|
|
47
|
-
|
49
|
+
MainKeyboard.on('enter', function(){
|
48
50
|
$.publish("code:execute:visible")
|
49
51
|
});
|
50
52
|
|
51
|
-
|
53
|
+
MainKeyboard.on('escape', function(){
|
52
54
|
$.publish("code:execution:clear");
|
53
55
|
});
|
56
|
+
|
57
|
+
|
58
|
+
KeyboardCreate('ConsoleKeyboard');
|
59
|
+
ConsoleKeyboard.disable();
|
60
|
+
|
61
|
+
ConsoleKeyboard.on('graveaccent',function() {
|
62
|
+
$.publish("console:hidden");
|
63
|
+
});
|
64
|
+
|
65
|
+
$.subscribe("console:show", function() {
|
66
|
+
setTimeout(function() { ConsoleKeyboard.enable(); }, 50 );
|
67
|
+
MainKeyboard.disable();
|
68
|
+
});
|
69
|
+
|
70
|
+
$.subscribe("console:hidden", function() {
|
71
|
+
setTimeout(function() { MainKeyboard.enable(); }, 50 );
|
72
|
+
ConsoleKeyboard.disable();
|
73
|
+
});
|
74
|
+
|
75
|
+
KeyboardCreate('NavigationKeyboard');
|
76
|
+
NavigationKeyboard.disable();
|
77
|
+
|
78
|
+
NavigationKeyboard.on('t, c, escape',function() {
|
79
|
+
$.publish("navigation:hidden");
|
80
|
+
});
|
81
|
+
|
82
|
+
NavigationKeyboard.on('down',function() {
|
83
|
+
$.publish("navigation:down");
|
84
|
+
});
|
85
|
+
NavigationKeyboard.on('up',function() {
|
86
|
+
$.publish("navigation:up");
|
87
|
+
});
|
88
|
+
NavigationKeyboard.on('left',function() {
|
89
|
+
$.publish("navigation:left");
|
90
|
+
});
|
91
|
+
NavigationKeyboard.on('right',function() {
|
92
|
+
$.publish("navigation:right")
|
93
|
+
});
|
94
|
+
NavigationKeyboard.on('enter',function() {
|
95
|
+
$.publish("navigation:selection");
|
96
|
+
});
|
97
|
+
|
98
|
+
$.subscribe("navigation:show", function() {
|
99
|
+
setTimeout(function() { NavigationKeyboard.enable(); }, 50 );
|
100
|
+
MainKeyboard.disable();
|
101
|
+
});
|
102
|
+
|
103
|
+
$.subscribe("navigation:hidden", function() {
|
104
|
+
setTimeout(function() { MainKeyboard.enable(); }, 50 );
|
105
|
+
NavigationKeyboard.disable();
|
106
|
+
});
|
107
|
+
|
54
108
|
});
|
data/lib/public/js/parade.js
CHANGED
@@ -1,47 +1,3 @@
|
|
1
|
-
function ListMenu(s) {
|
2
|
-
this.slide = s
|
3
|
-
this.typeName = 'ListMenu'
|
4
|
-
this.itemLength = 0;
|
5
|
-
this.items = new Array();
|
6
|
-
this.addItem = function (key, text, slide) {
|
7
|
-
if (key.length > 1) {
|
8
|
-
thisKey = key.shift()
|
9
|
-
if (!this.items[thisKey]) {
|
10
|
-
this.items[thisKey] = new ListMenu(slide)
|
11
|
-
}
|
12
|
-
this.items[thisKey].addItem(key, text, slide)
|
13
|
-
} else {
|
14
|
-
thisKey = key.shift()
|
15
|
-
this.items[thisKey] = new ListMenuItem(text, slide)
|
16
|
-
}
|
17
|
-
}
|
18
|
-
this.getList = function() {
|
19
|
-
var newMenu = $("<ul>")
|
20
|
-
for(var i in this.items) {
|
21
|
-
var item = this.items[i]
|
22
|
-
var domItem = $("<li>")
|
23
|
-
if (item.typeName == 'ListMenu') {
|
24
|
-
choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + i + "</a>")
|
25
|
-
domItem.append(choice)
|
26
|
-
domItem.append(item.getList())
|
27
|
-
}
|
28
|
-
if (item.typeName == 'ListMenuItem') {
|
29
|
-
choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + item.slide + '. ' + item.textName + "</a>")
|
30
|
-
domItem.append(choice)
|
31
|
-
}
|
32
|
-
newMenu.append(domItem)
|
33
|
-
}
|
34
|
-
return newMenu
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
function ListMenuItem(t, s) {
|
39
|
-
this.typeName = "ListMenuItem"
|
40
|
-
this.slide = s
|
41
|
-
this.textName = t
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
1
|
$(document).ready(function() {
|
46
2
|
|
47
3
|
window.Preshow = Spine.Class.create({
|
@@ -270,6 +226,23 @@ $(document).ready(function() {
|
|
270
226
|
this.maxSlides = arguments[2];
|
271
227
|
|
272
228
|
this.transition = this.htmlContent.attr('data-transition');
|
229
|
+
this.sequence = parseInt(this.htmlContent.attr('data-sequence'));
|
230
|
+
this.title = this.htmlContent.attr('data-title');
|
231
|
+
|
232
|
+
if (this.title === undefined) {
|
233
|
+
this.title = this.htmlContent.text().trim().split("\n")[0];
|
234
|
+
|
235
|
+
if (this.title.length > 20) {
|
236
|
+
this.title = this.title.substr(0,15) + "...";
|
237
|
+
}
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
this.sections = [];
|
242
|
+
|
243
|
+
if (this.htmlContent.attr('data-sections') != undefined) {
|
244
|
+
this.sections = this.htmlContent.attr('data-sections').split(',');
|
245
|
+
}
|
273
246
|
|
274
247
|
this.increments = this.htmlContent.find(".incremental > ul > li");
|
275
248
|
this.currentIncrement = 0;
|
@@ -289,7 +262,11 @@ $(document).ready(function() {
|
|
289
262
|
var increment = this.increments.eq(incrementIndex);
|
290
263
|
|
291
264
|
if (this.codeIncremental && increment.hasClass('command')) {
|
292
|
-
|
265
|
+
|
266
|
+
var typeInputOverDuration = increment.find('.input').text().length / 24;
|
267
|
+
|
268
|
+
increment.find('.prompt').css('visibility', 'visible');
|
269
|
+
increment.find('.input').css('visibility', 'visible').jTypeWriter({duration:typeInputOverDuration});
|
293
270
|
} else {
|
294
271
|
increment.css('visibility', 'visible');
|
295
272
|
}
|
@@ -354,6 +331,34 @@ $(document).ready(function() {
|
|
354
331
|
},
|
355
332
|
at: function(index) {
|
356
333
|
return new Slide($(this.slides.eq(index)),index,this.size());
|
334
|
+
},
|
335
|
+
find: function(query) {
|
336
|
+
var regexQuery = new RegExp(query,"i");
|
337
|
+
var matchedSlideNumbers = [];
|
338
|
+
for (var index = 0; index < this.size(); index++) {
|
339
|
+
var slide = this.at(index);
|
340
|
+
// console.log(slide.title + " " + regexQuery);
|
341
|
+
if (regexQuery.exec(slide.title)) { matchedSlideNumbers.push(slide.sequence); }
|
342
|
+
}
|
343
|
+
console.log("Found: " + matchedSlideNumbers);
|
344
|
+
return matchedSlideNumbers;
|
345
|
+
},
|
346
|
+
findClosestToQuery: function(position,query) {
|
347
|
+
console.log('Finding the query `' + query + '` next to position ' + position);
|
348
|
+
var matchingSlides = this.find(query);
|
349
|
+
|
350
|
+
var closestPosition = matchingSlides[0];
|
351
|
+
console.log('Defaulting to ' + closestPosition);
|
352
|
+
|
353
|
+
for (var mI = 0; mI < matchingSlides.length; mI++) {
|
354
|
+
if (matchingSlides[mI] > position) {
|
355
|
+
console.log('Setting movement to ' + matchingSlides[mI]);
|
356
|
+
closestPosition = matchingSlides[mI];
|
357
|
+
break;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
361
|
+
return closestPosition;
|
357
362
|
}
|
358
363
|
});
|
359
364
|
|
@@ -364,19 +369,14 @@ $(document).ready(function() {
|
|
364
369
|
},
|
365
370
|
populate: function(slides) {
|
366
371
|
|
367
|
-
var menu = new ListMenu()
|
368
|
-
|
369
|
-
slides.each(function(slideCount, slideElement) {
|
370
|
-
|
371
|
-
// TODO: by default the menu is populated with the html,
|
372
|
-
// allow the user to specify some metadata
|
373
|
-
|
374
|
-
content = $(slideElement).children(".content")
|
375
|
-
shortTitle = $(content).text().substr(0, 20)
|
376
|
-
path = $(content).attr('ref').split('/')
|
372
|
+
var menu = new ListMenu();
|
377
373
|
|
378
|
-
|
379
|
-
|
374
|
+
for (var i = 0; i < slides.size(); i++) {
|
375
|
+
var slide = slides.at(i);
|
376
|
+
var sectionsMinusRoot = slide.sections.slice(1,slide.sections.length);
|
377
|
+
sectionsMinusRoot.push(slide.sequence);
|
378
|
+
menu.addItem(sectionsMinusRoot, slide.title, slide.sequence);
|
379
|
+
}
|
380
380
|
|
381
381
|
this.menuView.html(menu.getList());
|
382
382
|
|
@@ -397,9 +397,60 @@ $(document).ready(function() {
|
|
397
397
|
},
|
398
398
|
open: function() {
|
399
399
|
this.element.trigger('click');
|
400
|
+
},
|
401
|
+
createMenu: function(slide) {
|
402
|
+
console.log(this);
|
403
|
+
function menu(slide) {
|
404
|
+
console.log(this);
|
405
|
+
}
|
400
406
|
}
|
401
407
|
});
|
402
408
|
|
409
|
+
function ListMenu(slide) {
|
410
|
+
this.slide = slide
|
411
|
+
this.typeName = 'ListMenu'
|
412
|
+
this.itemLength = 0;
|
413
|
+
this.items = new Array();
|
414
|
+
|
415
|
+
this.addItem = function (key, text, slide) {
|
416
|
+
if (key.length > 1) {
|
417
|
+
thisKey = key.shift()
|
418
|
+
if (!this.items[thisKey]) {
|
419
|
+
this.items[thisKey] = new ListMenu(slide)
|
420
|
+
}
|
421
|
+
this.items[thisKey].addItem(key, text, slide)
|
422
|
+
} else {
|
423
|
+
thisKey = key.shift()
|
424
|
+
this.items[thisKey] = new ListMenuItem(text, slide)
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
this.getList = function() {
|
429
|
+
var newMenu = $("<ul>");
|
430
|
+
for(var i in this.items) {
|
431
|
+
var item = this.items[i];
|
432
|
+
var domItem = $("<li>");
|
433
|
+
if (item.typeName == 'ListMenu') {
|
434
|
+
choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + i + "</a>");
|
435
|
+
domItem.append(choice);
|
436
|
+
domItem.append(item.getList());
|
437
|
+
}
|
438
|
+
if (item.typeName == 'ListMenuItem') {
|
439
|
+
choice = $("<a rel=\"" + (item.slide - 1) + "\" href=\"#\">" + item.slide + '. ' + item.textName + "</a>");
|
440
|
+
domItem.append(choice);
|
441
|
+
}
|
442
|
+
newMenu.append(domItem);
|
443
|
+
}
|
444
|
+
return newMenu;
|
445
|
+
}
|
446
|
+
|
447
|
+
}
|
448
|
+
|
449
|
+
function ListMenuItem(t, s) {
|
450
|
+
this.typeName = "ListMenuItem"
|
451
|
+
this.slide = s
|
452
|
+
this.textName = t
|
453
|
+
}
|
403
454
|
|
404
455
|
window.Presentation = Spine.Class.create({
|
405
456
|
slides: new Slides(),
|
@@ -421,7 +472,6 @@ $(document).ready(function() {
|
|
421
472
|
|
422
473
|
this.slides.show();
|
423
474
|
|
424
|
-
// TODO: Another entity to center the slides should be put in place
|
425
475
|
this.centerSlides();
|
426
476
|
|
427
477
|
// Copy the slides into the presentation area
|
@@ -434,7 +484,8 @@ $(document).ready(function() {
|
|
434
484
|
});
|
435
485
|
|
436
486
|
this.navigationMenu.hide();
|
437
|
-
|
487
|
+
|
488
|
+
this.navigationMenu.populate(this.slides);
|
438
489
|
|
439
490
|
$.subscribe("presentation:slide:location:change",$.proxy(function(event,slideIndex) {
|
440
491
|
this.gotoSlide(slideIndex);
|
@@ -481,7 +532,6 @@ $(document).ready(function() {
|
|
481
532
|
|
482
533
|
},
|
483
534
|
centerSlides: function() {
|
484
|
-
console.log("Centering Slides");
|
485
535
|
var presentation = this;
|
486
536
|
this.slides.slides.each(function(s,slide) {
|
487
537
|
presentation.centerSlide(slide);
|
@@ -489,13 +539,17 @@ $(document).ready(function() {
|
|
489
539
|
},
|
490
540
|
centerSlide: function(slide) {
|
491
541
|
var slideObject = $(slide);
|
492
|
-
var
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
542
|
+
var slideContent = slideObject.children(".content.vertical-center").first();
|
543
|
+
|
544
|
+
if (slideContent) {
|
545
|
+
var height = slideContent.height();
|
546
|
+
var marginTop = (0.5 * parseFloat(slideObject.height())) - (0.5 * parseFloat(height));
|
547
|
+
if (marginTop < 0) {
|
548
|
+
marginTop = 0;
|
549
|
+
}
|
550
|
+
slideContent.css('margin-top', marginTop);
|
497
551
|
}
|
498
|
-
|
552
|
+
|
499
553
|
},
|
500
554
|
showFirstSlide: function() {
|
501
555
|
this.slidenum = WindowToSlideLocation.location();
|
@@ -529,30 +583,38 @@ $(document).ready(function() {
|
|
529
583
|
showSlide: function() {
|
530
584
|
|
531
585
|
if(this.slidenum < 0) {
|
532
|
-
this.slidenum = 0
|
533
|
-
return
|
586
|
+
this.slidenum = 0;
|
587
|
+
return;
|
534
588
|
}
|
535
589
|
|
536
590
|
var maxSlides = this.slideTotal();
|
537
591
|
|
538
592
|
if(this.slidenum > (maxSlides - 1)) {
|
539
|
-
this.slidenum = maxSlides - 1
|
540
|
-
return
|
593
|
+
this.slidenum = maxSlides - 1;
|
594
|
+
return;
|
541
595
|
}
|
542
596
|
|
543
597
|
var currentSlide = this.currentSlide;
|
598
|
+
var futureSlide = this.slides.at(this.slidenum);
|
544
599
|
|
545
|
-
var transition =
|
546
|
-
var slideIsFullPage =
|
600
|
+
var transition = futureSlide.transition;
|
601
|
+
var slideIsFullPage = futureSlide.isFullPage();
|
547
602
|
|
548
603
|
if (slideIsFullPage) {
|
549
604
|
transition = 'none';
|
550
605
|
}
|
551
606
|
|
607
|
+
// currentSlide.trigger("parade:willDisappear");
|
608
|
+
// futureSlide.trigger("parade:willAppear");
|
609
|
+
|
610
|
+
$.publish('code:execution:clear');
|
552
611
|
$.publish("presentation:slide:willChange",[ this.slidenum, maxSlides ]);
|
553
612
|
this.presentationFrame.cycle(this.slidenum, transition);
|
613
|
+
this.currentSlide = futureSlide;
|
554
614
|
$.publish("presentation:slide:didChange",[ this.slidenum, maxSlides ]);
|
555
615
|
|
616
|
+
currentSlide.trigger("parade:didDisappear");
|
617
|
+
|
556
618
|
if (slideIsFullPage) {
|
557
619
|
this.presentationFrame.css({'width' : '100%', 'overflow' : 'visible'});
|
558
620
|
currentSlide.goFullPage();
|
@@ -562,11 +624,10 @@ $(document).ready(function() {
|
|
562
624
|
|
563
625
|
WindowToSlideLocation.updateLocation(this.slidenum + 1);
|
564
626
|
|
565
|
-
|
566
|
-
|
567
|
-
currentSlide.trigger("parade:show");
|
627
|
+
// futureSlide.trigger("parade:didAppear");
|
628
|
+
futureSlide.trigger("parade:show");
|
568
629
|
|
569
|
-
return
|
630
|
+
return futureSlide.notes();
|
570
631
|
},
|
571
632
|
nextStep: function() {
|
572
633
|
|
@@ -664,12 +725,4 @@ $(document).ready(function() {
|
|
664
725
|
/* window.onscroll = scrolled; */
|
665
726
|
/* window.onunload = unloaded; */
|
666
727
|
|
667
|
-
$('buttonNav.prev').click(function(){
|
668
|
-
$.publish("presentation:slide:previous");
|
669
|
-
});
|
670
|
-
|
671
|
-
$('buttonNav.next').click(function(){
|
672
|
-
$.publish("presentation:slide:next");
|
673
|
-
});
|
674
|
-
|
675
728
|
});
|