zurb-foundation 3.2.5 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -2
- data/CHANGELOG.md +1 -26
- data/CONTRIBUTING.md +18 -0
- data/Gemfile.lock +19 -0
- data/Gruntfile.js +27 -0
- data/README.md +5 -6
- data/{Capfile → docs/Capfile} +0 -1
- data/docs/Gemfile +8 -0
- data/docs/Gemfile.lock +43 -0
- data/docs/Procfile +2 -0
- data/docs/README.md +1 -0
- data/docs/_sidebar-components.html.erb +109 -0
- data/docs/_sidebar.html.erb +109 -0
- data/docs/_zurb-jobs.html.erb +5 -0
- data/docs/changelog.html.erb +185 -0
- data/docs/compile.rb +43 -0
- data/docs/components/alert-boxes.html.erb +202 -0
- data/docs/components/block-grid.html.erb +118 -0
- data/docs/components/breadcrumbs.html.erb +146 -0
- data/docs/components/button-groups.html.erb +174 -0
- data/docs/components/buttons.html.erb +220 -0
- data/docs/components/clearing.html.erb +152 -0
- data/docs/components/custom-forms.html.erb +306 -0
- data/docs/components/dropdown-buttons.html.erb +233 -0
- data/docs/components/dropdown.html.erb +186 -0
- data/docs/components/flex-video.html.erb +93 -0
- data/docs/components/forms.html.erb +468 -0
- data/docs/components/grid.html.erb +355 -0
- data/docs/components/inline-lists.html.erb +89 -0
- data/docs/components/joyride.html.erb +178 -0
- data/docs/components/keystrokes.html.erb +74 -0
- data/docs/components/labels.html.erb +98 -0
- data/docs/components/magellan.html.erb +84 -0
- data/docs/components/orbit.html.erb +262 -0
- data/docs/components/pagination.html.erb +181 -0
- data/docs/components/panels.html.erb +121 -0
- data/docs/components/pricing-tables.html.erb +154 -0
- data/docs/components/progress-bars.html.erb +120 -0
- data/docs/components/reveal.html.erb +147 -0
- data/docs/components/section.html.erb +156 -0
- data/docs/components/side-nav.html.erb +122 -0
- data/docs/components/split-buttons.html.erb +218 -0
- data/docs/components/sub-nav.html.erb +120 -0
- data/docs/components/switch.html.erb +288 -0
- data/docs/components/tables.html.erb +123 -0
- data/docs/components/thumbnails.html.erb +87 -0
- data/docs/components/tooltips.html.erb +73 -0
- data/docs/components/top-bar.html.erb +219 -0
- data/docs/components/type.html.erb +359 -0
- data/docs/components/visibility.html.erb +102 -0
- data/docs/config.ru +12 -0
- data/docs/config/deploy.rb +33 -0
- data/docs/controller.rb +43 -0
- data/docs/css/_coderay.scss +116 -0
- data/docs/css/_settings.scss +1 -0
- data/docs/css/docs.scss +174 -0
- data/docs/css/normalize.scss +396 -0
- data/docs/css/qunit-composite.css +13 -0
- data/docs/css/qunit.css +235 -0
- data/docs/faq.html.erb +61 -0
- data/docs/img/demos/demo1-th.png +0 -0
- data/docs/img/demos/demo1.png +0 -0
- data/docs/img/demos/demo2-th.png +0 -0
- data/docs/img/demos/demo2.png +0 -0
- data/docs/img/demos/demo3-th.png +0 -0
- data/docs/img/demos/demo3.png +0 -0
- data/docs/img/demos/demo4-th.png +0 -0
- data/docs/img/demos/demo4.png +0 -0
- data/docs/img/demos/demo5-th.png +0 -0
- data/docs/img/demos/demo5.png +0 -0
- data/docs/index.html.erb +299 -0
- data/docs/javascript.html.erb +133 -0
- data/docs/js/docs.js +3 -0
- data/docs/js/qunit-composite.js +105 -0
- data/docs/js/qunit.js +1977 -0
- data/docs/js/tests/tabs/simple_tabs.html +57 -0
- data/docs/js/tests/tabs/simple_tabs.js +54 -0
- data/docs/js/tests/tooltips/tooltips.html +39 -0
- data/docs/js/tests/tooltips/tooltips.js +11 -0
- data/docs/layout.html.erb +99 -0
- data/docs/rails.html.erb +66 -0
- data/docs/sass.html.erb +299 -0
- data/docs/support.html.erb +134 -0
- data/foundation.gemspec +2 -4
- data/index.html +3 -23
- data/js/foundation/foundation.alerts.js +50 -0
- data/js/foundation/foundation.clearing.js +478 -0
- data/{vendor/assets/javascripts/foundation/jquery.cookie.js → js/foundation/foundation.cookie.js} +3 -1
- data/js/foundation/foundation.dropdown.js +122 -0
- data/js/foundation/foundation.forms.js +403 -0
- data/js/foundation/foundation.joyride.js +613 -0
- data/js/foundation/foundation.js +331 -0
- data/js/foundation/foundation.magellan.js +130 -0
- data/js/foundation/foundation.orbit.js +355 -0
- data/{vendor/assets/javascripts/foundation/jquery.placeholder.js → js/foundation/foundation.placeholder.js} +4 -2
- data/js/foundation/foundation.reveal.js +264 -0
- data/js/foundation/foundation.section.js +180 -0
- data/js/foundation/foundation.tooltips.js +195 -0
- data/js/foundation/foundation.topbar.js +187 -0
- data/js/foundation/index.js +16 -0
- data/{vendor/assets/javascripts/foundation/modernizr.foundation.js → js/vendor/custom.modernizr.js} +0 -0
- data/js/vendor/jquery.js +9597 -0
- data/js/vendor/zepto.js +1782 -0
- data/lib/foundation/engine.rb +8 -1
- data/lib/foundation/generators/install_generator.rb +24 -1
- data/lib/foundation/generators/templates/application.html.erb +20 -6
- data/lib/foundation/generators/templates/application.html.haml +2 -6
- data/lib/foundation/generators/templates/application.html.slim +2 -5
- data/lib/foundation/version.rb +1 -1
- data/lib/zurb-foundation.rb +7 -9
- data/package.json +9 -0
- data/scss/foundation.scss +42 -15
- data/scss/foundation/_foundation-global.scss +226 -0
- data/scss/foundation/components/_alert-boxes.scss +106 -0
- data/scss/foundation/components/_block-grid.scss +63 -0
- data/scss/foundation/components/_breadcrumbs.scss +117 -0
- data/scss/foundation/components/_button-groups.scss +59 -0
- data/scss/foundation/components/_buttons.scss +217 -0
- data/scss/foundation/components/_clearing.scss +209 -0
- data/scss/foundation/components/_custom-forms.scss +232 -0
- data/scss/foundation/components/_dropdown-buttons.scss +114 -0
- data/scss/foundation/components/_dropdown.scss +137 -0
- data/scss/foundation/components/_flex-video.scss +45 -0
- data/scss/foundation/components/_forms.scss +309 -0
- data/scss/foundation/components/_grid.scss +149 -71
- data/scss/foundation/components/_inline-lists.scss +47 -0
- data/scss/foundation/components/_joyride.scss +193 -0
- data/scss/foundation/components/_keystrokes.scss +56 -0
- data/scss/foundation/components/_labels.scss +81 -0
- data/scss/foundation/components/_magellan.scss +15 -0
- data/scss/foundation/components/_orbit.scss +193 -0
- data/scss/foundation/components/_pagination.scss +99 -0
- data/scss/foundation/components/_panels.scss +76 -0
- data/scss/foundation/components/_pricing-tables.scss +130 -0
- data/scss/foundation/components/_progress-bars.scss +68 -0
- data/scss/foundation/components/_reveal.scss +131 -0
- data/scss/foundation/components/_section.scss +194 -0
- data/scss/foundation/components/_side-nav.scss +68 -0
- data/scss/foundation/components/_split-buttons.scss +159 -0
- data/scss/foundation/components/_sub-nav.scss +67 -0
- data/scss/foundation/components/_switch.scss +242 -0
- data/scss/foundation/components/_tables.scss +80 -0
- data/scss/foundation/components/_thumbs.scss +45 -0
- data/scss/foundation/components/_tooltips.scss +113 -0
- data/scss/foundation/components/_top-bar.scss +443 -0
- data/scss/foundation/components/_type.scss +411 -0
- data/scss/foundation/components/_visibility.scss +117 -0
- data/scss/normalize.scss +396 -0
- data/templates/project/config.rb +26 -0
- data/templates/project/index.html +28 -43
- data/templates/project/manifest.rb +21 -28
- data/templates/project/scss/_settings.scss +4 -243
- data/templates/project/scss/app.scss +37 -44
- data/templates/project/scss/normalize.scss +396 -0
- data/test/stylesheets/styles.css +955 -0
- metadata +144 -153
- data/config/deploy.rb +0 -42
- data/lib/foundation/generators/layout_generator.rb +0 -28
- data/scss/foundation/_settings.scss +0 -281
- data/scss/foundation/common/_base.scss +0 -4
- data/scss/foundation/common/_forms.scss +0 -117
- data/scss/foundation/common/_globals.scss +0 -35
- data/scss/foundation/common/_ratios.scss +0 -19
- data/scss/foundation/common/_typography.scss +0 -104
- data/scss/foundation/components/modules/_all.scss +0 -10
- data/scss/foundation/components/modules/_buttons.scss +0 -178
- data/scss/foundation/components/modules/_clearing.scss +0 -61
- data/scss/foundation/components/modules/_joyride.scss +0 -33
- data/scss/foundation/components/modules/_mqueries.scss +0 -458
- data/scss/foundation/components/modules/_navbar.scss +0 -74
- data/scss/foundation/components/modules/_offcanvas.scss +0 -55
- data/scss/foundation/components/modules/_orbit.scss +0 -90
- data/scss/foundation/components/modules/_reveal.scss +0 -34
- data/scss/foundation/components/modules/_tabs.scss +0 -67
- data/scss/foundation/components/modules/_topbar.scss +0 -167
- data/scss/foundation/components/modules/_ui.scss +0 -292
- data/scss/foundation/functions/_all.scss +0 -2
- data/scss/foundation/functions/_convert-number-to-word.scss +0 -10
- data/scss/foundation/functions/_grid-calc.scss +0 -5
- data/scss/foundation/functions/modular-scale.scss +0 -3
- data/scss/foundation/mixins/_all.scss +0 -5
- data/scss/foundation/mixins/_clearfix.scss +0 -13
- data/scss/foundation/mixins/_css-triangle.scss +0 -22
- data/scss/foundation/mixins/_font-size.scss +0 -13
- data/scss/foundation/mixins/_respond-to.scss +0 -11
- data/scss/foundation/mixins/_semantic-grid.scss +0 -66
- data/test/buttons.html +0 -189
- data/test/clearing.html +0 -85
- data/test/config.rb +0 -11
- data/test/elements.html +0 -490
- data/test/forms.html +0 -371
- data/test/grid.html +0 -543
- data/test/images/orbit-demo/demo1.jpeg +0 -0
- data/test/images/orbit-demo/demo2.jpeg +0 -0
- data/test/images/orbit-demo/demo3.jpeg +0 -0
- data/test/images/orbit-demo/slider-background.jpeg +0 -0
- data/test/index.html +0 -83
- data/test/joyride.html +0 -127
- data/test/magellan.html +0 -112
- data/test/navigation.html +0 -269
- data/test/orbit.html +0 -112
- data/test/reveal.html +0 -91
- data/test/scss/_settings.scss +0 -245
- data/test/scss/styles.scss +0 -50
- data/test/tabs.html +0 -197
- data/test/template.html +0 -52
- data/test/topbar-login.html +0 -194
- data/test/topbar.html +0 -139
- data/test/type.html +0 -188
- data/vendor/assets/images/foundation/orbit/bullets.jpg +0 -0
- data/vendor/assets/images/foundation/orbit/left-arrow-small.png +0 -0
- data/vendor/assets/images/foundation/orbit/left-arrow.png +0 -0
- data/vendor/assets/images/foundation/orbit/loading.gif +0 -0
- data/vendor/assets/images/foundation/orbit/mask-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/pause-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/right-arrow-small.png +0 -0
- data/vendor/assets/images/foundation/orbit/right-arrow.png +0 -0
- data/vendor/assets/images/foundation/orbit/rotator-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/timer-black.png +0 -0
- data/vendor/assets/javascripts/foundation/app.js +0 -41
- data/vendor/assets/javascripts/foundation/index.js +0 -19
- data/vendor/assets/javascripts/foundation/jquery.event.move.js +0 -580
- data/vendor/assets/javascripts/foundation/jquery.event.swipe.js +0 -130
- data/vendor/assets/javascripts/foundation/jquery.foundation.accordion.js +0 -47
- data/vendor/assets/javascripts/foundation/jquery.foundation.alerts.js +0 -20
- data/vendor/assets/javascripts/foundation/jquery.foundation.buttons.js +0 -83
- data/vendor/assets/javascripts/foundation/jquery.foundation.clearing.js +0 -413
- data/vendor/assets/javascripts/foundation/jquery.foundation.forms.js +0 -502
- data/vendor/assets/javascripts/foundation/jquery.foundation.joyride.js +0 -639
- data/vendor/assets/javascripts/foundation/jquery.foundation.magellan.js +0 -96
- data/vendor/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
- data/vendor/assets/javascripts/foundation/jquery.foundation.navigation.js +0 -55
- data/vendor/assets/javascripts/foundation/jquery.foundation.orbit.js +0 -919
- data/vendor/assets/javascripts/foundation/jquery.foundation.reveal.js +0 -794
- data/vendor/assets/javascripts/foundation/jquery.foundation.tabs.js +0 -66
- data/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js +0 -211
- data/vendor/assets/javascripts/foundation/jquery.foundation.topbar.js +0 -174
- data/vendor/assets/javascripts/foundation/jquery.js +0 -9555
- data/vendor/assets/javascripts/foundation/jquery.offcanvas.js +0 -50
@@ -0,0 +1,613 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.joyride = {
|
7
|
+
name: 'joyride',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
defaults : {
|
12
|
+
tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent
|
13
|
+
nubPosition : 'auto', // override on a per tooltip bases
|
14
|
+
scrollSpeed : 300, // Page scrolling speed in milliseconds
|
15
|
+
timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
|
16
|
+
startTimerOnClick : true, // true or false - true requires clicking the first button start the timer
|
17
|
+
startOffset : 0, // the index of the tooltip you want to start on (index of the li)
|
18
|
+
nextButton : true, // true or false to control whether a next button is used
|
19
|
+
tipAnimation : 'fade', // 'pop' or 'fade' in each tip
|
20
|
+
pauseAfter : [], // array of indexes where to pause the tour after
|
21
|
+
tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
|
22
|
+
cookieMonster : false, // true or false to control whether cookies are used
|
23
|
+
cookieName : 'joyride', // Name the cookie you'll use
|
24
|
+
cookieDomain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
|
25
|
+
cookieExpires : 365, // set when you would like the cookie to expire.
|
26
|
+
tipContainer : 'body', // Where will the tip be attached
|
27
|
+
postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete)
|
28
|
+
postStepCallback : function (){}, // A method to call after each step
|
29
|
+
template : { // HTML segments for tip layout
|
30
|
+
link : '<a href="#close" class="joyride-close-tip">×</a>',
|
31
|
+
timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
|
32
|
+
tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
|
33
|
+
wrapper : '<div class="joyride-content-wrapper"></div>',
|
34
|
+
button : '<a href="#" class="small button joyride-next-tip"></a>'
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
settings : {},
|
39
|
+
|
40
|
+
init : function (scope, method, options) {
|
41
|
+
this.scope = scope || this.scope;
|
42
|
+
Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay');
|
43
|
+
|
44
|
+
if (typeof method === 'object') {
|
45
|
+
$.extend(true, this.settings, this.defaults, method);
|
46
|
+
} else {
|
47
|
+
$.extend(true, this.settings, this.defaults, options);
|
48
|
+
}
|
49
|
+
|
50
|
+
if (typeof method != 'string') {
|
51
|
+
if (!this.settings.init) this.events();
|
52
|
+
|
53
|
+
return this.settings.init;
|
54
|
+
} else {
|
55
|
+
return this[method].call(this, options);
|
56
|
+
}
|
57
|
+
},
|
58
|
+
|
59
|
+
events : function () {
|
60
|
+
var self = this;
|
61
|
+
|
62
|
+
$(this.scope)
|
63
|
+
.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
|
64
|
+
e.preventDefault();
|
65
|
+
|
66
|
+
if (this.settings.$li.next().length < 1) {
|
67
|
+
this.end();
|
68
|
+
} else if (this.settings.timer > 0) {
|
69
|
+
clearTimeout(this.settings.automate);
|
70
|
+
this.hide();
|
71
|
+
this.show();
|
72
|
+
this.startTimer();
|
73
|
+
} else {
|
74
|
+
this.hide();
|
75
|
+
this.show();
|
76
|
+
}
|
77
|
+
|
78
|
+
}.bind(this))
|
79
|
+
|
80
|
+
.on('click.joyride', '.joyride-close-tip', function (e) {
|
81
|
+
e.preventDefault();
|
82
|
+
this.end();
|
83
|
+
}.bind(this));
|
84
|
+
|
85
|
+
$(window).on('resize.fndtn.joyride', self.throttle(function () {
|
86
|
+
if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
|
87
|
+
if (self.is_phone()) {
|
88
|
+
self.pos_phone();
|
89
|
+
} else {
|
90
|
+
self.pos_default();
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}, 100));
|
94
|
+
|
95
|
+
this.settings.init = true;
|
96
|
+
},
|
97
|
+
|
98
|
+
start : function () {
|
99
|
+
var self = this,
|
100
|
+
$this = $(this.scope).find('[data-joyride]'),
|
101
|
+
integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
|
102
|
+
int_settings_count = integer_settings.length;
|
103
|
+
|
104
|
+
if (!this.settings.init) this.init();
|
105
|
+
$.extend(true, this.settings, this.data_options($this));
|
106
|
+
|
107
|
+
// non configureable settings
|
108
|
+
this.settings.$content_el = $this;
|
109
|
+
this.settings.body_offset = $(this.settings.tipContainer).position();
|
110
|
+
this.settings.$tip_content = this.settings.$content_el.find('> li');
|
111
|
+
this.settings.paused = false;
|
112
|
+
this.settings.attempts = 0;
|
113
|
+
|
114
|
+
// Make sure that settings parsed from data_options are integers where necessary
|
115
|
+
for (var i = int_settings_count - 1; i >= 0; i--) {
|
116
|
+
this.settings[integer_settings[i]] = parseInt(this.settings[integer_settings[i]], 10);
|
117
|
+
}
|
118
|
+
|
119
|
+
this.settings.tipLocationPatterns = {
|
120
|
+
top: ['bottom'],
|
121
|
+
bottom: [], // bottom should not need to be repositioned
|
122
|
+
left: ['right', 'top', 'bottom'],
|
123
|
+
right: ['left', 'top', 'bottom']
|
124
|
+
};
|
125
|
+
|
126
|
+
// can we create cookies?
|
127
|
+
if (typeof $.cookie !== 'function') {
|
128
|
+
this.settings.cookieMonster = false;
|
129
|
+
}
|
130
|
+
|
131
|
+
// generate the tips and insert into dom.
|
132
|
+
if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) {
|
133
|
+
|
134
|
+
this.settings.$tip_content.each(function (index) {
|
135
|
+
self.create({$li : $(this), index : index});
|
136
|
+
});
|
137
|
+
|
138
|
+
// show first tip
|
139
|
+
if (!this.settings.startTimerOnClick && this.settings.timer > 0) {
|
140
|
+
this.show('init');
|
141
|
+
this.startTimer();
|
142
|
+
} else {
|
143
|
+
this.show('init');
|
144
|
+
}
|
145
|
+
|
146
|
+
}
|
147
|
+
},
|
148
|
+
|
149
|
+
resume : function () {
|
150
|
+
this.set_li();
|
151
|
+
this.show();
|
152
|
+
},
|
153
|
+
|
154
|
+
tip_template : function (opts) {
|
155
|
+
var $blank, content;
|
156
|
+
|
157
|
+
opts.tip_class = opts.tip_class || '';
|
158
|
+
|
159
|
+
$blank = $(this.settings.template.tip).addClass(opts.tip_class);
|
160
|
+
content = $.trim($(opts.li).html()) +
|
161
|
+
this.button_text(opts.button_text) +
|
162
|
+
this.settings.template.link +
|
163
|
+
this.timer_instance(opts.index);
|
164
|
+
|
165
|
+
$blank.append($(this.settings.template.wrapper));
|
166
|
+
$blank.first().attr('data-index', opts.index);
|
167
|
+
$('.joyride-content-wrapper', $blank).append(content);
|
168
|
+
|
169
|
+
return $blank[0];
|
170
|
+
},
|
171
|
+
|
172
|
+
timer_instance : function (index) {
|
173
|
+
var txt;
|
174
|
+
|
175
|
+
if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) {
|
176
|
+
txt = '';
|
177
|
+
} else {
|
178
|
+
txt = this.outerHTML($(this.settings.template.timer)[0]);
|
179
|
+
}
|
180
|
+
return txt;
|
181
|
+
},
|
182
|
+
|
183
|
+
button_text : function (txt) {
|
184
|
+
if (this.settings.nextButton) {
|
185
|
+
txt = $.trim(txt) || 'Next';
|
186
|
+
txt = this.outerHTML($(this.settings.template.button).append(txt)[0]);
|
187
|
+
} else {
|
188
|
+
txt = '';
|
189
|
+
}
|
190
|
+
return txt;
|
191
|
+
},
|
192
|
+
|
193
|
+
create : function (opts) {
|
194
|
+
// backwards compatability with data-text attribute
|
195
|
+
var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
|
196
|
+
tipClass = opts.$li.attr('class'),
|
197
|
+
$tip_content = $(this.tip_template({
|
198
|
+
tip_class : tipClass,
|
199
|
+
index : opts.index,
|
200
|
+
button_text : buttonText,
|
201
|
+
li : opts.$li
|
202
|
+
}));
|
203
|
+
|
204
|
+
$(this.settings.tipContainer).append($tip_content);
|
205
|
+
},
|
206
|
+
|
207
|
+
show : function (init) {
|
208
|
+
var $timer = null;
|
209
|
+
|
210
|
+
// are we paused?
|
211
|
+
if (this.settings.$li === undefined
|
212
|
+
|| ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) {
|
213
|
+
|
214
|
+
// don't go to the next li if the tour was paused
|
215
|
+
if (this.settings.paused) {
|
216
|
+
this.settings.paused = false;
|
217
|
+
} else {
|
218
|
+
this.set_li(init);
|
219
|
+
}
|
220
|
+
|
221
|
+
this.settings.attempts = 0;
|
222
|
+
|
223
|
+
if (this.settings.$li.length && this.settings.$target.length > 0) {
|
224
|
+
|
225
|
+
this.settings.tipSettings = $.extend(true,
|
226
|
+
this.settings, this.data_options(this.settings.$li));
|
227
|
+
|
228
|
+
this.settings.timer = parseInt(this.settings.timer, 10);
|
229
|
+
|
230
|
+
this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation];
|
231
|
+
|
232
|
+
// scroll if not modal
|
233
|
+
if (!/body/i.test(this.settings.$target.selector)) {
|
234
|
+
this.scroll_to();
|
235
|
+
}
|
236
|
+
|
237
|
+
if (this.is_phone()) {
|
238
|
+
this.pos_phone(true);
|
239
|
+
} else {
|
240
|
+
this.pos_default(true);
|
241
|
+
}
|
242
|
+
|
243
|
+
$timer = this.settings.$next_tip.find('.joyride-timer-indicator');
|
244
|
+
|
245
|
+
if (/pop/i.test(this.settings.tipAnimation)) {
|
246
|
+
|
247
|
+
$timer.width(0);
|
248
|
+
|
249
|
+
if (thsi.settings.timer > 0) {
|
250
|
+
|
251
|
+
this.settings.$next_tip.show();
|
252
|
+
|
253
|
+
this.delay(function () {
|
254
|
+
$timer.animate({
|
255
|
+
width: $timer.parent().width()
|
256
|
+
}, this.settings.timer, 'linear');
|
257
|
+
}.bind(this), this.settings.tipAnimationFadeSpeed);
|
258
|
+
|
259
|
+
} else {
|
260
|
+
this.settings.$next_tip.show();
|
261
|
+
|
262
|
+
}
|
263
|
+
|
264
|
+
|
265
|
+
} else if (/fade/i.test(this.settings.tipAnimation)) {
|
266
|
+
|
267
|
+
$timer.width(0);
|
268
|
+
|
269
|
+
if (this.settings.timer > 0) {
|
270
|
+
|
271
|
+
this.settings.$next_tip
|
272
|
+
.fadeIn(this.settings.tipAnimationFadeSpeed)
|
273
|
+
.show();
|
274
|
+
|
275
|
+
this.delay(function () {
|
276
|
+
$timer.animate({
|
277
|
+
width: $timer.parent().width()
|
278
|
+
}, this.settings.timer, 'linear');
|
279
|
+
}.bind(this), this.settings.tipAnimationFadeSpeed);
|
280
|
+
|
281
|
+
} else {
|
282
|
+
this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed);
|
283
|
+
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
this.settings.$current_tip = this.settings.$next_tip;
|
288
|
+
|
289
|
+
// skip non-existant targets
|
290
|
+
} else if (this.settings.$li && this.settings.$target.length < 1) {
|
291
|
+
|
292
|
+
this.show();
|
293
|
+
|
294
|
+
} else {
|
295
|
+
|
296
|
+
this.end();
|
297
|
+
|
298
|
+
}
|
299
|
+
} else {
|
300
|
+
|
301
|
+
this.settings.paused = true;
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
},
|
306
|
+
|
307
|
+
is_phone : function () {
|
308
|
+
if (Modernizr) {
|
309
|
+
return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;
|
310
|
+
}
|
311
|
+
|
312
|
+
return (this.settings.$window.width() < 767) ? true : false;
|
313
|
+
},
|
314
|
+
|
315
|
+
hide : function () {
|
316
|
+
this.settings.postStepCallback(this.settings.$li.index(),
|
317
|
+
this.settings.$current_tip);
|
318
|
+
$('.joyride-modal-bg').hide();
|
319
|
+
this.settings.$current_tip.hide();
|
320
|
+
},
|
321
|
+
|
322
|
+
set_li : function (init) {
|
323
|
+
if (init) {
|
324
|
+
this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset);
|
325
|
+
this.set_next_tip();
|
326
|
+
this.settings.$current_tip = this.settings.$next_tip;
|
327
|
+
} else {
|
328
|
+
this.settings.$li = this.settings.$li.next();
|
329
|
+
this.set_next_tip();
|
330
|
+
}
|
331
|
+
|
332
|
+
this.set_target();
|
333
|
+
},
|
334
|
+
|
335
|
+
set_next_tip : function () {
|
336
|
+
this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");
|
337
|
+
},
|
338
|
+
|
339
|
+
set_target : function () {
|
340
|
+
var cl = this.settings.$li.attr('data-class'),
|
341
|
+
id = this.settings.$li.attr('data-id'),
|
342
|
+
$sel = function () {
|
343
|
+
if (id) {
|
344
|
+
return $(document.getElementById(id));
|
345
|
+
} else if (cl) {
|
346
|
+
return $('.' + cl).first();
|
347
|
+
} else {
|
348
|
+
return $('body');
|
349
|
+
}
|
350
|
+
};
|
351
|
+
|
352
|
+
this.settings.$target = $sel();
|
353
|
+
},
|
354
|
+
|
355
|
+
scroll_to : function () {
|
356
|
+
var window_half, tipOffset;
|
357
|
+
|
358
|
+
window_half = $(window).height() / 2;
|
359
|
+
tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip));
|
360
|
+
if (tipOffset > 0) {
|
361
|
+
this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed);
|
362
|
+
}
|
363
|
+
},
|
364
|
+
|
365
|
+
paused : function () {
|
366
|
+
if (($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1)) {
|
367
|
+
return true;
|
368
|
+
}
|
369
|
+
|
370
|
+
return false;
|
371
|
+
},
|
372
|
+
|
373
|
+
restart : function () {
|
374
|
+
this.hide();
|
375
|
+
this.settings.$li = undefined;
|
376
|
+
this.show('init');
|
377
|
+
},
|
378
|
+
|
379
|
+
pos_default : function (init) {
|
380
|
+
var half_fold = Math.ceil($(window).height() / 2),
|
381
|
+
tip_position = this.settings.$next_tip.offset(),
|
382
|
+
$nub = this.settings.$next_tip.find('.joyride-nub'),
|
383
|
+
nub_height = Math.ceil(this.outerHeight($nub) / 2),
|
384
|
+
toggle = init || false;
|
385
|
+
|
386
|
+
// tip must not be "display: none" to calculate position
|
387
|
+
if (toggle) {
|
388
|
+
this.settings.$next_tip.css('visibility', 'hidden');
|
389
|
+
this.settings.$next_tip.show();
|
390
|
+
}
|
391
|
+
|
392
|
+
if (!/body/i.test(this.settings.$target.selector)) {
|
393
|
+
|
394
|
+
if (this.bottom()) {
|
395
|
+
this.settings.$next_tip.css({
|
396
|
+
top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)),
|
397
|
+
left: this.settings.$target.offset().left});
|
398
|
+
|
399
|
+
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top');
|
400
|
+
|
401
|
+
} else if (this.top()) {
|
402
|
+
|
403
|
+
this.settings.$next_tip.css({
|
404
|
+
top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height),
|
405
|
+
left: this.settings.$target.offset().left});
|
406
|
+
|
407
|
+
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom');
|
408
|
+
|
409
|
+
} else if (this.right()) {
|
410
|
+
|
411
|
+
this.settings.$next_tip.css({
|
412
|
+
top: this.settings.$target.offset().top,
|
413
|
+
left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left)});
|
414
|
+
|
415
|
+
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left');
|
416
|
+
|
417
|
+
} else if (this.left()) {
|
418
|
+
|
419
|
+
this.settings.$next_tip.css({
|
420
|
+
top: this.settings.$target.offset().top,
|
421
|
+
left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_height)});
|
422
|
+
|
423
|
+
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right');
|
424
|
+
|
425
|
+
}
|
426
|
+
|
427
|
+
if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) {
|
428
|
+
|
429
|
+
$nub.removeClass('bottom')
|
430
|
+
.removeClass('top')
|
431
|
+
.removeClass('right')
|
432
|
+
.removeClass('left');
|
433
|
+
|
434
|
+
this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts];
|
435
|
+
|
436
|
+
this.settings.attempts++;
|
437
|
+
|
438
|
+
this.pos_default(true);
|
439
|
+
|
440
|
+
}
|
441
|
+
|
442
|
+
} else if (this.settings.$li.length) {
|
443
|
+
|
444
|
+
this.pos_modal($nub);
|
445
|
+
|
446
|
+
}
|
447
|
+
|
448
|
+
if (toggle) {
|
449
|
+
this.settings.$next_tip.hide();
|
450
|
+
this.settings.$next_tip.css('visibility', 'visible');
|
451
|
+
}
|
452
|
+
|
453
|
+
},
|
454
|
+
|
455
|
+
pos_phone : function (init) {
|
456
|
+
var tip_height = this.outerHeight(this.settings.$next_tip),
|
457
|
+
tip_offset = this.settings.$next_tip.offset(),
|
458
|
+
target_height = this.outerHeight(this.settings.$target),
|
459
|
+
$nub = $('.joyride-nub', this.settings.$next_tip),
|
460
|
+
nub_height = Math.ceil(this.outerHeight($nub) / 2),
|
461
|
+
toggle = init || false;
|
462
|
+
|
463
|
+
$nub.removeClass('bottom')
|
464
|
+
.removeClass('top')
|
465
|
+
.removeClass('right')
|
466
|
+
.removeClass('left');
|
467
|
+
|
468
|
+
if (toggle) {
|
469
|
+
this.settings.$next_tip.css('visibility', 'hidden');
|
470
|
+
this.settings.$next_tip.show();
|
471
|
+
}
|
472
|
+
|
473
|
+
if (!/body/i.test(this.settings.$target.selector)) {
|
474
|
+
|
475
|
+
if (this.top()) {
|
476
|
+
|
477
|
+
this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
|
478
|
+
$nub.addClass('bottom');
|
479
|
+
|
480
|
+
} else {
|
481
|
+
|
482
|
+
this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
|
483
|
+
$nub.addClass('top');
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
} else if (this.settings.$li.length) {
|
488
|
+
|
489
|
+
this.pos_modal($nub);
|
490
|
+
|
491
|
+
}
|
492
|
+
|
493
|
+
if (toggle) {
|
494
|
+
this.settings.$next_tip.hide();
|
495
|
+
this.settings.$next_tip.css('visibility', 'visible');
|
496
|
+
}
|
497
|
+
},
|
498
|
+
|
499
|
+
pos_modal : function ($nub) {
|
500
|
+
this.center();
|
501
|
+
$nub.hide();
|
502
|
+
|
503
|
+
if ($('.joyride-modal-bg').length < 1) {
|
504
|
+
$('body').append('<div class="joyride-modal-bg">').show();
|
505
|
+
}
|
506
|
+
|
507
|
+
if (/pop/i.test(this.settings.tipAnimation)) {
|
508
|
+
$('.joyride-modal-bg').show();
|
509
|
+
} else {
|
510
|
+
$('.joyride-modal-bg').fadeIn(this.settings.tipAnimationFadeSpeed);
|
511
|
+
}
|
512
|
+
},
|
513
|
+
|
514
|
+
center : function () {
|
515
|
+
var $w = $(window);
|
516
|
+
|
517
|
+
this.settings.$next_tip.css({
|
518
|
+
top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()),
|
519
|
+
left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w))
|
520
|
+
});
|
521
|
+
|
522
|
+
return true;
|
523
|
+
},
|
524
|
+
|
525
|
+
bottom : function () {
|
526
|
+
return /bottom/i.test(this.settings.tipSettings.tipLocation);
|
527
|
+
},
|
528
|
+
|
529
|
+
top : function () {
|
530
|
+
return /top/i.test(this.settings.tipSettings.tipLocation);
|
531
|
+
},
|
532
|
+
|
533
|
+
right : function () {
|
534
|
+
return /right/i.test(this.settings.tipSettings.tipLocation);
|
535
|
+
},
|
536
|
+
|
537
|
+
left : function () {
|
538
|
+
return /left/i.test(this.settings.tipSettings.tipLocation);
|
539
|
+
},
|
540
|
+
|
541
|
+
corners : function (el) {
|
542
|
+
var w = $(window),
|
543
|
+
right = w.width() + this.scrollLeft(w),
|
544
|
+
bottom = w.width() + w.scrollTop();
|
545
|
+
|
546
|
+
return [
|
547
|
+
el.offset().top <= w.scrollTop(),
|
548
|
+
right <= el.offset().left + this.outerWidth(el),
|
549
|
+
bottom <= el.offset().top + this.outerHeight(el),
|
550
|
+
this.scrollLeft(w) >= el.offset().left
|
551
|
+
];
|
552
|
+
},
|
553
|
+
|
554
|
+
visible : function (hidden_corners) {
|
555
|
+
var i = hidden_corners.length;
|
556
|
+
|
557
|
+
while (i--) {
|
558
|
+
if (hidden_corners[i]) return false;
|
559
|
+
}
|
560
|
+
|
561
|
+
return true;
|
562
|
+
},
|
563
|
+
|
564
|
+
nub_position : function (nub, pos, def) {
|
565
|
+
if (pos === 'auto') {
|
566
|
+
nub.addClass(def);
|
567
|
+
} else {
|
568
|
+
nub.addClass(pos);
|
569
|
+
}
|
570
|
+
},
|
571
|
+
|
572
|
+
startTimer : function () {
|
573
|
+
if (this.settings.$li.length) {
|
574
|
+
this.settings.automate = setTimeout(function () {
|
575
|
+
this.hide();
|
576
|
+
this.show();
|
577
|
+
this.startTimer();
|
578
|
+
}.bind(this), this.settings.timer);
|
579
|
+
} else {
|
580
|
+
clearTimeout(this.settings.automate);
|
581
|
+
}
|
582
|
+
},
|
583
|
+
|
584
|
+
end : function () {
|
585
|
+
if (this.settings.cookieMonster) {
|
586
|
+
$.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain });
|
587
|
+
}
|
588
|
+
|
589
|
+
if (this.settings.timer > 0) {
|
590
|
+
clearTimeout(this.settings.automate);
|
591
|
+
}
|
592
|
+
|
593
|
+
$('.joyride-modal-bg').hide();
|
594
|
+
this.settings.$current_tip.hide();
|
595
|
+
this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);
|
596
|
+
this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip);
|
597
|
+
},
|
598
|
+
|
599
|
+
outerHTML : function (el) {
|
600
|
+
// support FireFox < 11
|
601
|
+
return el.outerHTML || new XMLSerializer().serializeToString(el);
|
602
|
+
},
|
603
|
+
|
604
|
+
off : function () {
|
605
|
+
$(this.scope).off('.joyride');
|
606
|
+
$(window).off('.joyride');
|
607
|
+
$('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
|
608
|
+
$('.joyride-tip-guide, .joyride-modal-bg').remove();
|
609
|
+
clearTimeout(this.settings.automate);
|
610
|
+
this.settings = {};
|
611
|
+
}
|
612
|
+
};
|
613
|
+
}(Foundation.zj, this, this.document));
|