aladdin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.md +43 -0
- data/assets/images/foundation/orbit/bullets.jpg +0 -0
- data/assets/images/foundation/orbit/left-arrow-small.png +0 -0
- data/assets/images/foundation/orbit/left-arrow.png +0 -0
- data/assets/images/foundation/orbit/loading.gif +0 -0
- data/assets/images/foundation/orbit/mask-black.png +0 -0
- data/assets/images/foundation/orbit/pause-black.png +0 -0
- data/assets/images/foundation/orbit/right-arrow-small.png +0 -0
- data/assets/images/foundation/orbit/right-arrow.png +0 -0
- data/assets/images/foundation/orbit/rotator-black.png +0 -0
- data/assets/images/foundation/orbit/timer-black.png +0 -0
- data/assets/javascripts/foundation/app.js +38 -0
- data/assets/javascripts/foundation/jquery.cookie.js +72 -0
- data/assets/javascripts/foundation/jquery.event.move.js +580 -0
- data/assets/javascripts/foundation/jquery.event.swipe.js +130 -0
- data/assets/javascripts/foundation/jquery.foundation.accordion.js +34 -0
- data/assets/javascripts/foundation/jquery.foundation.alerts.js +20 -0
- data/assets/javascripts/foundation/jquery.foundation.buttons.js +74 -0
- data/assets/javascripts/foundation/jquery.foundation.clearing.js +468 -0
- data/assets/javascripts/foundation/jquery.foundation.forms.js +486 -0
- data/assets/javascripts/foundation/jquery.foundation.joyride.js +639 -0
- data/assets/javascripts/foundation/jquery.foundation.magellan.js +85 -0
- data/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +27 -0
- data/assets/javascripts/foundation/jquery.foundation.navigation.js +55 -0
- data/assets/javascripts/foundation/jquery.foundation.orbit.js +897 -0
- data/assets/javascripts/foundation/jquery.foundation.reveal.js +794 -0
- data/assets/javascripts/foundation/jquery.foundation.tabs.js +43 -0
- data/assets/javascripts/foundation/jquery.foundation.tooltips.js +193 -0
- data/assets/javascripts/foundation/jquery.foundation.topbar.js +152 -0
- data/assets/javascripts/foundation/jquery.js +9440 -0
- data/assets/javascripts/foundation/jquery.offcanvas.js +50 -0
- data/assets/javascripts/foundation/jquery.placeholder.js +157 -0
- data/assets/javascripts/foundation/modernizr.foundation.js +4 -0
- data/bin/aladdin +20 -0
- data/lib/aladdin.rb +43 -0
- data/lib/aladdin/app.rb +89 -0
- data/lib/aladdin/render/markdown.rb +40 -0
- data/lib/aladdin/render/sanitize.rb +84 -0
- data/lib/aladdin/version.rb +4 -0
- data/views/haml/index.haml +43 -0
- data/views/haml/layout.haml +51 -0
- data/views/scss/_settings.scss +242 -0
- data/views/scss/app.scss +47 -0
- data/views/scss/github.scss +65 -0
- data/views/scss/pygment.scss +12 -0
- metadata +307 -0
@@ -0,0 +1,639 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Foundation Joyride Plugin 2.0.1
|
3
|
+
* http://foundation.zurb.com
|
4
|
+
* Copyright 2012, ZURB
|
5
|
+
* Free to use under the MIT license.
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
10
|
+
|
11
|
+
;(function ($, window, undefined) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var defaults = {
|
15
|
+
'version' : '2.0.1',
|
16
|
+
'tipLocation' : 'bottom', // 'top' or 'bottom' in relation to parent
|
17
|
+
'nubPosition' : 'auto', // override on a per tooltip bases
|
18
|
+
'scrollSpeed' : 300, // Page scrolling speed in milliseconds
|
19
|
+
'timer' : 0, // 0 = no timer , all other numbers = timer in milliseconds
|
20
|
+
'startTimerOnClick' : true, // true or false - true requires clicking the first button start the timer
|
21
|
+
'startOffset' : 0, // the index of the tooltip you want to start on (index of the li)
|
22
|
+
'nextButton' : true, // true or false to control whether a next button is used
|
23
|
+
'tipAnimation' : 'fade', // 'pop' or 'fade' in each tip
|
24
|
+
'pauseAfter' : [], // array of indexes where to pause the tour after
|
25
|
+
'tipAnimationFadeSpeed': 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
|
26
|
+
'cookieMonster' : false, // true or false to control whether cookies are used
|
27
|
+
'cookieName' : 'joyride', // Name the cookie you'll use
|
28
|
+
'cookieDomain' : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
|
29
|
+
'tipContainer' : 'body', // Where will the tip be attached
|
30
|
+
'postRideCallback' : $.noop, // A method to call once the tour closes (canceled or complete)
|
31
|
+
'postStepCallback' : $.noop, // A method to call after each step
|
32
|
+
'template' : { // HTML segments for tip layout
|
33
|
+
'link' : '<a href="#close" class="joyride-close-tip">X</a>',
|
34
|
+
'timer' : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
|
35
|
+
'tip' : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
|
36
|
+
'wrapper' : '<div class="joyride-content-wrapper"></div>',
|
37
|
+
'button' : '<a href="#" class="small button joyride-next-tip"></a>'
|
38
|
+
}
|
39
|
+
},
|
40
|
+
|
41
|
+
Modernizr = Modernizr || false,
|
42
|
+
|
43
|
+
settings = {},
|
44
|
+
|
45
|
+
methods = {
|
46
|
+
|
47
|
+
init : function (opts) {
|
48
|
+
return this.each(function () {
|
49
|
+
|
50
|
+
if ($.isEmptyObject(settings)) {
|
51
|
+
settings = $.extend(defaults, opts);
|
52
|
+
|
53
|
+
// non configureable settings
|
54
|
+
settings.document = window.document;
|
55
|
+
settings.$document = $(settings.document);
|
56
|
+
settings.$window = $(window);
|
57
|
+
settings.$content_el = $(this);
|
58
|
+
settings.body_offset = $(settings.tipContainer).position();
|
59
|
+
settings.$tip_content = $('li', settings.$content_el);
|
60
|
+
settings.paused = false;
|
61
|
+
settings.attempts = 0;
|
62
|
+
|
63
|
+
settings.tipLocationPatterns = {
|
64
|
+
top: ['bottom'],
|
65
|
+
bottom: [], // bottom should not need to be repositioned
|
66
|
+
left: ['right', 'top', 'bottom'],
|
67
|
+
right: ['left', 'top', 'bottom']
|
68
|
+
};
|
69
|
+
|
70
|
+
// are we using jQuery 1.7+
|
71
|
+
methods.jquery_check();
|
72
|
+
|
73
|
+
// can we create cookies?
|
74
|
+
if (!$.isFunction($.cookie)) {
|
75
|
+
settings.cookieMonster = false;
|
76
|
+
}
|
77
|
+
|
78
|
+
// generate the tips and insert into dom.
|
79
|
+
if (!settings.cookieMonster || !$.cookie(settings.cookieName)) {
|
80
|
+
|
81
|
+
settings.$tip_content.each(function (index) {
|
82
|
+
methods.create({$li : $(this), index : index});
|
83
|
+
});
|
84
|
+
|
85
|
+
// show first tip
|
86
|
+
if (!settings.startTimerOnClick && settings.timer > 0) {
|
87
|
+
methods.show('init');
|
88
|
+
methods.startTimer();
|
89
|
+
} else {
|
90
|
+
methods.show('init');
|
91
|
+
}
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
|
96
|
+
e.preventDefault();
|
97
|
+
|
98
|
+
if (settings.$li.next().length < 1) {
|
99
|
+
methods.end();
|
100
|
+
} else if (settings.timer > 0) {
|
101
|
+
clearTimeout(settings.automate);
|
102
|
+
methods.hide();
|
103
|
+
methods.show();
|
104
|
+
methods.startTimer();
|
105
|
+
} else {
|
106
|
+
methods.hide();
|
107
|
+
methods.show();
|
108
|
+
}
|
109
|
+
|
110
|
+
});
|
111
|
+
|
112
|
+
$('.joyride-close-tip').on('click.joyride', function (e) {
|
113
|
+
e.preventDefault();
|
114
|
+
methods.end();
|
115
|
+
});
|
116
|
+
|
117
|
+
settings.$window.on('resize.joyride', function (e) {
|
118
|
+
if (methods.is_phone()) {
|
119
|
+
methods.pos_phone();
|
120
|
+
} else {
|
121
|
+
methods.pos_default();
|
122
|
+
}
|
123
|
+
});
|
124
|
+
} else {
|
125
|
+
methods.restart();
|
126
|
+
}
|
127
|
+
|
128
|
+
});
|
129
|
+
},
|
130
|
+
|
131
|
+
// call this method when you want to resume the tour
|
132
|
+
resume : function () {
|
133
|
+
methods.set_li();
|
134
|
+
methods.show();
|
135
|
+
},
|
136
|
+
|
137
|
+
tip_template : function (opts) {
|
138
|
+
var $blank, content;
|
139
|
+
|
140
|
+
opts.tip_class = opts.tip_class || '';
|
141
|
+
|
142
|
+
$blank = $(settings.template.tip).addClass(opts.tip_class);
|
143
|
+
content = $.trim($(opts.li).html()) +
|
144
|
+
methods.button_text(opts.button_text) +
|
145
|
+
settings.template.link +
|
146
|
+
methods.timer_instance(opts.index);
|
147
|
+
|
148
|
+
$blank.append($(settings.template.wrapper));
|
149
|
+
$blank.first().attr('data-index', opts.index);
|
150
|
+
$('.joyride-content-wrapper', $blank).append(content);
|
151
|
+
|
152
|
+
return $blank[0];
|
153
|
+
},
|
154
|
+
|
155
|
+
timer_instance : function (index) {
|
156
|
+
var txt;
|
157
|
+
|
158
|
+
if ((index === 0 && settings.startTimerOnClick && settings.timer > 0) || settings.timer === 0) {
|
159
|
+
txt = '';
|
160
|
+
} else {
|
161
|
+
txt = methods.outerHTML($(settings.template.timer)[0]);
|
162
|
+
}
|
163
|
+
return txt;
|
164
|
+
},
|
165
|
+
|
166
|
+
button_text : function (txt) {
|
167
|
+
if (settings.nextButton) {
|
168
|
+
txt = $.trim(txt) || 'Next';
|
169
|
+
txt = methods.outerHTML($(settings.template.button).append(txt)[0]);
|
170
|
+
} else {
|
171
|
+
txt = '';
|
172
|
+
}
|
173
|
+
return txt;
|
174
|
+
},
|
175
|
+
|
176
|
+
create : function (opts) {
|
177
|
+
// backwards compatability with data-text attribute
|
178
|
+
var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
|
179
|
+
tipClass = opts.$li.attr('class'),
|
180
|
+
$tip_content = $(methods.tip_template({
|
181
|
+
tip_class : tipClass,
|
182
|
+
index : opts.index,
|
183
|
+
button_text : buttonText,
|
184
|
+
li : opts.$li
|
185
|
+
}));
|
186
|
+
|
187
|
+
$(settings.tipContainer).append($tip_content);
|
188
|
+
},
|
189
|
+
|
190
|
+
show : function (init) {
|
191
|
+
var opts = {}, ii, opts_arr = [], opts_len = 0, p,
|
192
|
+
$timer = null;
|
193
|
+
|
194
|
+
// are we paused?
|
195
|
+
if (settings.$li === undefined || ($.inArray(settings.$li.index(), settings.pauseAfter) === -1)) {
|
196
|
+
|
197
|
+
// don't go to the next li if the tour was paused
|
198
|
+
if (settings.paused) {
|
199
|
+
settings.paused = false;
|
200
|
+
} else {
|
201
|
+
methods.set_li(init);
|
202
|
+
}
|
203
|
+
|
204
|
+
settings.attempts = 0;
|
205
|
+
|
206
|
+
if (settings.$li.length && settings.$target.length > 0) {
|
207
|
+
opts_arr = (settings.$li.data('options') || ':').split(';');
|
208
|
+
opts_len = opts_arr.length;
|
209
|
+
|
210
|
+
// parse options
|
211
|
+
for (ii = opts_len - 1; ii >= 0; ii--) {
|
212
|
+
p = opts_arr[ii].split(':');
|
213
|
+
|
214
|
+
if (p.length === 2) {
|
215
|
+
opts[$.trim(p[0])] = $.trim(p[1]);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
settings.tipSettings = $.extend({}, settings, opts);
|
220
|
+
|
221
|
+
settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation];
|
222
|
+
|
223
|
+
// scroll if not modal
|
224
|
+
if (!/body/i.test(settings.$target.selector)) {
|
225
|
+
methods.scroll_to();
|
226
|
+
}
|
227
|
+
|
228
|
+
if (methods.is_phone()) {
|
229
|
+
methods.pos_phone(true);
|
230
|
+
} else {
|
231
|
+
methods.pos_default(true);
|
232
|
+
}
|
233
|
+
|
234
|
+
$timer = $('.joyride-timer-indicator', settings.$next_tip);
|
235
|
+
|
236
|
+
if (/pop/i.test(settings.tipAnimation)) {
|
237
|
+
|
238
|
+
$timer.outerWidth(0);
|
239
|
+
|
240
|
+
if (settings.timer > 0) {
|
241
|
+
|
242
|
+
settings.$next_tip.show();
|
243
|
+
$timer.animate({
|
244
|
+
width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
|
245
|
+
}, settings.timer);
|
246
|
+
|
247
|
+
} else {
|
248
|
+
|
249
|
+
settings.$next_tip.show();
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
} else if (/fade/i.test(settings.tipAnimation)) {
|
255
|
+
|
256
|
+
$timer.outerWidth(0);
|
257
|
+
|
258
|
+
if (settings.timer > 0) {
|
259
|
+
|
260
|
+
settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
|
261
|
+
|
262
|
+
settings.$next_tip.show();
|
263
|
+
$timer.animate({
|
264
|
+
width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
|
265
|
+
}, settings.timer);
|
266
|
+
|
267
|
+
} else {
|
268
|
+
|
269
|
+
settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
|
270
|
+
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
settings.$current_tip = settings.$next_tip;
|
275
|
+
|
276
|
+
// skip non-existant targets
|
277
|
+
} else if (settings.$li && settings.$target.length < 1) {
|
278
|
+
|
279
|
+
methods.show();
|
280
|
+
|
281
|
+
} else {
|
282
|
+
|
283
|
+
methods.end();
|
284
|
+
|
285
|
+
}
|
286
|
+
} else {
|
287
|
+
|
288
|
+
settings.paused = true;
|
289
|
+
|
290
|
+
}
|
291
|
+
|
292
|
+
},
|
293
|
+
|
294
|
+
// detect phones with media queries if supported.
|
295
|
+
is_phone : function () {
|
296
|
+
if (Modernizr) {
|
297
|
+
return Modernizr.mq('only screen and (max-width: 767px)');
|
298
|
+
}
|
299
|
+
|
300
|
+
return (settings.$window.width() < 767) ? true : false;
|
301
|
+
},
|
302
|
+
|
303
|
+
hide : function () {
|
304
|
+
settings.postStepCallback(settings.$li.index(), settings.$current_tip);
|
305
|
+
$('.joyride-modal-bg').hide();
|
306
|
+
settings.$current_tip.hide();
|
307
|
+
},
|
308
|
+
|
309
|
+
set_li : function (init) {
|
310
|
+
if (init) {
|
311
|
+
settings.$li = settings.$tip_content.eq(settings.startOffset);
|
312
|
+
methods.set_next_tip();
|
313
|
+
settings.$current_tip = settings.$next_tip;
|
314
|
+
} else {
|
315
|
+
settings.$li = settings.$li.next();
|
316
|
+
methods.set_next_tip();
|
317
|
+
}
|
318
|
+
|
319
|
+
methods.set_target();
|
320
|
+
},
|
321
|
+
|
322
|
+
set_next_tip : function () {
|
323
|
+
settings.$next_tip = $('.joyride-tip-guide[data-index=' + settings.$li.index() + ']');
|
324
|
+
},
|
325
|
+
|
326
|
+
set_target : function () {
|
327
|
+
var cl = settings.$li.attr('data-class'),
|
328
|
+
id = settings.$li.attr('data-id'),
|
329
|
+
$sel = function () {
|
330
|
+
if (id) {
|
331
|
+
return $(settings.document.getElementById(id));
|
332
|
+
} else if (cl) {
|
333
|
+
return $('.' + cl).first();
|
334
|
+
} else {
|
335
|
+
return $('body');
|
336
|
+
}
|
337
|
+
};
|
338
|
+
|
339
|
+
settings.$target = $sel();
|
340
|
+
},
|
341
|
+
|
342
|
+
scroll_to : function () {
|
343
|
+
var window_half, tipOffset;
|
344
|
+
|
345
|
+
window_half = settings.$window.height() / 2;
|
346
|
+
tipOffset = Math.ceil(settings.$target.offset().top - window_half + settings.$next_tip.outerHeight());
|
347
|
+
|
348
|
+
$("html, body").stop().animate({
|
349
|
+
scrollTop: tipOffset
|
350
|
+
}, settings.scrollSpeed);
|
351
|
+
},
|
352
|
+
|
353
|
+
paused : function () {
|
354
|
+
if (($.inArray((settings.$li.index() + 1), settings.pauseAfter) === -1)) {
|
355
|
+
return true;
|
356
|
+
}
|
357
|
+
|
358
|
+
return false;
|
359
|
+
},
|
360
|
+
|
361
|
+
destroy : function () {
|
362
|
+
settings.$document.off('.joyride');
|
363
|
+
$(window).off('.joyride');
|
364
|
+
$('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
|
365
|
+
$('.joyride-tip-guide, .joyride-modal-bg').remove();
|
366
|
+
clearTimeout(settings.automate);
|
367
|
+
settings = {};
|
368
|
+
},
|
369
|
+
|
370
|
+
restart : function () {
|
371
|
+
methods.hide();
|
372
|
+
settings.$li = undefined;
|
373
|
+
methods.show('init');
|
374
|
+
},
|
375
|
+
|
376
|
+
pos_default : function (init) {
|
377
|
+
var half_fold = Math.ceil(settings.$window.height() / 2),
|
378
|
+
tip_position = settings.$next_tip.offset(),
|
379
|
+
$nub = $('.joyride-nub', settings.$next_tip),
|
380
|
+
nub_height = Math.ceil($nub.outerHeight() / 2),
|
381
|
+
toggle = init || false;
|
382
|
+
|
383
|
+
// tip must not be "display: none" to calculate position
|
384
|
+
if (toggle) {
|
385
|
+
settings.$next_tip.css('visibility', 'hidden');
|
386
|
+
settings.$next_tip.show();
|
387
|
+
}
|
388
|
+
|
389
|
+
if (!/body/i.test(settings.$target.selector)) {
|
390
|
+
|
391
|
+
if (methods.bottom()) {
|
392
|
+
settings.$next_tip.css({
|
393
|
+
top: (settings.$target.offset().top + nub_height + settings.$target.outerHeight()),
|
394
|
+
left: settings.$target.offset().left});
|
395
|
+
|
396
|
+
methods.nub_position($nub, settings.tipSettings.nubPosition, 'top');
|
397
|
+
|
398
|
+
} else if (methods.top()) {
|
399
|
+
|
400
|
+
settings.$next_tip.css({
|
401
|
+
top: (settings.$target.offset().top - settings.$next_tip.outerHeight() - nub_height),
|
402
|
+
left: settings.$target.offset().left});
|
403
|
+
|
404
|
+
methods.nub_position($nub, settings.tipSettings.nubPosition, 'bottom');
|
405
|
+
|
406
|
+
} else if (methods.right()) {
|
407
|
+
|
408
|
+
settings.$next_tip.css({
|
409
|
+
top: settings.$target.offset().top,
|
410
|
+
left: (settings.$target.outerWidth() + settings.$target.offset().left)});
|
411
|
+
|
412
|
+
methods.nub_position($nub, settings.tipSettings.nubPosition, 'left');
|
413
|
+
|
414
|
+
} else if (methods.left()) {
|
415
|
+
|
416
|
+
settings.$next_tip.css({
|
417
|
+
top: settings.$target.offset().top,
|
418
|
+
left: (settings.$target.offset().left - settings.$next_tip.outerWidth() - nub_height)});
|
419
|
+
|
420
|
+
methods.nub_position($nub, settings.tipSettings.nubPosition, 'right');
|
421
|
+
|
422
|
+
}
|
423
|
+
|
424
|
+
if (!methods.visible(methods.corners(settings.$next_tip)) && settings.attempts < settings.tipSettings.tipLocationPattern.length) {
|
425
|
+
|
426
|
+
$nub.removeClass('bottom')
|
427
|
+
.removeClass('top')
|
428
|
+
.removeClass('right')
|
429
|
+
.removeClass('left');
|
430
|
+
|
431
|
+
settings.tipSettings.tipLocation = settings.tipSettings.tipLocationPattern[settings.attempts];
|
432
|
+
|
433
|
+
settings.attempts++;
|
434
|
+
|
435
|
+
methods.pos_default(true);
|
436
|
+
|
437
|
+
}
|
438
|
+
|
439
|
+
} else if (settings.$li.length) {
|
440
|
+
|
441
|
+
methods.pos_modal($nub);
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
if (toggle) {
|
446
|
+
settings.$next_tip.hide();
|
447
|
+
settings.$next_tip.css('visibility', 'visible');
|
448
|
+
}
|
449
|
+
|
450
|
+
},
|
451
|
+
|
452
|
+
pos_phone : function (init) {
|
453
|
+
var tip_height = settings.$next_tip.outerHeight(),
|
454
|
+
tip_offset = settings.$next_tip.offset(),
|
455
|
+
target_height = settings.$target.outerHeight(),
|
456
|
+
$nub = $('.joyride-nub', settings.$next_tip),
|
457
|
+
nub_height = Math.ceil($nub.outerHeight() / 2),
|
458
|
+
toggle = init || false;
|
459
|
+
|
460
|
+
$nub.removeClass('bottom')
|
461
|
+
.removeClass('top')
|
462
|
+
.removeClass('right')
|
463
|
+
.removeClass('left');
|
464
|
+
|
465
|
+
if (toggle) {
|
466
|
+
settings.$next_tip.css('visibility', 'hidden');
|
467
|
+
settings.$next_tip.show();
|
468
|
+
}
|
469
|
+
|
470
|
+
if (!/body/i.test(settings.$target.selector)) {
|
471
|
+
|
472
|
+
if (methods.top()) {
|
473
|
+
|
474
|
+
settings.$next_tip.offset({top: settings.$target.offset().top - tip_height - nub_height});
|
475
|
+
$nub.addClass('bottom');
|
476
|
+
|
477
|
+
} else {
|
478
|
+
|
479
|
+
settings.$next_tip.offset({top: settings.$target.offset().top + target_height + nub_height});
|
480
|
+
$nub.addClass('top');
|
481
|
+
|
482
|
+
}
|
483
|
+
|
484
|
+
} else if (settings.$li.length) {
|
485
|
+
|
486
|
+
methods.pos_modal($nub);
|
487
|
+
|
488
|
+
}
|
489
|
+
|
490
|
+
if (toggle) {
|
491
|
+
settings.$next_tip.hide();
|
492
|
+
settings.$next_tip.css('visibility', 'visible');
|
493
|
+
}
|
494
|
+
},
|
495
|
+
|
496
|
+
pos_modal : function ($nub) {
|
497
|
+
methods.center();
|
498
|
+
$nub.hide();
|
499
|
+
|
500
|
+
if ($('.joyride-modal-bg').length < 1) {
|
501
|
+
$('body').append('<div class="joyride-modal-bg">').show();
|
502
|
+
}
|
503
|
+
|
504
|
+
if (/pop/i.test(settings.tipAnimation)) {
|
505
|
+
$('.joyride-modal-bg').show();
|
506
|
+
} else {
|
507
|
+
$('.joyride-modal-bg').fadeIn(settings.tipAnimationFadeSpeed);
|
508
|
+
}
|
509
|
+
},
|
510
|
+
|
511
|
+
center : function () {
|
512
|
+
var $w = settings.$window;
|
513
|
+
|
514
|
+
settings.$next_tip.css({
|
515
|
+
top : ((($w.height() - settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
|
516
|
+
left : ((($w.width() - settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
|
517
|
+
});
|
518
|
+
|
519
|
+
return true;
|
520
|
+
},
|
521
|
+
|
522
|
+
bottom : function () {
|
523
|
+
return /bottom/i.test(settings.tipSettings.tipLocation);
|
524
|
+
},
|
525
|
+
|
526
|
+
top : function () {
|
527
|
+
return /top/i.test(settings.tipSettings.tipLocation);
|
528
|
+
},
|
529
|
+
|
530
|
+
right : function () {
|
531
|
+
return /right/i.test(settings.tipSettings.tipLocation);
|
532
|
+
},
|
533
|
+
|
534
|
+
left : function () {
|
535
|
+
return /left/i.test(settings.tipSettings.tipLocation);
|
536
|
+
},
|
537
|
+
|
538
|
+
corners : function (el) {
|
539
|
+
var w = settings.$window,
|
540
|
+
right = w.outerWidth() + w.scrollLeft(),
|
541
|
+
bottom = w.outerWidth() + w.scrollTop();
|
542
|
+
|
543
|
+
return [
|
544
|
+
el.offset().top <= w.scrollTop(),
|
545
|
+
right <= el.offset().left + el.outerWidth(),
|
546
|
+
bottom <= el.offset().top + el.outerHeight(),
|
547
|
+
w.scrollLeft() >= el.offset().left
|
548
|
+
];
|
549
|
+
},
|
550
|
+
|
551
|
+
visible : function (hidden_corners) {
|
552
|
+
var i = hidden_corners.length;
|
553
|
+
|
554
|
+
while (i--) {
|
555
|
+
if (hidden_corners[i]) return false;
|
556
|
+
}
|
557
|
+
|
558
|
+
return true;
|
559
|
+
},
|
560
|
+
|
561
|
+
nub_position : function (nub, pos, def) {
|
562
|
+
if (pos === 'auto') {
|
563
|
+
nub.addClass(def);
|
564
|
+
} else {
|
565
|
+
nub.addClass(pos);
|
566
|
+
}
|
567
|
+
},
|
568
|
+
|
569
|
+
startTimer : function () {
|
570
|
+
if (settings.$li.length) {
|
571
|
+
settings.automate = setTimeout(function () {
|
572
|
+
methods.hide();
|
573
|
+
methods.show();
|
574
|
+
methods.startTimer();
|
575
|
+
}, settings.timer);
|
576
|
+
} else {
|
577
|
+
clearTimeout(settings.automate);
|
578
|
+
}
|
579
|
+
},
|
580
|
+
|
581
|
+
end : function () {
|
582
|
+
if (settings.cookieMonster) {
|
583
|
+
$.cookie(settings.cookieName, 'ridden', { expires: 365, domain: settings.cookieDomain });
|
584
|
+
}
|
585
|
+
|
586
|
+
if (settings.timer > 0) {
|
587
|
+
clearTimeout(settings.automate);
|
588
|
+
}
|
589
|
+
|
590
|
+
$('.joyride-modal-bg').hide();
|
591
|
+
settings.$current_tip.hide();
|
592
|
+
settings.postStepCallback(settings.$li.index(), settings.$current_tip);
|
593
|
+
settings.postRideCallback(settings.$li.index(), settings.$current_tip);
|
594
|
+
},
|
595
|
+
|
596
|
+
jquery_check : function () {
|
597
|
+
// define on() and off() for older jQuery
|
598
|
+
if (!$.isFunction($.fn.on)) {
|
599
|
+
|
600
|
+
$.fn.on = function(types, sel, fn) {
|
601
|
+
|
602
|
+
return this.delegate(sel, types, fn);
|
603
|
+
|
604
|
+
};
|
605
|
+
|
606
|
+
$.fn.off = function(types, sel, fn) {
|
607
|
+
|
608
|
+
return this.undelegate(sel, types, fn);
|
609
|
+
|
610
|
+
};
|
611
|
+
|
612
|
+
return false;
|
613
|
+
}
|
614
|
+
|
615
|
+
return true;
|
616
|
+
},
|
617
|
+
|
618
|
+
outerHTML : function (el) {
|
619
|
+
// support FireFox < 11
|
620
|
+
return el.outerHTML || new XMLSerializer().serializeToString(el);
|
621
|
+
},
|
622
|
+
|
623
|
+
version : function () {
|
624
|
+
return settings.version;
|
625
|
+
}
|
626
|
+
|
627
|
+
};
|
628
|
+
|
629
|
+
$.fn.joyride = function (method) {
|
630
|
+
if (methods[method]) {
|
631
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
632
|
+
} else if (typeof method === 'object' || !method) {
|
633
|
+
return methods.init.apply(this, arguments);
|
634
|
+
} else {
|
635
|
+
$.error('Method ' + method + ' does not exist on jQuery.joyride');
|
636
|
+
}
|
637
|
+
};
|
638
|
+
|
639
|
+
}(jQuery, this));
|