slideshow-service 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +42 -0
  3. data/lib/slideshow/service/public/slideshow-deck.js/core/deck.core.css +391 -0
  4. data/lib/slideshow/service/public/slideshow-deck.js/core/deck.core.html +39 -0
  5. data/lib/slideshow/service/public/slideshow-deck.js/core/deck.core.js +460 -0
  6. data/lib/slideshow/service/public/slideshow-deck.js/core/deck.core.scss +432 -0
  7. data/lib/slideshow/service/public/slideshow-deck.js/extensions/goto/deck.goto.css +41 -0
  8. data/lib/slideshow/service/public/slideshow-deck.js/extensions/goto/deck.goto.html +6 -0
  9. data/lib/slideshow/service/public/slideshow-deck.js/extensions/goto/deck.goto.js +118 -0
  10. data/lib/slideshow/service/public/slideshow-deck.js/extensions/goto/deck.goto.scss +46 -0
  11. data/lib/slideshow/service/public/slideshow-deck.js/extensions/hash/deck.hash.css +13 -0
  12. data/lib/slideshow/service/public/slideshow-deck.js/extensions/hash/deck.hash.html +2 -0
  13. data/lib/slideshow/service/public/slideshow-deck.js/extensions/hash/deck.hash.js +126 -0
  14. data/lib/slideshow/service/public/slideshow-deck.js/extensions/hash/deck.hash.scss +15 -0
  15. data/lib/slideshow/service/public/slideshow-deck.js/extensions/menu/deck.menu.css +46 -0
  16. data/lib/slideshow/service/public/slideshow-deck.js/extensions/menu/deck.menu.js +182 -0
  17. data/lib/slideshow/service/public/slideshow-deck.js/extensions/menu/deck.menu.scss +57 -0
  18. data/lib/slideshow/service/public/slideshow-deck.js/extensions/navigation/deck.navigation.css +43 -0
  19. data/lib/slideshow/service/public/slideshow-deck.js/extensions/navigation/deck.navigation.html +3 -0
  20. data/lib/slideshow/service/public/slideshow-deck.js/extensions/navigation/deck.navigation.js +83 -0
  21. data/lib/slideshow/service/public/slideshow-deck.js/extensions/navigation/deck.navigation.scss +56 -0
  22. data/lib/slideshow/service/public/slideshow-deck.js/extensions/scale/deck.scale.css +16 -0
  23. data/lib/slideshow/service/public/slideshow-deck.js/extensions/scale/deck.scale.js +155 -0
  24. data/lib/slideshow/service/public/slideshow-deck.js/extensions/scale/deck.scale.scss +17 -0
  25. data/lib/slideshow/service/public/slideshow-deck.js/extensions/status/deck.status.css +14 -0
  26. data/lib/slideshow/service/public/slideshow-deck.js/extensions/status/deck.status.html +6 -0
  27. data/lib/slideshow/service/public/slideshow-deck.js/extensions/status/deck.status.js +83 -0
  28. data/lib/slideshow/service/public/slideshow-deck.js/extensions/status/deck.status.scss +16 -0
  29. data/lib/slideshow/service/public/slideshow-deck.js/lib/jquery-1.6.4.min.js +4 -0
  30. data/lib/slideshow/service/public/slideshow-deck.js/lib/modernizr.custom.js +4 -0
  31. data/lib/slideshow/service/public/slideshow-deck.js/slides.html +119 -0
  32. data/lib/slideshow/service/public/slideshow-deck.js/style.css +59 -0
  33. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/neon.css +114 -0
  34. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/neon.scss +139 -0
  35. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/swiss.css +75 -0
  36. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/swiss.scss +91 -0
  37. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/web-2.0.css +210 -0
  38. data/lib/slideshow/service/public/slideshow-deck.js/themes/style/web-2.0.scss +238 -0
  39. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/fade.css +44 -0
  40. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/fade.scss +70 -0
  41. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/horizontal-slide.css +79 -0
  42. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/horizontal-slide.scss +94 -0
  43. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/vertical-slide.css +97 -0
  44. data/lib/slideshow/service/public/slideshow-deck.js/themes/transition/vertical-slide.scss +116 -0
  45. data/lib/slideshow/service/version.rb +1 -1
  46. metadata +43 -1
