deckrb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/README.md +63 -0
  2. data/bin/deck +59 -0
  3. data/deck/GPL-license.txt +278 -0
  4. data/deck/MIT-license.txt +21 -0
  5. data/deck/README.md +57 -0
  6. data/deck/core/deck.core.css +404 -0
  7. data/deck/core/deck.core.html +39 -0
  8. data/deck/core/deck.core.js +498 -0
  9. data/deck/core/deck.core.scss +447 -0
  10. data/deck/extensions/goto/deck.goto.css +41 -0
  11. data/deck/extensions/goto/deck.goto.html +7 -0
  12. data/deck/extensions/goto/deck.goto.js +134 -0
  13. data/deck/extensions/goto/deck.goto.scss +46 -0
  14. data/deck/extensions/hash/deck.hash.css +13 -0
  15. data/deck/extensions/hash/deck.hash.html +2 -0
  16. data/deck/extensions/hash/deck.hash.js +129 -0
  17. data/deck/extensions/hash/deck.hash.scss +15 -0
  18. data/deck/extensions/menu/deck.menu.css +47 -0
  19. data/deck/extensions/menu/deck.menu.js +187 -0
  20. data/deck/extensions/menu/deck.menu.scss +58 -0
  21. data/deck/extensions/navigation/deck.navigation.css +43 -0
  22. data/deck/extensions/navigation/deck.navigation.html +3 -0
  23. data/deck/extensions/navigation/deck.navigation.js +91 -0
  24. data/deck/extensions/navigation/deck.navigation.scss +56 -0
  25. data/deck/extensions/scale/deck.scale.css +16 -0
  26. data/deck/extensions/scale/deck.scale.js +155 -0
  27. data/deck/extensions/scale/deck.scale.scss +17 -0
  28. data/deck/extensions/status/deck.status.css +18 -0
  29. data/deck/extensions/status/deck.status.html +6 -0
  30. data/deck/extensions/status/deck.status.js +95 -0
  31. data/deck/extensions/status/deck.status.scss +22 -0
  32. data/deck/extensions/theme-picker/deck.theme-picker.css +55 -0
  33. data/deck/extensions/theme-picker/deck.theme-picker.js +13 -0
  34. data/deck/introduction/index.html +221 -0
  35. data/deck/introduction/index.rb +101 -0
  36. data/deck/jquery-1.7.min.js +4 -0
  37. data/deck/modernizr.custom.js +4 -0
  38. data/deck/test/fixtures/complex.html +24 -0
  39. data/deck/test/fixtures/empty.html +19 -0
  40. data/deck/test/fixtures/iframe_simple.html +10 -0
  41. data/deck/test/fixtures/iframes.html +32 -0
  42. data/deck/test/fixtures/nesteds.html +36 -0
  43. data/deck/test/fixtures/standard.html +42 -0
  44. data/deck/test/index.html +39 -0
  45. data/deck/test/lib/jasmine-html.js +190 -0
  46. data/deck/test/lib/jasmine-jquery.js +288 -0
  47. data/deck/test/lib/jasmine.css +166 -0
  48. data/deck/test/lib/jasmine.js +2477 -0
  49. data/deck/test/settings.js +3 -0
  50. data/deck/test/spec.core.js +434 -0
  51. data/deck/test/spec.goto.js +119 -0
  52. data/deck/test/spec.hash.js +81 -0
  53. data/deck/test/spec.menu.js +66 -0
  54. data/deck/test/spec.navigation.js +51 -0
  55. data/deck/test/spec.scale.js +57 -0
  56. data/deck/test/spec.status.js +58 -0
  57. data/deck/themes/style/neon.css +114 -0
  58. data/deck/themes/style/neon.scss +139 -0
  59. data/deck/themes/style/swiss.css +75 -0
  60. data/deck/themes/style/swiss.scss +91 -0
  61. data/deck/themes/style/web-2.0.css +205 -0
  62. data/deck/themes/style/web-2.0.scss +236 -0
  63. data/deck/themes/transition/fade.css +44 -0
  64. data/deck/themes/transition/fade.scss +70 -0
  65. data/deck/themes/transition/horizontal-slide.css +79 -0
  66. data/deck/themes/transition/horizontal-slide.scss +94 -0
  67. data/deck/themes/transition/vertical-slide.css +97 -0
  68. data/deck/themes/transition/vertical-slide.scss +116 -0
  69. data/lib/deck.rb +7 -0
  70. data/lib/deck/app.rb +16 -0
  71. data/lib/deck/deck.rb +166 -0
  72. data/lib/deck/rack_static_patch.rb +13 -0
  73. data/lib/deck/slide.rb +120 -0
  74. data/lib/deck/version.rb +3 -0
  75. data/spec/deck_spec.rb +98 -0
  76. data/spec/javascripts/support/jasmine_config.rb +23 -0
  77. data/spec/javascripts/support/jasmine_runner.rb +32 -0
  78. data/spec/slide_spec.rb +285 -0
  79. data/spec/spec_helper.rb +7 -0
  80. metadata +172 -0
