rhet-butler 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +6 -14
  2. data/default-configuration/assets/fonts.googleapis.com/css/family=Arimo:700|Droid Sans Mono|Cinzel Decorative:700,900|Slackey,subset=latin,latin-ext +30 -0
  3. data/default-configuration/assets/fonts.gstatic.com/s/arimo/v12/P5sBzZCDf9_T_1Wi4TRNrZc.ttf +0 -0
  4. data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZQa9lESTQ.ttf +0 -0
  5. data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZoadlESTQ.ttf +0 -0
  6. data/default-configuration/assets/fonts.gstatic.com/s/droidsansmono/v10/6NUO8FuJNQ2MbkrZ5-J8lKFrp7pRef2u.ttf +0 -0
  7. data/default-configuration/assets/fonts.gstatic.com/s/slackey/v9/N0bV2SdQO-5yM0-dGlNQIQ.ttf +0 -0
  8. data/default-configuration/assets/javascript/presenter.js +317 -0
  9. data/default-configuration/assets/javascript/rhet-butler/child-step.js +13 -0
  10. data/default-configuration/assets/javascript/rhet-butler/step.js +197 -0
  11. data/default-configuration/assets/javascript/rhet-butler/steps/group.js +50 -0
  12. data/default-configuration/assets/javascript/rhet-butler/steps/item.js +60 -0
  13. data/default-configuration/assets/javascript/rhet-butler/steps/root.js +41 -0
  14. data/default-configuration/assets/javascript/rhet-butler/steps/slide.js +96 -0
  15. data/default-configuration/assets/javascript/rhet-butler/transition-states.js +173 -0
  16. data/default-configuration/assets/javascript/rhet-butler/transition-station.js +133 -0
  17. data/default-configuration/assets/javascript/rhet-butler/transition-stations.js +107 -0
  18. data/default-configuration/assets/javascript/rhet-butler/tree-builder.js +103 -0
  19. data/default-configuration/assets/javascript/utils.js +78 -0
  20. data/default-configuration/assets/stylesheets/font.sass +5 -9
  21. data/default-configuration/common/templates/presentation.html.erb +5 -5
  22. data/lib/rhet-butler/file-loading.rb +1 -1
  23. data/lib/rhet-butler/stasis/transform-queue.rb +2 -0
  24. data/spec/command-line.rb +1 -0
  25. data/spec/configuration.rb +27 -0
  26. data/spec/javascripts/fixtures/long-animation-group-1.html +19 -0
  27. data/spec/javascripts/fixtures/long-transition-group-1.html +10 -0
  28. data/spec/javascripts/fixtures/looped-animation-group-1.html +20 -0
  29. data/spec/javascripts/fixtures/quiet_console.js +2 -0
  30. data/spec/javascripts/fixtures/test-presentation.html +49 -0
  31. data/spec/javascripts/helpers/.gitkeep +0 -0
  32. data/spec/javascripts/helpers/jasmine-jquery.js +841 -0
  33. data/spec/javascripts/helpers/jj-fixture-path.js +3 -0
  34. data/spec/javascripts/helpers/jquery-3.4.0.min.js +2 -0
  35. data/spec/javascripts/present_spec.js +728 -0
  36. data/spec/javascripts/support/jasmine.yml +148 -0
  37. data/spec/javascripts/support/jasmine_helper.rb +23 -0
  38. data/spec/javascripts/support/run.html.erb +22 -0
  39. data/spec/javascripts/utils_spec.js +7 -0
  40. data/spec/main-app.rb +18 -0
  41. data/spec/messaging.rb +32 -0
  42. data/spec/presentation-view.rb +4 -4
  43. data/spec/resource-localizer.rb +37 -0
  44. data/spec/sass-functions.rb +25 -0
  45. data/spec/slide-loader.rb +1 -1
  46. data/spec/slide-rendering.rb +58 -0
  47. data/spec/static-generator.rb +54 -0
  48. metadata +211 -178
  49. data/default-configuration/assets/javascript/rhet-present.js +0 -855
  50. data/default-configuration/assets/javascript/rhet-present.min.js +0 -55
  51. data/default-configuration/assets/stylesheets/animate/attention/._pulse.scss.swp +0 -0
  52. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/arimo/v5/K-bXE71xZHgbUS_UdQjugvesZW2xOQ-xsNqO47m55DA.ttf +0 -0
  53. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9wIh9oxuYcmvOvyh_107lQs.ttf +0 -0
  54. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9zCUrkmwPfdnoTjOU_kXqBI.ttf +0 -0
  55. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJYW_AySPyikQrZReizgrnuw.ttf +0 -0
  56. data/default-configuration/assets/themes.googleusercontent.com/static/fonts/slackey/v3/bJZDrYrGx8atJRHR9DVdqg.ttf +0 -0
  57. data/default-configuration/skels/slides.yaml +0 -7
