deckrb 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/README.md +84 -25
  2. data/bin/deck +3 -4
  3. data/lib/deck/rack_app.rb +39 -7
  4. data/lib/deck/slide.rb +9 -2
  5. data/lib/deck/slide_deck.rb +10 -13
  6. data/lib/deck/version.rb +1 -1
  7. data/public/coderay.css +84 -0
  8. data/public/deck.js/GPL-license.txt +278 -0
  9. data/public/deck.js/MIT-license.txt +21 -0
  10. data/public/deck.js/README.md +57 -0
  11. data/public/deck.js/core/deck.core.css +404 -0
  12. data/public/deck.js/core/deck.core.html +39 -0
  13. data/public/deck.js/core/deck.core.js +498 -0
  14. data/public/deck.js/core/deck.core.scss +447 -0
  15. data/public/deck.js/extensions/goto/deck.goto.css +41 -0
  16. data/public/deck.js/extensions/goto/deck.goto.html +7 -0
  17. data/public/deck.js/extensions/goto/deck.goto.js +134 -0
  18. data/public/deck.js/extensions/goto/deck.goto.scss +46 -0
  19. data/public/deck.js/extensions/hash/deck.hash.css +13 -0
  20. data/public/deck.js/extensions/hash/deck.hash.html +2 -0
  21. data/public/deck.js/extensions/hash/deck.hash.js +129 -0
  22. data/public/deck.js/extensions/hash/deck.hash.scss +15 -0
  23. data/public/deck.js/extensions/menu/deck.menu.css +47 -0
  24. data/public/deck.js/extensions/menu/deck.menu.js +187 -0
  25. data/public/deck.js/extensions/menu/deck.menu.scss +58 -0
  26. data/public/deck.js/extensions/navigation/deck.navigation.css +43 -0
  27. data/public/deck.js/extensions/navigation/deck.navigation.html +3 -0
  28. data/public/deck.js/extensions/navigation/deck.navigation.js +91 -0
  29. data/public/deck.js/extensions/navigation/deck.navigation.scss +56 -0
  30. data/public/deck.js/extensions/scale/deck.scale.css +16 -0
  31. data/public/deck.js/extensions/scale/deck.scale.js +156 -0
  32. data/public/deck.js/extensions/scale/deck.scale.scss +17 -0
  33. data/public/deck.js/extensions/status/deck.status.css +18 -0
  34. data/public/deck.js/extensions/status/deck.status.html +6 -0
  35. data/public/deck.js/extensions/status/deck.status.js +95 -0
  36. data/public/deck.js/extensions/status/deck.status.scss +22 -0
  37. data/public/deck.js/extensions/theme-picker/deck.theme-picker.css +55 -0
  38. data/public/deck.js/extensions/theme-picker/deck.theme-picker.js +13 -0
  39. data/public/deck.js/introduction/index.html +221 -0
  40. data/public/deck.js/introduction/index.rb +101 -0
  41. data/public/deck.js/jquery-1.7.min.js +4 -0
  42. data/public/deck.js/modernizr.custom.js +4 -0
  43. data/public/deck.js/test/fixtures/complex.html +24 -0
  44. data/public/deck.js/test/fixtures/empty.html +19 -0
  45. data/public/deck.js/test/fixtures/iframe_simple.html +10 -0
  46. data/public/deck.js/test/fixtures/iframes.html +32 -0
  47. data/public/deck.js/test/fixtures/nesteds.html +36 -0
  48. data/public/deck.js/test/fixtures/standard.html +42 -0
  49. data/public/deck.js/test/index.html +39 -0
  50. data/public/deck.js/test/lib/jasmine-html.js +190 -0
  51. data/public/deck.js/test/lib/jasmine-jquery.js +288 -0
  52. data/public/deck.js/test/lib/jasmine.css +166 -0
  53. data/public/deck.js/test/lib/jasmine.js +2477 -0
  54. data/public/deck.js/test/settings.js +3 -0
  55. data/public/deck.js/test/spec.core.js +434 -0
  56. data/public/deck.js/test/spec.goto.js +119 -0
  57. data/public/deck.js/test/spec.hash.js +81 -0
  58. data/public/deck.js/test/spec.menu.js +66 -0
  59. data/public/deck.js/test/spec.navigation.js +51 -0
  60. data/public/deck.js/test/spec.scale.js +57 -0
  61. data/public/deck.js/test/spec.status.js +58 -0
  62. data/public/deck.js/themes/style/neon.css +114 -0
  63. data/public/deck.js/themes/style/neon.scss +139 -0
  64. data/public/deck.js/themes/style/swiss.css +75 -0
  65. data/public/deck.js/themes/style/swiss.scss +91 -0
  66. data/public/deck.js/themes/style/web-2.0.css +205 -0
  67. data/public/deck.js/themes/style/web-2.0.scss +236 -0
  68. data/public/deck.js/themes/transition/fade.css +44 -0
  69. data/public/deck.js/themes/transition/fade.scss +70 -0
  70. data/public/deck.js/themes/transition/horizontal-slide.css +79 -0
  71. data/public/deck.js/themes/transition/horizontal-slide.scss +94 -0
  72. data/public/deck.js/themes/transition/vertical-slide.css +97 -0
  73. data/public/deck.js/themes/transition/vertical-slide.scss +116 -0
  74. data/public/favicon.ico +0 -0
  75. data/spec/rack_app_spec.rb +101 -33
  76. data/spec/slide_deck_spec.rb +6 -7
  77. data/spec/slide_spec.rb +19 -0
  78. metadata +95 -16
