helios 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +93 -71
- data/README.md +150 -127
- data/helios.gemspec +5 -4
- data/lib/helios/backend/push-notification.rb +1 -0
- data/lib/helios/commands/link.rb +2 -0
- data/lib/helios/commands/new.rb +1 -0
- data/lib/helios/frontend/javascripts/vendor/foundation.js +163 -47
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.alerts.js +6 -4
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.clearing.js +70 -32
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.dropdown.js +87 -31
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.forms.js +360 -238
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.interchange.js +271 -0
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.joyride.js +279 -48
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.magellan.js +8 -4
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.orbit.js +59 -24
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.placeholder.js +21 -1
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.reveal.js +100 -42
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.section.js +299 -60
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.tooltips.js +26 -13
- data/lib/helios/frontend/javascripts/vendor/foundation/foundation.topbar.js +154 -59
- data/lib/helios/frontend/javascripts/vendor/foundation/index.js +17 -0
- data/lib/helios/frontend/stylesheets/screen.sass +0 -1
- data/lib/helios/frontend/templates/push-notification/devices.jst.tpl +0 -3
- data/lib/helios/templates/.gitignore.erb +32 -0
- data/lib/helios/version.rb +1 -1
- metadata +31 -14
@@ -0,0 +1,271 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.interchange = {
|
7
|
+
name : 'interchange',
|
8
|
+
|
9
|
+
version : '4.2.2',
|
10
|
+
|
11
|
+
cache : {},
|
12
|
+
|
13
|
+
settings : {
|
14
|
+
load_attr : 'interchange',
|
15
|
+
|
16
|
+
named_queries : {
|
17
|
+
'default' : 'only screen and (min-width: 1px)',
|
18
|
+
small : 'only screen and (min-width: 768px)',
|
19
|
+
medium : 'only screen and (min-width: 1280px)',
|
20
|
+
large : 'only screen and (min-width: 1440px)',
|
21
|
+
landscape : 'only screen and (orientation: landscape)',
|
22
|
+
portrait : 'only screen and (orientation: portrait)',
|
23
|
+
retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
|
24
|
+
'only screen and (min--moz-device-pixel-ratio: 2),' +
|
25
|
+
'only screen and (-o-min-device-pixel-ratio: 2/1),' +
|
26
|
+
'only screen and (min-device-pixel-ratio: 2),' +
|
27
|
+
'only screen and (min-resolution: 192dpi),' +
|
28
|
+
'only screen and (min-resolution: 2dppx)'
|
29
|
+
},
|
30
|
+
|
31
|
+
directives : {
|
32
|
+
replace : function (el, path) {
|
33
|
+
if (/IMG/.test(el[0].nodeName)) {
|
34
|
+
var path_parts = path.split('/'),
|
35
|
+
path_file = path_parts[path_parts.length - 1],
|
36
|
+
orig_path = el[0].src;
|
37
|
+
|
38
|
+
if (new RegExp(path_file, 'i').test(el[0].src)) return;
|
39
|
+
|
40
|
+
el[0].src = path;
|
41
|
+
|
42
|
+
return el.trigger('replace', [el[0].src, orig_path]);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
init : function (scope, method, options) {
|
49
|
+
Foundation.inherit(this, 'throttle');
|
50
|
+
|
51
|
+
if (typeof method === 'object') {
|
52
|
+
$.extend(true, this.settings, method);
|
53
|
+
}
|
54
|
+
|
55
|
+
this.events();
|
56
|
+
this.images();
|
57
|
+
|
58
|
+
if (typeof method !== 'string') {
|
59
|
+
return this.settings.init;
|
60
|
+
} else {
|
61
|
+
return this[method].call(this, options);
|
62
|
+
}
|
63
|
+
},
|
64
|
+
|
65
|
+
events : function () {
|
66
|
+
var self = this;
|
67
|
+
|
68
|
+
$(window).on('resize.fndtn.interchange', self.throttle(function () {
|
69
|
+
self.resize.call(self);
|
70
|
+
}, 50));
|
71
|
+
},
|
72
|
+
|
73
|
+
resize : function () {
|
74
|
+
var cache = this.cache;
|
75
|
+
|
76
|
+
for (var uuid in cache) {
|
77
|
+
if (cache.hasOwnProperty(uuid)) {
|
78
|
+
var passed = this.results(uuid, cache[uuid]);
|
79
|
+
|
80
|
+
if (passed) {
|
81
|
+
this.settings.directives[passed
|
82
|
+
.scenario[1]](passed.el, passed.scenario[0]);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
},
|
88
|
+
|
89
|
+
results : function (uuid, scenarios) {
|
90
|
+
var count = scenarios.length,
|
91
|
+
results_arr = [];
|
92
|
+
|
93
|
+
if (count > 0) {
|
94
|
+
var el = $('[data-uuid="' + uuid + '"]');
|
95
|
+
|
96
|
+
for (var i = count - 1; i >= 0; i--) {
|
97
|
+
var rule = scenarios[i][2];
|
98
|
+
if (this.settings.named_queries.hasOwnProperty(rule)) {
|
99
|
+
var mq = matchMedia(this.settings.named_queries[rule]);
|
100
|
+
} else {
|
101
|
+
var mq = matchMedia(scenarios[i][2]);
|
102
|
+
}
|
103
|
+
if (mq.matches) {
|
104
|
+
return {el: el, scenario: scenarios[i]};
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
return false;
|
110
|
+
},
|
111
|
+
|
112
|
+
images : function (force_update) {
|
113
|
+
if (typeof this.cached_images === 'undefined' || force_update) {
|
114
|
+
return this.update_images();
|
115
|
+
}
|
116
|
+
|
117
|
+
return this.cached_images;
|
118
|
+
},
|
119
|
+
|
120
|
+
update_images : function () {
|
121
|
+
var images = document.getElementsByTagName('img'),
|
122
|
+
count = images.length,
|
123
|
+
data_attr = 'data-' + this.settings.load_attr;
|
124
|
+
|
125
|
+
this.cached_images = [];
|
126
|
+
|
127
|
+
for (var i = count - 1; i >= 0; i--) {
|
128
|
+
this.loaded($(images[i]), (i === 0), function (image, last) {
|
129
|
+
if (image) {
|
130
|
+
var str = image.getAttribute(data_attr) || '';
|
131
|
+
|
132
|
+
if (str.length > 0) {
|
133
|
+
this.cached_images.push(image);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
if (last) this.enhance();
|
138
|
+
|
139
|
+
}.bind(this));
|
140
|
+
}
|
141
|
+
|
142
|
+
return 'deferred';
|
143
|
+
},
|
144
|
+
|
145
|
+
// based on jquery.imageready.js
|
146
|
+
// @weblinc, @jsantell, (c) 2012
|
147
|
+
|
148
|
+
loaded : function (image, last, callback) {
|
149
|
+
function loaded () {
|
150
|
+
callback(image[0], last);
|
151
|
+
}
|
152
|
+
|
153
|
+
function bindLoad () {
|
154
|
+
this.one('load', loaded);
|
155
|
+
|
156
|
+
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
|
157
|
+
var src = this.attr( 'src' ),
|
158
|
+
param = src.match( /\?/ ) ? '&' : '?';
|
159
|
+
|
160
|
+
param += 'random=' + (new Date()).getTime();
|
161
|
+
this.attr('src', src + param);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
if (!image.attr('src')) {
|
166
|
+
loaded();
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (image[0].complete || image[0].readyState === 4) {
|
171
|
+
loaded();
|
172
|
+
} else {
|
173
|
+
bindLoad.call(image);
|
174
|
+
}
|
175
|
+
},
|
176
|
+
|
177
|
+
enhance : function () {
|
178
|
+
var count = this.images().length;
|
179
|
+
|
180
|
+
for (var i = count - 1; i >= 0; i--) {
|
181
|
+
this._object($(this.images()[i]));
|
182
|
+
}
|
183
|
+
|
184
|
+
return $(window).trigger('resize');
|
185
|
+
},
|
186
|
+
|
187
|
+
parse_params : function (path, directive, mq) {
|
188
|
+
return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
|
189
|
+
},
|
190
|
+
|
191
|
+
convert_directive : function (directive) {
|
192
|
+
var trimmed = this.trim(directive);
|
193
|
+
|
194
|
+
if (trimmed.length > 0) {
|
195
|
+
return trimmed;
|
196
|
+
}
|
197
|
+
|
198
|
+
return 'replace';
|
199
|
+
},
|
200
|
+
|
201
|
+
_object : function(el) {
|
202
|
+
var raw_arr = this.parse_data_attr(el),
|
203
|
+
scenarios = [], count = raw_arr.length;
|
204
|
+
|
205
|
+
if (count > 0) {
|
206
|
+
for (var i = count - 1; i >= 0; i--) {
|
207
|
+
var split = raw_arr[i].split(/\((.*?)(\))$/);
|
208
|
+
|
209
|
+
if (split.length > 1) {
|
210
|
+
var cached_split = split[0].split(','),
|
211
|
+
params = this.parse_params(cached_split[0],
|
212
|
+
cached_split[1], split[1]);
|
213
|
+
|
214
|
+
scenarios.push(params);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
return this.store(el, scenarios);
|
220
|
+
},
|
221
|
+
|
222
|
+
uuid : function (separator) {
|
223
|
+
var delim = separator || "-";
|
224
|
+
|
225
|
+
function S4() {
|
226
|
+
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
227
|
+
}
|
228
|
+
|
229
|
+
return (S4() + S4() + delim + S4() + delim + S4()
|
230
|
+
+ delim + S4() + delim + S4() + S4() + S4());
|
231
|
+
},
|
232
|
+
|
233
|
+
store : function (el, scenarios) {
|
234
|
+
var uuid = this.uuid(),
|
235
|
+
current_uuid = el.data('uuid');
|
236
|
+
|
237
|
+
if (current_uuid) return this.cache[current_uuid];
|
238
|
+
|
239
|
+
el.attr('data-uuid', uuid);
|
240
|
+
|
241
|
+
return this.cache[uuid] = scenarios;
|
242
|
+
},
|
243
|
+
|
244
|
+
trim : function(str) {
|
245
|
+
if (typeof str === 'string') {
|
246
|
+
return $.trim(str);
|
247
|
+
}
|
248
|
+
|
249
|
+
return str;
|
250
|
+
},
|
251
|
+
|
252
|
+
parse_data_attr : function (el) {
|
253
|
+
var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
|
254
|
+
count = raw.length, output = [];
|
255
|
+
|
256
|
+
for (var i = count - 1; i >= 0; i--) {
|
257
|
+
if (raw[i].replace(/[\W\d]+/, '').length > 4) {
|
258
|
+
output.push(raw[i]);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
return output;
|
263
|
+
},
|
264
|
+
|
265
|
+
reflow : function () {
|
266
|
+
this.images(true);
|
267
|
+
}
|
268
|
+
|
269
|
+
};
|
270
|
+
|
271
|
+
}(Foundation.zj, this, this.document));
|
@@ -1,23 +1,26 @@
|
|
1
1
|
/*jslint unparam: true, browser: true, indent: 2 */
|
2
2
|
|
3
|
-
|
3
|
+
(function ($, window, document, undefined) {
|
4
4
|
'use strict';
|
5
5
|
|
6
6
|
Foundation.libs.joyride = {
|
7
7
|
name: 'joyride',
|
8
8
|
|
9
|
-
version : '4.
|
9
|
+
version : '4.2.2',
|
10
10
|
|
11
11
|
defaults : {
|
12
|
+
expose : false, // turn on or off the expose feature
|
13
|
+
modal : false, // Whether to cover page with modal during the tour
|
12
14
|
tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent
|
13
15
|
nubPosition : 'auto', // override on a per tooltip bases
|
14
|
-
scrollSpeed : 300, // Page scrolling speed in milliseconds
|
16
|
+
scrollSpeed : 300, // Page scrolling speed in milliseconds, 0 = no scroll animation
|
15
17
|
timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
|
16
18
|
startTimerOnClick : true, // true or false - true requires clicking the first button start the timer
|
17
19
|
startOffset : 0, // the index of the tooltip you want to start on (index of the li)
|
18
20
|
nextButton : true, // true or false to control whether a next button is used
|
19
21
|
tipAnimation : 'fade', // 'pop' or 'fade' in each tip
|
20
22
|
pauseAfter : [], // array of indexes where to pause the tour after
|
23
|
+
exposed : [], // array of expose elements
|
21
24
|
tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
|
22
25
|
cookieMonster : false, // true or false to control whether cookies are used
|
23
26
|
cookieName : 'joyride', // Name the cookie you'll use
|
@@ -26,13 +29,20 @@
|
|
26
29
|
tipContainer : 'body', // Where will the tip be attached
|
27
30
|
postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete)
|
28
31
|
postStepCallback : function (){}, // A method to call after each step
|
32
|
+
preStepCallback : function (){}, // A method to call before each step
|
33
|
+
preRideCallback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
|
34
|
+
postExposeCallback : function (){}, // A method to call after an element has been exposed
|
29
35
|
template : { // HTML segments for tip layout
|
30
36
|
link : '<a href="#close" class="joyride-close-tip">×</a>',
|
31
37
|
timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
|
32
38
|
tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
|
33
39
|
wrapper : '<div class="joyride-content-wrapper"></div>',
|
34
|
-
button : '<a href="#" class="small button joyride-next-tip"></a>'
|
35
|
-
|
40
|
+
button : '<a href="#" class="small button joyride-next-tip"></a>',
|
41
|
+
modal : '<div class="joyride-modal-bg"></div>',
|
42
|
+
expose : '<div class="joyride-expose-wrapper"></div>',
|
43
|
+
exposeCover: '<div class="joyride-expose-cover"></div>'
|
44
|
+
},
|
45
|
+
exposeAddClass : '' // One or more space-separated class names to be added to exposed element
|
36
46
|
},
|
37
47
|
|
38
48
|
settings : {},
|
@@ -47,7 +57,7 @@
|
|
47
57
|
$.extend(true, this.settings, this.defaults, options);
|
48
58
|
}
|
49
59
|
|
50
|
-
if (typeof method
|
60
|
+
if (typeof method !== 'string') {
|
51
61
|
if (!this.settings.init) this.events();
|
52
62
|
|
53
63
|
return this.settings.init;
|
@@ -84,10 +94,20 @@
|
|
84
94
|
|
85
95
|
$(window).on('resize.fndtn.joyride', self.throttle(function () {
|
86
96
|
if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
|
97
|
+
if (self.settings.exposed.length > 0) {
|
98
|
+
var $els = $(self.settings.exposed);
|
99
|
+
|
100
|
+
$els.each(function () {
|
101
|
+
var $this = $(this);
|
102
|
+
self.un_expose($this);
|
103
|
+
self.expose($this);
|
104
|
+
});
|
105
|
+
}
|
106
|
+
|
87
107
|
if (self.is_phone()) {
|
88
108
|
self.pos_phone();
|
89
109
|
} else {
|
90
|
-
self.pos_default();
|
110
|
+
self.pos_default(false, true);
|
91
111
|
}
|
92
112
|
}
|
93
113
|
}, 100));
|
@@ -102,20 +122,15 @@
|
|
102
122
|
int_settings_count = integer_settings.length;
|
103
123
|
|
104
124
|
if (!this.settings.init) this.init();
|
105
|
-
$.extend(true, this.settings, this.data_options($this));
|
106
125
|
|
107
126
|
// non configureable settings
|
108
127
|
this.settings.$content_el = $this;
|
128
|
+
this.settings.$body = $(this.settings.tipContainer);
|
109
129
|
this.settings.body_offset = $(this.settings.tipContainer).position();
|
110
130
|
this.settings.$tip_content = this.settings.$content_el.find('> li');
|
111
131
|
this.settings.paused = false;
|
112
132
|
this.settings.attempts = 0;
|
113
133
|
|
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
134
|
this.settings.tipLocationPatterns = {
|
120
135
|
top: ['bottom'],
|
121
136
|
bottom: [], // bottom should not need to be repositioned
|
@@ -130,9 +145,14 @@
|
|
130
145
|
|
131
146
|
// generate the tips and insert into dom.
|
132
147
|
if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) {
|
133
|
-
|
134
148
|
this.settings.$tip_content.each(function (index) {
|
135
|
-
|
149
|
+
var $this = $(this);
|
150
|
+
$.extend(true, self.settings, self.data_options($this));
|
151
|
+
// Make sure that settings parsed from data_options are integers where necessary
|
152
|
+
for (var i = int_settings_count - 1; i >= 0; i--) {
|
153
|
+
self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
|
154
|
+
}
|
155
|
+
self.create({$li : $this, index : index});
|
136
156
|
});
|
137
157
|
|
138
158
|
// show first tip
|
@@ -191,7 +211,6 @@
|
|
191
211
|
},
|
192
212
|
|
193
213
|
create : function (opts) {
|
194
|
-
// backwards compatability with data-text attribute
|
195
214
|
var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
|
196
215
|
tipClass = opts.$li.attr('class'),
|
197
216
|
$tip_content = $(this.tip_template({
|
@@ -221,9 +240,20 @@
|
|
221
240
|
this.settings.attempts = 0;
|
222
241
|
|
223
242
|
if (this.settings.$li.length && this.settings.$target.length > 0) {
|
243
|
+
if (init) { //run when we first start
|
244
|
+
this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip);
|
245
|
+
if (this.settings.modal) {
|
246
|
+
this.show_modal();
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip);
|
251
|
+
|
252
|
+
if (this.settings.modal && this.settings.expose) {
|
253
|
+
this.expose();
|
254
|
+
}
|
224
255
|
|
225
|
-
this.settings.tipSettings = $.extend(
|
226
|
-
this.settings, this.data_options(this.settings.$li));
|
256
|
+
this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li));
|
227
257
|
|
228
258
|
this.settings.timer = parseInt(this.settings.timer, 10);
|
229
259
|
|
@@ -246,7 +276,7 @@
|
|
246
276
|
|
247
277
|
$timer.width(0);
|
248
278
|
|
249
|
-
if (
|
279
|
+
if (this.settings.timer > 0) {
|
250
280
|
|
251
281
|
this.settings.$next_tip.show();
|
252
282
|
|
@@ -309,14 +339,20 @@
|
|
309
339
|
return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;
|
310
340
|
}
|
311
341
|
|
312
|
-
return (this.settings.$window.width() < 767)
|
342
|
+
return (this.settings.$window.width() < 767);
|
313
343
|
},
|
314
344
|
|
315
345
|
hide : function () {
|
346
|
+
if (this.settings.modal && this.settings.expose) {
|
347
|
+
this.un_expose();
|
348
|
+
}
|
349
|
+
|
350
|
+
if (!this.settings.modal) {
|
351
|
+
$('.joyride-modal-bg').hide();
|
352
|
+
}
|
353
|
+
this.settings.$current_tip.hide();
|
316
354
|
this.settings.postStepCallback(this.settings.$li.index(),
|
317
355
|
this.settings.$current_tip);
|
318
|
-
$('.joyride-modal-bg').hide();
|
319
|
-
this.settings.$current_tip.hide();
|
320
356
|
},
|
321
357
|
|
322
358
|
set_li : function (init) {
|
@@ -334,6 +370,7 @@
|
|
334
370
|
|
335
371
|
set_next_tip : function () {
|
336
372
|
this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");
|
373
|
+
this.settings.$next_tip.data('closed', '');
|
337
374
|
},
|
338
375
|
|
339
376
|
set_target : function () {
|
@@ -363,11 +400,7 @@
|
|
363
400
|
},
|
364
401
|
|
365
402
|
paused : function () {
|
366
|
-
|
367
|
-
return true;
|
368
|
-
}
|
369
|
-
|
370
|
-
return false;
|
403
|
+
return ($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1);
|
371
404
|
},
|
372
405
|
|
373
406
|
restart : function () {
|
@@ -376,10 +409,11 @@
|
|
376
409
|
this.show('init');
|
377
410
|
},
|
378
411
|
|
379
|
-
pos_default : function (init) {
|
412
|
+
pos_default : function (init, resizing) {
|
380
413
|
var half_fold = Math.ceil($(window).height() / 2),
|
381
414
|
tip_position = this.settings.$next_tip.offset(),
|
382
415
|
$nub = this.settings.$next_tip.find('.joyride-nub'),
|
416
|
+
nub_width = Math.ceil(this.outerWidth($nub) / 2),
|
383
417
|
nub_height = Math.ceil(this.outerHeight($nub) / 2),
|
384
418
|
toggle = init || false;
|
385
419
|
|
@@ -389,20 +423,31 @@
|
|
389
423
|
this.settings.$next_tip.show();
|
390
424
|
}
|
391
425
|
|
426
|
+
if (typeof resizing === 'undefined') {
|
427
|
+
resizing = false;
|
428
|
+
}
|
429
|
+
|
392
430
|
if (!/body/i.test(this.settings.$target.selector)) {
|
393
431
|
|
394
432
|
if (this.bottom()) {
|
433
|
+
var leftOffset = this.settings.$target.offset().left;
|
434
|
+
if (Foundation.rtl) {
|
435
|
+
leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
|
436
|
+
}
|
395
437
|
this.settings.$next_tip.css({
|
396
438
|
top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)),
|
397
|
-
left:
|
439
|
+
left: leftOffset});
|
398
440
|
|
399
441
|
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top');
|
400
442
|
|
401
443
|
} else if (this.top()) {
|
402
|
-
|
444
|
+
var leftOffset = this.settings.$target.offset().left;
|
445
|
+
if (Foundation.rtl) {
|
446
|
+
leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
|
447
|
+
}
|
403
448
|
this.settings.$next_tip.css({
|
404
449
|
top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height),
|
405
|
-
left:
|
450
|
+
left: leftOffset});
|
406
451
|
|
407
452
|
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom');
|
408
453
|
|
@@ -410,7 +455,7 @@
|
|
410
455
|
|
411
456
|
this.settings.$next_tip.css({
|
412
457
|
top: this.settings.$target.offset().top,
|
413
|
-
left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left)});
|
458
|
+
left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
|
414
459
|
|
415
460
|
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left');
|
416
461
|
|
@@ -418,7 +463,7 @@
|
|
418
463
|
|
419
464
|
this.settings.$next_tip.css({
|
420
465
|
top: this.settings.$target.offset().top,
|
421
|
-
left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) -
|
466
|
+
left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
|
422
467
|
|
423
468
|
this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right');
|
424
469
|
|
@@ -435,7 +480,7 @@
|
|
435
480
|
|
436
481
|
this.settings.attempts++;
|
437
482
|
|
438
|
-
this.pos_default(
|
483
|
+
this.pos_default();
|
439
484
|
|
440
485
|
}
|
441
486
|
|
@@ -485,9 +530,7 @@
|
|
485
530
|
}
|
486
531
|
|
487
532
|
} else if (this.settings.$li.length) {
|
488
|
-
|
489
533
|
this.pos_modal($nub);
|
490
|
-
|
491
534
|
}
|
492
535
|
|
493
536
|
if (toggle) {
|
@@ -500,14 +543,176 @@
|
|
500
543
|
this.center();
|
501
544
|
$nub.hide();
|
502
545
|
|
503
|
-
|
504
|
-
|
546
|
+
this.show_modal();
|
547
|
+
},
|
548
|
+
|
549
|
+
show_modal : function () {
|
550
|
+
if (!this.settings.$next_tip.data('closed')) {
|
551
|
+
var joyridemodalbg = $('.joyride-modal-bg');
|
552
|
+
if (joyridemodalbg.length < 1) {
|
553
|
+
$('body').append(this.settings.template.modal).show();
|
554
|
+
}
|
555
|
+
|
556
|
+
if (/pop/i.test(this.settings.tipAnimation)) {
|
557
|
+
joyridemodalbg.show();
|
558
|
+
} else {
|
559
|
+
joyridemodalbg.fadeIn(this.settings.tipAnimationFadeSpeed);
|
560
|
+
}
|
561
|
+
}
|
562
|
+
},
|
563
|
+
|
564
|
+
expose : function () {
|
565
|
+
var expose,
|
566
|
+
exposeCover,
|
567
|
+
el,
|
568
|
+
origCSS,
|
569
|
+
origClasses,
|
570
|
+
randId = 'expose-'+Math.floor(Math.random()*10000);
|
571
|
+
|
572
|
+
if (arguments.length > 0 && arguments[0] instanceof $) {
|
573
|
+
el = arguments[0];
|
574
|
+
} else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
|
575
|
+
el = this.settings.$target;
|
576
|
+
} else {
|
577
|
+
return false;
|
505
578
|
}
|
506
579
|
|
507
|
-
if
|
508
|
-
|
580
|
+
if(el.length < 1){
|
581
|
+
if(window.console){
|
582
|
+
console.error('element not valid', el);
|
583
|
+
}
|
584
|
+
return false;
|
585
|
+
}
|
586
|
+
|
587
|
+
expose = $(this.settings.template.expose);
|
588
|
+
this.settings.$body.append(expose);
|
589
|
+
expose.css({
|
590
|
+
top: el.offset().top,
|
591
|
+
left: el.offset().left,
|
592
|
+
width: this.outerWidth(el, true),
|
593
|
+
height: this.outerHeight(el, true)
|
594
|
+
});
|
595
|
+
|
596
|
+
exposeCover = $(this.settings.template.exposeCover);
|
597
|
+
|
598
|
+
origCSS = {
|
599
|
+
zIndex: el.css('z-index'),
|
600
|
+
position: el.css('position')
|
601
|
+
};
|
602
|
+
|
603
|
+
origClasses = el.attr('class') == null ? '' : el.attr('class');
|
604
|
+
|
605
|
+
el.css('z-index',parseInt(expose.css('z-index'))+1);
|
606
|
+
|
607
|
+
if (origCSS.position == 'static') {
|
608
|
+
el.css('position','relative');
|
609
|
+
}
|
610
|
+
|
611
|
+
el.data('expose-css',origCSS);
|
612
|
+
el.data('orig-class', origClasses);
|
613
|
+
el.attr('class', origClasses + ' ' + this.settings.exposeAddClass);
|
614
|
+
|
615
|
+
exposeCover.css({
|
616
|
+
top: el.offset().top,
|
617
|
+
left: el.offset().left,
|
618
|
+
width: this.outerWidth(el, true),
|
619
|
+
height: this.outerHeight(el, true)
|
620
|
+
});
|
621
|
+
|
622
|
+
this.settings.$body.append(exposeCover);
|
623
|
+
expose.addClass(randId);
|
624
|
+
exposeCover.addClass(randId);
|
625
|
+
el.data('expose', randId);
|
626
|
+
this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el);
|
627
|
+
this.add_exposed(el);
|
628
|
+
},
|
629
|
+
|
630
|
+
un_expose : function () {
|
631
|
+
var exposeId,
|
632
|
+
el,
|
633
|
+
expose ,
|
634
|
+
origCSS,
|
635
|
+
origClasses,
|
636
|
+
clearAll = false;
|
637
|
+
|
638
|
+
if (arguments.length > 0 && arguments[0] instanceof $) {
|
639
|
+
el = arguments[0];
|
640
|
+
} else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
|
641
|
+
el = this.settings.$target;
|
642
|
+
} else {
|
643
|
+
return false;
|
644
|
+
}
|
645
|
+
|
646
|
+
if(el.length < 1){
|
647
|
+
if (window.console) {
|
648
|
+
console.error('element not valid', el);
|
649
|
+
}
|
650
|
+
return false;
|
651
|
+
}
|
652
|
+
|
653
|
+
exposeId = el.data('expose');
|
654
|
+
expose = $('.' + exposeId);
|
655
|
+
|
656
|
+
if (arguments.length > 1) {
|
657
|
+
clearAll = arguments[1];
|
658
|
+
}
|
659
|
+
|
660
|
+
if (clearAll === true) {
|
661
|
+
$('.joyride-expose-wrapper,.joyride-expose-cover').remove();
|
509
662
|
} else {
|
510
|
-
|
663
|
+
expose.remove();
|
664
|
+
}
|
665
|
+
|
666
|
+
origCSS = el.data('expose-css');
|
667
|
+
|
668
|
+
if (origCSS.zIndex == 'auto') {
|
669
|
+
el.css('z-index', '');
|
670
|
+
} else {
|
671
|
+
el.css('z-index', origCSS.zIndex);
|
672
|
+
}
|
673
|
+
|
674
|
+
if (origCSS.position != el.css('position')) {
|
675
|
+
if(origCSS.position == 'static') {// this is default, no need to set it.
|
676
|
+
el.css('position', '');
|
677
|
+
} else {
|
678
|
+
el.css('position', origCSS.position);
|
679
|
+
}
|
680
|
+
}
|
681
|
+
|
682
|
+
origClasses = el.data('orig-class');
|
683
|
+
el.attr('class', origClasses);
|
684
|
+
el.removeData('orig-classes');
|
685
|
+
|
686
|
+
el.removeData('expose');
|
687
|
+
el.removeData('expose-z-index');
|
688
|
+
this.remove_exposed(el);
|
689
|
+
},
|
690
|
+
|
691
|
+
add_exposed: function(el){
|
692
|
+
this.settings.exposed = this.settings.exposed || [];
|
693
|
+
if (el instanceof $ || typeof el === 'object') {
|
694
|
+
this.settings.exposed.push(el[0]);
|
695
|
+
} else if (typeof el == 'string') {
|
696
|
+
this.settings.exposed.push(el);
|
697
|
+
}
|
698
|
+
},
|
699
|
+
|
700
|
+
remove_exposed: function(el){
|
701
|
+
var search, count;
|
702
|
+
if (el instanceof $) {
|
703
|
+
search = el[0]
|
704
|
+
} else if (typeof el == 'string'){
|
705
|
+
search = el;
|
706
|
+
}
|
707
|
+
|
708
|
+
this.settings.exposed = this.settings.exposed || [];
|
709
|
+
count = this.settings.exposed.length;
|
710
|
+
|
711
|
+
for (var i=0; i < count; i++) {
|
712
|
+
if (this.settings.exposed[i] == search) {
|
713
|
+
this.settings.exposed.splice(i, 1);
|
714
|
+
return;
|
715
|
+
}
|
511
716
|
}
|
512
717
|
},
|
513
718
|
|
@@ -540,14 +745,31 @@
|
|
540
745
|
|
541
746
|
corners : function (el) {
|
542
747
|
var w = $(window),
|
748
|
+
window_half = w.height() / 2,
|
749
|
+
//using this to calculate since scroll may not have finished yet.
|
750
|
+
tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
|
543
751
|
right = w.width() + this.scrollLeft(w),
|
544
|
-
|
752
|
+
offsetBottom = w.height() + tipOffset,
|
753
|
+
bottom = w.height() + w.scrollTop(),
|
754
|
+
top = w.scrollTop();
|
755
|
+
|
756
|
+
if (tipOffset < top) {
|
757
|
+
if (tipOffset < 0) {
|
758
|
+
top = 0;
|
759
|
+
} else {
|
760
|
+
top = tipOffset;
|
761
|
+
}
|
762
|
+
}
|
763
|
+
|
764
|
+
if (offsetBottom > bottom) {
|
765
|
+
bottom = offsetBottom;
|
766
|
+
}
|
545
767
|
|
546
768
|
return [
|
547
|
-
el.offset().top
|
548
|
-
right
|
549
|
-
bottom
|
550
|
-
this.scrollLeft(w)
|
769
|
+
el.offset().top < top,
|
770
|
+
right < el.offset().left + el.outerWidth(),
|
771
|
+
bottom < el.offset().top + el.outerHeight(),
|
772
|
+
this.scrollLeft(w) > el.offset().left
|
551
773
|
];
|
552
774
|
},
|
553
775
|
|
@@ -590,10 +812,17 @@
|
|
590
812
|
clearTimeout(this.settings.automate);
|
591
813
|
}
|
592
814
|
|
815
|
+
if (this.settings.modal && this.settings.expose) {
|
816
|
+
this.un_expose();
|
817
|
+
}
|
818
|
+
|
819
|
+
this.settings.$next_tip.data('closed', true);
|
820
|
+
|
593
821
|
$('.joyride-modal-bg').hide();
|
594
822
|
this.settings.$current_tip.hide();
|
595
823
|
this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);
|
596
824
|
this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip);
|
825
|
+
$('.joyride-tip-guide').remove();
|
597
826
|
},
|
598
827
|
|
599
828
|
outerHTML : function (el) {
|
@@ -608,6 +837,8 @@
|
|
608
837
|
$('.joyride-tip-guide, .joyride-modal-bg').remove();
|
609
838
|
clearTimeout(this.settings.automate);
|
610
839
|
this.settings = {};
|
611
|
-
}
|
840
|
+
},
|
841
|
+
|
842
|
+
reflow : function () {}
|
612
843
|
};
|
613
|
-
}(Foundation.zj, this, this.document));
|
844
|
+
}(Foundation.zj, this, this.document));
|