rbbt-rest 1.1.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +8 -8
  2. data/lib/rbbt/rest/common/cache.rb +33 -14
  3. data/lib/rbbt/rest/common/locate.rb +8 -6
  4. data/lib/rbbt/rest/common/misc.rb +4 -0
  5. data/lib/rbbt/rest/common/render.rb +14 -4
  6. data/lib/rbbt/rest/common/resources.rb +1 -1
  7. data/lib/rbbt/rest/common/table.rb +37 -7
  8. data/lib/rbbt/rest/entity.rb +5 -3
  9. data/lib/rbbt/rest/entity/favourites.rb +4 -1
  10. data/lib/rbbt/rest/entity/helpers.rb +12 -0
  11. data/lib/rbbt/rest/entity/rest.rb +6 -2
  12. data/lib/rbbt/rest/helpers.rb +7 -0
  13. data/lib/rbbt/rest/knowledge_base.rb +338 -0
  14. data/lib/rbbt/rest/knowledge_base/helpers.rb +57 -0
  15. data/lib/rbbt/rest/main.rb +16 -3
  16. data/share/views/compass/_rbbt.sass +11 -0
  17. data/share/views/compass/actions.sass +48 -24
  18. data/share/views/compass/app.sass +72 -50
  19. data/share/views/compass/colors.sass +3 -229
  20. data/share/views/compass/entity_card.sass +44 -108
  21. data/share/views/compass/favourites.sass +17 -72
  22. data/share/views/compass/finder.sass +30 -0
  23. data/share/views/compass/foundation.sass +79 -0
  24. data/share/views/compass/functions.sass +27 -0
  25. data/share/views/compass/help.sass +3 -0
  26. data/share/views/compass/layout.sass +132 -0
  27. data/share/views/compass/rbbt/form.sass +84 -0
  28. data/share/views/compass/rbbt/fragment.sass +7 -0
  29. data/share/views/compass/rbbt/menu.sass +189 -0
  30. data/share/views/compass/rbbt/reveal.sass +46 -0
  31. data/share/views/compass/rbbt/table.sass +169 -0
  32. data/share/views/compass/skeleton.sass +2 -0
  33. data/share/views/compass/skeleton/_dependencies.sass +151 -0
  34. data/share/views/compass/skeleton/_functions.sass +4 -0
  35. data/share/views/compass/skeleton/_mixins.sass +25 -0
  36. data/share/views/compass/skeleton/_vars.sass +72 -0
  37. data/share/views/compass/skeleton/base.sass +333 -0
  38. data/share/views/compass/skeleton/layout.sass +51 -0
  39. data/share/views/compass/skeleton/skeleton.sass +105 -0
  40. data/share/views/compass/solarized.sass +56 -0
  41. data/share/views/compass/style.sass +2 -116
  42. data/share/views/compass/theme.sass +57 -44
  43. data/share/views/compass/top_menu.sass +121 -0
  44. data/share/views/compass/user.sass +7 -0
  45. data/share/views/compass/variables.sass +7 -0
  46. data/share/views/compass/workflow.sass +6 -14
  47. data/share/views/entity_partials/action_controller.haml +7 -4
  48. data/share/views/entity_partials/entity_card.haml +10 -5
  49. data/share/views/entity_partials/entity_list.haml +4 -7
  50. data/share/views/entity_partials/entity_list_card.haml +10 -3
  51. data/share/views/entity_partials/entity_map_card.haml +2 -2
  52. data/share/views/entity_partials/list_container.haml +31 -26
  53. data/share/views/error.haml +5 -7
  54. data/share/views/help.haml +75 -31
  55. data/share/views/help/entity.haml +191 -193
  56. data/share/views/help/workflow.haml +59 -63
  57. data/share/views/job_result.haml +23 -26
  58. data/share/views/layout.haml +41 -61
  59. data/share/views/layout/top_menu.haml +19 -0
  60. data/share/views/layout/top_menu/favourites.haml +45 -0
  61. data/share/views/layout/top_menu/finder.haml +4 -0
  62. data/share/views/layout/top_menu/user.haml +15 -0
  63. data/share/views/public/js/_ajax_replace.js +17 -5
  64. data/share/views/public/js/_ellipsis.js +7 -9
  65. data/share/views/public/js/app.js +50 -2
  66. data/share/views/public/js/foundation/foundation.abide.js +194 -0
  67. data/share/views/public/js/foundation/foundation.alerts.js +52 -0
  68. data/share/views/public/js/foundation/foundation.clearing.js +516 -0
  69. data/share/views/public/js/foundation/foundation.cookie.js +74 -0
  70. data/share/views/public/js/foundation/foundation.dropdown.js +177 -0
  71. data/share/views/public/js/foundation/foundation.forms.js +533 -0
  72. data/share/views/public/js/foundation/foundation.interchange.js +280 -0
  73. data/share/views/public/js/foundation/foundation.joyride.js +850 -0
  74. data/share/views/public/js/foundation/foundation.js +440 -0
  75. data/share/views/public/js/foundation/foundation.magellan.js +135 -0
  76. data/share/views/public/js/foundation/foundation.orbit.js +412 -0
  77. data/share/views/public/js/foundation/foundation.placeholder.js +179 -0
  78. data/share/views/public/js/foundation/foundation.reveal.js +330 -0
  79. data/share/views/public/js/foundation/foundation.section.js +400 -0
  80. data/share/views/public/js/foundation/foundation.tooltips.js +208 -0
  81. data/share/views/public/js/foundation/foundation.topbar.js +300 -0
  82. data/share/views/public/js/foundation/index.js +18 -0
  83. data/share/views/public/js/helpers.js +33 -2
  84. data/share/views/public/js/jquery-ui.js +313 -0
  85. data/share/views/public/js/rbbt/actions.js +264 -0
  86. data/share/views/public/js/{_dom_update.js → rbbt/dom_update.js} +0 -0
  87. data/share/views/public/js/rbbt/favourites.js +425 -0
  88. data/share/views/public/js/rbbt/fragment.js +13 -0
  89. data/share/views/public/js/rbbt/hide.js +60 -0
  90. data/share/views/public/js/rbbt/list.js +117 -0
  91. data/share/views/public/js/{maps.js → rbbt/map.js} +3 -2
  92. data/share/views/public/js/rbbt/menu.js +22 -0
  93. data/share/views/public/js/rbbt/modal.js +96 -0
  94. data/share/views/public/js/{entities.js → rbbt/page_type.js} +12 -9
  95. data/share/views/public/js/rbbt/reveal.js +19 -0
  96. data/share/views/public/js/rbbt/table.js +283 -0
  97. data/share/views/public/js/{workflow.js → rbbt/workflow.js} +0 -0
  98. data/share/views/tasks.haml +14 -15
  99. data/share/views/wait.haml +11 -12
  100. metadata +62 -33
  101. data/share/views/compass/_foundation_setup.sass +0 -74
  102. data/share/views/compass/dom.sass +0 -32
  103. data/share/views/compass/footer.sass +0 -4
  104. data/share/views/compass/form.sass +0 -41
  105. data/share/views/compass/fragment.sass +0 -8
  106. data/share/views/compass/list_container.sass +0 -34
  107. data/share/views/compass/lists.sass +0 -33
  108. data/share/views/compass/offcanvas.sass +0 -66
  109. data/share/views/compass/responsive_table.sass +0 -80
  110. data/share/views/compass/reveal.sass +0 -31
  111. data/share/views/compass/style_mixins.sass +0 -42
  112. data/share/views/compass/table.sass +0 -63
  113. data/share/views/compass/tabs.sass +0 -81
  114. data/share/views/compass/topbar.sass +0 -25
  115. data/share/views/compass/web-fonts.sass +0 -77
  116. data/share/views/layout/favourites.haml +0 -46
  117. data/share/views/layout/header.haml +0 -44
  118. data/share/views/public/js/_fix_tablesorter_science.js +0 -38
  119. data/share/views/public/js/_foundation.js +0 -42
  120. data/share/views/public/js/actions.js +0 -108
  121. data/share/views/public/js/base.js +0 -121
  122. data/share/views/public/js/favourites.js +0 -441
  123. data/share/views/public/js/lists.js +0 -117
  124. data/share/views/public/js/offcanvas.js +0 -35
  125. data/share/views/public/js/reveal.js +0 -48
  126. data/share/views/public/js/tables.js +0 -314
  127. data/share/views/public/js/tabs.js +0 -7
