zurb-foundation-5 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.editorconfig +9 -0
  4. data/.gitignore +46 -0
  5. data/.travis.yml +34 -0
  6. data/CONTRIBUTING.md +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +16 -0
  9. data/Gruntfile.js +222 -0
  10. data/LICENSE +22 -0
  11. data/README.md +44 -0
  12. data/bower.json +20 -0
  13. data/composer.json +9 -0
  14. data/foundation.gemspec +21 -0
  15. data/humans.txt +8 -0
  16. data/js/foundation/foundation.abide.js +299 -0
  17. data/js/foundation/foundation.accordion.js +54 -0
  18. data/js/foundation/foundation.alert.js +43 -0
  19. data/js/foundation/foundation.clearing.js +531 -0
  20. data/js/foundation/foundation.dropdown.js +306 -0
  21. data/js/foundation/foundation.equalizer.js +68 -0
  22. data/js/foundation/foundation.interchange.js +331 -0
  23. data/js/foundation/foundation.joyride.js +849 -0
  24. data/js/foundation/foundation.js +609 -0
  25. data/js/foundation/foundation.magellan.js +173 -0
  26. data/js/foundation/foundation.offcanvas.js +50 -0
  27. data/js/foundation/foundation.orbit.js +606 -0
  28. data/js/foundation/foundation.reveal.js +427 -0
  29. data/js/foundation/foundation.slider.js +200 -0
  30. data/js/foundation/foundation.tab.js +168 -0
  31. data/js/foundation/foundation.tooltip.js +272 -0
  32. data/js/foundation/foundation.topbar.js +422 -0
  33. data/karma.conf.js +114 -0
  34. data/lib/foundation/engine.rb +20 -0
  35. data/lib/foundation/generators/USAGE +15 -0
  36. data/lib/foundation/generators/install_generator.rb +54 -0
  37. data/lib/foundation/generators/templates/application.html.erb +47 -0
  38. data/lib/foundation/generators/templates/application.html.haml +31 -0
  39. data/lib/foundation/generators/templates/application.html.slim +35 -0
  40. data/lib/foundation/sprockets.rb +4 -0
  41. data/lib/foundation/version.rb +3 -0
  42. data/lib/scss.js +114 -0
  43. data/lib/zurb-foundation.rb +33 -0
  44. data/package.json +48 -0
  45. data/robots.txt +4 -0
  46. data/run-tests.sh +83 -0
  47. data/sache.json +5 -0
  48. data/scss/foundation.scss +45 -0
  49. data/scss/foundation/_functions.scss +101 -0
  50. data/scss/foundation/_settings.scss +1279 -0
  51. data/scss/foundation/components/_accordion.scss +52 -0
  52. data/scss/foundation/components/_alert-boxes.scss +126 -0
  53. data/scss/foundation/components/_block-grid.scss +132 -0
  54. data/scss/foundation/components/_breadcrumbs.scss +127 -0
  55. data/scss/foundation/components/_button-groups.scss +108 -0
  56. data/scss/foundation/components/_buttons.scss +222 -0
  57. data/scss/foundation/components/_clearing.scss +247 -0
  58. data/scss/foundation/components/_dropdown-buttons.scss +129 -0
  59. data/scss/foundation/components/_dropdown.scss +248 -0
  60. data/scss/foundation/components/_flex-video.scss +51 -0
  61. data/scss/foundation/components/_forms.scss +496 -0
  62. data/scss/foundation/components/_global.scss +365 -0
  63. data/scss/foundation/components/_grid.scss +261 -0
  64. data/scss/foundation/components/_inline-lists.scss +56 -0
  65. data/scss/foundation/components/_joyride.scss +220 -0
  66. data/scss/foundation/components/_keystrokes.scss +61 -0
  67. data/scss/foundation/components/_labels.scss +104 -0
  68. data/scss/foundation/components/_magellan.scss +34 -0
  69. data/scss/foundation/components/_offcanvas.scss +381 -0
  70. data/scss/foundation/components/_orbit.scss +415 -0
  71. data/scss/foundation/components/_pagination.scss +150 -0
  72. data/scss/foundation/components/_panels.scss +91 -0
  73. data/scss/foundation/components/_pricing-tables.scss +150 -0
  74. data/scss/foundation/components/_progress-bars.scss +79 -0
  75. data/scss/foundation/components/_range-slider.scss +148 -0
  76. data/scss/foundation/components/_reveal-new.scss +0 -0
  77. data/scss/foundation/components/_reveal.scss +216 -0
  78. data/scss/foundation/components/_side-nav.scss +93 -0
  79. data/scss/foundation/components/_split-buttons.scss +191 -0
  80. data/scss/foundation/components/_sub-nav.scss +125 -0
  81. data/scss/foundation/components/_switch.scss +294 -0
  82. data/scss/foundation/components/_tables.scss +97 -0
  83. data/scss/foundation/components/_tabs.scss +105 -0
  84. data/scss/foundation/components/_thumbs.scss +68 -0
  85. data/scss/foundation/components/_tooltips.scss +140 -0
  86. data/scss/foundation/components/_top-bar.scss +640 -0
  87. data/scss/foundation/components/_type.scss +493 -0
  88. data/scss/foundation/components/_visibility.scss +345 -0
  89. data/scss/foundation/test.html +0 -0
  90. data/scss/normalize.scss +423 -0
  91. data/spec/abide/abide.js +173 -0
  92. data/spec/abide/advanced.html +22 -0
  93. data/spec/abide/basic.html +13 -0
  94. data/spec/accordion/accordion.js +94 -0
  95. data/spec/accordion/basic.html +39 -0
  96. data/spec/accordion/grid.html +44 -0
  97. data/spec/accordion/multiexpand.html +20 -0
  98. data/spec/alert/alert.js +35 -0
  99. data/spec/alert/basic.html +4 -0
  100. data/spec/clearing/222.gif +0 -0
  101. data/spec/clearing/777.gif +0 -0
  102. data/spec/clearing/basic.html +5 -0
  103. data/spec/clearing/ccc.gif +0 -0
  104. data/spec/clearing/clearing.js +55 -0
  105. data/spec/dropdown/basic.html +10 -0
  106. data/spec/dropdown/dropdown.js +65 -0
  107. data/spec/equalizer/basic.html +24 -0
  108. data/spec/equalizer/equalizer.js +30 -0
  109. data/spec/framework/framework.js +14 -0
  110. data/spec/helpers.js +37 -0
  111. data/spec/interchange/basic.html +3 -0
  112. data/spec/interchange/interchange.js +60 -0
  113. data/spec/joyride/joyride.js +14 -0
  114. data/spec/magellan/magellan.js +14 -0
  115. data/spec/offcanvas/offcanvas.js +14 -0
  116. data/spec/orbit/orbit.js +14 -0
  117. data/spec/reveal/reveal.js +14 -0
  118. data/spec/tab/tab.js +14 -0
  119. data/spec/tooltip/tooltip.js +14 -0
  120. data/spec/topbar/multidropdown.html +60 -0
  121. data/spec/topbar/sticky.html +31 -0
  122. data/spec/topbar/topbar.js +96 -0
  123. metadata +238 -0