@@ -1,855 +0,0 @@
1
- /*
2
- * RhetButler presentation Javascript (version 0.5
3
- * Build date: 12-05-2013
4
- *
5
- * Copyright 2013 Judson Lester (@judsonlester)
6
- *
7
- * Inspired by impress.js by
8
- * Bartek Szopka (@bartaz)
9
- *
10
- * Released under the MIT and GPL Licenses.
11
- */
12
- var rhetButler = {};
13
- (function() {
14
- var b = rhetButler;
15
- b.arrayify = function(a) {
16
- return[].slice.call(a)
17
- };
18
- b.$$ = function(a, b) {
19
- b = b || document;
20
- return this.arrayify(b.querySelectorAll(a))
21
- };
22
- b.byId = function(a) {
23
- return document.getElementById(a)
24
- };
25
- b.triggerEvent = function(a, b, d) {
26
- var e = document.createEvent("CustomEvent");
27
- e.initCustomEvent(b, !0, !0, d);
28
- a.dispatchEvent(e)
29
- };
30
- var a = "Webkit webkit moz Moz o O ms khtml Khtml".split(" ");
31
- b.pfx = function() {
32
- var c = window.getComputedStyle(document.createElement("dummy")), b = {};
33
- return function(d) {
34
- if("undefined" === typeof b[d]) {
35
- var e, f;
36
- e = d.replace(/-[a-z]/g, function(a) {
37
- return a.slice(-1)[0].toUpperCase()
38
- });
39
- f = [d, e];
40
- e = e.replace(/^[a-z]/, function(a) {
41
- return a.toUpperCase()
42
- });
43
- var h = a.forEach(function(a) {
44
- f.push(a + d);
45
- f.push(a + e);
46
- f.push(a + "-" + d);
47
- f.push(a + "-" + e);
48
- f.push("-" + a + "-" + d);
49
- f.push("-" + a + "-" + e)
50
- });
51
- f = f.concat(h);
52
- b[d] = null;
53
- for(var k in f) {
54
- if(h = c.getPropertyValue(f[k]), null !== h && void 0 !== h) {
55
- b[d] = f[k];
56
- break
57
- }
58
- }
59
- }
60
- return b[d]
61
- }
62
- }()
63
- })();
64
- rhetButler.Step = function(b) {
65
- this.element = b;
66
- this.groups = [];
67
- this.steps = []
68
- };
69
- (function() {
70
- var b = rhetButler.Step.prototype;
71
- b.toString = function() {
72
- return"A Step " + this.element.id
73
- };
74
- b.setup = function(a, c) {
75
- this.element = a;
76
- this.children = [];
77
- this.indexes = {};
78
- this.childrenById = {};
79
- for(field in c) {
80
- this.indexes[field] = c[field]
81
- }
82
- this.element.classList.add("future");
83
- this.nextItem = this.prevItem = this.lastItem = this.firstItem = this.nextSlide = this.prevSlide = this.lastSlide = this.firstSlide = null
84
- };
85
- b.treeFinished = function() {
86
- };
87
- b.addClass = function(a) {
88
- this.element.classList.add(a)
89
- };
90
- b.removeClass = function(a) {
91
- a instanceof RegExp ? Array.prototype.forEach.call(this.element.classList, function(c) {
92
- a.test(c) && this.element.classList.remove(c)
93
- }, this) : this.element.classList.remove(a)
94
- };
95
- b.hasClass = function(a) {
96
- return this.element.classList.contains(a)
97
- };
98
- b.beginDeparture = function() {
99
- this.addClass("previous");
100
- this.removeClass("current");
101
- this.parent.beginDeparture()
102
- };
103
- b.completeDeparture = function() {
104
- this.removeClass("previous");
105
- this.removeClass("present");
106
- this.removeClass("future");
107
- this.removeClass("current");
108
- this.addClass("past");
109
- this.parent.completeDeparture()
110
- };
111
- b.beginArrival = function() {
112
- this.addClass("next");
113
- this.parent.beginArrival()
114
- };
115
- b.completeArrival = function() {
116
- this.removeClass("next");
117
- this.addClass("current");
118
- this.removeClass("future");
119
- this.removeClass("past");
120
- this.addClass("present");
121
- this.parent.completeArrival()
122
- };
123
- b.cancelArrival = function() {
124
- this.removeClass("next")
125
- };
126
- b.eachStep = function(a) {
127
- a(this);
128
- this.children.forEach(function(c) {
129
- c.eachStep(a)
130
- })
131
- };
132
- b.relativeLevelPosition = function(a, c) {
133
- if(!c) {
134
- return["none", "same", a]
135
- }
136
- var b = c.indexes[a] - this.indexes[a];
137
- return-1 > b ? ["jump", "backwards", "by-" + a] : -1 == b ? ["advance", "backwards", "by-" + a] : 1 == b ? ["advance", "forwards", "by-" + a] : 1 < b ? ["jump", "forwards", "by-" + a] : ["none", "same", "by-" + a]
138
- };
139
- b.relativePosition = function(a) {
140
- var c = this.relativeLevelPosition("slide", a);
141
- "none" == c[0] && (c = this.relativeLevelPosition("item", a));
142
- return c
143
- };
144
- b.addChild = function(a) {
145
- this.debugAssoc("Xanc", a);
146
- var c = this.children.slice(-1)[0];
147
- c && (this.debugAssoc("Xalc", c), a.addPrevStep(c), c.addNextStep(a));
148
- this.children.push(a);
149
- this.addDescendant(a)
150
- };
151
- b.addDescendant = function(a) {
152
- this.childrenById[a.element.id] = a;
153
- a instanceof rhetButler.Steps.Slide && (this.lastSlide = a, null == this.firstSlide && (this.firstItem = this.firstSlide = a, null != this.prevSlide && (this.prevSlide.addNextSlide(a), a.addPrevSlide(this.prevSlide))));
154
- a instanceof rhetButler.Steps.Item && (this.lastItem = a);
155
- this.propagateDescendant(a)
156
- };
157
- b.lastChild = function() {
158
- return 0 < this.children.length ? this.children.slice(-1)[0] : this
159
- };
160
- b.debugAssoc = function(a, c) {
161
- };
162
- b.addNextRoot = function(a) {
163
- this.debugAssoc("Xnr", a)
164
- };
165
- b.addPrevRoot = function(a) {
166
- this.debugAssoc("Xpr", a)
167
- };
168
- b.addNextGroup = function(a) {
169
- this.debugAssoc("Xng", a)
170
- };
171
- b.addPrevGroup = function(a) {
172
- this.debugAssoc("Xpg", a)
173
- };
174
- b.addNextSlide = function(a) {
175
- this.debugAssoc("Xns", a)
176
- };
177
- b.addPrevSlide = function(a) {
178
- this.debugAssoc("Xps", a)
179
- };
180
- b.addNextItem = function(a) {
181
- this.debugAssoc("Xni", a)
182
- };
183
- b.addPrevItem = function(a) {
184
- this.debugAssoc("Xpi", a)
185
- }
186
- })();
187
- rhetButler.ChildStep = function() {
188
- };
189
- rhetButler.ChildStep.prototype = new rhetButler.Step;
190
- (function() {
191
- var b = rhetButler.ChildStep.prototype, a = rhetButler.Step.prototype;
192
- b.setup = function(c, b, d) {
193
- this.parent = c;
194
- a.setup.call(this, b, d);
195
- this.parent.addChild(this)
196
- };
197
- b.propagateDescendant = function(a) {
198
- this.parent.addDescendant(a)
199
- }
200
- })();
201
- rhetButler.Steps = {};
202
- rhetButler.Steps.Group = function(b, a, c) {
203
- this.setup(b, a, c)
204
- };
205
- rhetButler.Steps.Group.prototype = new rhetButler.ChildStep;
206
- (function() {
207
- var b = rhetButler.Steps.Group.prototype;
208
- b.addNextStep = function(a) {
209
- a.addPrevGroup(this)
210
- };
211
- b.addPrevStep = function(a) {
212
- a.addNextGroup(this)
213
- };
214
- b.addNextSlide = function(a) {
215
- this.debugAssoc("gns", a);
216
- this.nextSlide = a;
217
- this.lastSlide && this.lastSlide.addNextSlide(a)
218
- };
219
- b.addPrevSlide = function(a) {
220
- this.debugAssoc("gps", a);
221
- this.lastSlide || (this.lastSlide = a);
222
- this.lastItem || (this.lastItem = a.lastChild());
223
- this.prevSlide = a;
224
- this.prevItem = a.lastChild()
225
- };
226
- b.addNextGroup = function(a) {
227
- this.debugAssoc("gng", a)
228
- };
229
- b.addPrevGroup = function(a) {
230
- this.debugAssoc("gpg", a);
231
- this.lastSlide = this.prevSlide = a.lastSlide;
232
- this.lastItem = a.lastItem
233
- }
234
- })();
235
- rhetButler.Steps.Item = function(b, a, c, g) {
236
- this._cue = g;
237
- this.setup(b, a, c)
238
- };
239
- rhetButler.Steps.Item.prototype = new rhetButler.ChildStep;
240
- (function() {
241
- var b = rhetButler.Steps.Item.prototype;
242
- b.cue = function() {
243
- return this._cue
244
- };
245
- b.addChild = function(a) {
246
- this.parent.addChild(a)
247
- };
248
- b.addNextStep = function(a) {
249
- a.addPrevItem(this)
250
- };
251
- b.addPrevStep = function(a) {
252
- a.addNextItem(this)
253
- };
254
- b.addNextItem = function(a) {
255
- this.debugAssoc("ini", a);
256
- this.nextItem = a
257
- };
258
- b.addPrevItem = function(a) {
259
- this.debugAssoc("ipi", a);
260
- this.prevItem = a
261
- };
262
- b.beginDeparture = function() {
263
- this.parent.addClass("prev-" + this.cue());
264
- this.parent.removeClass(/^current-cue-.*/);
265
- this.parent.beginDeparture()
266
- };
267
- b.completeDeparture = function() {
268
- this.parent.removeClass("prev-" + this.cue());
269
- this.parent.completeDeparture()
270
- };
271
- b.beginArrival = function() {
272
- this.parent.addClass("next-" + this.cue());
273
- this.parent.beginArrival()
274
- };
275
- b.completeArrival = function() {
276
- this.parent.removeClass("next-" + this.cue());
277
- this.parent.addClass("current-" + this.cue());
278
- this.parent.completeArrival()
279
- }
280
- })();
281
- rhetButler.Steps.Root = function(b, a) {
282
- this.setup(b, a)
283
- };
284
- rhetButler.Steps.Root.prototype = new rhetButler.Step;
285
- (function() {
286
- var b = rhetButler.Steps.Root.prototype;
287
- b.propagateDescendant = function(a) {
288
- };
289
- b.addNextStep = function(a) {
290
- a.addPrevRoot(this)
291
- };
292
- b.addPrevStep = function(a) {
293
- a.addNextRoot(this)
294
- };
295
- b.beginTransition = function(a) {
296
- this.addClass("moving");
297
- this.addClass(a.startElemId());
298
- this.addClass(a.endElemId());
299
- a.direction.forEach(function(a) {
300
- this.addClass(a)
301
- }, this)
302
- };
303
- b.completeTransition = function(a) {
304
- this.removeClass("moving");
305
- this.removeClass(a.startElemId());
306
- this.removeClass(a.endElemId());
307
- a.direction.forEach(function(a) {
308
- this.removeClass(a)
309
- }, this)
310
- };
311
- b.beginArrival = function() {
312
- };
313
- b.completeArrival = function() {
314
- };
315
- b.beginDeparture = function() {
316
- };
317
- b.completeDeparture = function() {
318
- }
319
- })();
320
- rhetButler.Steps.Slide = function(b, a, c) {
321
- this.setup(b, a, c);
322
- this.items = []
323
- };
324
- rhetButler.Steps.Slide.prototype = new rhetButler.ChildStep;
325
- (function() {
326
- var b = rhetButler.Steps.Slide.prototype, a = rhetButler.Step.prototype;
327
- b.addChild = function(a) {
328
- this.items.some(function(b) {
329
- return a.cue() == b.cue()
330
- }) || this.items.push(a)
331
- };
332
- b.treeFinished = function() {
333
- var c = /^cue-(\d+)/;
334
- if(0 != this.items.length) {
335
- this.items = this.items.sort(function(a, b) {
336
- var g = parseInt(c.exec(a.cue())[1], 10), h = parseInt(c.exec(b.cue())[1], 10);
337
- return g == h ? a.cue() < b.cue() ? -1 : 1 : g < h ? -1 : 1
338
- });
339
- this.items[0].prevItem = this;
340
- this.nextItem = this.items[0];
341
- var b = Math.max.apply(void 0, this.items.map(function(a) {
342
- return a.indexes.item
343
- }));
344
- this.items.forEach(function(a) {
345
- a.indexes.item = b;
346
- b++
347
- });
348
- this.items.forEach(function(b) {
349
- b.prevSlide = this.prevSlide;
350
- a.addChild.call(this, b)
351
- }, this)
352
- }
353
- };
354
- b.addNextStep = function(a) {
355
- a.addPrevSlide(this)
356
- };
357
- b.addPrevStep = function(a) {
358
- a.addNextSlide(this)
359
- };
360
- b.addPrevGroup = function(a) {
361
- this.debugAssoc("spg", a);
362
- a.lastSlide && this.addPrevSlide(a.lastSlide)
363
- };
364
- b.addNextSlide = function(a) {
365
- this.debugAssoc("sns", a);
366
- this.nextSlide = a;
367
- this.children.forEach(function(b) {
368
- b.nextSlide = a
369
- });
370
- this.lastChild().nextItem = a
371
- };
372
- b.addPrevSlide = function(a) {
373
- this.debugAssoc("sps", a);
374
- this.prevSlide = a;
375
- this.children.forEach(function(b) {
376
- b.prevSlide = a
377
- });
378
- this.prevItem = a.lastChild()
379
- }
380
- })();
381
- rhetButler.TransitionStation = function(b) {
382
- this.step = b;
383
- this.checkIn = !1;
384
- this.eventListener = null
385
- };
386
- (function() {
387
- var b = ["transition-duration", "animation-name", "animation-iteration-count", "animation-play-state"], a = [];
388
- (function() {
389
- var b = ["TransitionEnd", "AnimationEnd"];
390
- ["webkit", "o", "MS", ""].forEach(function(c) {
391
- b.forEach(function(b) {
392
- a.push(c + b);
393
- a.push(c + b.toLowerCase())
394
- })
395
- })
396
- })();
397
- var c = rhetButler.TransitionStation.prototype;
398
- c.visit = function() {
399
- var a, b;
400
- if(this.checkIn) {
401
- return!0
402
- }
403
- a = this.getMotionStyles();
404
- this.step.addClass("am-at");
405
- this.step.removeClass("to-come");
406
- b = this.getMotionStyles();
407
- this.checkIn = !0;
408
- for(name in b) {
409
- a[name] != b[name] && (this.checkIn = !1)
410
- }
411
- this.elementHasMotion() || this.visited();
412
- this.checkIn && this.step.removeClass("am-at");
413
- return this.checkIn
414
- };
415
- c.setArriveHandler = function(a) {
416
- this.removeListener();
417
- this.eventListener = a;
418
- this.attachListener()
419
- };
420
- c.visited = function() {
421
- this.step.removeClass("to-come");
422
- this.step.addClass("has-gone");
423
- this.checkIn = !0
424
- };
425
- c.prepare = function() {
426
- this.step.addClass("to-come");
427
- this.attachListener()
428
- };
429
- c.complete = function() {
430
- this.step.removeClass("to-come");
431
- this.step.removeClass("has-gone");
432
- this.step.removeClass("am-at");
433
- this.removeListener()
434
- };
435
- c.getMotionStyles = function() {
436
- var a = window.getComputedStyle(document.getElementById(this.step.element.id)), c = {};
437
- b.map(function(b) {
438
- c[b] = a.getPropertyValue(rhetButler.pfx(b))
439
- });
440
- return c
441
- };
442
- c.elementHasMotion = function() {
443
- var a = this.getMotionStyles(), b = [], c;
444
- a["transition-duration"] && (b = a["transition-duration"].split(/\s*,\s*/));
445
- if(!b.every(function(a) {
446
- return"0s" == a
447
- })) {
448
- return!0
449
- }
450
- if(null == a["animation-name"] || "none" == a["animation-name"]) {
451
- return!1
452
- }
453
- b = a["animation-play-state"].split(/\s*,\s*/);
454
- c = a["animation-iteration-count"].split(/\s*,\s*/);
455
- b.length < c.length ? b = b.concat(b) : c = c.concat(c);
456
- return b.some(function(a, b) {
457
- return"paused" != a && "infinite" != c[b]
458
- })
459
- };
460
- c.attachListener = function() {
461
- this.eventListener && a.forEach(function(a) {
462
- this.step.element.addEventListener(a, this.eventListener, !0)
463
- }, this)
464
- };
465
- c.removeListener = function() {
466
- this.eventListener && a.forEach(function(a) {
467
- this.step.element.removeEventListener(a, this.eventListener, !0)
468
- }, this)
469
- }
470
- })();
471
- rhetButler.TransitionStations = function(b, a, c, g) {
472
- this.presenter = b;
473
- this.uphill = [];
474
- this.uphillIndex = 0;
475
- this.downhill = [];
476
- this.downhillIndex = 0;
477
- this.firstStep = a;
478
- this.currentStep = c;
479
- this.lastStep = g;
480
- this.buildList();
481
- this.currentState = null;
482
- this.changeState("preparing")
483
- };
484
- (function() {
485
- var b = rhetButler.TransitionStations.prototype, a = {preparing:{}, uphill:{}, downhill:{}, cancelled:{}, arrived:{}}, c = {enter:function() {
486
- }, start:function() {
487
- }, cancel:function() {
488
- this.changeState("cancelled")
489
- }, forceFinish:function() {
490
- console.log("Force Finish")
491
- }, finish:function() {
492
- }, currentLeg:function() {
493
- return[]
494
- }, enterState:function() {
495
- }, resumeStep:function() {
496
- return this.firstStep
497
- }, currentStation:function() {
498
- return null
499
- }, advanceStation:function() {
500
- }, nextStation:function() {
501
- this.currentStation().visit();
502
- if(this.currentStation().checkIn) {
503
- return this.advanceStation()
504
- }
505
- var a = this, b = this.currentStation();
506
- this.currentStation().setArriveHandler(function(c) {
507
- a.arriveListener(b, c)
508
- });
509
- return!1
510
- }};
511
- for(name in a) {
512
- for(func in c) {
513
- a[name][func] = c[func]
514
- }
515
- }
516
- a.preparing.enterState = function() {
517
- this.eachStation(function(a) {
518
- a.prepare()
519
- })
520
- };
521
- a.preparing.start = function() {
522
- this.changeState("uphill");
523
- this.elementArrived(this.currentStep)
524
- };
525
- a.preparing.forceFinish = function() {
526
- this.eachStation(function(a) {
527
- a.visited()
528
- });
529
- this.changeState("arrived")
530
- };
531
- a.uphill.enterState = function() {
532
- this.currentStep = this.uphill[0].step;
533
- this.presenter.rootStep.beginTransition(this);
534
- this.firstStep.beginDeparture();
535
- this.lastStep.beginArrival()
536
- };
537
- a.uphill.finish = function() {
538
- this.changeState("downhill")
539
- };
540
- a.uphill.currentLeg = function() {
541
- return this.uphill
542
- };
543
- a.uphill.currentStation = function() {
544
- return this.uphill[this.uphillIndex]
545
- };
546
- a.uphill.advanceStation = function() {
547
- this.uphillIndex++;
548
- this.uphillIndex < this.uphill.length ? this.currentStep = this.currentStation().step : this.changeState("downhill");
549
- return!0
550
- };
551
- a.downhill.currentLeg = function() {
552
- return this.downhill
553
- };
554
- a.downhill.enterState = function() {
555
- this.currentStep = this.downhill[0].step
556
- };
557
- a.downhill.currentStation = function() {
558
- return this.downhill[this.downhillIndex]
559
- };
560
- a.downhill.advanceStation = function() {
561
- this.downhillIndex++;
562
- if(this.downhillIndex < this.downhill.length) {
563
- return this.currentStep = this.currentStation().step, !0
564
- }
565
- this.changeState("arrived");
566
- return!1
567
- };
568
- a.downhill.finish = function() {
569
- this.changeState("arrived")
570
- };
571
- a.downhill.resumeStep = function() {
572
- return this.lastStep
573
- };
574
- a.cancelled.enterState = function() {
575
- this.eachStation(function(a) {
576
- a.step != this.currentStep && a.complete()
577
- }, this);
578
- this.presenter.rootStep.completeTransition(this);
579
- this.firstStep.completeDeparture();
580
- this.lastStep.cancelArrival()
581
- };
582
- a.arrived.enterState = function() {
583
- this.eachStation(function(a) {
584
- a.complete()
585
- });
586
- this.currentStep = this.lastStep;
587
- this.presenter.rootStep.completeTransition(this);
588
- this.firstStep.completeDeparture();
589
- this.lastStep.completeArrival();
590
- this.presenter.completeTransition()
591
- };
592
- a.arrived.resumeStep = function() {
593
- return this.lastStep
594
- };
595
- a.arrived.nextStation = function() {
596
- return!1
597
- };
598
- a.arrived.cancel = function() {
599
- return!1
600
- };
601
- b.changeState = function(b) {
602
- "undefined" == typeof quiet_console && console.log("Changing state: " + b + " S/C/E: " + this.firstStep.toString() + " / " + this.currentStep.toString() + " / " + this.lastStep.toString());
603
- var c = a[b];
604
- for(func in c) {
605
- this[func] = c[func]
606
- }
607
- for(stateName in a) {
608
- this.presenter.rootStep.removeClass(stateName)
609
- }
610
- this.presenter.rootStep.addClass(b);
611
- this.currentState = b;
612
- this.enterState()
613
- };
614
- b.buildList = function() {
615
- var a = this.firstStep, b = !0, c;
616
- for(this.direction = this.firstStep.relativePosition(this.lastStep);null != a;) {
617
- b = b && a != this.currentStep, c = new rhetButler.TransitionStation(a), this.uphill.push(c), b && c.visited(), a = a.parent
618
- }
619
- for(a = this.lastStep;null != a;) {
620
- this.downhill.unshift(new rhetButler.TransitionStation(a)), a = a.parent
621
- }
622
- };
623
- b.startElemId = function() {
624
- return"prev_" + this.firstStep.element.id
625
- };
626
- b.endElemId = function() {
627
- return"next_" + this.lastStep.element.id
628
- };
629
- b.eachStation = function(a) {
630
- this.uphill.forEach(a, this);
631
- this.downhill.forEach(a, this)
632
- };
633
- b.arriveListener = function(a, b) {
634
- console.log("rhet-butler/transition-stations.js:256", "event", b);
635
- b.stopPropagation();
636
- a.visited();
637
- this.elementArrived();
638
- return!0
639
- };
640
- b.elementArrived = function(a) {
641
- for(;this.nextStation();) {
642
- }
643
- "undefined" == typeof quiet_console && console.log("Waiting for event")
644
- }
645
- })();
646
- rhetButler.TreeBuilder = function(b, a) {
647
- this.root = b;
648
- this.stepClass = a;
649
- this.rootStep = null;
650
- this.parentStack = [];
651
- this.indexes = {step:0, group:0, slide:0, item:0}
652
- };
653
- (function() {
654
- var b = rhetButler.TreeBuilder.prototype;
655
- b.getParent = function(a) {
656
- for(var b, g, d;0 < this.parentStack.length;) {
657
- g = this.parentStack[0];
658
- d = g.element;
659
- for(b = a;b != d && b != this.root;) {
660
- b = b.parentElement
661
- }
662
- if(b == d) {
663
- return g
664
- }
665
- this.parentStack.shift().treeFinished()
666
- }
667
- return null
668
- };
669
- b.assembleNextElement = function(a) {
670
- var b, g = this.getParent(a);
671
- if(a.classList.contains("root")) {
672
- 0 == a.id.length && (a.id = "rhet-root"), this.rootStep = b = new rhetButler.Steps.Root(a, this.indexes), this.indexes.step++, this.parentStack.unshift(b)
673
- }else {
674
- if(a.classList.contains("group")) {
675
- this.indexes.group++, 0 == a.id.length && (a.id = "group-" + this.indexes.group), b = new rhetButler.Steps.Group(g, a, this.indexes), this.indexes.step++, this.parentStack.unshift(b)
676
- }else {
677
- if(a.classList.contains("slide")) {
678
- this.indexes.slide++, 0 == a.id.length && (a.id = "slide-" + this.indexes.slide), b = new rhetButler.Steps.Slide(g, a, this.indexes), this.indexes.step++, this.parentStack.unshift(b)
679
- }else {
680
- if(a.classList.contains("item")) {
681
- for(var d = Array.prototype.filter.call(a.classList, function(a) {
682
- return/^cue-.*/.test(a)
683
- }), e = d.length, f = 0;f < e;f++) {
684
- this.indexes.item++, 0 == a.id.length && (a.id = "item-" + this.indexes.item), b = new rhetButler.Steps.Item(g, a, this.indexes, d[f]), b.parent.items.some(function(a) {
685
- return a == b
686
- }) ? this.indexes.step++ : this.indexes.item--
687
- }
688
- }
689
- }
690
- }
691
- }
692
- };
693
- b.buildTree = function() {
694
- for(rhetButler.arrayify(this.root.getElementsByClassName(this.stepClass)).forEach(this.assembleNextElement, this);0 < this.parentStack.length;) {
695
- this.parentStack.shift().treeFinished()
696
- }
697
- return this.rootStep
698
- }
699
- })();
700
- rhetButler.Presenter = function(b, a) {
701
- this.document = b;
702
- this.body = b.body;
703
- this.window = a;
704
- this.stepsById = {};
705
- this.currentTransition = this.rootStep = null;
706
- this.nextStepIndex = this.previousStepIndex = this.nextStepIndex = this.previousSlideIndex = 0
707
- };
708
- (function() {
709
- var b = rhetButler.Presenter.prototype, a = rhetButler;
710
- b.setup = function(b) {
711
- this.root = a.byId(b);
712
- this.body.classList.remove("rhet-disabled");
713
- this.body.classList.add("rhet-enabled");
714
- a.arrayify(this.root.getElementsByClassName("rhet-butler"));
715
- this.rootStep = (new rhetButler.TreeBuilder(this.root, "rhet-butler")).buildTree();
716
- this.rootStep.eachStep(function(a) {
717
- a.addClass("future")
718
- });
719
- b = this.rootStep.firstItem;
720
- this.currentTransition = new rhetButler.TransitionStations(this, b, b, b);
721
- this.currentTransition.forceFinish();
722
- this.bindHandlers();
723
- a.triggerEvent(this.root, "rhet:init", {api:this})
724
- };
725
- b.markRange = function(a, b, d) {
726
- this.stepsList.slice(a, b).forEach(function(a) {
727
- a = this.containingElements(a);
728
- a.steps.forEach(function(a) {
729
- this.thisClassNotThose(a, d, "before", "after", "passing")
730
- }, this);
731
- a.slides.forEach(function(a) {
732
- this.thisClassNotThose(a, d, "before", "after", "passing")
733
- }, this)
734
- }, this)
735
- };
736
- b.bindHandlers = function() {
737
- var a = this;
738
- this.root.addEventListener("rhet:init", function() {
739
- var b = "";
740
- a.root.addEventListener("rhet:stepenter", function(a) {
741
- window.location.hash = b = "#/" + a.target.id
742
- }, !1);
743
- window.addEventListener("hashchange", function(d) {
744
- window.location.hash !== b && a.moveTo(a.getElementFromHash())
745
- }, !1);
746
- a.teleport(a.getElementFromHash() || a.rootStep.firstItem)
747
- }, !1)
748
- };
749
- b.resolveStep = function(a, b) {
750
- if(a instanceof rhetButler.Step) {
751
- return a
752
- }
753
- switch(a) {
754
- case "next":
755
- switch(b) {
756
- case "slide":
757
- return this.currentTransition.lastStep.nextSlide;
758
- case "item":
759
- return this.currentTransition.lastStep.nextItem;
760
- default:
761
- throw"Bad step reference: '" + a + "," + b + "'";
762
- }
763
- ;
764
- case "prev":
765
- ;
766
- case "previous":
767
- switch(b) {
768
- case "slide":
769
- return this.currentTransition.lastStep.prevSlide;
770
- case "item":
771
- return this.currentTransition.lastStep.prevItem;
772
- default:
773
- throw"Bad step reference: '" + a + "," + b + "'";
774
- }
775
- ;
776
- default:
777
- if(a in this.rootStep.childrenById) {
778
- return this.rootStep.childrenById[a]
779
- }
780
- throw"Bad slide direction: '" + a + "'";
781
- }
782
- };
783
- b.currentStep = function() {
784
- return this.currentTransition.currentStep
785
- };
786
- b.buildTransition = function(a) {
787
- var b = this.currentTransition.resumeStep(), d = this.currentTransition.currentStep;
788
- "undefined" == typeof quiet_console && console.log("New transition list: S/C/E: " + b.toString() + " / " + d.toString() + " / " + a.toString());
789
- this.currentTransition.cancel();
790
- this.currentTransition = new rhetButler.TransitionStations(this, b, d, a)
791
- };
792
- b.teleport = function(a, b) {
793
- var d = this.resolveStep(a, b);
794
- d && (this.buildTransition(d), this.currentTransition.forceFinish())
795
- };
796
- b.moveTo = function(a, b) {
797
- var d = this.resolveStep(a, b);
798
- d && (this.buildTransition(d), this.currentTransition.start())
799
- };
800
- b.completeTransition = function() {
801
- var b = document.getElementById(this.currentTransition.currentStep.element.id);
802
- a.triggerEvent(b, "rhet:stepenter", {api:this})
803
- };
804
- b.checkSupport = function() {
805
- navigator.userAgent.toLowerCase();
806
- if(null !== pfx("perspective") && body.classList && body.dataset) {
807
- return this.body.classList.remove("rhet-not-supported"), this.body.classList.add("rhet-supported"), !0
808
- }
809
- this.body.className += " rhet-not-supported ";
810
- return!1
811
- };
812
- b.getElementFromHash = function() {
813
- return window.location.hash.replace(/^#\/?/, "")
814
- };
815
- b.getStep = function(b) {
816
- "number" === typeof b ? b = 0 > b ? this.stepsList[stepsList.length + b] : this.stepsList[b] : "string" === typeof b && (b = a.byId(b));
817
- return b && b.id && this.stepsData[b.id] ? b : null
818
- };
819
- b.prev = function() {
820
- var a = this.steps.indexOf(this.activeStep) - 1, a = 0 <= a ? this.steps[a] : this.getStep(-1);
821
- return this.moveTo(a)
822
- };
823
- b.next = function() {
824
- var a = steps.indexOf(activeStep) + 1, a = a < steps.length ? steps[a] : steps[0];
825
- return this.moveTo(a)
826
- };
827
- b.thisClassNotThose = function(a, b) {
828
- var d;
829
- for(d = 2;d < arguments.length;d++) {
830
- a.classList.remove(arguments[d])
831
- }
832
- a.classList.add(b)
833
- };
834
- b.unmarkEndpoint = function(a, b) {
835
- var d = this.containingElements(this.steps[a]), e = d.slides[0];
836
- d.all.forEach(function(a) {
837
- a.classList.remove(b)
838
- });
839
- this.root.classList.remove(b + "-" + e.id)
840
- };
841
- b.markTime = function(a, b) {
842
- this.containingElements(this.steps[a]).all.forEach(function(a) {
843
- this.thisClassNotThose(a, b, "past", "present", "future")
844
- }, this)
845
- };
846
- b.markEndpoint = function(a, b) {
847
- var d = this.containingElements(this.steps[a]), e = d.slides[0];
848
- d.all.forEach(function(a) {
849
- this.thisClassNotThose(a, b, "before", "after", "passing")
850
- }, this);
851
- this.root.classList.add(b + "-" + e.id);
852
- return d
853
- }
854
- })();
855
-