@@ -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 {
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,155 @@
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 tallest slide as base height if not set manually
43
+ baseHeight = obh ? obh : (function() {
44
+ var greatest = 0;
45
+
46
+ $.each(slides, function(i, $slide) {
47
+ greatest = Math.max(greatest, $slide.outerHeight());
48
+ });
49
+
50
+ return greatest;
51
+ })();
52
+
53
+ scale = height / baseHeight;
54
+ }
55
+
56
+ // Scale, but don't scale up
57
+ transform = scale >= 1 ? 'none' : 'scale(' + scale + ')';
58
+ $.each('Webkit Moz O ms Khtml'.split(' '), function(i, prefix) {
59
+ $container.css(prefix + 'Transform', transform);
60
+ });
61
+ };
62
+
63
+ /*
64
+ Extends defaults/options.
65
+
66
+ options.classes.scale
67
+ This class is added to the deck container when scaling is enabled.
68
+ It is enabled by default when the module is included.
69
+
70
+ options.keys.scale
71
+ The numeric keycode used to toggle enabling and disabling scaling.
72
+
73
+ options.baseHeight
74
+ When baseheight is falsy, as it is by default, the deck is scaled
75
+ in proportion to the height of the slides. You may instead specify
76
+ a height, and the deck will be scaled against this height regardless
77
+ of the actual content height.
78
+
79
+ options.scaleDebounce
80
+ Scaling on the browser resize event is debounced. This number is the
81
+ threshold in milliseconds. You can learn more about debouncing here:
82
+ http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
83
+
84
+ */
85
+ $.extend(true, $[deck].defaults, {
86
+ classes: {
87
+ scale: 'deck-scale'
88
+ },
89
+
90
+ keys: {
91
+ scale: 83 // s
92
+ },
93
+
94
+ baseHeight: null,
95
+ scaleDebounce: 200
96
+ });
97
+
98
+ /*
99
+ jQuery.deck('disableScale')
100
+
101
+ Disables scaling and removes the scale class from the deck container.
102
+ */
103
+ $[deck]('extend', 'disableScale', function() {
104
+ $[deck]('getContainer').removeClass($[deck]('getOptions').classes.scale);
105
+ scaleDeck();
106
+ });
107
+
108
+ /*
109
+ jQuery.deck('enableScale')
110
+
111
+ Enables scaling and adds the scale class to the deck container.
112
+ */
113
+ $[deck]('extend', 'enableScale', function() {
114
+ $[deck]('getContainer').addClass($[deck]('getOptions').classes.scale);
115
+ scaleDeck();
116
+ });
117
+
118
+ /*
119
+ jQuery.deck('toggleScale')
120
+
121
+ Toggles between enabling and disabling scaling.
122
+ */
123
+ $[deck]('extend', 'toggleScale', function() {
124
+ var $c = $[deck]('getContainer');
125
+ $[deck]($c.hasClass($[deck]('getOptions').classes.scale) ?
126
+ 'disableScale' : 'enableScale');
127
+ });
128
+
129
+ $d.bind('deck.init', function() {
130
+ var opts = $[deck]('getOptions');
131
+
132
+ // Scaling enabled at start
133
+ $[deck]('getContainer').addClass(opts.classes.scale);
134
+
135
+ // Debounce the resize scaling
136
+ $w.unbind('resize.deckscale').bind('resize.deckscale', function() {
137
+ window.clearTimeout(timer);
138
+ timer = window.setTimeout(scaleDeck, opts.scaleDebounce);
139
+ })
140
+ // Scale once on load, in case images or something change layout
141
+ .unbind('load.deckscale').bind('load.deckscale', scaleDeck);
142
+
143
+ // Bind key events
144
+ $d.unbind('keydown.deckscale').bind('keydown.deckscale', function(e) {
145
+ if (e.which === opts.keys.scale || $.inArray(e.which, opts.keys.scale) > -1) {
146
+ $[deck]('toggleScale');
147
+ e.preventDefault();
148
+ }
149
+ });
150
+
151
+ // Scale once on init
152
+ scaleDeck();
153
+ });
154
+ })(jQuery, 'deck', this);
155
+
@@ -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
+ }