fastlane-plugin-polidea 0.1.0

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