tennpipes-init 3.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.rdoc +163 -0
  4. data/Rakefile +1 -0
  5. data/bin/tennpipes-init +16 -0
  6. data/lib/tennpipes-init.rb +73 -0
  7. data/lib/tennpipes-init/command.rb +18 -0
  8. data/lib/tennpipes-init/generators/actions.rb +630 -0
  9. data/lib/tennpipes-init/generators/app.rb +75 -0
  10. data/lib/tennpipes-init/generators/app/app.rb.tt +72 -0
  11. data/lib/tennpipes-init/generators/app/app.rb.tt~ +72 -0
  12. data/lib/tennpipes-init/generators/cli.rb +57 -0
  13. data/lib/tennpipes-init/generators/component.rb +73 -0
  14. data/lib/tennpipes-init/generators/components/actions.rb +208 -0
  15. data/lib/tennpipes-init/generators/components/mocks/mocha.rb +10 -0
  16. data/lib/tennpipes-init/generators/components/mocks/rr.rb +13 -0
  17. data/lib/tennpipes-init/generators/components/orms/activerecord.rb +201 -0
  18. data/lib/tennpipes-init/generators/components/orms/couchrest.rb +55 -0
  19. data/lib/tennpipes-init/generators/components/orms/datamapper.rb +140 -0
  20. data/lib/tennpipes-init/generators/components/orms/dynamoid.rb +67 -0
  21. data/lib/tennpipes-init/generators/components/orms/minirecord.rb +165 -0
  22. data/lib/tennpipes-init/generators/components/orms/mongoid.rb +113 -0
  23. data/lib/tennpipes-init/generators/components/orms/mongomapper.rb +43 -0
  24. data/lib/tennpipes-init/generators/components/orms/mongomatic.rb +84 -0
  25. data/lib/tennpipes-init/generators/components/orms/ohm.rb +65 -0
  26. data/lib/tennpipes-init/generators/components/orms/ripple.rb +75 -0
  27. data/lib/tennpipes-init/generators/components/orms/sequel.rb +99 -0
  28. data/lib/tennpipes-init/generators/components/renderers/erb.rb +3 -0
  29. data/lib/tennpipes-init/generators/components/renderers/haml.rb +3 -0
  30. data/lib/tennpipes-init/generators/components/renderers/liquid.rb +4 -0
  31. data/lib/tennpipes-init/generators/components/renderers/slim.rb +3 -0
  32. data/lib/tennpipes-init/generators/components/scripts/dojo.rb +10 -0
  33. data/lib/tennpipes-init/generators/components/scripts/extcore.rb +10 -0
  34. data/lib/tennpipes-init/generators/components/scripts/jquery.rb +10 -0
  35. data/lib/tennpipes-init/generators/components/scripts/mootools.rb +10 -0
  36. data/lib/tennpipes-init/generators/components/scripts/prototype.rb +12 -0
  37. data/lib/tennpipes-init/generators/components/scripts/rightjs.rb +10 -0
  38. data/lib/tennpipes-init/generators/components/stylesheets/compass.rb +39 -0
  39. data/lib/tennpipes-init/generators/components/stylesheets/compass/application.scss +43 -0
  40. data/lib/tennpipes-init/generators/components/stylesheets/compass/partials/_base.scss +12 -0
  41. data/lib/tennpipes-init/generators/components/stylesheets/less.rb +25 -0
  42. data/lib/tennpipes-init/generators/components/stylesheets/sass.rb +15 -0
  43. data/lib/tennpipes-init/generators/components/stylesheets/scss.rb +16 -0
  44. data/lib/tennpipes-init/generators/components/tests/bacon.rb +103 -0
  45. data/lib/tennpipes-init/generators/components/tests/cucumber.rb +86 -0
  46. data/lib/tennpipes-init/generators/components/tests/minitest.rb +110 -0
  47. data/lib/tennpipes-init/generators/components/tests/riot.rb +117 -0
  48. data/lib/tennpipes-init/generators/components/tests/rspec.rb +111 -0
  49. data/lib/tennpipes-init/generators/components/tests/shoulda.rb +114 -0
  50. data/lib/tennpipes-init/generators/components/tests/steak.rb +114 -0
  51. data/lib/tennpipes-init/generators/controller.rb +77 -0
  52. data/lib/tennpipes-init/generators/helper.rb +50 -0
  53. data/lib/tennpipes-init/generators/mailer.rb +52 -0
  54. data/lib/tennpipes-init/generators/migration.rb +43 -0
  55. data/lib/tennpipes-init/generators/model.rb +113 -0
  56. data/lib/tennpipes-init/generators/plugin.rb +67 -0
  57. data/lib/tennpipes-init/generators/project.rb +160 -0
  58. data/lib/tennpipes-init/generators/project/config.ru +9 -0
  59. data/lib/tennpipes-init/generators/project/config/apps.rb.tt +35 -0
  60. data/lib/tennpipes-init/generators/project/config/boot.rb +49 -0
  61. data/lib/tennpipes-init/generators/project/public/favicon.ico +0 -0
  62. data/lib/tennpipes-init/generators/project/public/images/booking.com.png +0 -0
  63. data/lib/tennpipes-init/generators/project/public/images/causes.png +0 -0
  64. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bg.jpg +0 -0
  65. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.png +0 -0
  66. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.svg +68 -0
  67. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.png +0 -0
  68. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.svg +65 -0
  69. data/lib/tennpipes-init/generators/project/public/images/forever21.png +0 -0
  70. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.eot +0 -0
  71. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.svg +970 -0
  72. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.ttf +0 -0
  73. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.woff +0 -0
  74. data/lib/tennpipes-init/generators/project/public/images/icons/tennpipes-icons.css +598 -0
  75. data/lib/tennpipes-init/generators/project/public/images/image1.jpg +0 -0
  76. data/lib/tennpipes-init/generators/project/public/images/image11.jpg +0 -0
  77. data/lib/tennpipes-init/generators/project/public/images/image2.jpg +0 -0
  78. data/lib/tennpipes-init/generators/project/public/images/image3.jpg +0 -0
  79. data/lib/tennpipes-init/generators/project/public/images/intuit.png +0 -0
  80. data/lib/tennpipes-init/generators/project/public/images/krispykreme.png +0 -0
  81. data/lib/tennpipes-init/generators/project/public/images/placeholders/README.md +302 -0
  82. data/lib/tennpipes-init/generators/project/public/images/placeholders/bower.json +4 -0
  83. data/lib/tennpipes-init/generators/project/public/images/placeholders/composer.json +34 -0
  84. data/lib/tennpipes-init/generators/project/public/images/placeholders/gulpfile.js +92 -0
  85. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.js +1920 -0
  86. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.min.js +12 -0
  87. data/lib/tennpipes-init/generators/project/public/images/placeholders/package.json +46 -0
  88. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/holder.js +1411 -0
  89. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/augment.js +27 -0
  90. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/ondomready.js +155 -0
  91. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/polyfills.js +177 -0
  92. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/scenegraph.js +101 -0
  93. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/utils.js +129 -0
  94. data/lib/tennpipes-init/generators/project/public/images/priceline.com.png +0 -0
  95. data/lib/tennpipes-init/generators/project/public/images/stripe.png +0 -0
  96. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes.min.js +6081 -0
  97. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.abide.js +340 -0
  98. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.accordion.js +67 -0
  99. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.alert.js +43 -0
  100. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.clearing.js +556 -0
  101. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.dropdown.js +448 -0
  102. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js +77 -0
  103. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.interchange.js +354 -0
  104. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.joyride.js +932 -0
  105. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.js +703 -0
  106. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.magellan.js +203 -0
  107. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.offcanvas.js +152 -0
  108. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.orbit.js +476 -0
  109. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.reveal.js +471 -0
  110. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.slider.js +263 -0
  111. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tab.js +237 -0
  112. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tooltip.js +307 -0
  113. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.topbar.js +452 -0
  114. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/fastclick.js +8 -0
  115. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.cookie.js +8 -0
  116. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.js +26 -0
  117. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/modernizr.js +8 -0
  118. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/placeholder.js +2 -0
  119. data/lib/tennpipes-init/generators/project/public/stylesheets/app.css~ +178 -0
  120. data/lib/tennpipes-init/generators/project/public/stylesheets/app1.css~ +177 -0
  121. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css +214 -0
  122. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css~ +214 -0
  123. data/lib/tennpipes-init/generators/project/public/stylesheets/normalize.css +427 -0
  124. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css +6201 -0
  125. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css~ +6201 -0
  126. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.min.css +1 -0
  127. data/lib/tennpipes-init/generators/runner.rb +139 -0
  128. data/lib/tennpipes-init/generators/task.rb +45 -0
  129. data/lib/tennpipes-init/generators/templates/Gemfile.tt +32 -0
  130. data/lib/tennpipes-init/generators/templates/Rakefile.tt +8 -0
  131. data/lib/tennpipes-init/generators/templates/controller.rb.tt +22 -0
  132. data/lib/tennpipes-init/generators/templates/gem/README.md.tt +29 -0
  133. data/lib/tennpipes-init/generators/templates/gem/gemspec.tt +19 -0
  134. data/lib/tennpipes-init/generators/templates/gem/lib/libname.tt +6 -0
  135. data/lib/tennpipes-init/generators/templates/gem/lib/libname/version.tt +3 -0
  136. data/lib/tennpipes-init/generators/templates/helper.rb.tt +13 -0
  137. data/lib/tennpipes-init/generators/templates/initializer.rb.tt +5 -0
  138. data/lib/tennpipes-init/generators/templates/mailer.rb.tt +54 -0
  139. data/lib/tennpipes-init/generators/templates/project_bin.tt +14 -0
  140. data/lib/tennpipes-init/generators/templates/task.rb.tt +7 -0
  141. data/lib/tennpipes-init/tennpipes-tasks/activerecord.rb +377 -0
  142. data/lib/tennpipes-init/tennpipes-tasks/database.rb +12 -0
  143. data/lib/tennpipes-init/tennpipes-tasks/datamapper.rb +94 -0
  144. data/lib/tennpipes-init/tennpipes-tasks/minirecord.rb +19 -0
  145. data/lib/tennpipes-init/tennpipes-tasks/mongoid.rb +215 -0
  146. data/lib/tennpipes-init/tennpipes-tasks/mongomapper.rb +55 -0
  147. data/lib/tennpipes-init/tennpipes-tasks/sequel.rb +85 -0
  148. data/lib/tennpipes-init/tennpipes-tasks/sql-helpers.rb +72 -0
  149. data/test/fixtures/admin_template.rb +7 -0
  150. data/test/fixtures/example_template.rb +15 -0
  151. data/test/fixtures/git_template.rb +4 -0
  152. data/test/fixtures/plugin_template.rb +13 -0
  153. data/test/fixtures/rake_template.rb +9 -0
  154. data/test/helper.rb +103 -0
  155. data/test/test_app_generator.rb +142 -0
  156. data/test/test_cli.rb +27 -0
  157. data/test/test_component_generator.rb +98 -0
  158. data/test/test_controller_generator.rb +272 -0
  159. data/test/test_generator.rb +13 -0
  160. data/test/test_helper_generator.rb +133 -0
  161. data/test/test_mailer_generator.rb +69 -0
  162. data/test/test_migration_generator.rb +222 -0
  163. data/test/test_model_generator.rb +553 -0
  164. data/test/test_plugin_generator.rb +152 -0
  165. data/test/test_project_generator.rb +757 -0
  166. data/test/test_task_generator.rb +53 -0
  167. metadata +285 -0