@@ -0,0 +1,280 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.interchange = {
7
+ name : 'interchange',
8
+
9
+ version : '4.2.4',
10
+
11
+ cache : {},
12
+
13
+ images_loaded : false,
14
+
15
+ settings : {
16
+ load_attr : 'interchange',
17
+
18
+ named_queries : {
19
+ 'default' : 'only screen and (min-width: 1px)',
20
+ small : 'only screen and (min-width: 768px)',
21
+ medium : 'only screen and (min-width: 1280px)',
22
+ large : 'only screen and (min-width: 1440px)',
23
+ landscape : 'only screen and (orientation: landscape)',
24
+ portrait : 'only screen and (orientation: portrait)',
25
+ retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
26
+ 'only screen and (min--moz-device-pixel-ratio: 2),' +
27
+ 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
28
+ 'only screen and (min-device-pixel-ratio: 2),' +
29
+ 'only screen and (min-resolution: 192dpi),' +
30
+ 'only screen and (min-resolution: 2dppx)'
31
+ },
32
+
33
+ directives : {
34
+ replace: function (el, path) {
35
+ if (/IMG/.test(el[0].nodeName)) {
36
+ var orig_path = el[0].src;
37
+
38
+ if (new RegExp(path, 'i').test(orig_path)) return;
39
+
40
+ el[0].src = path;
41
+
42
+ return el.trigger('replace', [el[0].src, orig_path]);
43
+ }
44
+ }
45
+ }
46
+ },
47
+
48
+ init : function (scope, method, options) {
49
+ Foundation.inherit(this, 'throttle');
50
+
51
+ if (typeof method === 'object') {
52
+ $.extend(true, this.settings, method);
53
+ }
54
+
55
+ this.events();
56
+ this.images();
57
+
58
+ if (typeof method !== 'string') {
59
+ return this.settings.init;
60
+ } else {
61
+ return this[method].call(this, options);
62
+ }
63
+ },
64
+
65
+ events : function () {
66
+ var self = this;
67
+
68
+ $(window).on('resize.fndtn.interchange', self.throttle(function () {
69
+ self.resize.call(self);
70
+ }, 50));
71
+ },
72
+
73
+ resize : function () {
74
+ var cache = this.cache;
75
+
76
+ if(!this.images_loaded) {
77
+ setTimeout($.proxy(this.resize, this), 50);
78
+ return;
79
+ }
80
+
81
+ for (var uuid in cache) {
82
+ if (cache.hasOwnProperty(uuid)) {
83
+ var passed = this.results(uuid, cache[uuid]);
84
+
85
+ if (passed) {
86
+ this.settings.directives[passed
87
+ .scenario[1]](passed.el, passed.scenario[0]);
88
+ }
89
+ }
90
+ }
91
+
92
+ },
93
+
94
+ results : function (uuid, scenarios) {
95
+ var count = scenarios.length;
96
+
97
+ if (count > 0) {
98
+ var el = $('[data-uuid="' + uuid + '"]');
99
+
100
+ for (var i = count - 1; i >= 0; i--) {
101
+ var mq, rule = scenarios[i][2];
102
+ if (this.settings.named_queries.hasOwnProperty(rule)) {
103
+ mq = matchMedia(this.settings.named_queries[rule]);
104
+ } else {
105
+ mq = matchMedia(rule);
106
+ }
107
+ if (mq.matches) {
108
+ return {el: el, scenario: scenarios[i]};
109
+ }
110
+ }
111
+ }
112
+
113
+ return false;
114
+ },
115
+
116
+ images : function (force_update) {
117
+ if (typeof this.cached_images === 'undefined' || force_update) {
118
+ return this.update_images();
119
+ }
120
+
121
+ return this.cached_images;
122
+ },
123
+
124
+ update_images : function () {
125
+ var images = document.getElementsByTagName('img'),
126
+ count = images.length,
127
+ loaded_count = 0,
128
+ data_attr = 'data-' + this.settings.load_attr;
129
+
130
+ this.cached_images = [];
131
+ this.images_loaded = false;
132
+
133
+ for (var i = count - 1; i >= 0; i--) {
134
+ this.loaded($(images[i]), function (image) {
135
+ loaded_count++;
136
+ if (image) {
137
+ var str = image.getAttribute(data_attr) || '';
138
+
139
+ if (str.length > 0) {
140
+ this.cached_images.push(image);
141
+ }
142
+ }
143
+
144
+ if(loaded_count === count) {
145
+ this.images_loaded = true;
146
+ this.enhance();
147
+ }
148
+ }.bind(this));
149
+ }
150
+
151
+ return 'deferred';
152
+ },
153
+
154
+ // based on jquery.imageready.js
155
+ // @weblinc, @jsantell, (c) 2012
156
+
157
+ loaded : function (image, callback) {
158
+ function loaded () {
159
+ callback(image[0]);
160
+ }
161
+
162
+ function bindLoad () {
163
+ this.one('load', loaded);
164
+
165
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
166
+ var src = this.attr( 'src' ),
167
+ param = src.match( /\?/ ) ? '&' : '?';
168
+
169
+ param += 'random=' + (new Date()).getTime();
170
+ this.attr('src', src + param);
171
+ }
172
+ }
173
+
174
+ if (!image.attr('src')) {
175
+ loaded();
176
+ return;
177
+ }
178
+
179
+ if (image[0].complete || image[0].readyState === 4) {
180
+ loaded();
181
+ } else {
182
+ bindLoad.call(image);
183
+ }
184
+ },
185
+
186
+ enhance : function () {
187
+ var count = this.images().length;
188
+
189
+ for (var i = count - 1; i >= 0; i--) {
190
+ this._object($(this.images()[i]));
191
+ }
192
+
193
+ return $(window).trigger('resize');
194
+ },
195
+
196
+ parse_params : function (path, directive, mq) {
197
+ return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
198
+ },
199
+
200
+ convert_directive : function (directive) {
201
+ var trimmed = this.trim(directive);
202
+
203
+ if (trimmed.length > 0) {
204
+ return trimmed;
205
+ }
206
+
207
+ return 'replace';
208
+ },
209
+
210
+ _object : function(el) {
211
+ var raw_arr = this.parse_data_attr(el),
212
+ scenarios = [], count = raw_arr.length;
213
+
214
+ if (count > 0) {
215
+ for (var i = count - 1; i >= 0; i--) {
216
+ var split = raw_arr[i].split(/\((.*?)(\))$/);
217
+
218
+ if (split.length > 1) {
219
+ var cached_split = split[0].split(','),
220
+ params = this.parse_params(cached_split[0],
221
+ cached_split[1], split[1]);
222
+
223
+ scenarios.push(params);
224
+ }
225
+ }
226
+ }
227
+
228
+ return this.store(el, scenarios);
229
+ },
230
+
231
+ uuid : function (separator) {
232
+ var delim = separator || "-";
233
+
234
+ function S4() {
235
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
236
+ }
237
+
238
+ return (S4() + S4() + delim + S4() + delim + S4()
239
+ + delim + S4() + delim + S4() + S4() + S4());
240
+ },
241
+
242
+ store : function (el, scenarios) {
243
+ var uuid = this.uuid(),
244
+ current_uuid = el.data('uuid');
245
+
246
+ if (current_uuid) return this.cache[current_uuid];
247
+
248
+ el.attr('data-uuid', uuid);
249
+
250
+ return this.cache[uuid] = scenarios;
251
+ },
252
+
253
+ trim : function(str) {
254
+ if (typeof str === 'string') {
255
+ return $.trim(str);
256
+ }
257
+
258
+ return str;
259
+ },
260
+
261
+ parse_data_attr : function (el) {
262
+ var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
263
+ count = raw.length, output = [];
264
+
265
+ for (var i = count - 1; i >= 0; i--) {
266
+ if (raw[i].replace(/[\W\d]+/, '').length > 4) {
267
+ output.push(raw[i]);
268
+ }
269
+ }
270
+
271
+ return output;
272
+ },
273
+
274
+ reflow : function () {
275
+ this.images(true);
276
+ }
277
+
278
+ };
279
+
280
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,850 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ (function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.joyride = {
7
+ name : 'joyride',
8
+
9
+ version : '4.2.2',
10
+
11
+ defaults : {
12
+ expose : false, // turn on or off the expose feature
13
+ modal : false, // Whether to cover page with modal during the tour
14
+ tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent
15
+ nubPosition : 'auto', // override on a per tooltip bases
16
+ scrollSpeed : 300, // Page scrolling speed in milliseconds, 0 = no scroll animation
17
+ timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
18
+ startTimerOnClick : true, // true or false - true requires clicking the first button start the timer
19
+ startOffset : 0, // the index of the tooltip you want to start on (index of the li)
20
+ nextButton : true, // true or false to control whether a next button is used
21
+ tipAnimation : 'fade', // 'pop' or 'fade' in each tip
22
+ pauseAfter : [], // array of indexes where to pause the tour after
23
+ exposed : [], // array of expose elements
24
+ tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
25
+ cookieMonster : false, // true or false to control whether cookies are used
26
+ cookieName : 'joyride', // Name the cookie you'll use
27
+ cookieDomain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
28
+ cookieExpires : 365, // set when you would like the cookie to expire.
29
+ tipContainer : 'body', // Where will the tip be attached
30
+ postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete)
31
+ postStepCallback : function (){}, // A method to call after each step
32
+ preStepCallback : function (){}, // A method to call before each step
33
+ preRideCallback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
34
+ postExposeCallback : function (){}, // A method to call after an element has been exposed
35
+ template : { // HTML segments for tip layout
36
+ link : '<a href="#close" class="joyride-close-tip">&times;</a>',
37
+ timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
38
+ tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
39
+ wrapper : '<div class="joyride-content-wrapper"></div>',
40
+ button : '<a href="#" class="small button joyride-next-tip"></a>',
41
+ modal : '<div class="joyride-modal-bg"></div>',
42
+ expose : '<div class="joyride-expose-wrapper"></div>',
43
+ exposeCover: '<div class="joyride-expose-cover"></div>'
44
+ },
45
+ exposeAddClass : '' // One or more space-separated class names to be added to exposed element
46
+ },
47
+
48
+ settings : {},
49
+
50
+ init : function (scope, method, options) {
51
+ this.scope = scope || this.scope;
52
+ Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay');
53
+
54
+ if (typeof method === 'object') {
55
+ $.extend(true, this.settings, this.defaults, method);
56
+ } else {
57
+ $.extend(true, this.settings, this.defaults, options);
58
+ }
59
+
60
+ if (typeof method !== 'string') {
61
+ if (!this.settings.init) this.events();
62
+
63
+ return this.settings.init;
64
+ } else {
65
+ return this[method].call(this, options);
66
+ }
67
+ },
68
+
69
+ events : function () {
70
+ var self = this;
71
+
72
+ $(this.scope)
73
+ .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
74
+ e.preventDefault();
75
+
76
+ if (this.settings.$li.next().length < 1) {
77
+ this.end();
78
+ } else if (this.settings.timer > 0) {
79
+ clearTimeout(this.settings.automate);
80
+ this.hide();
81
+ this.show();
82
+ this.startTimer();
83
+ } else {
84
+ this.hide();
85
+ this.show();
86
+ }
87
+
88
+ }.bind(this))
89
+
90
+ .on('click.joyride', '.joyride-close-tip', function (e) {
91
+ e.preventDefault();
92
+ this.end();
93
+ }.bind(this));
94
+
95
+ $(window).on('resize.fndtn.joyride', self.throttle(function () {
96
+ if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
97
+ if (self.settings.exposed.length > 0) {
98
+ var $els = $(self.settings.exposed);
99
+
100
+ $els.each(function () {
101
+ var $this = $(this);
102
+ self.un_expose($this);
103
+ self.expose($this);
104
+ });
105
+ }
106
+
107
+ if (self.is_phone()) {
108
+ self.pos_phone();
109
+ } else {
110
+ self.pos_default(false, true);
111
+ }
112
+ }
113
+ }, 100));
114
+
115
+ this.settings.init = true;
116
+ },
117
+
118
+ start : function () {
119
+ var self = this,
120
+ $this = $(this.scope).find('[data-joyride]'),
121
+ integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
122
+ int_settings_count = integer_settings.length;
123
+
124
+ if (!this.settings.init) this.init();
125
+
126
+ // non configureable settings
127
+ this.settings.$content_el = $this;
128
+ this.settings.$body = $(this.settings.tipContainer);
129
+ this.settings.body_offset = $(this.settings.tipContainer).position();
130
+ this.settings.$tip_content = this.settings.$content_el.find('> li');
131
+ this.settings.paused = false;
132
+ this.settings.attempts = 0;
133
+
134
+ this.settings.tipLocationPatterns = {
135
+ top: ['bottom'],
136
+ bottom: [], // bottom should not need to be repositioned
137
+ left: ['right', 'top', 'bottom'],
138
+ right: ['left', 'top', 'bottom']
139
+ };
140
+
141
+ // can we create cookies?
142
+ if (typeof $.cookie !== 'function') {
143
+ this.settings.cookieMonster = false;
144
+ }
145
+
146
+ // generate the tips and insert into dom.
147
+ if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) {
148
+ this.settings.$tip_content.each(function (index) {
149
+ var $this = $(this);
150
+ $.extend(true, self.settings, self.data_options($this));
151
+ // Make sure that settings parsed from data_options are integers where necessary
152
+ for (var i = int_settings_count - 1; i >= 0; i--) {
153
+ self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
154
+ }
155
+ self.create({$li : $this, index : index});
156
+ });
157
+
158
+ // show first tip
159
+ if (!this.settings.startTimerOnClick && this.settings.timer > 0) {
160
+ this.show('init');
161
+ this.startTimer();
162
+ } else {
163
+ this.show('init');
164
+ }
165
+
166
+ }
167
+ },
168
+
169
+ resume : function () {
170
+ this.set_li();
171
+ this.show();
172
+ },
173
+
174
+ tip_template : function (opts) {
175
+ var $blank, content;
176
+
177
+ opts.tip_class = opts.tip_class || '';
178
+
179
+ $blank = $(this.settings.template.tip).addClass(opts.tip_class);
180
+ content = $.trim($(opts.li).html()) +
181
+ this.button_text(opts.button_text) +
182
+ this.settings.template.link +
183
+ this.timer_instance(opts.index);
184
+
185
+ $blank.append($(this.settings.template.wrapper));
186
+ $blank.first().attr('data-index', opts.index);
187
+ $('.joyride-content-wrapper', $blank).append(content);
188
+
189
+ return $blank[0];
190
+ },
191
+
192
+ timer_instance : function (index) {
193
+ var txt;
194
+
195
+ if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) {
196
+ txt = '';
197
+ } else {
198
+ txt = this.outerHTML($(this.settings.template.timer)[0]);
199
+ }
200
+ return txt;
201
+ },
202
+
203
+ button_text : function (txt) {
204
+ if (this.settings.nextButton) {
205
+ txt = $.trim(txt) || 'Next';
206
+ txt = this.outerHTML($(this.settings.template.button).append(txt)[0]);
207
+ } else {
208
+ txt = '';
209
+ }
210
+ return txt;
211
+ },
212
+
213
+ create : function (opts) {
214
+ var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
215
+ tipClass = opts.$li.attr('class'),
216
+ $tip_content = $(this.tip_template({
217
+ tip_class : tipClass,
218
+ index : opts.index,
219
+ button_text : buttonText,
220
+ li : opts.$li
221
+ }));
222
+
223
+ $(this.settings.tipContainer).append($tip_content);
224
+ },
225
+
226
+ show : function (init) {
227
+ var $timer = null;
228
+
229
+ // are we paused?
230
+ if (this.settings.$li === undefined
231
+ || ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) {
232
+
233
+ // don't go to the next li if the tour was paused
234
+ if (this.settings.paused) {
235
+ this.settings.paused = false;
236
+ } else {
237
+ this.set_li(init);
238
+ }
239
+
240
+ this.settings.attempts = 0;
241
+
242
+ if (this.settings.$li.length && this.settings.$target.length > 0) {
243
+ if (init) { //run when we first start
244
+ this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip);
245
+ if (this.settings.modal) {
246
+ this.show_modal();
247
+ }
248
+ }
249
+
250
+ this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip);
251
+
252
+ if (this.settings.modal && this.settings.expose) {
253
+ this.expose();
254
+ }
255
+
256
+ this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li));
257
+
258
+ this.settings.timer = parseInt(this.settings.timer, 10);
259
+
260
+ this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation];
261
+
262
+ // scroll if not modal
263
+ if (!/body/i.test(this.settings.$target.selector)) {
264
+ this.scroll_to();
265
+ }
266
+
267
+ if (this.is_phone()) {
268
+ this.pos_phone(true);
269
+ } else {
270
+ this.pos_default(true);
271
+ }
272
+
273
+ $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
274
+
275
+ if (/pop/i.test(this.settings.tipAnimation)) {
276
+
277
+ $timer.width(0);
278
+
279
+ if (this.settings.timer > 0) {
280
+
281
+ this.settings.$next_tip.show();
282
+
283
+ this.delay(function () {
284
+ $timer.animate({
285
+ width: $timer.parent().width()
286
+ }, this.settings.timer, 'linear');
287
+ }.bind(this), this.settings.tipAnimationFadeSpeed);
288
+
289
+ } else {
290
+ this.settings.$next_tip.show();
291
+
292
+ }
293
+
294
+
295
+ } else if (/fade/i.test(this.settings.tipAnimation)) {
296
+
297
+ $timer.width(0);
298
+
299
+ if (this.settings.timer > 0) {
300
+
301
+ this.settings.$next_tip
302
+ .fadeIn(this.settings.tipAnimationFadeSpeed)
303
+ .show();
304
+
305
+ this.delay(function () {
306
+ $timer.animate({
307
+ width: $timer.parent().width()
308
+ }, this.settings.timer, 'linear');
309
+ }.bind(this), this.settings.tipAnimationFadeSpeed);
310
+
311
+ } else {
312
+ this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed);
313
+
314
+ }
315
+ }
316
+
317
+ this.settings.$current_tip = this.settings.$next_tip;
318
+
319
+ // skip non-existant targets
320
+ } else if (this.settings.$li && this.settings.$target.length < 1) {
321
+
322
+ this.show();
323
+
324
+ } else {
325
+
326
+ this.end();
327
+
328
+ }
329
+ } else {
330
+
331
+ this.settings.paused = true;
332
+
333
+ }
334
+
335
+ },
336
+
337
+ is_phone : function () {
338
+ if (Modernizr) {
339
+ return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;
340
+ }
341
+
342
+ return (this.settings.$window.width() < 767);
343
+ },
344
+
345
+ hide : function () {
346
+ if (this.settings.modal && this.settings.expose) {
347
+ this.un_expose();
348
+ }
349
+
350
+ if (!this.settings.modal) {
351
+ $('.joyride-modal-bg').hide();
352
+ }
353
+
354
+ // Prevent scroll bouncing...wait to remove from layout
355
+ this.settings.$current_tip.css('visibility', 'hidden');
356
+ setTimeout($.proxy(function() {
357
+ this.hide();
358
+ this.css('visibility', 'visible');
359
+ }, this.settings.$current_tip), 0);
360
+ this.settings.postStepCallback(this.settings.$li.index(),
361
+ this.settings.$current_tip);
362
+ },
363
+
364
+ set_li : function (init) {
365
+ if (init) {
366
+ this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset);
367
+ this.set_next_tip();
368
+ this.settings.$current_tip = this.settings.$next_tip;
369
+ } else {
370
+ this.settings.$li = this.settings.$li.next();
371
+ this.set_next_tip();
372
+ }
373
+
374
+ this.set_target();
375
+ },
376
+
377
+ set_next_tip : function () {
378
+ this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");
379
+ this.settings.$next_tip.data('closed', '');
380
+ },
381
+
382
+ set_target : function () {
383
+ var cl = this.settings.$li.attr('data-class'),
384
+ id = this.settings.$li.attr('data-id'),
385
+ $sel = function () {
386
+ if (id) {
387
+ return $(document.getElementById(id));
388
+ } else if (cl) {
389
+ return $('.' + cl).first();
390
+ } else {
391
+ return $('body');
392
+ }
393
+ };
394
+
395
+ this.settings.$target = $sel();
396
+ },
397
+
398
+ scroll_to : function () {
399
+ var window_half, tipOffset;
400
+
401
+ window_half = $(window).height() / 2;
402
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip));
403
+ if (tipOffset > 0) {
404
+ this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed);
405
+ }
406
+ },
407
+
408
+ paused : function () {
409
+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1);
410
+ },
411
+
412
+ restart : function () {
413
+ this.hide();
414
+ this.settings.$li = undefined;
415
+ this.show('init');
416
+ },
417
+
418
+ pos_default : function (init, resizing) {
419
+ var half_fold = Math.ceil($(window).height() / 2),
420
+ tip_position = this.settings.$next_tip.offset(),
421
+ $nub = this.settings.$next_tip.find('.joyride-nub'),
422
+ nub_width = Math.ceil(this.outerWidth($nub) / 2),
423
+ nub_height = Math.ceil(this.outerHeight($nub) / 2),
424
+ toggle = init || false;
425
+
426
+ // tip must not be "display: none" to calculate position
427
+ if (toggle) {
428
+ this.settings.$next_tip.css('visibility', 'hidden');
429
+ this.settings.$next_tip.show();
430
+ }
431
+
432
+ if (typeof resizing === 'undefined') {
433
+ resizing = false;
434
+ }
435
+
436
+ if (!/body/i.test(this.settings.$target.selector)) {
437
+
438
+ if (this.bottom()) {
439
+ var leftOffset = this.settings.$target.offset().left;
440
+ if (Foundation.rtl) {
441
+ leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
442
+ }
443
+ this.settings.$next_tip.css({
444
+ top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)),
445
+ left: leftOffset});
446
+
447
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top');
448
+
449
+ } else if (this.top()) {
450
+ var leftOffset = this.settings.$target.offset().left;
451
+ if (Foundation.rtl) {
452
+ leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
453
+ }
454
+ this.settings.$next_tip.css({
455
+ top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height),
456
+ left: leftOffset});
457
+
458
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom');
459
+
460
+ } else if (this.right()) {
461
+
462
+ this.settings.$next_tip.css({
463
+ top: this.settings.$target.offset().top,
464
+ left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
465
+
466
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left');
467
+
468
+ } else if (this.left()) {
469
+
470
+ this.settings.$next_tip.css({
471
+ top: this.settings.$target.offset().top,
472
+ left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
473
+
474
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right');
475
+
476
+ }
477
+
478
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) {
479
+
480
+ $nub.removeClass('bottom')
481
+ .removeClass('top')
482
+ .removeClass('right')
483
+ .removeClass('left');
484
+
485
+ this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts];
486
+
487
+ this.settings.attempts++;
488
+
489
+ this.pos_default();
490
+
491
+ }
492
+
493
+ } else if (this.settings.$li.length) {
494
+
495
+ this.pos_modal($nub);
496
+
497
+ }
498
+
499
+ if (toggle) {
500
+ this.settings.$next_tip.hide();
501
+ this.settings.$next_tip.css('visibility', 'visible');
502
+ }
503
+
504
+ },
505
+
506
+ pos_phone : function (init) {
507
+ var tip_height = this.outerHeight(this.settings.$next_tip),
508
+ tip_offset = this.settings.$next_tip.offset(),
509
+ target_height = this.outerHeight(this.settings.$target),
510
+ $nub = $('.joyride-nub', this.settings.$next_tip),
511
+ nub_height = Math.ceil(this.outerHeight($nub) / 2),
512
+ toggle = init || false;
513
+
514
+ $nub.removeClass('bottom')
515
+ .removeClass('top')
516
+ .removeClass('right')
517
+ .removeClass('left');
518
+
519
+ if (toggle) {
520
+ this.settings.$next_tip.css('visibility', 'hidden');
521
+ this.settings.$next_tip.show();
522
+ }
523
+
524
+ if (!/body/i.test(this.settings.$target.selector)) {
525
+
526
+ if (this.top()) {
527
+
528
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
529
+ $nub.addClass('bottom');
530
+
531
+ } else {
532
+
533
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
534
+ $nub.addClass('top');
535
+
536
+ }
537
+
538
+ } else if (this.settings.$li.length) {
539
+ this.pos_modal($nub);
540
+ }
541
+
542
+ if (toggle) {
543
+ this.settings.$next_tip.hide();
544
+ this.settings.$next_tip.css('visibility', 'visible');
545
+ }
546
+ },
547
+
548
+ pos_modal : function ($nub) {
549
+ this.center();
550
+ $nub.hide();
551
+
552
+ this.show_modal();
553
+ },
554
+
555
+ show_modal : function () {
556
+ if (!this.settings.$next_tip.data('closed')) {
557
+ var joyridemodalbg = $('.joyride-modal-bg');
558
+ if (joyridemodalbg.length < 1) {
559
+ $('body').append(this.settings.template.modal).show();
560
+ }
561
+
562
+ if (/pop/i.test(this.settings.tipAnimation)) {
563
+ joyridemodalbg.show();
564
+ } else {
565
+ joyridemodalbg.fadeIn(this.settings.tipAnimationFadeSpeed);
566
+ }
567
+ }
568
+ },
569
+
570
+ expose : function () {
571
+ var expose,
572
+ exposeCover,
573
+ el,
574
+ origCSS,
575
+ origClasses,
576
+ randId = 'expose-'+Math.floor(Math.random()*10000);
577
+
578
+ if (arguments.length > 0 && arguments[0] instanceof $) {
579
+ el = arguments[0];
580
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
581
+ el = this.settings.$target;
582
+ } else {
583
+ return false;
584
+ }
585
+
586
+ if(el.length < 1){
587
+ if(window.console){
588
+ console.error('element not valid', el);
589
+ }
590
+ return false;
591
+ }
592
+
593
+ expose = $(this.settings.template.expose);
594
+ this.settings.$body.append(expose);
595
+ expose.css({
596
+ top: el.offset().top,
597
+ left: el.offset().left,
598
+ width: this.outerWidth(el, true),
599
+ height: this.outerHeight(el, true)
600
+ });
601
+
602
+ exposeCover = $(this.settings.template.exposeCover);
603
+
604
+ origCSS = {
605
+ zIndex: el.css('z-index'),
606
+ position: el.css('position')
607
+ };
608
+
609
+ origClasses = el.attr('class') == null ? '' : el.attr('class');
610
+
611
+ el.css('z-index',parseInt(expose.css('z-index'))+1);
612
+
613
+ if (origCSS.position == 'static') {
614
+ el.css('position','relative');
615
+ }
616
+
617
+ el.data('expose-css',origCSS);
618
+ el.data('orig-class', origClasses);
619
+ el.attr('class', origClasses + ' ' + this.settings.exposeAddClass);
620
+
621
+ exposeCover.css({
622
+ top: el.offset().top,
623
+ left: el.offset().left,
624
+ width: this.outerWidth(el, true),
625
+ height: this.outerHeight(el, true)
626
+ });
627
+
628
+ this.settings.$body.append(exposeCover);
629
+ expose.addClass(randId);
630
+ exposeCover.addClass(randId);
631
+ el.data('expose', randId);
632
+ this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el);
633
+ this.add_exposed(el);
634
+ },
635
+
636
+ un_expose : function () {
637
+ var exposeId,
638
+ el,
639
+ expose ,
640
+ origCSS,
641
+ origClasses,
642
+ clearAll = false;
643
+
644
+ if (arguments.length > 0 && arguments[0] instanceof $) {
645
+ el = arguments[0];
646
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
647
+ el = this.settings.$target;
648
+ } else {
649
+ return false;
650
+ }
651
+
652
+ if(el.length < 1){
653
+ if (window.console) {
654
+ console.error('element not valid', el);
655
+ }
656
+ return false;
657
+ }
658
+
659
+ exposeId = el.data('expose');
660
+ expose = $('.' + exposeId);
661
+
662
+ if (arguments.length > 1) {
663
+ clearAll = arguments[1];
664
+ }
665
+
666
+ if (clearAll === true) {
667
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
668
+ } else {
669
+ expose.remove();
670
+ }
671
+
672
+ origCSS = el.data('expose-css');
673
+
674
+ if (origCSS.zIndex == 'auto') {
675
+ el.css('z-index', '');
676
+ } else {
677
+ el.css('z-index', origCSS.zIndex);
678
+ }
679
+
680
+ if (origCSS.position != el.css('position')) {
681
+ if(origCSS.position == 'static') {// this is default, no need to set it.
682
+ el.css('position', '');
683
+ } else {
684
+ el.css('position', origCSS.position);
685
+ }
686
+ }
687
+
688
+ origClasses = el.data('orig-class');
689
+ el.attr('class', origClasses);
690
+ el.removeData('orig-classes');
691
+
692
+ el.removeData('expose');
693
+ el.removeData('expose-z-index');
694
+ this.remove_exposed(el);
695
+ },
696
+
697
+ add_exposed: function(el){
698
+ this.settings.exposed = this.settings.exposed || [];
699
+ if (el instanceof $ || typeof el === 'object') {
700
+ this.settings.exposed.push(el[0]);
701
+ } else if (typeof el == 'string') {
702
+ this.settings.exposed.push(el);
703
+ }
704
+ },
705
+
706
+ remove_exposed: function(el){
707
+ var search, count;
708
+ if (el instanceof $) {
709
+ search = el[0]
710
+ } else if (typeof el == 'string'){
711
+ search = el;
712
+ }
713
+
714
+ this.settings.exposed = this.settings.exposed || [];
715
+ count = this.settings.exposed.length;
716
+
717
+ for (var i=0; i < count; i++) {
718
+ if (this.settings.exposed[i] == search) {
719
+ this.settings.exposed.splice(i, 1);
720
+ return;
721
+ }
722
+ }
723
+ },
724
+
725
+ center : function () {
726
+ var $w = $(window);
727
+
728
+ this.settings.$next_tip.css({
729
+ top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()),
730
+ left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w))
731
+ });
732
+
733
+ return true;
734
+ },
735
+
736
+ bottom : function () {
737
+ return /bottom/i.test(this.settings.tipSettings.tipLocation);
738
+ },
739
+
740
+ top : function () {
741
+ return /top/i.test(this.settings.tipSettings.tipLocation);
742
+ },
743
+
744
+ right : function () {
745
+ return /right/i.test(this.settings.tipSettings.tipLocation);
746
+ },
747
+
748
+ left : function () {
749
+ return /left/i.test(this.settings.tipSettings.tipLocation);
750
+ },
751
+
752
+ corners : function (el) {
753
+ var w = $(window),
754
+ window_half = w.height() / 2,
755
+ //using this to calculate since scroll may not have finished yet.
756
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
757
+ right = w.width() + this.scrollLeft(w),
758
+ offsetBottom = w.height() + tipOffset,
759
+ bottom = w.height() + w.scrollTop(),
760
+ top = w.scrollTop();
761
+
762
+ if (tipOffset < top) {
763
+ if (tipOffset < 0) {
764
+ top = 0;
765
+ } else {
766
+ top = tipOffset;
767
+ }
768
+ }
769
+
770
+ if (offsetBottom > bottom) {
771
+ bottom = offsetBottom;
772
+ }
773
+
774
+ return [
775
+ el.offset().top < top,
776
+ right < el.offset().left + el.outerWidth(),
777
+ bottom < el.offset().top + el.outerHeight(),
778
+ this.scrollLeft(w) > el.offset().left
779
+ ];
780
+ },
781
+
782
+ visible : function (hidden_corners) {
783
+ var i = hidden_corners.length;
784
+
785
+ while (i--) {
786
+ if (hidden_corners[i]) return false;
787
+ }
788
+
789
+ return true;
790
+ },
791
+
792
+ nub_position : function (nub, pos, def) {
793
+ if (pos === 'auto') {
794
+ nub.addClass(def);
795
+ } else {
796
+ nub.addClass(pos);
797
+ }
798
+ },
799
+
800
+ startTimer : function () {
801
+ if (this.settings.$li.length) {
802
+ this.settings.automate = setTimeout(function () {
803
+ this.hide();
804
+ this.show();
805
+ this.startTimer();
806
+ }.bind(this), this.settings.timer);
807
+ } else {
808
+ clearTimeout(this.settings.automate);
809
+ }
810
+ },
811
+
812
+ end : function () {
813
+ if (this.settings.cookieMonster) {
814
+ $.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain });
815
+ }
816
+
817
+ if (this.settings.timer > 0) {
818
+ clearTimeout(this.settings.automate);
819
+ }
820
+
821
+ if (this.settings.modal && this.settings.expose) {
822
+ this.un_expose();
823
+ }
824
+
825
+ this.settings.$next_tip.data('closed', true);
826
+
827
+ $('.joyride-modal-bg').hide();
828
+ this.settings.$current_tip.hide();
829
+ this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);
830
+ this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip);
831
+ $('.joyride-tip-guide').remove();
832
+ },
833
+
834
+ outerHTML : function (el) {
835
+ // support FireFox < 11
836
+ return el.outerHTML || new XMLSerializer().serializeToString(el);
837
+ },
838
+
839
+ off : function () {
840
+ $(this.scope).off('.joyride');
841
+ $(window).off('.joyride');
842
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
843
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
844
+ clearTimeout(this.settings.automate);
845
+ this.settings = {};
846
+ },
847
+
848
+ reflow : function () {}
849
+ };
850
+ }(Foundation.zj, this, this.document));