slideshift-static 0.0.1

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.
@@ -0,0 +1,13 @@
1
+ .deck-container .deck-permalink {
2
+ display: none;
3
+ position: absolute;
4
+ z-index: 4;
5
+ bottom: 30px;
6
+ right: 0;
7
+ width: 48px;
8
+ text-align: center;
9
+ }
10
+
11
+ .no-history .deck-container:hover .deck-permalink {
12
+ display: block;
13
+ }
@@ -0,0 +1,141 @@
1
+ /*!
2
+ Deck JS - deck.hash
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 deep linking to individual slides, enables internal links
11
+ to slides within decks, and updates the address bar with the hash as the user
12
+ moves through the deck. A permalink anchor is also updated. Standard themes
13
+ hide this link in browsers that support the History API, and show it for
14
+ those that do not. Slides that do not have an id are assigned one according to
15
+ the hashPrefix option. In addition to the on-slide container state class
16
+ kept by core, this module adds an on-slide state class that uses the id of each
17
+ slide.
18
+ */
19
+ (function ($, deck, window, undefined) {
20
+ var $d = $(document),
21
+ $window = $(window),
22
+
23
+ /* Collection of internal fragment links in the deck */
24
+ $internals,
25
+
26
+ /*
27
+ Internal only function. Given a string, extracts the id from the hash,
28
+ matches it to the appropriate slide, and navigates there.
29
+ */
30
+ goByHash = function(str) {
31
+ var id = str.substr(str.indexOf("#") + 1),
32
+ slides = $[deck]('getSlides');
33
+
34
+ $.each(slides, function(i, $el) {
35
+ if ($el.attr('id') === id) {
36
+ $[deck]('go', i);
37
+ return false;
38
+ }
39
+ });
40
+
41
+ // If we don't set these to 0 the container scrolls due to hashchange
42
+ $[deck]('getContainer').scrollLeft(0).scrollTop(0);
43
+ };
44
+
45
+ /*
46
+ Extends defaults/options.
47
+
48
+ options.selectors.hashLink
49
+ The element matching this selector has its href attribute updated to
50
+ the hash of the current slide as the user navigates through the deck.
51
+
52
+ options.hashPrefix
53
+ Every slide that does not have an id is assigned one at initialization.
54
+ Assigned ids take the form of hashPrefix + slideIndex, e.g., slide-0,
55
+ slide-12, etc.
56
+
57
+ options.preventFragmentScroll
58
+ When deep linking to a hash of a nested slide, this scrolls the deck
59
+ container to the top, undoing the natural browser behavior of scrolling
60
+ to the document fragment on load.
61
+ */
62
+ $.extend(true, $[deck].defaults, {
63
+ selectors: {
64
+ hashLink: '.deck-permalink'
65
+ },
66
+
67
+ hashPrefix: 'slide-',
68
+ preventFragmentScroll: true
69
+ });
70
+
71
+
72
+ $d.bind('deck.init', function() {
73
+ var opts = $[deck]('getOptions');
74
+ $internals = $(),
75
+ slides = $[deck]('getSlides');
76
+
77
+ $.each(slides, function(i, $el) {
78
+ var hash;
79
+
80
+ /* Hand out ids to the unfortunate slides born without them */
81
+ if (!$el.attr('id') || $el.data('deckAssignedId') === $el.attr('id')) {
82
+ $el.attr('id', opts.hashPrefix + i);
83
+ $el.data('deckAssignedId', opts.hashPrefix + i);
84
+ }
85
+
86
+ hash ='#' + $el.attr('id');
87
+
88
+ /* Deep link to slides on init */
89
+ if (hash === window.location.hash) {
90
+ $[deck]('go', i);
91
+ }
92
+
93
+ /* Add internal links to this slide */
94
+ $internals = $internals.add('a[href="' + hash + '"]');
95
+ });
96
+
97
+ if (!Modernizr.hashchange) {
98
+ /* Set up internal links using click for the poor browsers
99
+ without a hashchange event. */
100
+ $internals.unbind('click.deckhash').bind('click.deckhash', function(e) {
101
+ goByHash($(this).attr('href'));
102
+ });
103
+ }
104
+
105
+ /* Set up first id container state class */
106
+ if (slides.length) {
107
+ $[deck]('getContainer').addClass(opts.classes.onPrefix + $[deck]('getSlide').attr('id'));
108
+ };
109
+ })
110
+ /* Update permalink, address bar, and state class on a slide change */
111
+ .bind('deck.change', function(e, from, to) {
112
+ var hash = '#' + $[deck]('getSlide', to).attr('id'),
113
+ opts = $[deck]('getOptions'),
114
+ osp = opts.classes.onPrefix,
115
+ $c = $[deck]('getContainer');
116
+
117
+ $c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
118
+ $c.addClass(osp + $[deck]('getSlide', to).attr('id'));
119
+
120
+ $(opts.selectors.hashLink).attr('href', hash);
121
+ if (Modernizr.history) {
122
+ window.history.replaceState({}, "", hash);
123
+ }
124
+ });
125
+
126
+ /* Deals with internal links in modern browsers */
127
+ $window.bind('hashchange.deckhash', function(e) {
128
+ if (e.originalEvent && e.originalEvent.newURL) {
129
+ goByHash(e.originalEvent.newURL);
130
+ }
131
+ else {
132
+ goByHash(window.location.hash);
133
+ }
134
+ })
135
+ /* Prevent scrolling on deep links */
136
+ .bind('load', function() {
137
+ if ($[deck]('getOptions').preventFragmentScroll) {
138
+ $[deck]('getContainer').scrollLeft(0).scrollTop(0);
139
+ }
140
+ });
141
+ })(jQuery, 'deck', this);
@@ -0,0 +1,47 @@
1
+ .deck-menu .slide {
2
+ background: #eee;
3
+ position: relative;
4
+ left: 0;
5
+ top: 0;
6
+ visibility: visible;
7
+ cursor: pointer;
8
+ }
9
+ .no-csstransforms .deck-menu > .slide {
10
+ float: left;
11
+ width: 22%;
12
+ height: 22%;
13
+ min-height: 0;
14
+ margin: 1%;
15
+ font-size: 0.22em;
16
+ overflow: hidden;
17
+ padding: 0 0.5%;
18
+ }
19
+ .csstransforms .deck-menu > .slide {
20
+ -webkit-transform: scale(0.22) !important;
21
+ -moz-transform: scale(0.22) !important;
22
+ -o-transform: scale(0.22) !important;
23
+ -ms-transform: scale(0.22) !important;
24
+ transform: scale(0.22) !important;
25
+ -webkit-transform-origin: 0 0;
26
+ -moz-transform-origin: 0 0;
27
+ -o-transform-origin: 0 0;
28
+ -ms-transform-origin: 0 0;
29
+ transform-origin: 0 0;
30
+ -webkit-box-sizing: border-box;
31
+ -moz-box-sizing: border-box;
32
+ box-sizing: border-box;
33
+ width: 100%;
34
+ height: 100%;
35
+ overflow: hidden;
36
+ padding: 0 48px;
37
+ margin: 12px;
38
+ }
39
+ .deck-menu iframe, .deck-menu img, .deck-menu video {
40
+ max-width: 100%;
41
+ }
42
+ .deck-menu .deck-current, .no-touch .deck-menu .slide:hover {
43
+ background: #ddf;
44
+ }
45
+ .deck-menu.deck-container:hover .deck-prev-link, .deck-menu.deck-container:hover .deck-next-link {
46
+ display: none;
47
+ }
@@ -0,0 +1,187 @@
1
+ /*!
2
+ Deck JS - deck.menu
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 the methods and key binding to show and hide a menu of all
11
+ slides in the deck. The deck menu state is indicated by the presence of a class
12
+ on the deck container.
13
+ */
14
+ (function($, deck, undefined) {
15
+ var $d = $(document),
16
+ rootSlides; // Array of top level slides
17
+
18
+ /*
19
+ Extends defaults/options.
20
+
21
+ options.classes.menu
22
+ This class is added to the deck container when showing the slide menu.
23
+
24
+ options.keys.menu
25
+ The numeric keycode used to toggle between showing and hiding the slide
26
+ menu.
27
+
28
+ options.touch.doubletapWindow
29
+ Two consecutive touch events within this number of milliseconds will
30
+ be considered a double tap, and will toggle the menu on touch devices.
31
+ */
32
+ $.extend(true, $[deck].defaults, {
33
+ classes: {
34
+ menu: 'deck-menu'
35
+ },
36
+
37
+ keys: {
38
+ menu: 77 // m
39
+ },
40
+
41
+ touch: {
42
+ doubletapWindow: 400
43
+ }
44
+ });
45
+
46
+ /*
47
+ jQuery.deck('showMenu')
48
+
49
+ Shows the slide menu by adding the class specified by the menu class option
50
+ to the deck container.
51
+ */
52
+ $[deck]('extend', 'showMenu', function() {
53
+ var $c = $[deck]('getContainer'),
54
+ opts = $[deck]('getOptions');
55
+
56
+ if ($c.hasClass(opts.classes.menu)) return;
57
+
58
+ // Hide through loading class to short-circuit transitions (perf)
59
+ $c.addClass([opts.classes.loading, opts.classes.menu].join(' '));
60
+
61
+ /* Forced to do this in JS until CSS learns second-grade math. Save old
62
+ style value for restoration when menu is hidden. */
63
+ if (Modernizr.csstransforms) {
64
+ $.each(rootSlides, function(i, $slide) {
65
+ $slide.data('oldStyle', $slide.attr('style'));
66
+ $slide.css({
67
+ 'position': 'absolute',
68
+ 'left': ((i % 4) * 25) + '%',
69
+ 'top': (Math.floor(i / 4) * 25) + '%'
70
+ });
71
+ });
72
+ }
73
+
74
+ // Need to ensure the loading class renders first, then remove
75
+ window.setTimeout(function() {
76
+ $c.removeClass(opts.classes.loading)
77
+ .scrollTop($[deck]('getSlide').offset().top);
78
+ }, 0);
79
+ });
80
+
81
+ /*
82
+ jQuery.deck('hideMenu')
83
+
84
+ Hides the slide menu by removing the class specified by the menu class
85
+ option from the deck container.
86
+ */
87
+ $[deck]('extend', 'hideMenu', function() {
88
+ var $c = $[deck]('getContainer'),
89
+ opts = $[deck]('getOptions');
90
+
91
+ if (!$c.hasClass(opts.classes.menu)) return;
92
+
93
+ $c.removeClass(opts.classes.menu);
94
+ $c.addClass(opts.classes.loading);
95
+
96
+ /* Restore old style value */
97
+ if (Modernizr.csstransforms) {
98
+ $.each(rootSlides, function(i, $slide) {
99
+ var oldStyle = $slide.data('oldStyle');
100
+
101
+ $slide.attr('style', oldStyle ? oldStyle : '');
102
+ });
103
+ }
104
+
105
+ window.setTimeout(function() {
106
+ $c.removeClass(opts.classes.loading).scrollTop(0);
107
+ }, 0);
108
+ });
109
+
110
+ /*
111
+ jQuery.deck('toggleMenu')
112
+
113
+ Toggles between showing and hiding the slide menu.
114
+ */
115
+ $[deck]('extend', 'toggleMenu', function() {
116
+ $[deck]('getContainer').hasClass($[deck]('getOptions').classes.menu) ?
117
+ $[deck]('hideMenu') : $[deck]('showMenu');
118
+ });
119
+
120
+ $d.bind('deck.init', function() {
121
+ var opts = $[deck]('getOptions'),
122
+ touchEndTime = 0,
123
+ currentSlide,
124
+ slideTest = $.map([
125
+ opts.classes.before,
126
+ opts.classes.previous,
127
+ opts.classes.current,
128
+ opts.classes.next,
129
+ opts.classes.after
130
+ ], function(el, i) {
131
+ return '.' + el;
132
+ }).join(', ');
133
+
134
+ // Build top level slides array
135
+ rootSlides = [];
136
+ $.each($[deck]('getSlides'), function(i, $el) {
137
+ if (!$el.parentsUntil(opts.selectors.container, slideTest).length) {
138
+ rootSlides.push($el);
139
+ }
140
+ });
141
+
142
+ // Bind key events
143
+ $d.unbind('keydown.deckmenu').bind('keydown.deckmenu', function(e) {
144
+ if (e.which === opts.keys.menu || $.inArray(e.which, opts.keys.menu) > -1) {
145
+ $[deck]('toggleMenu');
146
+ e.preventDefault();
147
+ }
148
+ });
149
+
150
+ // Double tap to toggle slide menu for touch devices
151
+ $[deck]('getContainer').unbind('touchstart.deckmenu').bind('touchstart.deckmenu', function(e) {
152
+ currentSlide = $[deck]('getSlide');
153
+ })
154
+ .unbind('touchend.deckmenu').bind('touchend.deckmenu', function(e) {
155
+ var now = Date.now();
156
+
157
+ // Ignore this touch event if it caused a nav change (swipe)
158
+ if (currentSlide !== $[deck]('getSlide')) return;
159
+
160
+ if (now - touchEndTime < opts.touch.doubletapWindow) {
161
+ $[deck]('toggleMenu');
162
+ e.preventDefault();
163
+ }
164
+ touchEndTime = now;
165
+ });
166
+
167
+ // Selecting slides from the menu
168
+ $.each($[deck]('getSlides'), function(i, $s) {
169
+ $s.unbind('click.deckmenu').bind('click.deckmenu', function(e) {
170
+ if (!$[deck]('getContainer').hasClass(opts.classes.menu)) return;
171
+
172
+ $[deck]('go', i);
173
+ $[deck]('hideMenu');
174
+ e.stopPropagation();
175
+ e.preventDefault();
176
+ });
177
+ });
178
+ })
179
+ .bind('deck.change', function(e, from, to) {
180
+ var container = $[deck]('getContainer');
181
+
182
+ if (container.hasClass($[deck]('getOptions').classes.menu)) {
183
+ container.scrollTop($[deck]('getSlide', to).offset().top);
184
+ }
185
+ });
186
+ })(jQuery, 'deck');
187
+
@@ -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,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
+