@@ -0,0 +1,354 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Tennpipes.libs.interchange = {
5
+ name : 'interchange',
6
+
7
+ version : '5.5.1',
8
+
9
+ cache : {},
10
+
11
+ images_loaded : false,
12
+ nodes_loaded : false,
13
+
14
+ settings : {
15
+ load_attr : 'interchange',
16
+
17
+ named_queries : {
18
+ 'default' : 'only screen',
19
+ 'small' : Tennpipes.media_queries['small'],
20
+ 'small-only' : Tennpipes.media_queries['small-only'],
21
+ 'medium' : Tennpipes.media_queries['medium'],
22
+ 'medium-only' : Tennpipes.media_queries['medium-only'],
23
+ 'large' : Tennpipes.media_queries['large'],
24
+ 'large-only' : Tennpipes.media_queries['large-only'],
25
+ 'xlarge' : Tennpipes.media_queries['xlarge'],
26
+ 'xlarge-only' : Tennpipes.media_queries['xlarge-only'],
27
+ 'xxlarge' : Tennpipes.media_queries['xxlarge'],
28
+ 'landscape' : 'only screen and (orientation: landscape)',
29
+ 'portrait' : 'only screen and (orientation: portrait)',
30
+ 'retina' : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
31
+ 'only screen and (min--moz-device-pixel-ratio: 2),' +
32
+ 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
33
+ 'only screen and (min-device-pixel-ratio: 2),' +
34
+ 'only screen and (min-resolution: 192dpi),' +
35
+ 'only screen and (min-resolution: 2dppx)'
36
+ },
37
+
38
+ directives : {
39
+ replace : function (el, path, trigger) {
40
+ // The trigger argument, if called within the directive, fires
41
+ // an event named after the directive on the element, passing
42
+ // any parameters along to the event that you pass to trigger.
43
+ //
44
+ // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
45
+ //
46
+ // This allows you to bind a callback like so:
47
+ // $('#interchangeContainer').on('replace', function (e, a, b, c) {
48
+ // console.log($(this).html(), a, b, c);
49
+ // });
50
+
51
+ if (/IMG/.test(el[0].nodeName)) {
52
+ var orig_path = el[0].src;
53
+
54
+ if (new RegExp(path, 'i').test(orig_path)) {
55
+ return;
56
+ }
57
+
58
+ el[0].src = path;
59
+
60
+ return trigger(el[0].src);
61
+ }
62
+ var last_path = el.data(this.data_attr + '-last-path'),
63
+ self = this;
64
+
65
+ if (last_path == path) {
66
+ return;
67
+ }
68
+
69
+ if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
70
+ $(el).css('background-image', 'url(' + path + ')');
71
+ el.data('interchange-last-path', path);
72
+ return trigger(path);
73
+ }
74
+
75
+ return $.get(path, function (response) {
76
+ el.html(response);
77
+ el.data(self.data_attr + '-last-path', path);
78
+ trigger();
79
+ });
80
+
81
+ }
82
+ }
83
+ },
84
+
85
+ init : function (scope, method, options) {
86
+ Tennpipes.inherit(this, 'throttle random_str');
87
+
88
+ this.data_attr = this.set_data_attr();
89
+ $.extend(true, this.settings, method, options);
90
+ this.bindings(method, options);
91
+ this.load('images');
92
+ this.load('nodes');
93
+ },
94
+
95
+ get_media_hash : function () {
96
+ var mediaHash = '';
97
+ for (var queryName in this.settings.named_queries ) {
98
+ mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
99
+ }
100
+ return mediaHash;
101
+ },
102
+
103
+ events : function () {
104
+ var self = this, prevMediaHash;
105
+
106
+ $(window)
107
+ .off('.interchange')
108
+ .on('resize.fndtn.interchange', self.throttle(function () {
109
+ var currMediaHash = self.get_media_hash();
110
+ if (currMediaHash !== prevMediaHash) {
111
+ self.resize();
112
+ }
113
+ prevMediaHash = currMediaHash;
114
+ }, 50));
115
+
116
+ return this;
117
+ },
118
+
119
+ resize : function () {
120
+ var cache = this.cache;
121
+
122
+ if (!this.images_loaded || !this.nodes_loaded) {
123
+ setTimeout($.proxy(this.resize, this), 50);
124
+ return;
125
+ }
126
+
127
+ for (var uuid in cache) {
128
+ if (cache.hasOwnProperty(uuid)) {
129
+ var passed = this.results(uuid, cache[uuid]);
130
+
131
+ if (passed) {
132
+ this.settings.directives[passed
133
+ .scenario[1]].call(this, passed.el, passed.scenario[0], (function (passed) {
134
+ if (arguments[0] instanceof Array) {
135
+ var args = arguments[0];
136
+ } else {
137
+ var args = Array.prototype.slice.call(arguments, 0);
138
+ }
139
+
140
+ return function() {
141
+ passed.el.trigger(passed.scenario[1], args);
142
+ }
143
+ }(passed)));
144
+ }
145
+ }
146
+ }
147
+
148
+ },
149
+
150
+ results : function (uuid, scenarios) {
151
+ var count = scenarios.length;
152
+
153
+ if (count > 0) {
154
+ var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
155
+
156
+ while (count--) {
157
+ var mq, rule = scenarios[count][2];
158
+ if (this.settings.named_queries.hasOwnProperty(rule)) {
159
+ mq = matchMedia(this.settings.named_queries[rule]);
160
+ } else {
161
+ mq = matchMedia(rule);
162
+ }
163
+ if (mq.matches) {
164
+ return {el : el, scenario : scenarios[count]};
165
+ }
166
+ }
167
+ }
168
+
169
+ return false;
170
+ },
171
+
172
+ load : function (type, force_update) {
173
+ if (typeof this['cached_' + type] === 'undefined' || force_update) {
174
+ this['update_' + type]();
175
+ }
176
+
177
+ return this['cached_' + type];
178
+ },
179
+
180
+ update_images : function () {
181
+ var images = this.S('img[' + this.data_attr + ']'),
182
+ count = images.length,
183
+ i = count,
184
+ loaded_count = 0,
185
+ data_attr = this.data_attr;
186
+
187
+ this.cache = {};
188
+ this.cached_images = [];
189
+ this.images_loaded = (count === 0);
190
+
191
+ while (i--) {
192
+ loaded_count++;
193
+ if (images[i]) {
194
+ var str = images[i].getAttribute(data_attr) || '';
195
+
196
+ if (str.length > 0) {
197
+ this.cached_images.push(images[i]);
198
+ }
199
+ }
200
+
201
+ if (loaded_count === count) {
202
+ this.images_loaded = true;
203
+ this.enhance('images');
204
+ }
205
+ }
206
+
207
+ return this;
208
+ },
209
+
210
+ update_nodes : function () {
211
+ var nodes = this.S('[' + this.data_attr + ']').not('img'),
212
+ count = nodes.length,
213
+ i = count,
214
+ loaded_count = 0,
215
+ data_attr = this.data_attr;
216
+
217
+ this.cached_nodes = [];
218
+ this.nodes_loaded = (count === 0);
219
+
220
+ while (i--) {
221
+ loaded_count++;
222
+ var str = nodes[i].getAttribute(data_attr) || '';
223
+
224
+ if (str.length > 0) {
225
+ this.cached_nodes.push(nodes[i]);
226
+ }
227
+
228
+ if (loaded_count === count) {
229
+ this.nodes_loaded = true;
230
+ this.enhance('nodes');
231
+ }
232
+ }
233
+
234
+ return this;
235
+ },
236
+
237
+ enhance : function (type) {
238
+ var i = this['cached_' + type].length;
239
+
240
+ while (i--) {
241
+ this.object($(this['cached_' + type][i]));
242
+ }
243
+
244
+ return $(window).trigger('resize').trigger('resize.fndtn.interchange');
245
+ },
246
+
247
+ convert_directive : function (directive) {
248
+
249
+ var trimmed = this.trim(directive);
250
+
251
+ if (trimmed.length > 0) {
252
+ return trimmed;
253
+ }
254
+
255
+ return 'replace';
256
+ },
257
+
258
+ parse_scenario : function (scenario) {
259
+ // This logic had to be made more complex since some users were using commas in the url path
260
+ // So we cannot simply just split on a comma
261
+ var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
262
+ media_query = scenario[1];
263
+
264
+ if (directive_match) {
265
+ var path = directive_match[1],
266
+ directive = directive_match[2];
267
+ } else {
268
+ var cached_split = scenario[0].split(/,\s*$/),
269
+ path = cached_split[0],
270
+ directive = '';
271
+ }
272
+
273
+ return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
274
+ },
275
+
276
+ object : function (el) {
277
+ var raw_arr = this.parse_data_attr(el),
278
+ scenarios = [],
279
+ i = raw_arr.length;
280
+
281
+ if (i > 0) {
282
+ while (i--) {
283
+ var split = raw_arr[i].split(/\(([^\)]*?)(\))$/);
284
+
285
+ if (split.length > 1) {
286
+ var params = this.parse_scenario(split);
287
+ scenarios.push(params);
288
+ }
289
+ }
290
+ }
291
+
292
+ return this.store(el, scenarios);
293
+ },
294
+
295
+ store : function (el, scenarios) {
296
+ var uuid = this.random_str(),
297
+ current_uuid = el.data(this.add_namespace('uuid', true));
298
+
299
+ if (this.cache[current_uuid]) {
300
+ return this.cache[current_uuid];
301
+ }
302
+
303
+ el.attr(this.add_namespace('data-uuid'), uuid);
304
+
305
+ return this.cache[uuid] = scenarios;
306
+ },
307
+
308
+ trim : function (str) {
309
+
310
+ if (typeof str === 'string') {
311
+ return $.trim(str);
312
+ }
313
+
314
+ return str;
315
+ },
316
+
317
+ set_data_attr : function (init) {
318
+ if (init) {
319
+ if (this.namespace.length > 0) {
320
+ return this.namespace + '-' + this.settings.load_attr;
321
+ }
322
+
323
+ return this.settings.load_attr;
324
+ }
325
+
326
+ if (this.namespace.length > 0) {
327
+ return 'data-' + this.namespace + '-' + this.settings.load_attr;
328
+ }
329
+
330
+ return 'data-' + this.settings.load_attr;
331
+ },
332
+
333
+ parse_data_attr : function (el) {
334
+ var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
335
+ i = raw.length,
336
+ output = [];
337
+
338
+ while (i--) {
339
+ if (raw[i].replace(/[\W\d]+/, '').length > 4) {
340
+ output.push(raw[i]);
341
+ }
342
+ }
343
+
344
+ return output;
345
+ },
346
+
347
+ reflow : function () {
348
+ this.load('images', true);
349
+ this.load('nodes', true);
350
+ }
351
+
352
+ };
353
+
354
+ }(jQuery, window, window.document));
@@ -0,0 +1,932 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ var Modernizr = Modernizr || false;
5
+
6
+ Tennpipes.libs.joyride = {
7
+ name : 'joyride',
8
+
9
+ version : '5.5.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
+ 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
+ Tennpipes.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.fndtn.joyride', function (e) {
115
+ // Don't do anything if keystrokes are disabled
116
+ // or if the joyride is not being shown
117
+ if (!this.settings.keyboard || !this.settings.riding) {
118
+ return;
119
+ }
120
+
121
+ switch (e.which) {
122
+ case 39: // right arrow
123
+ e.preventDefault();
124
+ this.go_next();
125
+ break;
126
+ case 37: // left arrow
127
+ e.preventDefault();
128
+ this.go_prev();
129
+ break;
130
+ case 27: // escape
131
+ e.preventDefault();
132
+ this.end(this.settings.abort_on_close);
133
+ }
134
+ }.bind(this));
135
+
136
+ $(window)
137
+ .off('.joyride')
138
+ .on('resize.fndtn.joyride', self.throttle(function () {
139
+ if ($('[' + self.attr_name() + ']').length > 0 && self.settings.$next_tip && self.settings.riding) {
140
+ if (self.settings.exposed.length > 0) {
141
+ var $els = $(self.settings.exposed);
142
+
143
+ $els.each(function () {
144
+ var $this = $(this);
145
+ self.un_expose($this);
146
+ self.expose($this);
147
+ });
148
+ }
149
+
150
+ if (self.is_phone()) {
151
+ self.pos_phone();
152
+ } else {
153
+ self.pos_default(false);
154
+ }
155
+ }
156
+ }, 100));
157
+ },
158
+
159
+ start : function () {
160
+ var self = this,
161
+ $this = $('[' + this.attr_name() + ']', this.scope),
162
+ integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
163
+ int_settings_count = integer_settings.length;
164
+
165
+ if (!$this.length > 0) {
166
+ return;
167
+ }
168
+
169
+ if (!this.settings.init) {
170
+ this.events();
171
+ }
172
+
173
+ this.settings = $this.data(this.attr_name(true) + '-init');
174
+
175
+ // non configureable settings
176
+ this.settings.$content_el = $this;
177
+ this.settings.$body = $(this.settings.tip_container);
178
+ this.settings.body_offset = $(this.settings.tip_container).position();
179
+ this.settings.$tip_content = this.settings.$content_el.find('> li');
180
+ this.settings.paused = false;
181
+ this.settings.attempts = 0;
182
+ this.settings.riding = true;
183
+
184
+ // can we create cookies?
185
+ if (typeof $.cookie !== 'function') {
186
+ this.settings.cookie_monster = false;
187
+ }
188
+
189
+ // generate the tips and insert into dom.
190
+ if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
191
+ this.settings.$tip_content.each(function (index) {
192
+ var $this = $(this);
193
+ this.settings = $.extend({}, self.defaults, self.data_options($this));
194
+
195
+ // Make sure that settings parsed from data_options are integers where necessary
196
+ var i = int_settings_count;
197
+ while (i--) {
198
+ self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
199
+ }
200
+ self.create({$li : $this, index : index});
201
+ });
202
+
203
+ // show first tip
204
+ if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
205
+ this.show('init');
206
+ this.startTimer();
207
+ } else {
208
+ this.show('init');
209
+ }
210
+
211
+ }
212
+ },
213
+
214
+ resume : function () {
215
+ this.set_li();
216
+ this.show();
217
+ },
218
+
219
+ tip_template : function (opts) {
220
+ var $blank, content;
221
+
222
+ opts.tip_class = opts.tip_class || '';
223
+
224
+ $blank = $(this.settings.template.tip).addClass(opts.tip_class);
225
+ content = $.trim($(opts.li).html()) +
226
+ this.prev_button_text(opts.prev_button_text, opts.index) +
227
+ this.button_text(opts.button_text) +
228
+ this.settings.template.link +
229
+ this.timer_instance(opts.index);
230
+
231
+ $blank.append($(this.settings.template.wrapper));
232
+ $blank.first().attr(this.add_namespace('data-index'), opts.index);
233
+ $('.joyride-content-wrapper', $blank).append(content);
234
+
235
+ return $blank[0];
236
+ },
237
+
238
+ timer_instance : function (index) {
239
+ var txt;
240
+
241
+ if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
242
+ txt = '';
243
+ } else {
244
+ txt = $(this.settings.template.timer)[0].outerHTML;
245
+ }
246
+ return txt;
247
+ },
248
+
249
+ button_text : function (txt) {
250
+ if (this.settings.tip_settings.next_button) {
251
+ txt = $.trim(txt) || 'Next';
252
+ txt = $(this.settings.template.button).append(txt)[0].outerHTML;
253
+ } else {
254
+ txt = '';
255
+ }
256
+ return txt;
257
+ },
258
+
259
+ prev_button_text : function (txt, idx) {
260
+ if (this.settings.tip_settings.prev_button) {
261
+ txt = $.trim(txt) || 'Previous';
262
+
263
+ // Add the disabled class to the button if it's the first element
264
+ if (idx == 0) {
265
+ txt = $(this.settings.template.prev_button).append(txt).addClass('disabled')[0].outerHTML;
266
+ } else {
267
+ txt = $(this.settings.template.prev_button).append(txt)[0].outerHTML;
268
+ }
269
+ } else {
270
+ txt = '';
271
+ }
272
+ return txt;
273
+ },
274
+
275
+ create : function (opts) {
276
+ this.settings.tip_settings = $.extend({}, this.settings, this.data_options(opts.$li));
277
+ var buttonText = opts.$li.attr(this.add_namespace('data-button')) || opts.$li.attr(this.add_namespace('data-text')),
278
+ prevButtonText = opts.$li.attr(this.add_namespace('data-button-prev')) || opts.$li.attr(this.add_namespace('data-prev-text')),
279
+ tipClass = opts.$li.attr('class'),
280
+ $tip_content = $(this.tip_template({
281
+ tip_class : tipClass,
282
+ index : opts.index,
283
+ button_text : buttonText,
284
+ prev_button_text : prevButtonText,
285
+ li : opts.$li
286
+ }));
287
+
288
+ $(this.settings.tip_container).append($tip_content);
289
+ },
290
+
291
+ show : function (init, is_prev) {
292
+ var $timer = null;
293
+
294
+ // are we paused?
295
+ if (this.settings.$li === undefined || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
296
+
297
+ // don't go to the next li if the tour was paused
298
+ if (this.settings.paused) {
299
+ this.settings.paused = false;
300
+ } else {
301
+ this.set_li(init, is_prev);
302
+ }
303
+
304
+ this.settings.attempts = 0;
305
+
306
+ if (this.settings.$li.length && this.settings.$target.length > 0) {
307
+ if (init) { //run when we first start
308
+ this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
309
+ if (this.settings.modal) {
310
+ this.show_modal();
311
+ }
312
+ }
313
+
314
+ this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
315
+
316
+ if (this.settings.modal && this.settings.expose) {
317
+ this.expose();
318
+ }
319
+
320
+ this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
321
+
322
+ this.settings.timer = parseInt(this.settings.timer, 10);
323
+
324
+ this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
325
+
326
+ // scroll and hide bg if not modal
327
+ if (!/body/i.test(this.settings.$target.selector)) {
328
+ var joyridemodalbg = $('.joyride-modal-bg');
329
+ if (/pop/i.test(this.settings.tipAnimation)) {
330
+ joyridemodalbg.hide();
331
+ } else {
332
+ joyridemodalbg.fadeOut(this.settings.tipAnimationFadeSpeed);
333
+ }
334
+ this.scroll_to();
335
+ }
336
+
337
+ if (this.is_phone()) {
338
+ this.pos_phone(true);
339
+ } else {
340
+ this.pos_default(true);
341
+ }
342
+
343
+ $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
344
+
345
+ if (/pop/i.test(this.settings.tip_animation)) {
346
+
347
+ $timer.width(0);
348
+
349
+ if (this.settings.timer > 0) {
350
+
351
+ this.settings.$next_tip.show();
352
+
353
+ setTimeout(function () {
354
+ $timer.animate({
355
+ width : $timer.parent().width()
356
+ }, this.settings.timer, 'linear');
357
+ }.bind(this), this.settings.tip_animation_fade_speed);
358
+
359
+ } else {
360
+ this.settings.$next_tip.show();
361
+
362
+ }
363
+
364
+ } else if (/fade/i.test(this.settings.tip_animation)) {
365
+
366
+ $timer.width(0);
367
+
368
+ if (this.settings.timer > 0) {
369
+
370
+ this.settings.$next_tip
371
+ .fadeIn(this.settings.tip_animation_fade_speed)
372
+ .show();
373
+
374
+ setTimeout(function () {
375
+ $timer.animate({
376
+ width : $timer.parent().width()
377
+ }, this.settings.timer, 'linear');
378
+ }.bind(this), this.settings.tip_animation_fade_speed);
379
+
380
+ } else {
381
+ this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
382
+ }
383
+ }
384
+
385
+ this.settings.$current_tip = this.settings.$next_tip;
386
+
387
+ // skip non-existant targets
388
+ } else if (this.settings.$li && this.settings.$target.length < 1) {
389
+
390
+ this.show(init, is_prev);
391
+
392
+ } else {
393
+
394
+ this.end();
395
+
396
+ }
397
+ } else {
398
+
399
+ this.settings.paused = true;
400
+
401
+ }
402
+
403
+ },
404
+
405
+ is_phone : function () {
406
+ return matchMedia(Tennpipes.media_queries.small).matches &&
407
+ !matchMedia(Tennpipes.media_queries.medium).matches;
408
+ },
409
+
410
+ hide : function () {
411
+ if (this.settings.modal && this.settings.expose) {
412
+ this.un_expose();
413
+ }
414
+
415
+ if (!this.settings.modal) {
416
+ $('.joyride-modal-bg').hide();
417
+ }
418
+
419
+ // Prevent scroll bouncing...wait to remove from layout
420
+ this.settings.$current_tip.css('visibility', 'hidden');
421
+ setTimeout($.proxy(function () {
422
+ this.hide();
423
+ this.css('visibility', 'visible');
424
+ }, this.settings.$current_tip), 0);
425
+ this.settings.post_step_callback(this.settings.$li.index(),
426
+ this.settings.$current_tip);
427
+ },
428
+
429
+ set_li : function (init, is_prev) {
430
+ if (init) {
431
+ this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
432
+ this.set_next_tip();
433
+ this.settings.$current_tip = this.settings.$next_tip;
434
+ } else {
435
+ if (is_prev) {
436
+ this.settings.$li = this.settings.$li.prev();
437
+ } else {
438
+ this.settings.$li = this.settings.$li.next();
439
+ }
440
+ this.set_next_tip();
441
+ }
442
+
443
+ this.set_target();
444
+ },
445
+
446
+ set_next_tip : function () {
447
+ this.settings.$next_tip = $('.joyride-tip-guide').eq(this.settings.$li.index());
448
+ this.settings.$next_tip.data('closed', '');
449
+ },
450
+
451
+ set_target : function () {
452
+ var cl = this.settings.$li.attr(this.add_namespace('data-class')),
453
+ id = this.settings.$li.attr(this.add_namespace('data-id')),
454
+ $sel = function () {
455
+ if (id) {
456
+ return $(document.getElementById(id));
457
+ } else if (cl) {
458
+ return $('.' + cl).first();
459
+ } else {
460
+ return $('body');
461
+ }
462
+ };
463
+
464
+ this.settings.$target = $sel();
465
+ },
466
+
467
+ scroll_to : function () {
468
+ var window_half, tipOffset;
469
+
470
+ window_half = $(window).height() / 2;
471
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
472
+
473
+ if (tipOffset != 0) {
474
+ $('html, body').stop().animate({
475
+ scrollTop : tipOffset
476
+ }, this.settings.scroll_speed, 'swing');
477
+ }
478
+ },
479
+
480
+ paused : function () {
481
+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
482
+ },
483
+
484
+ restart : function () {
485
+ this.hide();
486
+ this.settings.$li = undefined;
487
+ this.show('init');
488
+ },
489
+
490
+ pos_default : function (init) {
491
+ var $nub = this.settings.$next_tip.find('.joyride-nub'),
492
+ nub_width = Math.ceil($nub.outerWidth() / 2),
493
+ nub_height = Math.ceil($nub.outerHeight() / 2),
494
+ toggle = init || false;
495
+
496
+ // tip must not be "display: none" to calculate position
497
+ if (toggle) {
498
+ this.settings.$next_tip.css('visibility', 'hidden');
499
+ this.settings.$next_tip.show();
500
+ }
501
+
502
+ if (!/body/i.test(this.settings.$target.selector)) {
503
+ var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0,
504
+ leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0;
505
+
506
+ if (this.bottom()) {
507
+ if (this.rtl) {
508
+ this.settings.$next_tip.css({
509
+ top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
510
+ left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment});
511
+ } else {
512
+ this.settings.$next_tip.css({
513
+ top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
514
+ left : this.settings.$target.offset().left + leftAdjustment});
515
+ }
516
+
517
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
518
+
519
+ } else if (this.top()) {
520
+ if (this.rtl) {
521
+ this.settings.$next_tip.css({
522
+ top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
523
+ left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
524
+ } else {
525
+ this.settings.$next_tip.css({
526
+ top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
527
+ left : this.settings.$target.offset().left + leftAdjustment});
528
+ }
529
+
530
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
531
+
532
+ } else if (this.right()) {
533
+
534
+ this.settings.$next_tip.css({
535
+ top : this.settings.$target.offset().top + topAdjustment,
536
+ left : (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)});
537
+
538
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
539
+
540
+ } else if (this.left()) {
541
+
542
+ this.settings.$next_tip.css({
543
+ top : this.settings.$target.offset().top + topAdjustment,
544
+ left : (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)});
545
+
546
+ this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
547
+
548
+ }
549
+
550
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
551
+
552
+ $nub.removeClass('bottom')
553
+ .removeClass('top')
554
+ .removeClass('right')
555
+ .removeClass('left');
556
+
557
+ this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
558
+
559
+ this.settings.attempts++;
560
+
561
+ this.pos_default();
562
+
563
+ }
564
+
565
+ } else if (this.settings.$li.length) {
566
+
567
+ this.pos_modal($nub);
568
+
569
+ }
570
+
571
+ if (toggle) {
572
+ this.settings.$next_tip.hide();
573
+ this.settings.$next_tip.css('visibility', 'visible');
574
+ }
575
+
576
+ },
577
+
578
+ pos_phone : function (init) {
579
+ var tip_height = this.settings.$next_tip.outerHeight(),
580
+ tip_offset = this.settings.$next_tip.offset(),
581
+ target_height = this.settings.$target.outerHeight(),
582
+ $nub = $('.joyride-nub', this.settings.$next_tip),
583
+ nub_height = Math.ceil($nub.outerHeight() / 2),
584
+ toggle = init || false;
585
+
586
+ $nub.removeClass('bottom')
587
+ .removeClass('top')
588
+ .removeClass('right')
589
+ .removeClass('left');
590
+
591
+ if (toggle) {
592
+ this.settings.$next_tip.css('visibility', 'hidden');
593
+ this.settings.$next_tip.show();
594
+ }
595
+
596
+ if (!/body/i.test(this.settings.$target.selector)) {
597
+
598
+ if (this.top()) {
599
+
600
+ this.settings.$next_tip.offset({top : this.settings.$target.offset().top - tip_height - nub_height});
601
+ $nub.addClass('bottom');
602
+
603
+ } else {
604
+
605
+ this.settings.$next_tip.offset({top : this.settings.$target.offset().top + target_height + nub_height});
606
+ $nub.addClass('top');
607
+
608
+ }
609
+
610
+ } else if (this.settings.$li.length) {
611
+ this.pos_modal($nub);
612
+ }
613
+
614
+ if (toggle) {
615
+ this.settings.$next_tip.hide();
616
+ this.settings.$next_tip.css('visibility', 'visible');
617
+ }
618
+ },
619
+
620
+ pos_modal : function ($nub) {
621
+ this.center();
622
+ $nub.hide();
623
+
624
+ this.show_modal();
625
+ },
626
+
627
+ show_modal : function () {
628
+ if (!this.settings.$next_tip.data('closed')) {
629
+ var joyridemodalbg = $('.joyride-modal-bg');
630
+ if (joyridemodalbg.length < 1) {
631
+ var joyridemodalbg = $(this.settings.template.modal);
632
+ joyridemodalbg.appendTo('body');
633
+ }
634
+
635
+ if (/pop/i.test(this.settings.tip_animation)) {
636
+ joyridemodalbg.show();
637
+ } else {
638
+ joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
639
+ }
640
+ }
641
+ },
642
+
643
+ expose : function () {
644
+ var expose,
645
+ exposeCover,
646
+ el,
647
+ origCSS,
648
+ origClasses,
649
+ randId = 'expose-' + this.random_str(6);
650
+
651
+ if (arguments.length > 0 && arguments[0] instanceof $) {
652
+ el = arguments[0];
653
+ } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
654
+ el = this.settings.$target;
655
+ } else {
656
+ return false;
657
+ }
658
+
659
+ if (el.length < 1) {
660
+ if (window.console) {
661
+ console.error('element not valid', el);
662
+ }
663
+ return false;
664
+ }
665
+
666
+ expose = $(this.settings.template.expose);
667
+ this.settings.$body.append(expose);
668
+ expose.css({
669
+ top : el.offset().top,
670
+ left : el.offset().left,
671
+ width : el.outerWidth(true),
672
+ height : el.outerHeight(true)
673
+ });
674
+
675
+ exposeCover = $(this.settings.template.expose_cover);
676
+
677
+ origCSS = {
678
+ zIndex : el.css('z-index'),
679
+ position : el.css('position')
680
+ };
681
+
682
+ origClasses = el.attr('class') == null ? '' : el.attr('class');
683
+
684
+ el.css('z-index', parseInt(expose.css('z-index')) + 1);
685
+
686
+ if (origCSS.position == 'static') {
687
+ el.css('position', 'relative');
688
+ }
689
+
690
+ el.data('expose-css', origCSS);
691
+ el.data('orig-class', origClasses);
692
+ el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
693
+
694
+ exposeCover.css({
695
+ top : el.offset().top,
696
+ left : el.offset().left,
697
+ width : el.outerWidth(true),
698
+ height : el.outerHeight(true)
699
+ });
700
+
701
+ if (this.settings.modal) {
702
+ this.show_modal();
703
+ }
704
+
705
+ this.settings.$body.append(exposeCover);
706
+ expose.addClass(randId);
707
+ exposeCover.addClass(randId);
708
+ el.data('expose', randId);
709
+ this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
710
+ this.add_exposed(el);
711
+ },
712
+
713
+ un_expose : function () {
714
+ var exposeId,
715
+ el,
716
+ expose,
717
+ origCSS,
718
+ origClasses,
719
+ clearAll = false;
720
+
721
+ if (arguments.length > 0 && arguments[0] instanceof $) {
722
+ el = arguments[0];
723
+ } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
724
+ el = this.settings.$target;
725
+ } else {
726
+ return false;
727
+ }
728
+
729
+ if (el.length < 1) {
730
+ if (window.console) {
731
+ console.error('element not valid', el);
732
+ }
733
+ return false;
734
+ }
735
+
736
+ exposeId = el.data('expose');
737
+ expose = $('.' + exposeId);
738
+
739
+ if (arguments.length > 1) {
740
+ clearAll = arguments[1];
741
+ }
742
+
743
+ if (clearAll === true) {
744
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
745
+ } else {
746
+ expose.remove();
747
+ }
748
+
749
+ origCSS = el.data('expose-css');
750
+
751
+ if (origCSS.zIndex == 'auto') {
752
+ el.css('z-index', '');
753
+ } else {
754
+ el.css('z-index', origCSS.zIndex);
755
+ }
756
+
757
+ if (origCSS.position != el.css('position')) {
758
+ if (origCSS.position == 'static') {// this is default, no need to set it.
759
+ el.css('position', '');
760
+ } else {
761
+ el.css('position', origCSS.position);
762
+ }
763
+ }
764
+
765
+ origClasses = el.data('orig-class');
766
+ el.attr('class', origClasses);
767
+ el.removeData('orig-classes');
768
+
769
+ el.removeData('expose');
770
+ el.removeData('expose-z-index');
771
+ this.remove_exposed(el);
772
+ },
773
+
774
+ add_exposed : function (el) {
775
+ this.settings.exposed = this.settings.exposed || [];
776
+ if (el instanceof $ || typeof el === 'object') {
777
+ this.settings.exposed.push(el[0]);
778
+ } else if (typeof el == 'string') {
779
+ this.settings.exposed.push(el);
780
+ }
781
+ },
782
+
783
+ remove_exposed : function (el) {
784
+ var search, i;
785
+ if (el instanceof $) {
786
+ search = el[0]
787
+ } else if (typeof el == 'string') {
788
+ search = el;
789
+ }
790
+
791
+ this.settings.exposed = this.settings.exposed || [];
792
+ i = this.settings.exposed.length;
793
+
794
+ while (i--) {
795
+ if (this.settings.exposed[i] == search) {
796
+ this.settings.exposed.splice(i, 1);
797
+ return;
798
+ }
799
+ }
800
+ },
801
+
802
+ center : function () {
803
+ var $w = $(window);
804
+
805
+ this.settings.$next_tip.css({
806
+ top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
807
+ left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
808
+ });
809
+
810
+ return true;
811
+ },
812
+
813
+ bottom : function () {
814
+ return /bottom/i.test(this.settings.tip_settings.tip_location);
815
+ },
816
+
817
+ top : function () {
818
+ return /top/i.test(this.settings.tip_settings.tip_location);
819
+ },
820
+
821
+ right : function () {
822
+ return /right/i.test(this.settings.tip_settings.tip_location);
823
+ },
824
+
825
+ left : function () {
826
+ return /left/i.test(this.settings.tip_settings.tip_location);
827
+ },
828
+
829
+ corners : function (el) {
830
+ var w = $(window),
831
+ window_half = w.height() / 2,
832
+ //using this to calculate since scroll may not have finished yet.
833
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
834
+ right = w.width() + w.scrollLeft(),
835
+ offsetBottom = w.height() + tipOffset,
836
+ bottom = w.height() + w.scrollTop(),
837
+ top = w.scrollTop();
838
+
839
+ if (tipOffset < top) {
840
+ if (tipOffset < 0) {
841
+ top = 0;
842
+ } else {
843
+ top = tipOffset;
844
+ }
845
+ }
846
+
847
+ if (offsetBottom > bottom) {
848
+ bottom = offsetBottom;
849
+ }
850
+
851
+ return [
852
+ el.offset().top < top,
853
+ right < el.offset().left + el.outerWidth(),
854
+ bottom < el.offset().top + el.outerHeight(),
855
+ w.scrollLeft() > el.offset().left
856
+ ];
857
+ },
858
+
859
+ visible : function (hidden_corners) {
860
+ var i = hidden_corners.length;
861
+
862
+ while (i--) {
863
+ if (hidden_corners[i]) {
864
+ return false;
865
+ }
866
+ }
867
+
868
+ return true;
869
+ },
870
+
871
+ nub_position : function (nub, pos, def) {
872
+ if (pos === 'auto') {
873
+ nub.addClass(def);
874
+ } else {
875
+ nub.addClass(pos);
876
+ }
877
+ },
878
+
879
+ startTimer : function () {
880
+ if (this.settings.$li.length) {
881
+ this.settings.automate = setTimeout(function () {
882
+ this.hide();
883
+ this.show();
884
+ this.startTimer();
885
+ }.bind(this), this.settings.timer);
886
+ } else {
887
+ clearTimeout(this.settings.automate);
888
+ }
889
+ },
890
+
891
+ end : function (abort) {
892
+ if (this.settings.cookie_monster) {
893
+ $.cookie(this.settings.cookie_name, 'ridden', {expires : this.settings.cookie_expires, domain : this.settings.cookie_domain});
894
+ }
895
+
896
+ if (this.settings.timer > 0) {
897
+ clearTimeout(this.settings.automate);
898
+ }
899
+
900
+ if (this.settings.modal && this.settings.expose) {
901
+ this.un_expose();
902
+ }
903
+
904
+ // Unplug keystrokes listener
905
+ $(this.scope).off('keyup.joyride')
906
+
907
+ this.settings.$next_tip.data('closed', true);
908
+ this.settings.riding = false;
909
+
910
+ $('.joyride-modal-bg').hide();
911
+ this.settings.$current_tip.hide();
912
+
913
+ if (typeof abort === 'undefined' || abort === false) {
914
+ this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
915
+ this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
916
+ }
917
+
918
+ $('.joyride-tip-guide').remove();
919
+ },
920
+
921
+ off : function () {
922
+ $(this.scope).off('.joyride');
923
+ $(window).off('.joyride');
924
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
925
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
926
+ clearTimeout(this.settings.automate);
927
+ this.settings = {};
928
+ },
929
+
930
+ reflow : function () {}
931
+ };
932
+ }(jQuery, window, window.document));