opsask 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.yardoc/checksums +4 -0
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/.yardoc/proxy_types +0 -0
  7. data/Gemfile +15 -0
  8. data/Gemfile.lock +75 -0
  9. data/LICENSE +13 -0
  10. data/Rakefile +30 -0
  11. data/Readme.md +3 -0
  12. data/VERSION +1 -0
  13. data/bin/opsask +4 -0
  14. data/lib/opsask/app.rb +540 -0
  15. data/lib/opsask/main.rb +54 -0
  16. data/lib/opsask/metadata.rb +29 -0
  17. data/lib/opsask.rb +3 -0
  18. data/opsask.gemspec +29 -0
  19. data/public/css/foundation.css +5068 -0
  20. data/public/css/foundation.min.css +1 -0
  21. data/public/css/normalize.css +410 -0
  22. data/public/css/style.css +152 -0
  23. data/public/favicon.ico +0 -0
  24. data/public/fonts/DINMittelschriftStd.woff +0 -0
  25. data/public/img/.gitkeep +1 -0
  26. data/public/js/foundation/foundation.abide.js +256 -0
  27. data/public/js/foundation/foundation.accordion.js +49 -0
  28. data/public/js/foundation/foundation.alert.js +37 -0
  29. data/public/js/foundation/foundation.clearing.js +485 -0
  30. data/public/js/foundation/foundation.dropdown.js +208 -0
  31. data/public/js/foundation/foundation.equalizer.js +64 -0
  32. data/public/js/foundation/foundation.interchange.js +326 -0
  33. data/public/js/foundation/foundation.joyride.js +848 -0
  34. data/public/js/foundation/foundation.js +587 -0
  35. data/public/js/foundation/foundation.magellan.js +171 -0
  36. data/public/js/foundation/foundation.offcanvas.js +39 -0
  37. data/public/js/foundation/foundation.orbit.js +464 -0
  38. data/public/js/foundation/foundation.reveal.js +399 -0
  39. data/public/js/foundation/foundation.tab.js +58 -0
  40. data/public/js/foundation/foundation.tooltip.js +215 -0
  41. data/public/js/foundation/foundation.topbar.js +387 -0
  42. data/public/js/foundation/jquery.cookie.js +8 -0
  43. data/public/js/foundation.min.js +10 -0
  44. data/public/js/opsask.js +19 -0
  45. data/public/js/vendor/fastclick.js +9 -0
  46. data/public/js/vendor/jquery.cookie.js +8 -0
  47. data/public/js/vendor/jquery.js +26 -0
  48. data/public/js/vendor/modernizr.js +8 -0
  49. data/public/js/vendor/placeholder.js +2 -0
  50. data/tasks/generate-email-summary.rb +73 -0
  51. data/tasks/send-email-summary.sh +13 -0
  52. data/views/_components.erb +6 -0
  53. data/views/_count.erb +11 -0
  54. data/views/_flash.erb +3 -0
  55. data/views/_form.erb +37 -0
  56. data/views/_queue.erb +16 -0
  57. data/views/agile.erb +6 -0
  58. data/views/glance.erb +19 -0
  59. data/views/index.erb +27 -0
  60. data/views/layout.erb +43 -0
  61. data/views/stragglers.erb +6 -0
  62. data/views/untracked.erb +6 -0
  63. metadata +217 -0