@@ -0,0 +1,58 @@
1
+ .deck-menu {
2
+ .slide {
3
+ background:#eee;
4
+ position:relative;
5
+ left:0;
6
+ top:0;
7
+ visibility:visible;
8
+ cursor:pointer;
9
+ }
10
+
11
+ > .slide {
12
+ .no-csstransforms & {
13
+ float:left;
14
+ width:22%;
15
+ height:22%;
16
+ min-height:0;
17
+ margin:1%;
18
+ font-size:0.22em;
19
+ overflow:hidden;
20
+ padding:0 0.5%;
21
+ }
22
+
23
+ .csstransforms & {
24
+ -webkit-transform:scale(.22);
25
+ -moz-transform:scale(.22);
26
+ -o-transform:scale(.22);
27
+ -ms-transform:scale(.22);
28
+ transform:scale(.22);
29
+ -webkit-transform-origin:0 0;
30
+ -moz-transform-origin:0 0;
31
+ -o-transform-origin:0 0;
32
+ -ms-transform-origin:0 0;
33
+ transform-origin:0 0;
34
+ -webkit-box-sizing: border-box;
35
+ -moz-box-sizing: border-box;
36
+ box-sizing: border-box;
37
+ width:100%;
38
+ height:100%;
39
+ overflow:hidden;
40
+ padding:0 48px;
41
+ margin:12px;
42
+ }
43
+ }
44
+
45
+ iframe, img, video {
46
+ max-width:100%;
47
+ }
48
+
49
+ .deck-current, .no-touch & .slide:hover {
50
+ background:#ddf;
51
+ }
52
+
53
+ &.deck-container:hover {
54
+ .deck-prev-link, .deck-next-link {
55
+ display:none;
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,43 @@
1
+ .deck-container .deck-prev-link, .deck-container .deck-next-link {
2
+ display: none;
3
+ position: absolute;
4
+ z-index: 3;
5
+ top: 50%;
6
+ width: 32px;
7
+ height: 32px;
8
+ margin-top: -16px;
9
+ font-size: 20px;
10
+ font-weight: bold;
11
+ line-height: 32px;
12
+ vertical-align: middle;
13
+ text-align: center;
14
+ text-decoration: none;
15
+ color: #fff;
16
+ background: #888;
17
+ }
18
+ .borderradius .deck-container .deck-prev-link, .borderradius .deck-container .deck-next-link {
19
+ -webkit-border-radius: 16px;
20
+ -moz-border-radius: 16px;
21
+ border-radius: 16px;
22
+ }
23
+ .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
24
+ color: #fff;
25
+ }
26
+ .deck-container .deck-prev-link {
27
+ left: 8px;
28
+ }
29
+ .deck-container .deck-next-link {
30
+ right: 8px;
31
+ }
32
+ .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link {
33
+ display: block;
34
+ }
35
+ .deck-container:hover .deck-prev-link.deck-nav-disabled, .touch .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link.deck-nav-disabled, .touch .deck-container:hover .deck-next-link {
36
+ display: none;
37
+ }
38
+
39
+ @media print {
40
+ .deck-prev-link, .deck-next-link {
41
+ display: none !important;
42
+ }
43
+ }
@@ -0,0 +1,3 @@
1
+ <!-- Place the following snippet at the bottom of the deck container. -->
2
+ <a href="#" class="deck-prev-link" title="Previous">&#8592;</a>
3
+ <a href="#" class="deck-next-link" title="Next">&#8594;</a>
@@ -0,0 +1,91 @@
1
+ /*!
2
+ Deck JS - deck.navigation
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
+ This module adds clickable previous and next links to the deck.
11
+ */
12
+ (function($, deck, undefined) {
13
+ var $d = $(document),
14
+
15
+ /* Updates link hrefs, and disabled states if last/first slide */
16
+ updateButtons = function(e, from, to) {
17
+ var opts = $[deck]('getOptions'),
18
+ last = $[deck]('getSlides').length - 1,
19
+ prevSlide = $[deck]('getSlide', to - 1),
20
+ nextSlide = $[deck]('getSlide', to + 1),
21
+ prevId = prevSlide ? prevSlide.attr('id') : undefined;
22
+ nextId = nextSlide ? nextSlide.attr('id') : undefined;
23
+
24
+ $(opts.selectors.previousLink)
25
+ .toggleClass(opts.classes.navDisabled, !to)
26
+ .attr('href', '#' + (prevId ? prevId : ''));
27
+ $(opts.selectors.nextLink)
28
+ .toggleClass(opts.classes.navDisabled, to === last)
29
+ .attr('href', '#' + (nextId ? nextId : ''));
30
+ };
31
+
32
+ /*
33
+ Extends defaults/options.
34
+
35
+ options.classes.navDisabled
36
+ This class is added to a navigation link when that action is disabled.
37
+ It is added to the previous link when on the first slide, and to the
38
+ next link when on the last slide.
39
+
40
+ options.selectors.nextLink
41
+ The elements that match this selector will move the deck to the next
42
+ slide when clicked.
43
+
44
+ options.selectors.previousLink
45
+ The elements that match this selector will move to deck to the previous
46
+ slide when clicked.
47
+ */
48
+ $.extend(true, $[deck].defaults, {
49
+ classes: {
50
+ navDisabled: 'deck-nav-disabled'
51
+ },
52
+
53
+ selectors: {
54
+ nextLink: '.deck-next-link',
55
+ previousLink: '.deck-prev-link'
56
+ }
57
+ });
58
+
59
+ $d.bind('deck.init', function() {
60
+ var opts = $[deck]('getOptions'),
61
+ slides = $[deck]('getSlides'),
62
+ $current = $[deck]('getSlide'),
63
+ ndx;
64
+
65
+ // Setup prev/next link events
66
+ $(opts.selectors.previousLink)
67
+ .unbind('click.decknavigation')
68
+ .bind('click.decknavigation', function(e) {
69
+ $[deck]('prev');
70
+ e.preventDefault();
71
+ });
72
+
73
+ $(opts.selectors.nextLink)
74
+ .unbind('click.decknavigation')
75
+ .bind('click.decknavigation', function(e) {
76
+ $[deck]('next');
77
+ e.preventDefault();
78
+ });
79
+
80
+ // Find where we started in the deck and set initial states
81
+ $.each(slides, function(i, $slide) {
82
+ if ($slide === $current) {
83
+ ndx = i;
84
+ return false;
85
+ }
86
+ });
87
+ updateButtons(null, ndx, ndx);
88
+ })
89
+ .bind('deck.change', updateButtons);
90
+ })(jQuery, 'deck');
91
+
@@ -0,0 +1,56 @@
1
+ @mixin border-radius($r) {
2
+ -webkit-border-radius:$r;
3
+ -moz-border-radius:$r;
4
+ border-radius:$r;
5
+ }
6
+
7
+ .deck-container {
8
+ .deck-prev-link, .deck-next-link {
9
+ display:none;
10
+ position:absolute;
11
+ z-index:3;
12
+ top:50%;
13
+ width:32px;
14
+ height:32px;
15
+ margin-top:-16px;
16
+ font-size:20px;
17
+ font-weight:bold;
18
+ line-height:32px;
19
+ vertical-align:middle;
20
+ text-align:center;
21
+ text-decoration:none;
22
+ color:#fff;
23
+ background:#888;
24
+
25
+ .borderradius & {
26
+ @include border-radius(16px);
27
+ }
28
+
29
+ &:hover, &:focus, &:active, &:visited {
30
+ color:#fff;
31
+ }
32
+ }
33
+
34
+ .deck-prev-link {
35
+ left:8px;
36
+ }
37
+
38
+ .deck-next-link {
39
+ right:8px;
40
+ }
41
+
42
+ &:hover .deck-prev-link, &:hover .deck-next-link {
43
+ display:block;
44
+
45
+ &.deck-nav-disabled, .touch & {
46
+ display:none;
47
+ }
48
+ }
49
+ }
50
+
51
+
52
+ @media print {
53
+ .deck-prev-link, .deck-next-link {
54
+ display:none !important;
55
+ }
56
+ }
@@ -0,0 +1,16 @@
1
+ .csstransforms .deck-container.deck-scale section.slide {
2
+ width:auto;
3
+ -webkit-transform-origin: 50% 0;
4
+ -moz-transform-origin: 50% 0;
5
+ -o-transform-origin: 50% 0;
6
+ -ms-transform-origin: 50% 0;
7
+ transform-origin: 50% 0;
8
+ }
9
+ .csstransforms .deck-container.deck-scale.deck-menu {
10
+ width: 70%;
11
+ -webkit-transform: none !important;
12
+ -moz-transform: none !important;
13
+ -o-transform: none !important;
14
+ -ms-transform: none !important;
15
+ transform: none !important;
16
+ }
@@ -0,0 +1,156 @@
1
+ /*!
2
+ Deck JS - deck.scale
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
+ This module adds automatic scaling to the deck. It should only be used on
11
+ standalone decks where the body is the deck container. Slides are scaled down
12
+ using CSS transforms to fit within the browser window. If the browser window
13
+ is big enough to hold the slides without scaling, no scaling occurs. The user
14
+ can disable and enable scaling with a keyboard shortcut.
15
+
16
+ Note: CSS transforms make Flash videos render incorrectly. Presenters that
17
+ need to use video will want to disable scaling to play them. HTML5 video
18
+ works fine.
19
+ */
20
+ (function($, deck, window, undefined) {
21
+ var $d = $(document),
22
+ $w = $(window),
23
+ baseHeight, // Value to scale against
24
+ timer, // Timeout id for debouncing
25
+
26
+ /*
27
+ Internal function to do all the dirty work of scaling the deck container.
28
+ */
29
+ scaleDeck = function() {
30
+ var obh = $[deck]('getOptions').baseHeight,
31
+ $container = $[deck]('getContainer'),
32
+ height = $w.height(),
33
+ slides = $[deck]('getSlides'),
34
+ scale,
35
+ transform;
36
+
37
+ // Don't scale if scaling disabled
38
+ if (!$container.hasClass($[deck]('getOptions').classes.scale)) {
39
+ scale = 1;
40
+ }
41
+ else {
42
+ // Use window height as base height if not set manually
43
+ baseHeight = obh ? obh : (function() {
44
+ var slop = 40; /* for padding */
45
+ var windowHeight = $(window).height();
46
+ return windowHeight - slop;
47
+ })();
48
+ }
49
+
50
+ // Scale each slide down if necessary (but don't scale up)
51
+ $.each(slides, function(i, $slide) {
52
+ var slideHeight = $slide.innerHeight();
53
+ var scale = baseHeight / slideHeight;
54
+
55
+ if (scale < 1) {
56
+ transform = 'scale(' + scale + ')';
57
+ $.each('Webkit Moz O ms Khtml'.split(' '), function(i, prefix) {
58
+ $slide.css(prefix + 'Transform', transform);
59
+ });
60
+ }
61
+ });
62
+ }
63
+
64
+ /*
65
+ Extends defaults/options.
66
+
67
+ options.classes.scale
68
+ This class is added to the deck container when scaling is enabled.
69
+ It is enabled by default when the module is included.
70
+
71
+ options.keys.scale
72
+ The numeric keycode used to toggle enabling and disabling scaling.
73
+
74
+ options.baseHeight
75
+ When baseheight is falsy, as it is by default, the deck is scaled
76
+ in proportion to the height of the slides. You may instead specify
77
+ a height, and the deck will be scaled against this height regardless
78
+ of the actual content height.
79
+
80
+ options.scaleDebounce
81
+ Scaling on the browser resize event is debounced. This number is the
82
+ threshold in milliseconds. You can learn more about debouncing here:
83
+ http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
84
+
85
+ */
86
+ $.extend(true, $[deck].defaults, {
87
+ classes: {
88
+ scale: 'deck-scale'
89
+ },
90
+
91
+ keys: {
92
+ scale: 83 // s
93
+ },
94
+
95
+ baseHeight: null,
96
+ scaleDebounce: 200
97
+ });
98
+
99
+ /*
100
+ jQuery.deck('disableScale')
101
+
102
+ Disables scaling and removes the scale class from the deck container.
103
+ */
104
+ $[deck]('extend', 'disableScale', function() {
105
+ $[deck]('getContainer').removeClass($[deck]('getOptions').classes.scale);
106
+ scaleDeck();
107
+ });
108
+
109
+ /*
110
+ jQuery.deck('enableScale')
111
+
112
+ Enables scaling and adds the scale class to the deck container.
113
+ */
114
+ $[deck]('extend', 'enableScale', function() {
115
+ $[deck]('getContainer').addClass($[deck]('getOptions').classes.scale);
116
+ scaleDeck();
117
+ });
118
+
119
+ /*
120
+ jQuery.deck('toggleScale')
121
+
122
+ Toggles between enabling and disabling scaling.
123
+ */
124
+ $[deck]('extend', 'toggleScale', function() {
125
+ var $c = $[deck]('getContainer');
126
+ $[deck]($c.hasClass($[deck]('getOptions').classes.scale) ?
127
+ 'disableScale' : 'enableScale');
128
+ });
129
+
130
+ $d.bind('deck.init', function() {
131
+ var opts = $[deck]('getOptions');
132
+
133
+ // Scaling enabled at start
134
+ $[deck]('getContainer').addClass(opts.classes.scale);
135
+
136
+ // Debounce the resize scaling
137
+ $w.unbind('resize.deckscale').bind('resize.deckscale', function() {
138
+ window.clearTimeout(timer);
139
+ timer = window.setTimeout(scaleDeck, opts.scaleDebounce);
140
+ })
141
+ // Scale once on load, in case images or something change layout
142
+ .unbind('load.deckscale').bind('load.deckscale', scaleDeck);
143
+
144
+ // Bind key events
145
+ $d.unbind('keydown.deckscale').bind('keydown.deckscale', function(e) {
146
+ if (e.which === opts.keys.scale || $.inArray(e.which, opts.keys.scale) > -1) {
147
+ $[deck]('toggleScale');
148
+ e.preventDefault();
149
+ }
150
+ });
151
+
152
+ // Scale once on init
153
+ scaleDeck();
154
+ });
155
+ })(jQuery, 'deck', this);
156
+
@@ -0,0 +1,17 @@
1
+ .csstransforms .deck-container.deck-scale {
2
+ width:auto;
3
+ -webkit-transform-origin: 50% 0;
4
+ -moz-transform-origin: 50% 0;
5
+ -o-transform-origin: 50% 0;
6
+ -ms-transform-origin: 50% 0;
7
+ transform-origin: 50% 0;
8
+
9
+ &.deck-menu {
10
+ width:70%;
11
+ -webkit-transform:none !important;
12
+ -moz-transform:none !important;
13
+ -o-transform:none !important;
14
+ -ms-transform:none !important;
15
+ transform:none !important;
16
+ }
17
+ }