deckrb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +55 -20
- data/bin/deck +5 -10
- data/lib/deck.rb +1 -1
- data/lib/deck/noko.rb +15 -0
- data/lib/deck/rack_app.rb +61 -0
- data/lib/deck/slide.rb +50 -28
- data/lib/deck/{deck.rb → slide_deck.rb} +42 -41
- data/lib/deck/version.rb +1 -1
- data/spec/rack_app_spec.rb +177 -0
- data/spec/slide_deck_spec.rb +46 -0
- data/spec/slide_spec.rb +24 -21
- data/spec/spec_helper.rb +5 -0
- metadata +51 -81
- data/deck/GPL-license.txt +0 -278
- data/deck/MIT-license.txt +0 -21
- data/deck/README.md +0 -57
- data/deck/core/deck.core.css +0 -404
- data/deck/core/deck.core.html +0 -39
- data/deck/core/deck.core.js +0 -498
- data/deck/core/deck.core.scss +0 -447
- data/deck/extensions/goto/deck.goto.css +0 -41
- data/deck/extensions/goto/deck.goto.html +0 -7
- data/deck/extensions/goto/deck.goto.js +0 -134
- data/deck/extensions/goto/deck.goto.scss +0 -46
- data/deck/extensions/hash/deck.hash.css +0 -13
- data/deck/extensions/hash/deck.hash.html +0 -2
- data/deck/extensions/hash/deck.hash.js +0 -129
- data/deck/extensions/hash/deck.hash.scss +0 -15
- data/deck/extensions/menu/deck.menu.css +0 -47
- data/deck/extensions/menu/deck.menu.js +0 -187
- data/deck/extensions/menu/deck.menu.scss +0 -58
- data/deck/extensions/navigation/deck.navigation.css +0 -43
- data/deck/extensions/navigation/deck.navigation.html +0 -3
- data/deck/extensions/navigation/deck.navigation.js +0 -91
- data/deck/extensions/navigation/deck.navigation.scss +0 -56
- data/deck/extensions/scale/deck.scale.css +0 -16
- data/deck/extensions/scale/deck.scale.js +0 -155
- data/deck/extensions/scale/deck.scale.scss +0 -17
- data/deck/extensions/status/deck.status.css +0 -18
- data/deck/extensions/status/deck.status.html +0 -6
- data/deck/extensions/status/deck.status.js +0 -95
- data/deck/extensions/status/deck.status.scss +0 -22
- data/deck/extensions/theme-picker/deck.theme-picker.css +0 -55
- data/deck/extensions/theme-picker/deck.theme-picker.js +0 -13
- data/deck/introduction/index.html +0 -221
- data/deck/introduction/index.rb +0 -101
- data/deck/jquery-1.7.min.js +0 -4
- data/deck/modernizr.custom.js +0 -4
- data/deck/test/fixtures/complex.html +0 -24
- data/deck/test/fixtures/empty.html +0 -19
- data/deck/test/fixtures/iframe_simple.html +0 -10
- data/deck/test/fixtures/iframes.html +0 -32
- data/deck/test/fixtures/nesteds.html +0 -36
- data/deck/test/fixtures/standard.html +0 -42
- data/deck/test/index.html +0 -39
- data/deck/test/lib/jasmine-html.js +0 -190
- data/deck/test/lib/jasmine-jquery.js +0 -288
- data/deck/test/lib/jasmine.css +0 -166
- data/deck/test/lib/jasmine.js +0 -2477
- data/deck/test/settings.js +0 -3
- data/deck/test/spec.core.js +0 -434
- data/deck/test/spec.goto.js +0 -119
- data/deck/test/spec.hash.js +0 -81
- data/deck/test/spec.menu.js +0 -66
- data/deck/test/spec.navigation.js +0 -51
- data/deck/test/spec.scale.js +0 -57
- data/deck/test/spec.status.js +0 -58
- data/deck/themes/style/neon.css +0 -114
- data/deck/themes/style/neon.scss +0 -139
- data/deck/themes/style/swiss.css +0 -75
- data/deck/themes/style/swiss.scss +0 -91
- data/deck/themes/style/web-2.0.css +0 -205
- data/deck/themes/style/web-2.0.scss +0 -236
- data/deck/themes/transition/fade.css +0 -44
- data/deck/themes/transition/fade.scss +0 -70
- data/deck/themes/transition/horizontal-slide.css +0 -79
- data/deck/themes/transition/horizontal-slide.scss +0 -94
- data/deck/themes/transition/vertical-slide.css +0 -97
- data/deck/themes/transition/vertical-slide.scss +0 -116
- data/lib/deck/app.rb +0 -16
- data/spec/deck_spec.rb +0 -98
@@ -1,7 +0,0 @@
|
|
1
|
-
<!-- Place the following snippet at the bottom of the deck container. -->
|
2
|
-
<form action="." method="get" class="goto-form">
|
3
|
-
<label for="goto-slide">Go to slide:</label>
|
4
|
-
<input type="text" name="slidenum" id="goto-slide" list="goto-datalist">
|
5
|
-
<datalist id="goto-datalist"></datalist>
|
6
|
-
<input type="submit" value="Go">
|
7
|
-
</form>
|
@@ -1,134 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
Deck JS - deck.goto
|
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 necessary methods and key bindings to show and hide a form
|
11
|
-
for jumping to any slide number/id in the deck (and processes that form
|
12
|
-
accordingly). The form-showing state is indicated by the presence of a class on
|
13
|
-
the deck container.
|
14
|
-
*/
|
15
|
-
(function($, deck, undefined) {
|
16
|
-
var $d = $(document);
|
17
|
-
|
18
|
-
/*
|
19
|
-
Extends defaults/options.
|
20
|
-
|
21
|
-
options.classes.goto
|
22
|
-
This class is added to the deck container when showing the Go To Slide
|
23
|
-
form.
|
24
|
-
|
25
|
-
options.selectors.gotoDatalist
|
26
|
-
The element that matches this selector is the datalist element that will
|
27
|
-
be populated with options for each of the slide ids. In browsers that
|
28
|
-
support the datalist element, this provides a drop list of slide ids to
|
29
|
-
aid the user in selecting a slide.
|
30
|
-
|
31
|
-
options.selectors.gotoForm
|
32
|
-
The element that matches this selector is the form that is submitted
|
33
|
-
when a user hits enter after typing a slide number/id in the gotoInput
|
34
|
-
element.
|
35
|
-
|
36
|
-
options.selectors.gotoInput
|
37
|
-
The element that matches this selector is the text input field for
|
38
|
-
entering a slide number/id in the Go To Slide form.
|
39
|
-
|
40
|
-
options.keys.goto
|
41
|
-
The numeric keycode used to show the Go To Slide form.
|
42
|
-
*/
|
43
|
-
$.extend(true, $[deck].defaults, {
|
44
|
-
classes: {
|
45
|
-
goto: 'deck-goto'
|
46
|
-
},
|
47
|
-
|
48
|
-
selectors: {
|
49
|
-
gotoDatalist: '#goto-datalist',
|
50
|
-
gotoForm: '.goto-form',
|
51
|
-
gotoInput: '#goto-slide'
|
52
|
-
},
|
53
|
-
|
54
|
-
keys: {
|
55
|
-
goto: 71 // g
|
56
|
-
}
|
57
|
-
});
|
58
|
-
|
59
|
-
/*
|
60
|
-
jQuery.deck('showGoTo')
|
61
|
-
|
62
|
-
Shows the Go To Slide form by adding the class specified by the goto class
|
63
|
-
option to the deck container.
|
64
|
-
*/
|
65
|
-
$[deck]('extend', 'showGoTo', function() {
|
66
|
-
$[deck]('getContainer').addClass($[deck]('getOptions').classes.goto);
|
67
|
-
$($[deck]('getOptions').selectors.gotoInput).focus();
|
68
|
-
});
|
69
|
-
|
70
|
-
/*
|
71
|
-
jQuery.deck('hideGoTo')
|
72
|
-
|
73
|
-
Hides the Go To Slide form by removing the class specified by the goto class
|
74
|
-
option from the deck container.
|
75
|
-
*/
|
76
|
-
$[deck]('extend', 'hideGoTo', function() {
|
77
|
-
$($[deck]('getOptions').selectors.gotoInput).blur();
|
78
|
-
$[deck]('getContainer').removeClass($[deck]('getOptions').classes.goto);
|
79
|
-
});
|
80
|
-
|
81
|
-
/*
|
82
|
-
jQuery.deck('toggleGoTo')
|
83
|
-
|
84
|
-
Toggles between showing and hiding the Go To Slide form.
|
85
|
-
*/
|
86
|
-
$[deck]('extend', 'toggleGoTo', function() {
|
87
|
-
$[deck]($[deck]('getContainer').hasClass($[deck]('getOptions').classes.goto) ? 'hideGoTo' : 'showGoTo');
|
88
|
-
});
|
89
|
-
|
90
|
-
$d.bind('deck.init', function() {
|
91
|
-
var opts = $[deck]('getOptions'),
|
92
|
-
$datalist = $(opts.selectors.gotoDatalist);
|
93
|
-
|
94
|
-
// Bind key events
|
95
|
-
$d.unbind('keydown.deckgoto').bind('keydown.deckgoto', function(e) {
|
96
|
-
var key = $[deck]('getOptions').keys.goto;
|
97
|
-
|
98
|
-
if (e.which === key || $.inArray(e.which, key) > -1) {
|
99
|
-
e.preventDefault();
|
100
|
-
$[deck]('toggleGoTo');
|
101
|
-
}
|
102
|
-
});
|
103
|
-
|
104
|
-
/* Populate datalist */
|
105
|
-
$.each($[deck]('getSlides'), function(i, $slide) {
|
106
|
-
var id = $slide.attr('id');
|
107
|
-
|
108
|
-
if (id) {
|
109
|
-
$datalist.append('<option value="' + id + '">');
|
110
|
-
}
|
111
|
-
});
|
112
|
-
|
113
|
-
// Process form submittal, go to the slide entered
|
114
|
-
$(opts.selectors.gotoForm)
|
115
|
-
.unbind('submit.deckgoto')
|
116
|
-
.bind('submit.deckgoto', function(e) {
|
117
|
-
var $field = $($[deck]('getOptions').selectors.gotoInput),
|
118
|
-
i = parseInt($field.val(), 10);
|
119
|
-
|
120
|
-
$[deck]('go', isNaN(i) ? $field.val() : i - 1);
|
121
|
-
$[deck]('hideGoTo');
|
122
|
-
$field.val('');
|
123
|
-
|
124
|
-
e.preventDefault();
|
125
|
-
});
|
126
|
-
|
127
|
-
$(opts.selectors.gotoInput)
|
128
|
-
.unbind('keydown.deckgoto')
|
129
|
-
.bind('keydown.deckgoto', function(e) {
|
130
|
-
e.stopPropagation();
|
131
|
-
});
|
132
|
-
});
|
133
|
-
})(jQuery, 'deck');
|
134
|
-
|
@@ -1,46 +0,0 @@
|
|
1
|
-
.deck-container {
|
2
|
-
.goto-form {
|
3
|
-
position:absolute;
|
4
|
-
z-index:3;
|
5
|
-
bottom:10px;
|
6
|
-
left:50%;
|
7
|
-
height:1.75em;
|
8
|
-
margin:0 0 0 -9.125em;
|
9
|
-
line-height:1.75em;
|
10
|
-
padding:0.625em;
|
11
|
-
display:none;
|
12
|
-
background:#ccc;
|
13
|
-
overflow:hidden;
|
14
|
-
|
15
|
-
.borderradius & {
|
16
|
-
-webkit-border-radius:10px;
|
17
|
-
-moz-border-radius:10px;
|
18
|
-
border-radius:10px;
|
19
|
-
}
|
20
|
-
|
21
|
-
label {
|
22
|
-
font-weight:bold;
|
23
|
-
}
|
24
|
-
|
25
|
-
label, input {
|
26
|
-
display:inline-block;
|
27
|
-
font-family:inherit;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
.deck-goto .goto-form {
|
33
|
-
display:block;
|
34
|
-
}
|
35
|
-
|
36
|
-
#goto-slide {
|
37
|
-
width:8.375em;
|
38
|
-
margin:0 0.625em;
|
39
|
-
height:1.4375em;
|
40
|
-
}
|
41
|
-
|
42
|
-
@media print {
|
43
|
-
.goto-form, #goto-slide {
|
44
|
-
display:none !important;
|
45
|
-
}
|
46
|
-
}
|
@@ -1,129 +0,0 @@
|
|
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
|
-
$.extend(true, $[deck].defaults, {
|
58
|
-
selectors: {
|
59
|
-
hashLink: '.deck-permalink'
|
60
|
-
},
|
61
|
-
|
62
|
-
hashPrefix: 'slide-'
|
63
|
-
});
|
64
|
-
|
65
|
-
|
66
|
-
$d.bind('deck.init', function() {
|
67
|
-
var opts = $[deck]('getOptions');
|
68
|
-
$internals = $(),
|
69
|
-
slides = $[deck]('getSlides');
|
70
|
-
|
71
|
-
$.each(slides, function(i, $el) {
|
72
|
-
var hash;
|
73
|
-
|
74
|
-
/* Hand out ids to the unfortunate slides born without them */
|
75
|
-
if (!$el.attr('id') || $el.data('deckAssignedId') === $el.attr('id')) {
|
76
|
-
$el.attr('id', opts.hashPrefix + i);
|
77
|
-
$el.data('deckAssignedId', opts.hashPrefix + i);
|
78
|
-
}
|
79
|
-
|
80
|
-
hash ='#' + $el.attr('id');
|
81
|
-
|
82
|
-
/* Deep link to slides on init */
|
83
|
-
if (hash === window.location.hash) {
|
84
|
-
$[deck]('go', i);
|
85
|
-
}
|
86
|
-
|
87
|
-
/* Add internal links to this slide */
|
88
|
-
$internals = $internals.add('a[href="' + hash + '"]');
|
89
|
-
});
|
90
|
-
|
91
|
-
if (!Modernizr.hashchange) {
|
92
|
-
/* Set up internal links using click for the poor browsers
|
93
|
-
without a hashchange event. */
|
94
|
-
$internals.unbind('click.deckhash').bind('click.deckhash', function(e) {
|
95
|
-
goByHash($(this).attr('href'));
|
96
|
-
});
|
97
|
-
}
|
98
|
-
|
99
|
-
/* Set up first id container state class */
|
100
|
-
if (slides.length) {
|
101
|
-
$[deck]('getContainer').addClass(opts.classes.onPrefix + $[deck]('getSlide').attr('id'));
|
102
|
-
};
|
103
|
-
})
|
104
|
-
/* Update permalink, address bar, and state class on a slide change */
|
105
|
-
.bind('deck.change', function(e, from, to) {
|
106
|
-
var hash = '#' + $[deck]('getSlide', to).attr('id'),
|
107
|
-
opts = $[deck]('getOptions'),
|
108
|
-
osp = opts.classes.onPrefix,
|
109
|
-
$c = $[deck]('getContainer');
|
110
|
-
|
111
|
-
$c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
|
112
|
-
$c.addClass(osp + $[deck]('getSlide', to).attr('id'));
|
113
|
-
|
114
|
-
$(opts.selectors.hashLink).attr('href', hash);
|
115
|
-
if (Modernizr.history) {
|
116
|
-
window.history.replaceState({}, "", hash);
|
117
|
-
}
|
118
|
-
});
|
119
|
-
|
120
|
-
/* Deals with internal links in modern browsers */
|
121
|
-
$window.bind('hashchange.deckhash', function(e) {
|
122
|
-
if (e.originalEvent && e.originalEvent.newURL) {
|
123
|
-
goByHash(e.originalEvent.newURL);
|
124
|
-
}
|
125
|
-
else {
|
126
|
-
goByHash(window.location.hash);
|
127
|
-
}
|
128
|
-
});
|
129
|
-
})(jQuery, 'deck', this);
|
@@ -1,47 +0,0 @@
|
|
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);
|
21
|
-
-moz-transform: scale(0.22);
|
22
|
-
-o-transform: scale(0.22);
|
23
|
-
-ms-transform: scale(0.22);
|
24
|
-
transform: scale(0.22);
|
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
|
-
}
|
@@ -1,187 +0,0 @@
|
|
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
|
-
|