aml 0.1.3.2 → 0.1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/bin/aml-kit +3 -0
  3. data/lib/aml-kit.rb +11 -0
  4. data/lib/aml-kit/Build.rb +55 -0
  5. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap-theme.min.css +6 -0
  6. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap.min.css +5 -0
  7. data/lib/aml-kit/core/bootstrap/3.2.0/css/font-awesome.min.css +4 -0
  8. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/FontAwesome.otf +0 -0
  9. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.eot +0 -0
  10. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.svg +520 -0
  11. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.ttf +0 -0
  12. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.woff +0 -0
  13. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.eot +0 -0
  14. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.svg +229 -0
  15. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.ttf +0 -0
  16. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.woff +0 -0
  17. data/lib/aml-kit/core/bootstrap/3.2.0/index.aml +16 -0
  18. data/lib/aml-kit/core/bootstrap/3.2.0/js/bootstrap.min.js +6 -0
  19. data/lib/aml-kit/core/bootstrap/3.2.0/js/html5shiv.min.js +4 -0
  20. data/lib/aml-kit/core/bootstrap/3.2.0/js/jquery.min.js +4 -0
  21. data/lib/aml-kit/core/bootstrap/3.2.0/js/respond.min.js +5 -0
  22. data/lib/aml-kit/core/bootstrap/3.2.0/mixin.aml +11 -0
  23. data/lib/aml-kit/core/bootstrap/3.2.0/partial/footer.aml +17 -0
  24. data/lib/aml-kit/core/bootstrap/3.2.0/partial/header.aml +20 -0
  25. data/lib/aml-kit/core/bootstrap/3.2.0/partial/navigation-top.aml +17 -0
  26. data/lib/aml-kit/core/foundation/5.3.1/css/foundation.min.css +1 -0
  27. data/lib/aml-kit/core/foundation/5.3.1/css/normalize.css +425 -0
  28. data/lib/aml-kit/core/foundation/5.3.1/index.aml +14 -0
  29. data/lib/aml-kit/core/foundation/5.3.1/js/foundation.min.js +10 -0
  30. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.abide.js +299 -0
  31. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.accordion.js +65 -0
  32. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.alert.js +43 -0
  33. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.clearing.js +542 -0
  34. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.dropdown.js +313 -0
  35. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.equalizer.js +74 -0
  36. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.interchange.js +344 -0
  37. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.joyride.js +846 -0
  38. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.js +613 -0
  39. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.magellan.js +180 -0
  40. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.offcanvas.js +108 -0
  41. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.orbit.js +472 -0
  42. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.reveal.js +437 -0
  43. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.slider.js +226 -0
  44. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tab.js +167 -0
  45. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tooltip.js +298 -0
  46. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.topbar.js +426 -0
  47. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/fastclick.js +9 -0
  48. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.cookie.js +8 -0
  49. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.js +26 -0
  50. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/modernizr.js +8 -0
  51. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/placeholder.js +2 -0
  52. data/lib/aml-kit/core/foundation/5.3.1/partial/footer.aml +4 -0
  53. data/lib/aml-kit/core/foundation/5.3.1/partial/header.aml +9 -0
  54. data/lib/aml.rb +1 -1
  55. data/lib/aml/Compile.rb +15 -19
  56. data/lib/aml/Definition.rb +0 -1
  57. data/lib/aml/Line.rb +1 -1
  58. data/lib/aml/Prepare.rb +1 -2
  59. data/lib/aml/core/method.rb +42 -19
  60. metadata +59 -6