@@ -0,0 +1,460 @@
1
+ /*!
2
+ Deck JS - deck.core
3
+ Copyright (c) 2011 Caleb Troughton
4
+ Dual licensed under the MIT license and GPL license.
5
+ https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6
+ https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
7
+ */
8
+
9
+ /*
10
+ The deck.core module provides all the basic functionality for creating and
11
+ moving through a deck. It does so by applying classes to indicate the state of
12
+ the deck and its slides, allowing CSS to take care of the visual representation
13
+ of each state. It also provides methods for navigating the deck and inspecting
14
+ its state, as well as basic key bindings for going to the next and previous
15
+ slides. More functionality is provided by wholly separate extension modules
16
+ that use the API provided by core.
17
+ */
18
+ (function($, deck, document, undefined) {
19
+ var slides, // Array of all the uh, slides...
20
+ current, // Array index of the current slide
21
+ $container, // Keeping this cached
22
+
23
+ events = {
24
+ /*
25
+ This event fires whenever the current slide changes, whether by way of
26
+ next, prev, or go. The callback function is passed two parameters, from
27
+ and to, equal to the indices of the old slide and the new slide
28
+ respectively.
29
+
30
+ $(document).bind('deck.change', function(event, from, to) {
31
+ alert('Moving from slide ' + from + ' to ' + to);
32
+ });
33
+ */
34
+ change: 'deck.change',
35
+
36
+ /*
37
+ This event fires at the end of deck initialization. Extensions should
38
+ implement any code that relies on user extensible options (key bindings,
39
+ element selectors, classes) within a handler for this event. Native
40
+ events associated with Deck JS should be scoped under a .deck event
41
+ namespace, as with the example below:
42
+
43
+ var $d = $(document);
44
+ $.deck.defaults.keys.myExtensionKeycode = 70; // 'h'
45
+ $d.bind('deck.init', function() {
46
+ $d.bind('keydown.deck', function(event) {
47
+ if (event.which === $.deck.getOptions().keys.myExtensionKeycode) {
48
+ // Rock out
49
+ }
50
+ });
51
+ });
52
+ */
53
+ initialize: 'deck.init'
54
+ },
55
+
56
+ options = {},
57
+ $d = $(document),
58
+
59
+ /*
60
+ Internal function. Updates slide and container classes based on which
61
+ slide is the current slide.
62
+ */
63
+ updateStates = function() {
64
+ var oc = options.classes,
65
+ osc = options.selectors.container,
66
+ old = $container.data('onSlide'),
67
+ $all = $();
68
+
69
+ // Container state
70
+ $container.removeClass(oc.onPrefix + old)
71
+ .addClass(oc.onPrefix + current)
72
+ .data('onSlide', current);
73
+
74
+ // Remove and re-add child-current classes for nesting
75
+ $('.' + oc.current).parentsUntil(osc).removeClass(oc.childCurrent);
76
+ slides[current].parentsUntil(osc).addClass(oc.childCurrent);
77
+
78
+ // Remove previous states
79
+ $.each(slides, function(i, el) {
80
+ $all = $all.add(el);
81
+ });
82
+ $all.removeClass([
83
+ oc.before,
84
+ oc.previous,
85
+ oc.current,
86
+ oc.next,
87
+ oc.after
88
+ ].join(" "));
89
+
90
+ // Add new states back in
91
+ slides[current].addClass(oc.current);
92
+ if (current > 0) {
93
+ slides[current-1].addClass(oc.previous);
94
+ }
95
+ if (current + 1 < slides.length) {
96
+ slides[current+1].addClass(oc.next);
97
+ }
98
+ if (current > 1) {
99
+ $.each(slides.slice(0, current - 1), function(i, el) {
100
+ el.addClass(oc.before);
101
+ });
102
+ }
103
+ if (current + 2 < slides.length) {
104
+ $.each(slides.slice(current+2), function(i, el) {
105
+ el.addClass(oc.after);
106
+ });
107
+ }
108
+ },
109
+
110
+ /* Methods exposed in the jQuery.deck namespace */
111
+ methods = {
112
+
113
+ /*
114
+ jQuery.deck(selector, options)
115
+
116
+ selector: string | jQuery | array
117
+ options: object, optional
118
+
119
+ Initializes the deck, using each element matched by selector as a slide.
120
+ May also be passed an array of string selectors or jQuery objects, in
121
+ which case each selector in the array is considered a slide. The second
122
+ parameter is an optional options object which will extend the default
123
+ values.
124
+
125
+ $.deck('.slide');
126
+
127
+ or
128
+
129
+ $.deck([
130
+ '#first-slide',
131
+ '#second-slide',
132
+ '#etc'
133
+ ]);
134
+ */
135
+ init: function(elements, opts) {
136
+ var startTouch,
137
+ tolerance,
138
+ esp = function(e) {
139
+ e.stopPropagation();
140
+ };
141
+
142
+ options = $.extend(true, {}, $[deck].defaults, opts);
143
+ slides = [];
144
+ current = 0;
145
+ $container = $(options.selectors.container);
146
+ tolerance = options.touch.swipeTolerance;
147
+
148
+ // Hide the deck while states are being applied to kill transitions
149
+ $container.addClass(options.classes.loading);
150
+
151
+ // Fill slides array depending on parameter type
152
+ if ($.isArray(elements)) {
153
+ $.each(elements, function(i, e) {
154
+ slides.push($(e));
155
+ });
156
+ }
157
+ else {
158
+ $(elements).each(function(i, e) {
159
+ slides.push($(e));
160
+ });
161
+ }
162
+
163
+ /* Remove any previous bindings, and rebind key events */
164
+ $d.unbind('keydown.deck').bind('keydown.deck', function(e) {
165
+ if (e.which === options.keys.next || $.inArray(e.which, options.keys.next) > -1) {
166
+ methods.next();
167
+ e.preventDefault();
168
+ }
169
+ else if (e.which === options.keys.previous || $.inArray(e.which, options.keys.previous) > -1) {
170
+ methods.prev();
171
+ e.preventDefault();
172
+ }
173
+ });
174
+
175
+ /* Bind touch events for swiping between slides on touch devices */
176
+ $container.unbind('touchstart.deck').bind('touchstart.deck', function(e) {
177
+ if (!startTouch) {
178
+ startTouch = $.extend({}, e.originalEvent.targetTouches[0]);
179
+ }
180
+ })
181
+ .unbind('touchmove.deck').bind('touchmove.deck', function(e) {
182
+ $.each(e.originalEvent.changedTouches, function(i, t) {
183
+ if (startTouch && t.identifier === startTouch.identifier) {
184
+ if (t.screenX - startTouch.screenX > tolerance || t.screenY - startTouch.screenY > tolerance) {
185
+ $[deck]('prev');
186
+ startTouch = undefined;
187
+ }
188
+ else if (t.screenX - startTouch.screenX < -1 * tolerance || t.screenY - startTouch.screenY < -1 * tolerance) {
189
+ $[deck]('next');
190
+ startTouch = undefined;
191
+ }
192
+ return false;
193
+ }
194
+ });
195
+ e.preventDefault();
196
+ })
197
+ .unbind('touchend.deck').bind('touchend.deck', function(t) {
198
+ $.each(t.originalEvent.changedTouches, function(i, t) {
199
+ if (startTouch && t.identifier === startTouch.identifier) {
200
+ startTouch = undefined;
201
+ }
202
+ });
203
+ })
204
+ .scrollLeft(0).scrollTop(0)
205
+ /* Stop propagation of key events within editable elements of slides */
206
+ .undelegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp)
207
+ .delegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp);
208
+
209
+ /*
210
+ Kick iframe videos, which dont like to redraw w/ transforms.
211
+ Remove this if Webkit ever fixes it.
212
+ */
213
+ $.each(slides, function(i, $el) {
214
+ $el.unbind('webkitTransitionEnd.deck').bind('webkitTransitionEnd.deck',
215
+ function(event) {
216
+ if ($el.hasClass($[deck]('getOptions').classes.current)) {
217
+ var embeds = $(this).find('iframe').css('opacity', 0);
218
+ window.setTimeout(function() {
219
+ embeds.css('opacity', 1);
220
+ }, 100);
221
+ }
222
+ });
223
+ });
224
+
225
+ updateStates();
226
+
227
+ // Show deck again now that slides are in place
228
+ $container.removeClass(options.classes.loading);
229
+ $d.trigger(events.initialize);
230
+ },
231
+
232
+ /*
233
+ jQuery.deck('go', index)
234
+
235
+ index: integer
236
+
237
+ Moves to the slide at the specified index. Index is 0-based, so
238
+ $.deck('go', 0); will move to the first slide. If index is out of bounds
239
+ or not a number the call is ignored.
240
+ */
241
+ go: function(index) {
242
+ if (typeof index != 'number' || index < 0 || index >= slides.length) return;
243
+
244
+ $d.trigger(events.change, [current, index]);
245
+ current = index;
246
+ updateStates();
247
+ },
248
+
249
+ /*
250
+ jQuery.deck('next')
251
+
252
+ Moves to the next slide. If the last slide is already active, the call
253
+ is ignored.
254
+ */
255
+ next: function() {
256
+ methods.go(current+1);
257
+ },
258
+
259
+ /*
260
+ jQuery.deck('prev')
261
+
262
+ Moves to the previous slide. If the first slide is already active, the
263
+ call is ignored.
264
+ */
265
+ prev: function() {
266
+ methods.go(current-1);
267
+ },
268
+
269
+ /*
270
+ jQuery.deck('getSlide', index)
271
+
272
+ index: integer, optional
273
+
274
+ Returns a jQuery object containing the slide at index. If index is not
275
+ specified, the current slide is returned.
276
+ */
277
+ getSlide: function(index) {
278
+ var i = typeof index !== 'undefined' ? index : current;
279
+ if (typeof i != 'number' || i < 0 || i >= slides.length) return null;
280
+ return slides[i];
281
+ },
282
+
283
+ /*
284
+ jQuery.deck('getSlides')
285
+
286
+ Returns all slides as an array of jQuery objects.
287
+ */
288
+ getSlides: function() {
289
+ return slides;
290
+ },
291
+
292
+ /*
293
+ jQuery.deck('getContainer')
294
+
295
+ Returns a jQuery object containing the deck container as defined by the
296
+ container option.
297
+ */
298
+ getContainer: function() {
299
+ return $container;
300
+ },
301
+
302
+ /*
303
+ jQuery.deck('getOptions')
304
+
305
+ Returns the options object for the deck, including any overrides that
306
+ were defined at initialization.
307
+ */
308
+ getOptions: function() {
309
+ return options;
310
+ },
311
+
312
+ /*
313
+ jQuery.deck('extend', name, method)
314
+
315
+ name: string
316
+ method: function
317
+
318
+ Adds method to the deck namespace with the key of name. This doesn’t
319
+ give access to any private member data — public methods must still be
320
+ used within method — but lets extension authors piggyback on the deck
321
+ namespace rather than pollute jQuery.
322
+
323
+ $.deck('extend', 'alert', function(msg) {
324
+ alert(msg);
325
+ });
326
+
327
+ // Alerts 'boom'
328
+ $.deck('alert', 'boom');
329
+ */
330
+ extend: function(name, method) {
331
+ methods[name] = method;
332
+ }
333
+ };
334
+
335
+ /* jQuery extension */
336
+ $[deck] = function(method, arg) {
337
+ if (methods[method]) {
338
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
339
+ }
340
+ else {
341
+ return methods.init(method, arg);
342
+ }
343
+ };
344
+
345
+ /*
346
+ The default settings object for a deck. All deck extensions should extend
347
+ this object to add defaults for any of their options.
348
+
349
+ options.classes.after
350
+ This class is added to all slides that appear after the 'next' slide.
351
+
352
+ options.classes.before
353
+ This class is added to all slides that appear before the 'previous'
354
+ slide.
355
+
356
+ options.classes.childCurrent
357
+ This class is added to all elements in the DOM tree between the
358
+ 'current' slide and the deck container. For standard slides, this is
359
+ mostly seen and used for nested slides.
360
+
361
+ options.classes.current
362
+ This class is added to the current slide.
363
+
364
+ options.classes.loading
365
+ This class is applied to the deck container during loading phases and is
366
+ primarily used as a way to short circuit transitions between states
367
+ where such transitions are distracting or unwanted. For example, this
368
+ class is applied during deck initialization and then removed to prevent
369
+ all the slides from appearing stacked and transitioning into place
370
+ on load.
371
+
372
+ options.classes.next
373
+ This class is added to the slide immediately following the 'current'
374
+ slide.
375
+
376
+ options.classes.onPrefix
377
+ This prefix, concatenated with the current slide index, is added to the
378
+ deck container as you change slides.
379
+
380
+ options.classes.previous
381
+ This class is added to the slide immediately preceding the 'current'
382
+ slide.
383
+
384
+ options.selectors.container
385
+ Elements matched by this CSS selector will be considered the deck
386
+ container. The deck container is used to scope certain states of the
387
+ deck, as with the onPrefix option, or with extensions such as deck.goto
388
+ and deck.menu.
389
+
390
+ options.keys.next
391
+ The numeric keycode used to go to the next slide.
392
+
393
+ options.keys.previous
394
+ The numeric keycode used to go to the previous slide.
395
+
396
+ options.touch.swipeTolerance
397
+ The number of pixels the users finger must travel to produce a swipe
398
+ gesture.
399
+ */
400
+ $[deck].defaults = {
401
+ classes: {
402
+ after: 'deck-after',
403
+ before: 'deck-before',
404
+ childCurrent: 'deck-child-current',
405
+ current: 'deck-current',
406
+ loading: 'deck-loading',
407
+ next: 'deck-next',
408
+ onPrefix: 'on-slide-',
409
+ previous: 'deck-previous'
410
+ },
411
+
412
+ selectors: {
413
+ container: '.deck-container'
414
+ },
415
+
416
+ keys: {
417
+ // enter, space, page down, right arrow, down arrow,
418
+ next: [13, 32, 34, 39, 40],
419
+ // backspace, page up, left arrow, up arrow
420
+ previous: [8, 33, 37, 38]
421
+ },
422
+
423
+ touch: {
424
+ swipeTolerance: 60
425
+ }
426
+ };
427
+
428
+ $d.ready(function() {
429
+ $('html').addClass('ready');
430
+ });
431
+
432
+ /*
433
+ FF + Transforms + Flash video don't get along...
434
+ Firefox will reload and start playing certain videos after a
435
+ transform. Blanking the src when a previously shown slide goes out
436
+ of view prevents this.
437
+ */
438
+ $d.bind('deck.change', function(e, from, to) {
439
+ var oldFrames = $[deck]('getSlide', from).find('iframe'),
440
+ newFrames = $[deck]('getSlide', to).find('iframe');
441
+
442
+ oldFrames.each(function() {
443
+ var $this = $(this),
444
+ curSrc = $this.attr('src');
445
+
446
+ if(curSrc) {
447
+ $this.data('deck-src', curSrc).attr('src', '');
448
+ }
449
+ });
450
+
451
+ newFrames.each(function() {
452
+ var $this = $(this),
453
+ originalSrc = $this.data('deck-src');
454
+
455
+ if (originalSrc) {
456
+ $this.attr('src', originalSrc);
457
+ }
458
+ });
459
+ });
460
+ })(jQuery, 'deck', document);