@@ -0,0 +1,848 @@
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.1.1',
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
+ tip_location_patterns : {
32
+ top: ['bottom'],
33
+ bottom: [], // bottom should not need to be repositioned
34
+ left: ['right', 'top', 'bottom'],
35
+ right: ['left', 'top', 'bottom']
36
+ },
37
+ post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete)
38
+ post_step_callback : function (){}, // A method to call after each step
39
+ pre_step_callback : function (){}, // A method to call before each step
40
+ pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
41
+ post_expose_callback : function (){}, // A method to call after an element has been exposed
42
+ template : { // HTML segments for tip layout
43
+ link : '<a href="#close" class="joyride-close-tip">&times;</a>',
44
+ timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
45
+ tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
46
+ wrapper : '<div class="joyride-content-wrapper"></div>',
47
+ button : '<a href="#" class="small button joyride-next-tip"></a>',
48
+ modal : '<div class="joyride-modal-bg"></div>',
49
+ expose : '<div class="joyride-expose-wrapper"></div>',
50
+ expose_cover: '<div class="joyride-expose-cover"></div>'
51
+ },
52
+ expose_add_class : '' // One or more space-separated class names to be added to exposed element
53
+ },
54
+
55
+ init : function (scope, method, options) {
56
+ Foundation.inherit(this, 'throttle random_str');
57
+
58
+ this.settings = this.defaults;
59
+
60
+ this.bindings(method, options)
61
+ },
62
+
63
+ events : function () {
64
+ var self = this;
65
+
66
+ $(this.scope)
67
+ .off('.joyride')
68
+ .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
69
+ e.preventDefault();
70
+
71
+ if (this.settings.$li.next().length < 1) {
72
+ this.end();
73
+ } else if (this.settings.timer > 0) {
74
+ clearTimeout(this.settings.automate);
75
+ this.hide();
76
+ this.show();
77
+ this.startTimer();
78
+ } else {
79
+ this.hide();
80
+ this.show();
81
+ }
82
+
83
+ }.bind(this))
84
+
85
+ .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
86
+ e.preventDefault();
87
+ this.end();
88
+ }.bind(this));
89
+
90
+ $(window)
91
+ .off('.joyride')
92
+ .on('resize.fndtn.joyride', self.throttle(function () {
93
+ if ($('[' + self.attr_name() + ']').length > 0 && self.settings.$next_tip) {
94
+ if (self.settings.exposed.length > 0) {
95
+ var $els = $(self.settings.exposed);
96
+
97
+ $els.each(function () {
98
+ var $this = $(this);
99
+ self.un_expose($this);
100
+ self.expose($this);
101
+ });
102
+ }
103
+
104
+ if (self.is_phone()) {
105
+ self.pos_phone();
106
+ } else {
107
+ self.pos_default(false, true);
108
+ }
109
+ }
110
+ }, 100));
111
+ },
112
+
113
+ start : function () {
114
+ var self = this,
115
+ $this = $('[' + this.attr_name() + ']', this.scope),
116
+ integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
117
+ int_settings_count = integer_settings.length;
118
+
119
+ if (!$this.length > 0) return;
120
+
121
+ if (!this.settings.init) this.events();
122
+
123
+ this.settings = $this.data(this.attr_name(true) + '-init');
124
+
125
+ // non configureable settings
126
+ this.settings.$content_el = $this;
127
+ this.settings.$body = $(this.settings.tip_container);
128
+ this.settings.body_offset = $(this.settings.tip_container).position();
129
+ this.settings.$tip_content = this.settings.$content_el.find('> li');
130
+ this.settings.paused = false;
131
+ this.settings.attempts = 0;
132
+
133
+ // can we create cookies?
134
+ if (typeof $.cookie !== 'function') {
135
+ this.settings.cookie_monster = false;
136
+ }
137
+
138
+ // generate the tips and insert into dom.
139
+ if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
140
+ this.settings.$tip_content.each(function (index) {
141
+ var $this = $(this);
142
+ this.settings = $.extend({}, self.defaults, self.data_options($this))
143
+
144
+ // Make sure that settings parsed from data_options are integers where necessary
145
+ var i = int_settings_count;
146
+ while (i--) {
147
+ self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
148
+ }
149
+ self.create({$li : $this, index : index});
150
+ });
151
+
152
+ // show first tip
153
+ if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
154
+ this.show('init');
155
+ this.startTimer();
156
+ } else {
157
+ this.show('init');
158
+ }
159
+
160
+ }
161
+ },
162
+
163
+ resume : function () {
164
+ this.set_li();
165
+ this.show();
166
+ },
167
+
168
+ tip_template : function (opts) {
169
+ var $blank, content;
170
+
171
+ opts.tip_class = opts.tip_class || '';
172
+
173
+ $blank = $(this.settings.template.tip).addClass(opts.tip_class);
174
+ content = $.trim($(opts.li).html()) +
175
+ this.button_text(opts.button_text) +
176
+ this.settings.template.link +
177
+ this.timer_instance(opts.index);
178
+
179
+ $blank.append($(this.settings.template.wrapper));
180
+ $blank.first().attr(this.add_namespace('data-index'), opts.index);
181
+ $('.joyride-content-wrapper', $blank).append(content);
182
+
183
+ return $blank[0];
184
+ },
185
+
186
+ timer_instance : function (index) {
187
+ var txt;
188
+
189
+ if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
190
+ txt = '';
191
+ } else {
192
+ txt = $(this.settings.template.timer)[0].outerHTML;
193
+ }
194
+ return txt;
195
+ },
196
+
197
+ button_text : function (txt) {
198
+ if (this.settings.next_button) {
199
+ txt = $.trim(txt) || 'Next';
200
+ txt = $(this.settings.template.button).append(txt)[0].outerHTML;
201
+ } else {
202
+ txt = '';
203
+ }
204
+ return txt;
205
+ },
206
+
207
+ create : function (opts) {
208
+ console.log(opts.$li)
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
+ console.log(this.add_namespace('data-class'))
376
+ var cl = this.settings.$li.attr(this.add_namespace('data-class')),
377
+ id = this.settings.$li.attr(this.add_namespace('data-id')),
378
+ $sel = function () {
379
+ if (id) {
380
+ return $(document.getElementById(id));
381
+ } else if (cl) {
382
+ return $('.' + cl).first();
383
+ } else {
384
+ return $('body');
385
+ }
386
+ };
387
+
388
+ console.log(cl, id)
389
+
390
+ this.settings.$target = $sel();
391
+ },
392
+
393
+ scroll_to : function () {
394
+ var window_half, tipOffset;
395
+
396
+ window_half = $(window).height() / 2;
397
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
398
+
399
+ if (tipOffset != 0) {
400
+ $('html, body').animate({
401
+ scrollTop: tipOffset
402
+ }, this.settings.scroll_speed, 'swing');
403
+ }
404
+ },
405
+
406
+ paused : function () {
407
+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
408
+ },
409
+
410
+ restart : function () {
411
+ this.hide();
412
+ this.settings.$li = undefined;
413
+ this.show('init');
414
+ },
415
+
416
+ pos_default : function (init, resizing) {
417
+ var half_fold = Math.ceil($(window).height() / 2),
418
+ tip_position = this.settings.$next_tip.offset(),
419
+ $nub = this.settings.$next_tip.find('.joyride-nub'),
420
+ nub_width = Math.ceil($nub.outerWidth() / 2),
421
+ nub_height = Math.ceil($nub.outerHeight() / 2),
422
+ toggle = init || false;
423
+
424
+ // tip must not be "display: none" to calculate position
425
+ if (toggle) {
426
+ this.settings.$next_tip.css('visibility', 'hidden');
427
+ this.settings.$next_tip.show();
428
+ }
429
+
430
+ if (typeof resizing === 'undefined') {
431
+ resizing = false;
432
+ }
433
+
434
+ if (!/body/i.test(this.settings.$target.selector)) {
435
+ if (this.bottom()) {
436
+ if (this.rtl) {
437
+ this.settings.$next_tip.css({
438
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
439
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
440
+ } else {
441
+ this.settings.$next_tip.css({
442
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
443
+ left: this.settings.$target.offset().left});
444
+ }
445
+
446
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
447
+
448
+ } else if (this.top()) {
449
+ if (this.rtl) {
450
+ this.settings.$next_tip.css({
451
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
452
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
453
+ } else {
454
+ this.settings.$next_tip.css({
455
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
456
+ left: this.settings.$target.offset().left});
457
+ }
458
+
459
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
460
+
461
+ } else if (this.right()) {
462
+
463
+ this.settings.$next_tip.css({
464
+ top: this.settings.$target.offset().top,
465
+ left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
466
+
467
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
468
+
469
+ } else if (this.left()) {
470
+
471
+ this.settings.$next_tip.css({
472
+ top: this.settings.$target.offset().top,
473
+ left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
474
+
475
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
476
+
477
+ }
478
+
479
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
480
+
481
+ $nub.removeClass('bottom')
482
+ .removeClass('top')
483
+ .removeClass('right')
484
+ .removeClass('left');
485
+
486
+ this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
487
+
488
+ this.settings.attempts++;
489
+
490
+ this.pos_default();
491
+
492
+ }
493
+
494
+ } else if (this.settings.$li.length) {
495
+
496
+ this.pos_modal($nub);
497
+
498
+ }
499
+
500
+ if (toggle) {
501
+ this.settings.$next_tip.hide();
502
+ this.settings.$next_tip.css('visibility', 'visible');
503
+ }
504
+
505
+ },
506
+
507
+ pos_phone : function (init) {
508
+ var tip_height = this.settings.$next_tip.outerHeight(),
509
+ tip_offset = this.settings.$next_tip.offset(),
510
+ target_height = this.settings.$target.outerHeight(),
511
+ $nub = $('.joyride-nub', this.settings.$next_tip),
512
+ nub_height = Math.ceil($nub.outerHeight() / 2),
513
+ toggle = init || false;
514
+
515
+ $nub.removeClass('bottom')
516
+ .removeClass('top')
517
+ .removeClass('right')
518
+ .removeClass('left');
519
+
520
+ if (toggle) {
521
+ this.settings.$next_tip.css('visibility', 'hidden');
522
+ this.settings.$next_tip.show();
523
+ }
524
+
525
+ if (!/body/i.test(this.settings.$target.selector)) {
526
+
527
+ if (this.top()) {
528
+
529
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
530
+ $nub.addClass('bottom');
531
+
532
+ } else {
533
+
534
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
535
+ $nub.addClass('top');
536
+
537
+ }
538
+
539
+ } else if (this.settings.$li.length) {
540
+ this.pos_modal($nub);
541
+ }
542
+
543
+ if (toggle) {
544
+ this.settings.$next_tip.hide();
545
+ this.settings.$next_tip.css('visibility', 'visible');
546
+ }
547
+ },
548
+
549
+ pos_modal : function ($nub) {
550
+ this.center();
551
+ $nub.hide();
552
+
553
+ this.show_modal();
554
+ },
555
+
556
+ show_modal : function () {
557
+ if (!this.settings.$next_tip.data('closed')) {
558
+ var joyridemodalbg = $('.joyride-modal-bg');
559
+ if (joyridemodalbg.length < 1) {
560
+ $('body').append(this.settings.template.modal).show();
561
+ }
562
+
563
+ if (/pop/i.test(this.settings.tip_animation)) {
564
+ joyridemodalbg.show();
565
+ } else {
566
+ joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
567
+ }
568
+ }
569
+ },
570
+
571
+ expose : function () {
572
+ var expose,
573
+ exposeCover,
574
+ el,
575
+ origCSS,
576
+ origClasses,
577
+ randId = 'expose-' + this.random_str(6);
578
+
579
+ if (arguments.length > 0 && arguments[0] instanceof $) {
580
+ el = arguments[0];
581
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
582
+ el = this.settings.$target;
583
+ } else {
584
+ return false;
585
+ }
586
+
587
+ if(el.length < 1){
588
+ if(window.console){
589
+ console.error('element not valid', el);
590
+ }
591
+ return false;
592
+ }
593
+
594
+ expose = $(this.settings.template.expose);
595
+ this.settings.$body.append(expose);
596
+ expose.css({
597
+ top: el.offset().top,
598
+ left: el.offset().left,
599
+ width: el.outerWidth(true),
600
+ height: el.outerHeight(true)
601
+ });
602
+
603
+ exposeCover = $(this.settings.template.expose_cover);
604
+
605
+ origCSS = {
606
+ zIndex: el.css('z-index'),
607
+ position: el.css('position')
608
+ };
609
+
610
+ origClasses = el.attr('class') == null ? '' : el.attr('class');
611
+
612
+ el.css('z-index',parseInt(expose.css('z-index'))+1);
613
+
614
+ if (origCSS.position == 'static') {
615
+ el.css('position','relative');
616
+ }
617
+
618
+ el.data('expose-css',origCSS);
619
+ el.data('orig-class', origClasses);
620
+ el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
621
+
622
+ exposeCover.css({
623
+ top: el.offset().top,
624
+ left: el.offset().left,
625
+ width: el.outerWidth(true),
626
+ height: el.outerHeight(true)
627
+ });
628
+
629
+ if (this.settings.modal) this.show_modal();
630
+
631
+ this.settings.$body.append(exposeCover);
632
+ expose.addClass(randId);
633
+ exposeCover.addClass(randId);
634
+ el.data('expose', randId);
635
+ this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
636
+ this.add_exposed(el);
637
+ },
638
+
639
+ un_expose : function () {
640
+ var exposeId,
641
+ el,
642
+ expose ,
643
+ origCSS,
644
+ origClasses,
645
+ clearAll = false;
646
+
647
+ if (arguments.length > 0 && arguments[0] instanceof $) {
648
+ el = arguments[0];
649
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
650
+ el = this.settings.$target;
651
+ } else {
652
+ return false;
653
+ }
654
+
655
+ if(el.length < 1){
656
+ if (window.console) {
657
+ console.error('element not valid', el);
658
+ }
659
+ return false;
660
+ }
661
+
662
+ exposeId = el.data('expose');
663
+ expose = $('.' + exposeId);
664
+
665
+ if (arguments.length > 1) {
666
+ clearAll = arguments[1];
667
+ }
668
+
669
+ if (clearAll === true) {
670
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
671
+ } else {
672
+ expose.remove();
673
+ }
674
+
675
+ origCSS = el.data('expose-css');
676
+
677
+ if (origCSS.zIndex == 'auto') {
678
+ el.css('z-index', '');
679
+ } else {
680
+ el.css('z-index', origCSS.zIndex);
681
+ }
682
+
683
+ if (origCSS.position != el.css('position')) {
684
+ if(origCSS.position == 'static') {// this is default, no need to set it.
685
+ el.css('position', '');
686
+ } else {
687
+ el.css('position', origCSS.position);
688
+ }
689
+ }
690
+
691
+ origClasses = el.data('orig-class');
692
+ el.attr('class', origClasses);
693
+ el.removeData('orig-classes');
694
+
695
+ el.removeData('expose');
696
+ el.removeData('expose-z-index');
697
+ this.remove_exposed(el);
698
+ },
699
+
700
+ add_exposed: function(el){
701
+ this.settings.exposed = this.settings.exposed || [];
702
+ if (el instanceof $ || typeof el === 'object') {
703
+ this.settings.exposed.push(el[0]);
704
+ } else if (typeof el == 'string') {
705
+ this.settings.exposed.push(el);
706
+ }
707
+ },
708
+
709
+ remove_exposed: function(el){
710
+ var search, i;
711
+ if (el instanceof $) {
712
+ search = el[0]
713
+ } else if (typeof el == 'string'){
714
+ search = el;
715
+ }
716
+
717
+ this.settings.exposed = this.settings.exposed || [];
718
+ i = this.settings.exposed.length;
719
+
720
+ while (i--) {
721
+ if (this.settings.exposed[i] == search) {
722
+ this.settings.exposed.splice(i, 1);
723
+ return;
724
+ }
725
+ }
726
+ },
727
+
728
+ center : function () {
729
+ var $w = $(window);
730
+
731
+ this.settings.$next_tip.css({
732
+ top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
733
+ left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
734
+ });
735
+
736
+ return true;
737
+ },
738
+
739
+ bottom : function () {
740
+ return /bottom/i.test(this.settings.tip_settings.tip_location);
741
+ },
742
+
743
+ top : function () {
744
+ return /top/i.test(this.settings.tip_settings.tip_location);
745
+ },
746
+
747
+ right : function () {
748
+ return /right/i.test(this.settings.tip_settings.tip_location);
749
+ },
750
+
751
+ left : function () {
752
+ return /left/i.test(this.settings.tip_settings.tip_location);
753
+ },
754
+
755
+ corners : function (el) {
756
+ var w = $(window),
757
+ window_half = w.height() / 2,
758
+ //using this to calculate since scroll may not have finished yet.
759
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
760
+ right = w.width() + w.scrollLeft(),
761
+ offsetBottom = w.height() + tipOffset,
762
+ bottom = w.height() + w.scrollTop(),
763
+ top = w.scrollTop();
764
+
765
+ if (tipOffset < top) {
766
+ if (tipOffset < 0) {
767
+ top = 0;
768
+ } else {
769
+ top = tipOffset;
770
+ }
771
+ }
772
+
773
+ if (offsetBottom > bottom) {
774
+ bottom = offsetBottom;
775
+ }
776
+
777
+ return [
778
+ el.offset().top < top,
779
+ right < el.offset().left + el.outerWidth(),
780
+ bottom < el.offset().top + el.outerHeight(),
781
+ w.scrollLeft() > el.offset().left
782
+ ];
783
+ },
784
+
785
+ visible : function (hidden_corners) {
786
+ var i = hidden_corners.length;
787
+
788
+ while (i--) {
789
+ if (hidden_corners[i]) return false;
790
+ }
791
+
792
+ return true;
793
+ },
794
+
795
+ nub_position : function (nub, pos, def) {
796
+ if (pos === 'auto') {
797
+ nub.addClass(def);
798
+ } else {
799
+ nub.addClass(pos);
800
+ }
801
+ },
802
+
803
+ startTimer : function () {
804
+ if (this.settings.$li.length) {
805
+ this.settings.automate = setTimeout(function () {
806
+ this.hide();
807
+ this.show();
808
+ this.startTimer();
809
+ }.bind(this), this.settings.timer);
810
+ } else {
811
+ clearTimeout(this.settings.automate);
812
+ }
813
+ },
814
+
815
+ end : function () {
816
+ if (this.settings.cookie_monster) {
817
+ $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });
818
+ }
819
+
820
+ if (this.settings.timer > 0) {
821
+ clearTimeout(this.settings.automate);
822
+ }
823
+
824
+ if (this.settings.modal && this.settings.expose) {
825
+ this.un_expose();
826
+ }
827
+
828
+ this.settings.$next_tip.data('closed', true);
829
+
830
+ $('.joyride-modal-bg').hide();
831
+ this.settings.$current_tip.hide();
832
+ this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
833
+ this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
834
+ $('.joyride-tip-guide').remove();
835
+ },
836
+
837
+ off : function () {
838
+ $(this.scope).off('.joyride');
839
+ $(window).off('.joyride');
840
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
841
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
842
+ clearTimeout(this.settings.automate);
843
+ this.settings = {};
844
+ },
845
+
846
+ reflow : function () {}
847
+ };
848
+ }(jQuery, this, this.document));