@@ -0,0 +1,846 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ var Modernizr = Modernizr || false;
5
+
6
+ Foundation.libs.joyride = {
7
+ name : 'joyride',
8
+
9
+ version : '5.3.0',
10
+
11
+ defaults : {
12
+ expose : false, // turn on or off the expose feature
13
+ modal : true, // Whether to cover page with modal during the tour
14
+ tip_location : 'bottom', // 'top' or 'bottom' in relation to parent
15
+ nub_position : 'auto', // override on a per tooltip bases
16
+ scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation
17
+ scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI.
18
+ timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
19
+ start_timer_on_click : true, // true or false - true requires clicking the first button start the timer
20
+ start_offset : 0, // the index of the tooltip you want to start on (index of the li)
21
+ next_button : true, // true or false to control whether a next button is used
22
+ tip_animation : 'fade', // 'pop' or 'fade' in each tip
23
+ pause_after : [], // array of indexes where to pause the tour after
24
+ exposed : [], // array of expose elements
25
+ tip_animation_fade_speed : 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
26
+ cookie_monster : false, // true or false to control whether cookies are used
27
+ cookie_name : 'joyride', // Name the cookie you'll use
28
+ cookie_domain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
29
+ cookie_expires : 365, // set when you would like the cookie to expire.
30
+ tip_container : 'body', // Where will the tip be attached
31
+ abort_on_close : true, // When true, the close event will not fire any callback
32
+ tip_location_patterns : {
33
+ top: ['bottom'],
34
+ bottom: [], // bottom should not need to be repositioned
35
+ left: ['right', 'top', 'bottom'],
36
+ right: ['left', 'top', 'bottom']
37
+ },
38
+ post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete)
39
+ post_step_callback : function (){}, // A method to call after each step
40
+ pre_step_callback : function (){}, // A method to call before each step
41
+ pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
42
+ post_expose_callback : function (){}, // A method to call after an element has been exposed
43
+ template : { // HTML segments for tip layout
44
+ link : '<a href="#close" class="joyride-close-tip">&times;</a>',
45
+ timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
46
+ tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
47
+ wrapper : '<div class="joyride-content-wrapper"></div>',
48
+ button : '<a href="#" class="small button joyride-next-tip"></a>',
49
+ modal : '<div class="joyride-modal-bg"></div>',
50
+ expose : '<div class="joyride-expose-wrapper"></div>',
51
+ expose_cover: '<div class="joyride-expose-cover"></div>'
52
+ },
53
+ expose_add_class : '' // One or more space-separated class names to be added to exposed element
54
+ },
55
+
56
+ init : function (scope, method, options) {
57
+ Foundation.inherit(this, 'throttle random_str');
58
+
59
+ this.settings = this.settings || $.extend({}, this.defaults, (options || method));
60
+
61
+ this.bindings(method, options)
62
+ },
63
+
64
+ events : function () {
65
+ var self = this;
66
+
67
+ $(this.scope)
68
+ .off('.joyride')
69
+ .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
70
+ e.preventDefault();
71
+
72
+ if (this.settings.$li.next().length < 1) {
73
+ this.end();
74
+ } else if (this.settings.timer > 0) {
75
+ clearTimeout(this.settings.automate);
76
+ this.hide();
77
+ this.show();
78
+ this.startTimer();
79
+ } else {
80
+ this.hide();
81
+ this.show();
82
+ }
83
+
84
+ }.bind(this))
85
+
86
+ .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
87
+ e.preventDefault();
88
+ this.end(this.settings.abort_on_close);
89
+ }.bind(this));
90
+
91
+ $(window)
92
+ .off('.joyride')
93
+ .on('resize.fndtn.joyride', self.throttle(function () {
94
+ if ($('[' + self.attr_name() + ']').length > 0 && self.settings.$next_tip) {
95
+ if (self.settings.exposed.length > 0) {
96
+ var $els = $(self.settings.exposed);
97
+
98
+ $els.each(function () {
99
+ var $this = $(this);
100
+ self.un_expose($this);
101
+ self.expose($this);
102
+ });
103
+ }
104
+
105
+ if (self.is_phone()) {
106
+ self.pos_phone();
107
+ } else {
108
+ self.pos_default(false);
109
+ }
110
+ }
111
+ }, 100));
112
+ },
113
+
114
+ start : function () {
115
+ var self = this,
116
+ $this = $('[' + this.attr_name() + ']', this.scope),
117
+ integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
118
+ int_settings_count = integer_settings.length;
119
+
120
+ if (!$this.length > 0) return;
121
+
122
+ if (!this.settings.init) this.events();
123
+
124
+ this.settings = $this.data(this.attr_name(true) + '-init');
125
+
126
+ // non configureable settings
127
+ this.settings.$content_el = $this;
128
+ this.settings.$body = $(this.settings.tip_container);
129
+ this.settings.body_offset = $(this.settings.tip_container).position();
130
+ this.settings.$tip_content = this.settings.$content_el.find('> li');
131
+ this.settings.paused = false;
132
+ this.settings.attempts = 0;
133
+
134
+ // can we create cookies?
135
+ if (typeof $.cookie !== 'function') {
136
+ this.settings.cookie_monster = false;
137
+ }
138
+
139
+ // generate the tips and insert into dom.
140
+ if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
141
+ this.settings.$tip_content.each(function (index) {
142
+ var $this = $(this);
143
+ this.settings = $.extend({}, self.defaults, self.data_options($this));
144
+
145
+ // Make sure that settings parsed from data_options are integers where necessary
146
+ var i = int_settings_count;
147
+ while (i--) {
148
+ self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
149
+ }
150
+ self.create({$li : $this, index : index});
151
+ });
152
+
153
+ // show first tip
154
+ if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
155
+ this.show('init');
156
+ this.startTimer();
157
+ } else {
158
+ this.show('init');
159
+ }
160
+
161
+ }
162
+ },
163
+
164
+ resume : function () {
165
+ this.set_li();
166
+ this.show();
167
+ },
168
+
169
+ tip_template : function (opts) {
170
+ var $blank, content;
171
+
172
+ opts.tip_class = opts.tip_class || '';
173
+
174
+ $blank = $(this.settings.template.tip).addClass(opts.tip_class);
175
+ content = $.trim($(opts.li).html()) +
176
+ this.button_text(opts.button_text) +
177
+ this.settings.template.link +
178
+ this.timer_instance(opts.index);
179
+
180
+ $blank.append($(this.settings.template.wrapper));
181
+ $blank.first().attr(this.add_namespace('data-index'), opts.index);
182
+ $('.joyride-content-wrapper', $blank).append(content);
183
+
184
+ return $blank[0];
185
+ },
186
+
187
+ timer_instance : function (index) {
188
+ var txt;
189
+
190
+ if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
191
+ txt = '';
192
+ } else {
193
+ txt = $(this.settings.template.timer)[0].outerHTML;
194
+ }
195
+ return txt;
196
+ },
197
+
198
+ button_text : function (txt) {
199
+ if (this.settings.next_button) {
200
+ txt = $.trim(txt) || 'Next';
201
+ txt = $(this.settings.template.button).append(txt)[0].outerHTML;
202
+ } else {
203
+ txt = '';
204
+ }
205
+ return txt;
206
+ },
207
+
208
+ create : function (opts) {
209
+ var buttonText = opts.$li.attr(this.add_namespace('data-button'))
210
+ || opts.$li.attr(this.add_namespace('data-text')),
211
+ tipClass = opts.$li.attr('class'),
212
+ $tip_content = $(this.tip_template({
213
+ tip_class : tipClass,
214
+ index : opts.index,
215
+ button_text : buttonText,
216
+ li : opts.$li
217
+ }));
218
+
219
+ $(this.settings.tip_container).append($tip_content);
220
+ },
221
+
222
+ show : function (init) {
223
+ var $timer = null;
224
+
225
+ // are we paused?
226
+ if (this.settings.$li === undefined
227
+ || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
228
+
229
+ // don't go to the next li if the tour was paused
230
+ if (this.settings.paused) {
231
+ this.settings.paused = false;
232
+ } else {
233
+ this.set_li(init);
234
+ }
235
+
236
+ this.settings.attempts = 0;
237
+
238
+ if (this.settings.$li.length && this.settings.$target.length > 0) {
239
+ if (init) { //run when we first start
240
+ this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
241
+ if (this.settings.modal) {
242
+ this.show_modal();
243
+ }
244
+ }
245
+
246
+ this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
247
+
248
+ if (this.settings.modal && this.settings.expose) {
249
+ this.expose();
250
+ }
251
+
252
+ this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
253
+
254
+ this.settings.timer = parseInt(this.settings.timer, 10);
255
+
256
+ this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
257
+
258
+ // scroll if not modal
259
+ if (!/body/i.test(this.settings.$target.selector)) {
260
+ this.scroll_to();
261
+ }
262
+
263
+ if (this.is_phone()) {
264
+ this.pos_phone(true);
265
+ } else {
266
+ this.pos_default(true);
267
+ }
268
+
269
+ $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
270
+
271
+ if (/pop/i.test(this.settings.tip_animation)) {
272
+
273
+ $timer.width(0);
274
+
275
+ if (this.settings.timer > 0) {
276
+
277
+ this.settings.$next_tip.show();
278
+
279
+ setTimeout(function () {
280
+ $timer.animate({
281
+ width: $timer.parent().width()
282
+ }, this.settings.timer, 'linear');
283
+ }.bind(this), this.settings.tip_animation_fade_speed);
284
+
285
+ } else {
286
+ this.settings.$next_tip.show();
287
+
288
+ }
289
+
290
+
291
+ } else if (/fade/i.test(this.settings.tip_animation)) {
292
+
293
+ $timer.width(0);
294
+
295
+ if (this.settings.timer > 0) {
296
+
297
+ this.settings.$next_tip
298
+ .fadeIn(this.settings.tip_animation_fade_speed)
299
+ .show();
300
+
301
+ setTimeout(function () {
302
+ $timer.animate({
303
+ width: $timer.parent().width()
304
+ }, this.settings.timer, 'linear');
305
+ }.bind(this), this.settings.tip_animation_fade_speed);
306
+
307
+ } else {
308
+ this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
309
+ }
310
+ }
311
+
312
+ this.settings.$current_tip = this.settings.$next_tip;
313
+
314
+ // skip non-existant targets
315
+ } else if (this.settings.$li && this.settings.$target.length < 1) {
316
+
317
+ this.show();
318
+
319
+ } else {
320
+
321
+ this.end();
322
+
323
+ }
324
+ } else {
325
+
326
+ this.settings.paused = true;
327
+
328
+ }
329
+
330
+ },
331
+
332
+ is_phone : function () {
333
+ return matchMedia(Foundation.media_queries.small).matches &&
334
+ !matchMedia(Foundation.media_queries.medium).matches;
335
+ },
336
+
337
+ hide : function () {
338
+ if (this.settings.modal && this.settings.expose) {
339
+ this.un_expose();
340
+ }
341
+
342
+ if (!this.settings.modal) {
343
+ $('.joyride-modal-bg').hide();
344
+ }
345
+
346
+ // Prevent scroll bouncing...wait to remove from layout
347
+ this.settings.$current_tip.css('visibility', 'hidden');
348
+ setTimeout($.proxy(function() {
349
+ this.hide();
350
+ this.css('visibility', 'visible');
351
+ }, this.settings.$current_tip), 0);
352
+ this.settings.post_step_callback(this.settings.$li.index(),
353
+ this.settings.$current_tip);
354
+ },
355
+
356
+ set_li : function (init) {
357
+ if (init) {
358
+ this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
359
+ this.set_next_tip();
360
+ this.settings.$current_tip = this.settings.$next_tip;
361
+ } else {
362
+ this.settings.$li = this.settings.$li.next();
363
+ this.set_next_tip();
364
+ }
365
+
366
+ this.set_target();
367
+ },
368
+
369
+ set_next_tip : function () {
370
+ this.settings.$next_tip = $(".joyride-tip-guide").eq(this.settings.$li.index());
371
+ this.settings.$next_tip.data('closed', '');
372
+ },
373
+
374
+ set_target : function () {
375
+ var cl = this.settings.$li.attr(this.add_namespace('data-class')),
376
+ id = this.settings.$li.attr(this.add_namespace('data-id')),
377
+ $sel = function () {
378
+ if (id) {
379
+ return $(document.getElementById(id));
380
+ } else if (cl) {
381
+ return $('.' + cl).first();
382
+ } else {
383
+ return $('body');
384
+ }
385
+ };
386
+
387
+ this.settings.$target = $sel();
388
+ },
389
+
390
+ scroll_to : function () {
391
+ var window_half, tipOffset;
392
+
393
+ window_half = $(window).height() / 2;
394
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
395
+
396
+ if (tipOffset != 0) {
397
+ $('html, body').stop().animate({
398
+ scrollTop: tipOffset
399
+ }, this.settings.scroll_speed, 'swing');
400
+ }
401
+ },
402
+
403
+ paused : function () {
404
+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
405
+ },
406
+
407
+ restart : function () {
408
+ this.hide();
409
+ this.settings.$li = undefined;
410
+ this.show('init');
411
+ },
412
+
413
+ pos_default : function (init) {
414
+ var $nub = this.settings.$next_tip.find('.joyride-nub'),
415
+ nub_width = Math.ceil($nub.outerWidth() / 2),
416
+ nub_height = Math.ceil($nub.outerHeight() / 2),
417
+ toggle = init || false;
418
+
419
+ // tip must not be "display: none" to calculate position
420
+ if (toggle) {
421
+ this.settings.$next_tip.css('visibility', 'hidden');
422
+ this.settings.$next_tip.show();
423
+ }
424
+
425
+ if (!/body/i.test(this.settings.$target.selector)) {
426
+ var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0,
427
+ leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0;
428
+
429
+ if (this.bottom()) {
430
+ if (this.rtl) {
431
+ this.settings.$next_tip.css({
432
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
433
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment});
434
+ } else {
435
+ this.settings.$next_tip.css({
436
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
437
+ left: this.settings.$target.offset().left + leftAdjustment});
438
+ }
439
+
440
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
441
+
442
+ } else if (this.top()) {
443
+ if (this.rtl) {
444
+ this.settings.$next_tip.css({
445
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
446
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
447
+ } else {
448
+ this.settings.$next_tip.css({
449
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
450
+ left: this.settings.$target.offset().left + leftAdjustment});
451
+ }
452
+
453
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
454
+
455
+ } else if (this.right()) {
456
+
457
+ this.settings.$next_tip.css({
458
+ top: this.settings.$target.offset().top + topAdjustment,
459
+ left: (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)});
460
+
461
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
462
+
463
+ } else if (this.left()) {
464
+
465
+ this.settings.$next_tip.css({
466
+ top: this.settings.$target.offset().top + topAdjustment,
467
+ left: (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)});
468
+
469
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
470
+
471
+ }
472
+
473
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
474
+
475
+ $nub.removeClass('bottom')
476
+ .removeClass('top')
477
+ .removeClass('right')
478
+ .removeClass('left');
479
+
480
+ this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
481
+
482
+ this.settings.attempts++;
483
+
484
+ this.pos_default();
485
+
486
+ }
487
+
488
+ } else if (this.settings.$li.length) {
489
+
490
+ this.pos_modal($nub);
491
+
492
+ }
493
+
494
+ if (toggle) {
495
+ this.settings.$next_tip.hide();
496
+ this.settings.$next_tip.css('visibility', 'visible');
497
+ }
498
+
499
+ },
500
+
501
+ pos_phone : function (init) {
502
+ var tip_height = this.settings.$next_tip.outerHeight(),
503
+ tip_offset = this.settings.$next_tip.offset(),
504
+ target_height = this.settings.$target.outerHeight(),
505
+ $nub = $('.joyride-nub', this.settings.$next_tip),
506
+ nub_height = Math.ceil($nub.outerHeight() / 2),
507
+ toggle = init || false;
508
+
509
+ $nub.removeClass('bottom')
510
+ .removeClass('top')
511
+ .removeClass('right')
512
+ .removeClass('left');
513
+
514
+ if (toggle) {
515
+ this.settings.$next_tip.css('visibility', 'hidden');
516
+ this.settings.$next_tip.show();
517
+ }
518
+
519
+ if (!/body/i.test(this.settings.$target.selector)) {
520
+
521
+ if (this.top()) {
522
+
523
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
524
+ $nub.addClass('bottom');
525
+
526
+ } else {
527
+
528
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
529
+ $nub.addClass('top');
530
+
531
+ }
532
+
533
+ } else if (this.settings.$li.length) {
534
+ this.pos_modal($nub);
535
+ }
536
+
537
+ if (toggle) {
538
+ this.settings.$next_tip.hide();
539
+ this.settings.$next_tip.css('visibility', 'visible');
540
+ }
541
+ },
542
+
543
+ pos_modal : function ($nub) {
544
+ this.center();
545
+ $nub.hide();
546
+
547
+ this.show_modal();
548
+ },
549
+
550
+ show_modal : function () {
551
+ if (!this.settings.$next_tip.data('closed')) {
552
+ var joyridemodalbg = $('.joyride-modal-bg');
553
+ if (joyridemodalbg.length < 1) {
554
+ $('body').append(this.settings.template.modal).show();
555
+ }
556
+
557
+ if (/pop/i.test(this.settings.tip_animation)) {
558
+ joyridemodalbg.show();
559
+ } else {
560
+ joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
561
+ }
562
+ }
563
+ },
564
+
565
+ expose : function () {
566
+ var expose,
567
+ exposeCover,
568
+ el,
569
+ origCSS,
570
+ origClasses,
571
+ randId = 'expose-' + this.random_str(6);
572
+
573
+ if (arguments.length > 0 && arguments[0] instanceof $) {
574
+ el = arguments[0];
575
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
576
+ el = this.settings.$target;
577
+ } else {
578
+ return false;
579
+ }
580
+
581
+ if(el.length < 1){
582
+ if(window.console){
583
+ console.error('element not valid', el);
584
+ }
585
+ return false;
586
+ }
587
+
588
+ expose = $(this.settings.template.expose);
589
+ this.settings.$body.append(expose);
590
+ expose.css({
591
+ top: el.offset().top,
592
+ left: el.offset().left,
593
+ width: el.outerWidth(true),
594
+ height: el.outerHeight(true)
595
+ });
596
+
597
+ exposeCover = $(this.settings.template.expose_cover);
598
+
599
+ origCSS = {
600
+ zIndex: el.css('z-index'),
601
+ position: el.css('position')
602
+ };
603
+
604
+ origClasses = el.attr('class') == null ? '' : el.attr('class');
605
+
606
+ el.css('z-index',parseInt(expose.css('z-index'))+1);
607
+
608
+ if (origCSS.position == 'static') {
609
+ el.css('position','relative');
610
+ }
611
+
612
+ el.data('expose-css',origCSS);
613
+ el.data('orig-class', origClasses);
614
+ el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
615
+
616
+ exposeCover.css({
617
+ top: el.offset().top,
618
+ left: el.offset().left,
619
+ width: el.outerWidth(true),
620
+ height: el.outerHeight(true)
621
+ });
622
+
623
+ if (this.settings.modal) this.show_modal();
624
+
625
+ this.settings.$body.append(exposeCover);
626
+ expose.addClass(randId);
627
+ exposeCover.addClass(randId);
628
+ el.data('expose', randId);
629
+ this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
630
+ this.add_exposed(el);
631
+ },
632
+
633
+ un_expose : function () {
634
+ var exposeId,
635
+ el,
636
+ expose ,
637
+ origCSS,
638
+ origClasses,
639
+ clearAll = false;
640
+
641
+ if (arguments.length > 0 && arguments[0] instanceof $) {
642
+ el = arguments[0];
643
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
644
+ el = this.settings.$target;
645
+ } else {
646
+ return false;
647
+ }
648
+
649
+ if(el.length < 1){
650
+ if (window.console) {
651
+ console.error('element not valid', el);
652
+ }
653
+ return false;
654
+ }
655
+
656
+ exposeId = el.data('expose');
657
+ expose = $('.' + exposeId);
658
+
659
+ if (arguments.length > 1) {
660
+ clearAll = arguments[1];
661
+ }
662
+
663
+ if (clearAll === true) {
664
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
665
+ } else {
666
+ expose.remove();
667
+ }
668
+
669
+ origCSS = el.data('expose-css');
670
+
671
+ if (origCSS.zIndex == 'auto') {
672
+ el.css('z-index', '');
673
+ } else {
674
+ el.css('z-index', origCSS.zIndex);
675
+ }
676
+
677
+ if (origCSS.position != el.css('position')) {
678
+ if(origCSS.position == 'static') {// this is default, no need to set it.
679
+ el.css('position', '');
680
+ } else {
681
+ el.css('position', origCSS.position);
682
+ }
683
+ }
684
+
685
+ origClasses = el.data('orig-class');
686
+ el.attr('class', origClasses);
687
+ el.removeData('orig-classes');
688
+
689
+ el.removeData('expose');
690
+ el.removeData('expose-z-index');
691
+ this.remove_exposed(el);
692
+ },
693
+
694
+ add_exposed: function(el){
695
+ this.settings.exposed = this.settings.exposed || [];
696
+ if (el instanceof $ || typeof el === 'object') {
697
+ this.settings.exposed.push(el[0]);
698
+ } else if (typeof el == 'string') {
699
+ this.settings.exposed.push(el);
700
+ }
701
+ },
702
+
703
+ remove_exposed: function(el){
704
+ var search, i;
705
+ if (el instanceof $) {
706
+ search = el[0]
707
+ } else if (typeof el == 'string'){
708
+ search = el;
709
+ }
710
+
711
+ this.settings.exposed = this.settings.exposed || [];
712
+ i = this.settings.exposed.length;
713
+
714
+ while (i--) {
715
+ if (this.settings.exposed[i] == search) {
716
+ this.settings.exposed.splice(i, 1);
717
+ return;
718
+ }
719
+ }
720
+ },
721
+
722
+ center : function () {
723
+ var $w = $(window);
724
+
725
+ this.settings.$next_tip.css({
726
+ top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
727
+ left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
728
+ });
729
+
730
+ return true;
731
+ },
732
+
733
+ bottom : function () {
734
+ return /bottom/i.test(this.settings.tip_settings.tip_location);
735
+ },
736
+
737
+ top : function () {
738
+ return /top/i.test(this.settings.tip_settings.tip_location);
739
+ },
740
+
741
+ right : function () {
742
+ return /right/i.test(this.settings.tip_settings.tip_location);
743
+ },
744
+
745
+ left : function () {
746
+ return /left/i.test(this.settings.tip_settings.tip_location);
747
+ },
748
+
749
+ corners : function (el) {
750
+ var w = $(window),
751
+ window_half = w.height() / 2,
752
+ //using this to calculate since scroll may not have finished yet.
753
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
754
+ right = w.width() + w.scrollLeft(),
755
+ offsetBottom = w.height() + tipOffset,
756
+ bottom = w.height() + w.scrollTop(),
757
+ top = w.scrollTop();
758
+
759
+ if (tipOffset < top) {
760
+ if (tipOffset < 0) {
761
+ top = 0;
762
+ } else {
763
+ top = tipOffset;
764
+ }
765
+ }
766
+
767
+ if (offsetBottom > bottom) {
768
+ bottom = offsetBottom;
769
+ }
770
+
771
+ return [
772
+ el.offset().top < top,
773
+ right < el.offset().left + el.outerWidth(),
774
+ bottom < el.offset().top + el.outerHeight(),
775
+ w.scrollLeft() > el.offset().left
776
+ ];
777
+ },
778
+
779
+ visible : function (hidden_corners) {
780
+ var i = hidden_corners.length;
781
+
782
+ while (i--) {
783
+ if (hidden_corners[i]) return false;
784
+ }
785
+
786
+ return true;
787
+ },
788
+
789
+ nub_position : function (nub, pos, def) {
790
+ if (pos === 'auto') {
791
+ nub.addClass(def);
792
+ } else {
793
+ nub.addClass(pos);
794
+ }
795
+ },
796
+
797
+ startTimer : function () {
798
+ if (this.settings.$li.length) {
799
+ this.settings.automate = setTimeout(function () {
800
+ this.hide();
801
+ this.show();
802
+ this.startTimer();
803
+ }.bind(this), this.settings.timer);
804
+ } else {
805
+ clearTimeout(this.settings.automate);
806
+ }
807
+ },
808
+
809
+ end : function (abort) {
810
+ if (this.settings.cookie_monster) {
811
+ $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });
812
+ }
813
+
814
+ if (this.settings.timer > 0) {
815
+ clearTimeout(this.settings.automate);
816
+ }
817
+
818
+ if (this.settings.modal && this.settings.expose) {
819
+ this.un_expose();
820
+ }
821
+
822
+ this.settings.$next_tip.data('closed', true);
823
+
824
+ $('.joyride-modal-bg').hide();
825
+ this.settings.$current_tip.hide();
826
+
827
+ if (typeof abort === 'undefined' || abort === false) {
828
+ this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
829
+ this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
830
+ }
831
+
832
+ $('.joyride-tip-guide').remove();
833
+ },
834
+
835
+ off : function () {
836
+ $(this.scope).off('.joyride');
837
+ $(window).off('.joyride');
838
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
839
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
840
+ clearTimeout(this.settings.automate);
841
+ this.settings = {};
842
+ },
843
+
844
+ reflow : function () {}
845
+ };
846
+ }(jQuery, window, window.document));