@@ -0,0 +1,849 @@
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.2.2',
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, true);
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_fadeSpeed);
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').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, resizing) {
414
+ var half_fold = Math.ceil($(window).height() / 2),
415
+ tip_position = this.settings.$next_tip.offset(),
416
+ $nub = this.settings.$next_tip.find('.joyride-nub'),
417
+ nub_width = Math.ceil($nub.outerWidth() / 2),
418
+ nub_height = Math.ceil($nub.outerHeight() / 2),
419
+ toggle = init || false;
420
+
421
+ // tip must not be "display: none" to calculate position
422
+ if (toggle) {
423
+ this.settings.$next_tip.css('visibility', 'hidden');
424
+ this.settings.$next_tip.show();
425
+ }
426
+
427
+ if (typeof resizing === 'undefined') {
428
+ resizing = false;
429
+ }
430
+
431
+ if (!/body/i.test(this.settings.$target.selector)) {
432
+ if (this.bottom()) {
433
+ if (this.rtl) {
434
+ this.settings.$next_tip.css({
435
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
436
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
437
+ } else {
438
+ this.settings.$next_tip.css({
439
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
440
+ left: this.settings.$target.offset().left});
441
+ }
442
+
443
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
444
+
445
+ } else if (this.top()) {
446
+ if (this.rtl) {
447
+ this.settings.$next_tip.css({
448
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
449
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
450
+ } else {
451
+ this.settings.$next_tip.css({
452
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
453
+ left: this.settings.$target.offset().left});
454
+ }
455
+
456
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
457
+
458
+ } else if (this.right()) {
459
+
460
+ this.settings.$next_tip.css({
461
+ top: this.settings.$target.offset().top,
462
+ left: (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width)});
463
+
464
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
465
+
466
+ } else if (this.left()) {
467
+
468
+ this.settings.$next_tip.css({
469
+ top: this.settings.$target.offset().top,
470
+ left: (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width)});
471
+
472
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
473
+
474
+ }
475
+
476
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
477
+
478
+ $nub.removeClass('bottom')
479
+ .removeClass('top')
480
+ .removeClass('right')
481
+ .removeClass('left');
482
+
483
+ this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
484
+
485
+ this.settings.attempts++;
486
+
487
+ this.pos_default();
488
+
489
+ }
490
+
491
+ } else if (this.settings.$li.length) {
492
+
493
+ this.pos_modal($nub);
494
+
495
+ }
496
+
497
+ if (toggle) {
498
+ this.settings.$next_tip.hide();
499
+ this.settings.$next_tip.css('visibility', 'visible');
500
+ }
501
+
502
+ },
503
+
504
+ pos_phone : function (init) {
505
+ var tip_height = this.settings.$next_tip.outerHeight(),
506
+ tip_offset = this.settings.$next_tip.offset(),
507
+ target_height = this.settings.$target.outerHeight(),
508
+ $nub = $('.joyride-nub', this.settings.$next_tip),
509
+ nub_height = Math.ceil($nub.outerHeight() / 2),
510
+ toggle = init || false;
511
+
512
+ $nub.removeClass('bottom')
513
+ .removeClass('top')
514
+ .removeClass('right')
515
+ .removeClass('left');
516
+
517
+ if (toggle) {
518
+ this.settings.$next_tip.css('visibility', 'hidden');
519
+ this.settings.$next_tip.show();
520
+ }
521
+
522
+ if (!/body/i.test(this.settings.$target.selector)) {
523
+
524
+ if (this.top()) {
525
+
526
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
527
+ $nub.addClass('bottom');
528
+
529
+ } else {
530
+
531
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
532
+ $nub.addClass('top');
533
+
534
+ }
535
+
536
+ } else if (this.settings.$li.length) {
537
+ this.pos_modal($nub);
538
+ }
539
+
540
+ if (toggle) {
541
+ this.settings.$next_tip.hide();
542
+ this.settings.$next_tip.css('visibility', 'visible');
543
+ }
544
+ },
545
+
546
+ pos_modal : function ($nub) {
547
+ this.center();
548
+ $nub.hide();
549
+
550
+ this.show_modal();
551
+ },
552
+
553
+ show_modal : function () {
554
+ if (!this.settings.$next_tip.data('closed')) {
555
+ var joyridemodalbg = $('.joyride-modal-bg');
556
+ if (joyridemodalbg.length < 1) {
557
+ $('body').append(this.settings.template.modal).show();
558
+ }
559
+
560
+ if (/pop/i.test(this.settings.tip_animation)) {
561
+ joyridemodalbg.show();
562
+ } else {
563
+ joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
564
+ }
565
+ }
566
+ },
567
+
568
+ expose : function () {
569
+ var expose,
570
+ exposeCover,
571
+ el,
572
+ origCSS,
573
+ origClasses,
574
+ randId = 'expose-' + this.random_str(6);
575
+
576
+ if (arguments.length > 0 && arguments[0] instanceof $) {
577
+ el = arguments[0];
578
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
579
+ el = this.settings.$target;
580
+ } else {
581
+ return false;
582
+ }
583
+
584
+ if(el.length < 1){
585
+ if(window.console){
586
+ console.error('element not valid', el);
587
+ }
588
+ return false;
589
+ }
590
+
591
+ expose = $(this.settings.template.expose);
592
+ this.settings.$body.append(expose);
593
+ expose.css({
594
+ top: el.offset().top,
595
+ left: el.offset().left,
596
+ width: el.outerWidth(true),
597
+ height: el.outerHeight(true)
598
+ });
599
+
600
+ exposeCover = $(this.settings.template.expose_cover);
601
+
602
+ origCSS = {
603
+ zIndex: el.css('z-index'),
604
+ position: el.css('position')
605
+ };
606
+
607
+ origClasses = el.attr('class') == null ? '' : el.attr('class');
608
+
609
+ el.css('z-index',parseInt(expose.css('z-index'))+1);
610
+
611
+ if (origCSS.position == 'static') {
612
+ el.css('position','relative');
613
+ }
614
+
615
+ el.data('expose-css',origCSS);
616
+ el.data('orig-class', origClasses);
617
+ el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
618
+
619
+ exposeCover.css({
620
+ top: el.offset().top,
621
+ left: el.offset().left,
622
+ width: el.outerWidth(true),
623
+ height: el.outerHeight(true)
624
+ });
625
+
626
+ if (this.settings.modal) this.show_modal();
627
+
628
+ this.settings.$body.append(exposeCover);
629
+ expose.addClass(randId);
630
+ exposeCover.addClass(randId);
631
+ el.data('expose', randId);
632
+ this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
633
+ this.add_exposed(el);
634
+ },
635
+
636
+ un_expose : function () {
637
+ var exposeId,
638
+ el,
639
+ expose ,
640
+ origCSS,
641
+ origClasses,
642
+ clearAll = false;
643
+
644
+ if (arguments.length > 0 && arguments[0] instanceof $) {
645
+ el = arguments[0];
646
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
647
+ el = this.settings.$target;
648
+ } else {
649
+ return false;
650
+ }
651
+
652
+ if(el.length < 1){
653
+ if (window.console) {
654
+ console.error('element not valid', el);
655
+ }
656
+ return false;
657
+ }
658
+
659
+ exposeId = el.data('expose');
660
+ expose = $('.' + exposeId);
661
+
662
+ if (arguments.length > 1) {
663
+ clearAll = arguments[1];
664
+ }
665
+
666
+ if (clearAll === true) {
667
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
668
+ } else {
669
+ expose.remove();
670
+ }
671
+
672
+ origCSS = el.data('expose-css');
673
+
674
+ if (origCSS.zIndex == 'auto') {
675
+ el.css('z-index', '');
676
+ } else {
677
+ el.css('z-index', origCSS.zIndex);
678
+ }
679
+
680
+ if (origCSS.position != el.css('position')) {
681
+ if(origCSS.position == 'static') {// this is default, no need to set it.
682
+ el.css('position', '');
683
+ } else {
684
+ el.css('position', origCSS.position);
685
+ }
686
+ }
687
+
688
+ origClasses = el.data('orig-class');
689
+ el.attr('class', origClasses);
690
+ el.removeData('orig-classes');
691
+
692
+ el.removeData('expose');
693
+ el.removeData('expose-z-index');
694
+ this.remove_exposed(el);
695
+ },
696
+
697
+ add_exposed: function(el){
698
+ this.settings.exposed = this.settings.exposed || [];
699
+ if (el instanceof $ || typeof el === 'object') {
700
+ this.settings.exposed.push(el[0]);
701
+ } else if (typeof el == 'string') {
702
+ this.settings.exposed.push(el);
703
+ }
704
+ },
705
+
706
+ remove_exposed: function(el){
707
+ var search, i;
708
+ if (el instanceof $) {
709
+ search = el[0]
710
+ } else if (typeof el == 'string'){
711
+ search = el;
712
+ }
713
+
714
+ this.settings.exposed = this.settings.exposed || [];
715
+ i = this.settings.exposed.length;
716
+
717
+ while (i--) {
718
+ if (this.settings.exposed[i] == search) {
719
+ this.settings.exposed.splice(i, 1);
720
+ return;
721
+ }
722
+ }
723
+ },
724
+
725
+ center : function () {
726
+ var $w = $(window);
727
+
728
+ this.settings.$next_tip.css({
729
+ top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
730
+ left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
731
+ });
732
+
733
+ return true;
734
+ },
735
+
736
+ bottom : function () {
737
+ return /bottom/i.test(this.settings.tip_settings.tip_location);
738
+ },
739
+
740
+ top : function () {
741
+ return /top/i.test(this.settings.tip_settings.tip_location);
742
+ },
743
+
744
+ right : function () {
745
+ return /right/i.test(this.settings.tip_settings.tip_location);
746
+ },
747
+
748
+ left : function () {
749
+ return /left/i.test(this.settings.tip_settings.tip_location);
750
+ },
751
+
752
+ corners : function (el) {
753
+ var w = $(window),
754
+ window_half = w.height() / 2,
755
+ //using this to calculate since scroll may not have finished yet.
756
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
757
+ right = w.width() + w.scrollLeft(),
758
+ offsetBottom = w.height() + tipOffset,
759
+ bottom = w.height() + w.scrollTop(),
760
+ top = w.scrollTop();
761
+
762
+ if (tipOffset < top) {
763
+ if (tipOffset < 0) {
764
+ top = 0;
765
+ } else {
766
+ top = tipOffset;
767
+ }
768
+ }
769
+
770
+ if (offsetBottom > bottom) {
771
+ bottom = offsetBottom;
772
+ }
773
+
774
+ return [
775
+ el.offset().top < top,
776
+ right < el.offset().left + el.outerWidth(),
777
+ bottom < el.offset().top + el.outerHeight(),
778
+ w.scrollLeft() > el.offset().left
779
+ ];
780
+ },
781
+
782
+ visible : function (hidden_corners) {
783
+ var i = hidden_corners.length;
784
+
785
+ while (i--) {
786
+ if (hidden_corners[i]) return false;
787
+ }
788
+
789
+ return true;
790
+ },
791
+
792
+ nub_position : function (nub, pos, def) {
793
+ if (pos === 'auto') {
794
+ nub.addClass(def);
795
+ } else {
796
+ nub.addClass(pos);
797
+ }
798
+ },
799
+
800
+ startTimer : function () {
801
+ if (this.settings.$li.length) {
802
+ this.settings.automate = setTimeout(function () {
803
+ this.hide();
804
+ this.show();
805
+ this.startTimer();
806
+ }.bind(this), this.settings.timer);
807
+ } else {
808
+ clearTimeout(this.settings.automate);
809
+ }
810
+ },
811
+
812
+ end : function (abort) {
813
+ if (this.settings.cookie_monster) {
814
+ $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });
815
+ }
816
+
817
+ if (this.settings.timer > 0) {
818
+ clearTimeout(this.settings.automate);
819
+ }
820
+
821
+ if (this.settings.modal && this.settings.expose) {
822
+ this.un_expose();
823
+ }
824
+
825
+ this.settings.$next_tip.data('closed', true);
826
+
827
+ $('.joyride-modal-bg').hide();
828
+ this.settings.$current_tip.hide();
829
+
830
+ if (typeof abort === 'undefined') {
831
+ this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
832
+ this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
833
+ }
834
+
835
+ $('.joyride-tip-guide').remove();
836
+ },
837
+
838
+ off : function () {
839
+ $(this.scope).off('.joyride');
840
+ $(window).off('.joyride');
841
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
842
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
843
+ clearTimeout(this.settings.automate);
844
+ this.settings = {};
845
+ },
846
+
847
+ reflow : function () {}
848
+ };
849
+ }(jQuery, this, this.document));