zurb-foundation 3.2.5 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.gitignore +6 -2
  2. data/CHANGELOG.md +1 -26
  3. data/CONTRIBUTING.md +18 -0
  4. data/Gemfile.lock +19 -0
  5. data/Gruntfile.js +27 -0
  6. data/README.md +5 -6
  7. data/{Capfile → docs/Capfile} +0 -1
  8. data/docs/Gemfile +8 -0
  9. data/docs/Gemfile.lock +43 -0
  10. data/docs/Procfile +2 -0
  11. data/docs/README.md +1 -0
  12. data/docs/_sidebar-components.html.erb +109 -0
  13. data/docs/_sidebar.html.erb +109 -0
  14. data/docs/_zurb-jobs.html.erb +5 -0
  15. data/docs/changelog.html.erb +185 -0
  16. data/docs/compile.rb +43 -0
  17. data/docs/components/alert-boxes.html.erb +202 -0
  18. data/docs/components/block-grid.html.erb +118 -0
  19. data/docs/components/breadcrumbs.html.erb +146 -0
  20. data/docs/components/button-groups.html.erb +174 -0
  21. data/docs/components/buttons.html.erb +220 -0
  22. data/docs/components/clearing.html.erb +152 -0
  23. data/docs/components/custom-forms.html.erb +306 -0
  24. data/docs/components/dropdown-buttons.html.erb +233 -0
  25. data/docs/components/dropdown.html.erb +186 -0
  26. data/docs/components/flex-video.html.erb +93 -0
  27. data/docs/components/forms.html.erb +468 -0
  28. data/docs/components/grid.html.erb +355 -0
  29. data/docs/components/inline-lists.html.erb +89 -0
  30. data/docs/components/joyride.html.erb +178 -0
  31. data/docs/components/keystrokes.html.erb +74 -0
  32. data/docs/components/labels.html.erb +98 -0
  33. data/docs/components/magellan.html.erb +84 -0
  34. data/docs/components/orbit.html.erb +262 -0
  35. data/docs/components/pagination.html.erb +181 -0
  36. data/docs/components/panels.html.erb +121 -0
  37. data/docs/components/pricing-tables.html.erb +154 -0
  38. data/docs/components/progress-bars.html.erb +120 -0
  39. data/docs/components/reveal.html.erb +147 -0
  40. data/docs/components/section.html.erb +156 -0
  41. data/docs/components/side-nav.html.erb +122 -0
  42. data/docs/components/split-buttons.html.erb +218 -0
  43. data/docs/components/sub-nav.html.erb +120 -0
  44. data/docs/components/switch.html.erb +288 -0
  45. data/docs/components/tables.html.erb +123 -0
  46. data/docs/components/thumbnails.html.erb +87 -0
  47. data/docs/components/tooltips.html.erb +73 -0
  48. data/docs/components/top-bar.html.erb +219 -0
  49. data/docs/components/type.html.erb +359 -0
  50. data/docs/components/visibility.html.erb +102 -0
  51. data/docs/config.ru +12 -0
  52. data/docs/config/deploy.rb +33 -0
  53. data/docs/controller.rb +43 -0
  54. data/docs/css/_coderay.scss +116 -0
  55. data/docs/css/_settings.scss +1 -0
  56. data/docs/css/docs.scss +174 -0
  57. data/docs/css/normalize.scss +396 -0
  58. data/docs/css/qunit-composite.css +13 -0
  59. data/docs/css/qunit.css +235 -0
  60. data/docs/faq.html.erb +61 -0
  61. data/docs/img/demos/demo1-th.png +0 -0
  62. data/docs/img/demos/demo1.png +0 -0
  63. data/docs/img/demos/demo2-th.png +0 -0
  64. data/docs/img/demos/demo2.png +0 -0
  65. data/docs/img/demos/demo3-th.png +0 -0
  66. data/docs/img/demos/demo3.png +0 -0
  67. data/docs/img/demos/demo4-th.png +0 -0
  68. data/docs/img/demos/demo4.png +0 -0
  69. data/docs/img/demos/demo5-th.png +0 -0
  70. data/docs/img/demos/demo5.png +0 -0
  71. data/docs/index.html.erb +299 -0
  72. data/docs/javascript.html.erb +133 -0
  73. data/docs/js/docs.js +3 -0
  74. data/docs/js/qunit-composite.js +105 -0
  75. data/docs/js/qunit.js +1977 -0
  76. data/docs/js/tests/tabs/simple_tabs.html +57 -0
  77. data/docs/js/tests/tabs/simple_tabs.js +54 -0
  78. data/docs/js/tests/tooltips/tooltips.html +39 -0
  79. data/docs/js/tests/tooltips/tooltips.js +11 -0
  80. data/docs/layout.html.erb +99 -0
  81. data/docs/rails.html.erb +66 -0
  82. data/docs/sass.html.erb +299 -0
  83. data/docs/support.html.erb +134 -0
  84. data/foundation.gemspec +2 -4
  85. data/index.html +3 -23
  86. data/js/foundation/foundation.alerts.js +50 -0
  87. data/js/foundation/foundation.clearing.js +478 -0
  88. data/{vendor/assets/javascripts/foundation/jquery.cookie.js → js/foundation/foundation.cookie.js} +3 -1
  89. data/js/foundation/foundation.dropdown.js +122 -0
  90. data/js/foundation/foundation.forms.js +403 -0
  91. data/js/foundation/foundation.joyride.js +613 -0
  92. data/js/foundation/foundation.js +331 -0
  93. data/js/foundation/foundation.magellan.js +130 -0
  94. data/js/foundation/foundation.orbit.js +355 -0
  95. data/{vendor/assets/javascripts/foundation/jquery.placeholder.js → js/foundation/foundation.placeholder.js} +4 -2
  96. data/js/foundation/foundation.reveal.js +264 -0
  97. data/js/foundation/foundation.section.js +180 -0
  98. data/js/foundation/foundation.tooltips.js +195 -0
  99. data/js/foundation/foundation.topbar.js +187 -0
  100. data/js/foundation/index.js +16 -0
  101. data/{vendor/assets/javascripts/foundation/modernizr.foundation.js → js/vendor/custom.modernizr.js} +0 -0
  102. data/js/vendor/jquery.js +9597 -0
  103. data/js/vendor/zepto.js +1782 -0
  104. data/lib/foundation/engine.rb +8 -1
  105. data/lib/foundation/generators/install_generator.rb +24 -1
  106. data/lib/foundation/generators/templates/application.html.erb +20 -6
  107. data/lib/foundation/generators/templates/application.html.haml +2 -6
  108. data/lib/foundation/generators/templates/application.html.slim +2 -5
  109. data/lib/foundation/version.rb +1 -1
  110. data/lib/zurb-foundation.rb +7 -9
  111. data/package.json +9 -0
  112. data/scss/foundation.scss +42 -15
  113. data/scss/foundation/_foundation-global.scss +226 -0
  114. data/scss/foundation/components/_alert-boxes.scss +106 -0
  115. data/scss/foundation/components/_block-grid.scss +63 -0
  116. data/scss/foundation/components/_breadcrumbs.scss +117 -0
  117. data/scss/foundation/components/_button-groups.scss +59 -0
  118. data/scss/foundation/components/_buttons.scss +217 -0
  119. data/scss/foundation/components/_clearing.scss +209 -0
  120. data/scss/foundation/components/_custom-forms.scss +232 -0
  121. data/scss/foundation/components/_dropdown-buttons.scss +114 -0
  122. data/scss/foundation/components/_dropdown.scss +137 -0
  123. data/scss/foundation/components/_flex-video.scss +45 -0
  124. data/scss/foundation/components/_forms.scss +309 -0
  125. data/scss/foundation/components/_grid.scss +149 -71
  126. data/scss/foundation/components/_inline-lists.scss +47 -0
  127. data/scss/foundation/components/_joyride.scss +193 -0
  128. data/scss/foundation/components/_keystrokes.scss +56 -0
  129. data/scss/foundation/components/_labels.scss +81 -0
  130. data/scss/foundation/components/_magellan.scss +15 -0
  131. data/scss/foundation/components/_orbit.scss +193 -0
  132. data/scss/foundation/components/_pagination.scss +99 -0
  133. data/scss/foundation/components/_panels.scss +76 -0
  134. data/scss/foundation/components/_pricing-tables.scss +130 -0
  135. data/scss/foundation/components/_progress-bars.scss +68 -0
  136. data/scss/foundation/components/_reveal.scss +131 -0
  137. data/scss/foundation/components/_section.scss +194 -0
  138. data/scss/foundation/components/_side-nav.scss +68 -0
  139. data/scss/foundation/components/_split-buttons.scss +159 -0
  140. data/scss/foundation/components/_sub-nav.scss +67 -0
  141. data/scss/foundation/components/_switch.scss +242 -0
  142. data/scss/foundation/components/_tables.scss +80 -0
  143. data/scss/foundation/components/_thumbs.scss +45 -0
  144. data/scss/foundation/components/_tooltips.scss +113 -0
  145. data/scss/foundation/components/_top-bar.scss +443 -0
  146. data/scss/foundation/components/_type.scss +411 -0
  147. data/scss/foundation/components/_visibility.scss +117 -0
  148. data/scss/normalize.scss +396 -0
  149. data/templates/project/config.rb +26 -0
  150. data/templates/project/index.html +28 -43
  151. data/templates/project/manifest.rb +21 -28
  152. data/templates/project/scss/_settings.scss +4 -243
  153. data/templates/project/scss/app.scss +37 -44
  154. data/templates/project/scss/normalize.scss +396 -0
  155. data/test/stylesheets/styles.css +955 -0
  156. metadata +144 -153
  157. data/config/deploy.rb +0 -42
  158. data/lib/foundation/generators/layout_generator.rb +0 -28
  159. data/scss/foundation/_settings.scss +0 -281
  160. data/scss/foundation/common/_base.scss +0 -4
  161. data/scss/foundation/common/_forms.scss +0 -117
  162. data/scss/foundation/common/_globals.scss +0 -35
  163. data/scss/foundation/common/_ratios.scss +0 -19
  164. data/scss/foundation/common/_typography.scss +0 -104
  165. data/scss/foundation/components/modules/_all.scss +0 -10
  166. data/scss/foundation/components/modules/_buttons.scss +0 -178
  167. data/scss/foundation/components/modules/_clearing.scss +0 -61
  168. data/scss/foundation/components/modules/_joyride.scss +0 -33
  169. data/scss/foundation/components/modules/_mqueries.scss +0 -458
  170. data/scss/foundation/components/modules/_navbar.scss +0 -74
  171. data/scss/foundation/components/modules/_offcanvas.scss +0 -55
  172. data/scss/foundation/components/modules/_orbit.scss +0 -90
  173. data/scss/foundation/components/modules/_reveal.scss +0 -34
  174. data/scss/foundation/components/modules/_tabs.scss +0 -67
  175. data/scss/foundation/components/modules/_topbar.scss +0 -167
  176. data/scss/foundation/components/modules/_ui.scss +0 -292
  177. data/scss/foundation/functions/_all.scss +0 -2
  178. data/scss/foundation/functions/_convert-number-to-word.scss +0 -10
  179. data/scss/foundation/functions/_grid-calc.scss +0 -5
  180. data/scss/foundation/functions/modular-scale.scss +0 -3
  181. data/scss/foundation/mixins/_all.scss +0 -5
  182. data/scss/foundation/mixins/_clearfix.scss +0 -13
  183. data/scss/foundation/mixins/_css-triangle.scss +0 -22
  184. data/scss/foundation/mixins/_font-size.scss +0 -13
  185. data/scss/foundation/mixins/_respond-to.scss +0 -11
  186. data/scss/foundation/mixins/_semantic-grid.scss +0 -66
  187. data/test/buttons.html +0 -189
  188. data/test/clearing.html +0 -85
  189. data/test/config.rb +0 -11
  190. data/test/elements.html +0 -490
  191. data/test/forms.html +0 -371
  192. data/test/grid.html +0 -543
  193. data/test/images/orbit-demo/demo1.jpeg +0 -0
  194. data/test/images/orbit-demo/demo2.jpeg +0 -0
  195. data/test/images/orbit-demo/demo3.jpeg +0 -0
  196. data/test/images/orbit-demo/slider-background.jpeg +0 -0
  197. data/test/index.html +0 -83
  198. data/test/joyride.html +0 -127
  199. data/test/magellan.html +0 -112
  200. data/test/navigation.html +0 -269
  201. data/test/orbit.html +0 -112
  202. data/test/reveal.html +0 -91
  203. data/test/scss/_settings.scss +0 -245
  204. data/test/scss/styles.scss +0 -50
  205. data/test/tabs.html +0 -197
  206. data/test/template.html +0 -52
  207. data/test/topbar-login.html +0 -194
  208. data/test/topbar.html +0 -139
  209. data/test/type.html +0 -188
  210. data/vendor/assets/images/foundation/orbit/bullets.jpg +0 -0
  211. data/vendor/assets/images/foundation/orbit/left-arrow-small.png +0 -0
  212. data/vendor/assets/images/foundation/orbit/left-arrow.png +0 -0
  213. data/vendor/assets/images/foundation/orbit/loading.gif +0 -0
  214. data/vendor/assets/images/foundation/orbit/mask-black.png +0 -0
  215. data/vendor/assets/images/foundation/orbit/pause-black.png +0 -0
  216. data/vendor/assets/images/foundation/orbit/right-arrow-small.png +0 -0
  217. data/vendor/assets/images/foundation/orbit/right-arrow.png +0 -0
  218. data/vendor/assets/images/foundation/orbit/rotator-black.png +0 -0
  219. data/vendor/assets/images/foundation/orbit/timer-black.png +0 -0
  220. data/vendor/assets/javascripts/foundation/app.js +0 -41
  221. data/vendor/assets/javascripts/foundation/index.js +0 -19
  222. data/vendor/assets/javascripts/foundation/jquery.event.move.js +0 -580
  223. data/vendor/assets/javascripts/foundation/jquery.event.swipe.js +0 -130
  224. data/vendor/assets/javascripts/foundation/jquery.foundation.accordion.js +0 -47
  225. data/vendor/assets/javascripts/foundation/jquery.foundation.alerts.js +0 -20
  226. data/vendor/assets/javascripts/foundation/jquery.foundation.buttons.js +0 -83
  227. data/vendor/assets/javascripts/foundation/jquery.foundation.clearing.js +0 -413
  228. data/vendor/assets/javascripts/foundation/jquery.foundation.forms.js +0 -502
  229. data/vendor/assets/javascripts/foundation/jquery.foundation.joyride.js +0 -639
  230. data/vendor/assets/javascripts/foundation/jquery.foundation.magellan.js +0 -96
  231. data/vendor/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
  232. data/vendor/assets/javascripts/foundation/jquery.foundation.navigation.js +0 -55
  233. data/vendor/assets/javascripts/foundation/jquery.foundation.orbit.js +0 -919
  234. data/vendor/assets/javascripts/foundation/jquery.foundation.reveal.js +0 -794
  235. data/vendor/assets/javascripts/foundation/jquery.foundation.tabs.js +0 -66
  236. data/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js +0 -211
  237. data/vendor/assets/javascripts/foundation/jquery.foundation.topbar.js +0 -174
  238. data/vendor/assets/javascripts/foundation/jquery.js +0 -9555
  239. data/vendor/assets/javascripts/foundation/jquery.offcanvas.js +0 -50
@@ -1,639 +0,0 @@
1
- /*
2
- * jQuery Foundation Joyride Plugin 2.0.3
3
- * http://foundation.zurb.com
4
- * Copyright 2012, ZURB
5
- * Free to use under the MIT license.
6
- * http://www.opensource.org/licenses/mit-license.php
7
- */
8
-
9
- /*jslint unparam: true, browser: true, indent: 2 */
10
-
11
- ;(function ($, window, undefined) {
12
- 'use strict';
13
-
14
- var defaults = {
15
- 'version' : '2.0.3',
16
- 'tipLocation' : 'bottom', // 'top' or 'bottom' in relation to parent
17
- 'nubPosition' : 'auto', // override on a per tooltip bases
18
- 'scrollSpeed' : 300, // Page scrolling speed in milliseconds
19
- 'timer' : 0, // 0 = no timer , all other numbers = timer in milliseconds
20
- 'startTimerOnClick' : true, // true or false - true requires clicking the first button start the timer
21
- 'startOffset' : 0, // the index of the tooltip you want to start on (index of the li)
22
- 'nextButton' : true, // true or false to control whether a next button is used
23
- 'tipAnimation' : 'fade', // 'pop' or 'fade' in each tip
24
- 'pauseAfter' : [], // array of indexes where to pause the tour after
25
- 'tipAnimationFadeSpeed': 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
26
- 'cookieMonster' : false, // true or false to control whether cookies are used
27
- 'cookieName' : 'joyride', // Name the cookie you'll use
28
- 'cookieDomain' : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
29
- 'tipContainer' : 'body', // Where will the tip be attached
30
- 'postRideCallback' : $.noop, // A method to call once the tour closes (canceled or complete)
31
- 'postStepCallback' : $.noop, // A method to call after each step
32
- 'template' : { // HTML segments for tip layout
33
- 'link' : '<a href="#close" class="joyride-close-tip">X</a>',
34
- 'timer' : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
35
- 'tip' : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
36
- 'wrapper' : '<div class="joyride-content-wrapper"></div>',
37
- 'button' : '<a href="#" class="small button joyride-next-tip"></a>'
38
- }
39
- },
40
-
41
- Modernizr = Modernizr || false,
42
-
43
- settings = {},
44
-
45
- methods = {
46
-
47
- init : function (opts) {
48
- return this.each(function () {
49
-
50
- if ($.isEmptyObject(settings)) {
51
- settings = $.extend(true, defaults, opts);
52
-
53
- // non configurable settings
54
- settings.document = window.document;
55
- settings.$document = $(settings.document);
56
- settings.$window = $(window);
57
- settings.$content_el = $(this);
58
- settings.body_offset = $(settings.tipContainer).position();
59
- settings.$tip_content = $('> li', settings.$content_el);
60
- settings.paused = false;
61
- settings.attempts = 0;
62
-
63
- settings.tipLocationPatterns = {
64
- top: ['bottom'],
65
- bottom: [], // bottom should not need to be repositioned
66
- left: ['right', 'top', 'bottom'],
67
- right: ['left', 'top', 'bottom']
68
- };
69
-
70
- // are we using jQuery 1.7+
71
- methods.jquery_check();
72
-
73
- // can we create cookies?
74
- if (!$.isFunction($.cookie)) {
75
- settings.cookieMonster = false;
76
- }
77
-
78
- // generate the tips and insert into dom.
79
- if (!settings.cookieMonster || !$.cookie(settings.cookieName)) {
80
-
81
- settings.$tip_content.each(function (index) {
82
- methods.create({$li : $(this), index : index});
83
- });
84
-
85
- // show first tip
86
- if (!settings.startTimerOnClick && settings.timer > 0) {
87
- methods.show('init');
88
- methods.startTimer();
89
- } else {
90
- methods.show('init');
91
- }
92
-
93
- }
94
-
95
- settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
96
- e.preventDefault();
97
-
98
- if (settings.$li.next().length < 1) {
99
- methods.end();
100
- } else if (settings.timer > 0) {
101
- clearTimeout(settings.automate);
102
- methods.hide();
103
- methods.show();
104
- methods.startTimer();
105
- } else {
106
- methods.hide();
107
- methods.show();
108
- }
109
-
110
- });
111
-
112
- settings.$document.on('click.joyride', '.joyride-close-tip', function (e) {
113
- e.preventDefault();
114
- methods.end();
115
- });
116
-
117
- settings.$window.bind('resize.joyride', function (e) {
118
- if (methods.is_phone()) {
119
- methods.pos_phone();
120
- } else {
121
- methods.pos_default();
122
- }
123
- });
124
- } else {
125
- methods.restart();
126
- }
127
-
128
- });
129
- },
130
-
131
- // call this method when you want to resume the tour
132
- resume : function () {
133
- methods.set_li();
134
- methods.show();
135
- },
136
-
137
- tip_template : function (opts) {
138
- var $blank, content;
139
-
140
- opts.tip_class = opts.tip_class || '';
141
-
142
- $blank = $(settings.template.tip).addClass(opts.tip_class);
143
- content = $.trim($(opts.li).html()) +
144
- methods.button_text(opts.button_text) +
145
- settings.template.link +
146
- methods.timer_instance(opts.index);
147
-
148
- $blank.append($(settings.template.wrapper));
149
- $blank.first().attr('data-index', opts.index);
150
- $('.joyride-content-wrapper', $blank).append(content);
151
-
152
- return $blank[0];
153
- },
154
-
155
- timer_instance : function (index) {
156
- var txt;
157
-
158
- if ((index === 0 && settings.startTimerOnClick && settings.timer > 0) || settings.timer === 0) {
159
- txt = '';
160
- } else {
161
- txt = methods.outerHTML($(settings.template.timer)[0]);
162
- }
163
- return txt;
164
- },
165
-
166
- button_text : function (txt) {
167
- if (settings.nextButton) {
168
- txt = $.trim(txt) || 'Next';
169
- txt = methods.outerHTML($(settings.template.button).append(txt)[0]);
170
- } else {
171
- txt = '';
172
- }
173
- return txt;
174
- },
175
-
176
- create : function (opts) {
177
- // backwards compatibility with data-text attribute
178
- var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
179
- tipClass = opts.$li.attr('class'),
180
- $tip_content = $(methods.tip_template({
181
- tip_class : tipClass,
182
- index : opts.index,
183
- button_text : buttonText,
184
- li : opts.$li
185
- }));
186
-
187
- $(settings.tipContainer).append($tip_content);
188
- },
189
-
190
- show : function (init) {
191
- var opts = {}, ii, opts_arr = [], opts_len = 0, p,
192
- $timer = null;
193
-
194
- // are we paused?
195
- if (settings.$li === undefined || ($.inArray(settings.$li.index(), settings.pauseAfter) === -1)) {
196
-
197
- // don't go to the next li if the tour was paused
198
- if (settings.paused) {
199
- settings.paused = false;
200
- } else {
201
- methods.set_li(init);
202
- }
203
-
204
- settings.attempts = 0;
205
-
206
- if (settings.$li.length && settings.$target.length > 0) {
207
- opts_arr = (settings.$li.data('options') || ':').split(';');
208
- opts_len = opts_arr.length;
209
-
210
- // parse options
211
- for (ii = opts_len - 1; ii >= 0; ii--) {
212
- p = opts_arr[ii].split(':');
213
-
214
- if (p.length === 2) {
215
- opts[$.trim(p[0])] = $.trim(p[1]);
216
- }
217
- }
218
-
219
- settings.tipSettings = $.extend({}, settings, opts);
220
-
221
- settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation];
222
-
223
- // scroll if not modal
224
- if (!/body/i.test(settings.$target.selector)) {
225
- methods.scroll_to();
226
- }
227
-
228
- if (methods.is_phone()) {
229
- methods.pos_phone(true);
230
- } else {
231
- methods.pos_default(true);
232
- }
233
-
234
- $timer = $('.joyride-timer-indicator', settings.$next_tip);
235
-
236
- if (/pop/i.test(settings.tipAnimation)) {
237
-
238
- $timer.outerWidth(0);
239
-
240
- if (settings.timer > 0) {
241
-
242
- settings.$next_tip.show();
243
- $timer.animate({
244
- width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
245
- }, settings.timer);
246
-
247
- } else {
248
-
249
- settings.$next_tip.show();
250
-
251
- }
252
-
253
-
254
- } else if (/fade/i.test(settings.tipAnimation)) {
255
-
256
- $timer.outerWidth(0);
257
-
258
- if (settings.timer > 0) {
259
-
260
- settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
261
-
262
- settings.$next_tip.show();
263
- $timer.animate({
264
- width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
265
- }, settings.timer);
266
-
267
- } else {
268
-
269
- settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
270
-
271
- }
272
- }
273
-
274
- settings.$current_tip = settings.$next_tip;
275
-
276
- // skip non-existent targets
277
- } else if (settings.$li && settings.$target.length < 1) {
278
-
279
- methods.show();
280
-
281
- } else {
282
-
283
- methods.end();
284
-
285
- }
286
- } else {
287
-
288
- settings.paused = true;
289
-
290
- }
291
-
292
- },
293
-
294
- // detect phones with media queries if supported.
295
- is_phone : function () {
296
- if (Modernizr) {
297
- return Modernizr.mq('only screen and (max-width: 767px)');
298
- }
299
-
300
- return (settings.$window.width() < 767) ? true : false;
301
- },
302
-
303
- hide : function () {
304
- settings.postStepCallback(settings.$li.index(), settings.$current_tip);
305
- $('.joyride-modal-bg').hide();
306
- settings.$current_tip.hide();
307
- },
308
-
309
- set_li : function (init) {
310
- if (init) {
311
- settings.$li = settings.$tip_content.eq(settings.startOffset);
312
- methods.set_next_tip();
313
- settings.$current_tip = settings.$next_tip;
314
- } else {
315
- settings.$li = settings.$li.next();
316
- methods.set_next_tip();
317
- }
318
-
319
- methods.set_target();
320
- },
321
-
322
- set_next_tip : function () {
323
- settings.$next_tip = $('.joyride-tip-guide[data-index=' + settings.$li.index() + ']');
324
- },
325
-
326
- set_target : function () {
327
- var cl = settings.$li.attr('data-class'),
328
- id = settings.$li.attr('data-id'),
329
- $sel = function () {
330
- if (id) {
331
- return $(settings.document.getElementById(id));
332
- } else if (cl) {
333
- return $('.' + cl).first();
334
- } else {
335
- return $('body');
336
- }
337
- };
338
-
339
- settings.$target = $sel();
340
- },
341
-
342
- scroll_to : function () {
343
- var window_half, tipOffset;
344
-
345
- window_half = settings.$window.height() / 2;
346
- tipOffset = Math.ceil(settings.$target.offset().top - window_half + settings.$next_tip.outerHeight());
347
-
348
- $("html, body").stop().animate({
349
- scrollTop: tipOffset
350
- }, settings.scrollSpeed);
351
- },
352
-
353
- paused : function () {
354
- if (($.inArray((settings.$li.index() + 1), settings.pauseAfter) === -1)) {
355
- return true;
356
- }
357
-
358
- return false;
359
- },
360
-
361
- destroy : function () {
362
- settings.$document.off('.joyride');
363
- $(window).off('.joyride');
364
- $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
365
- $('.joyride-tip-guide, .joyride-modal-bg').remove();
366
- clearTimeout(settings.automate);
367
- settings = {};
368
- },
369
-
370
- restart : function () {
371
- methods.hide();
372
- settings.$li = undefined;
373
- methods.show('init');
374
- },
375
-
376
- pos_default : function (init) {
377
- var half_fold = Math.ceil(settings.$window.height() / 2),
378
- tip_position = settings.$next_tip.offset(),
379
- $nub = $('.joyride-nub', settings.$next_tip),
380
- nub_height = Math.ceil($nub.outerHeight() / 2),
381
- toggle = init || false;
382
-
383
- // tip must not be "display: none" to calculate position
384
- if (toggle) {
385
- settings.$next_tip.css('visibility', 'hidden');
386
- settings.$next_tip.show();
387
- }
388
-
389
- if (!/body/i.test(settings.$target.selector)) {
390
-
391
- if (methods.bottom()) {
392
- settings.$next_tip.css({
393
- top: (settings.$target.offset().top + nub_height + settings.$target.outerHeight()),
394
- left: settings.$target.offset().left});
395
-
396
- methods.nub_position($nub, settings.tipSettings.nubPosition, 'top');
397
-
398
- } else if (methods.top()) {
399
-
400
- settings.$next_tip.css({
401
- top: (settings.$target.offset().top - settings.$next_tip.outerHeight() - nub_height),
402
- left: settings.$target.offset().left});
403
-
404
- methods.nub_position($nub, settings.tipSettings.nubPosition, 'bottom');
405
-
406
- } else if (methods.right()) {
407
-
408
- settings.$next_tip.css({
409
- top: settings.$target.offset().top,
410
- left: (settings.$target.outerWidth() + settings.$target.offset().left)});
411
-
412
- methods.nub_position($nub, settings.tipSettings.nubPosition, 'left');
413
-
414
- } else if (methods.left()) {
415
-
416
- settings.$next_tip.css({
417
- top: settings.$target.offset().top,
418
- left: (settings.$target.offset().left - settings.$next_tip.outerWidth() - nub_height)});
419
-
420
- methods.nub_position($nub, settings.tipSettings.nubPosition, 'right');
421
-
422
- }
423
-
424
- if (!methods.visible(methods.corners(settings.$next_tip)) && settings.attempts < settings.tipSettings.tipLocationPattern.length) {
425
-
426
- $nub.removeClass('bottom')
427
- .removeClass('top')
428
- .removeClass('right')
429
- .removeClass('left');
430
-
431
- settings.tipSettings.tipLocation = settings.tipSettings.tipLocationPattern[settings.attempts];
432
-
433
- settings.attempts++;
434
-
435
- methods.pos_default(true);
436
-
437
- }
438
-
439
- } else if (settings.$li.length) {
440
-
441
- methods.pos_modal($nub);
442
-
443
- }
444
-
445
- if (toggle) {
446
- settings.$next_tip.hide();
447
- settings.$next_tip.css('visibility', 'visible');
448
- }
449
-
450
- },
451
-
452
- pos_phone : function (init) {
453
- var tip_height = settings.$next_tip.outerHeight(),
454
- tip_offset = settings.$next_tip.offset(),
455
- target_height = settings.$target.outerHeight(),
456
- $nub = $('.joyride-nub', settings.$next_tip),
457
- nub_height = Math.ceil($nub.outerHeight() / 2),
458
- toggle = init || false;
459
-
460
- $nub.removeClass('bottom')
461
- .removeClass('top')
462
- .removeClass('right')
463
- .removeClass('left');
464
-
465
- if (toggle) {
466
- settings.$next_tip.css('visibility', 'hidden');
467
- settings.$next_tip.show();
468
- }
469
-
470
- if (!/body/i.test(settings.$target.selector)) {
471
-
472
- if (methods.top()) {
473
-
474
- settings.$next_tip.offset({top: settings.$target.offset().top - tip_height - nub_height});
475
- $nub.addClass('bottom');
476
-
477
- } else {
478
-
479
- settings.$next_tip.offset({top: settings.$target.offset().top + target_height + nub_height});
480
- $nub.addClass('top');
481
-
482
- }
483
-
484
- } else if (settings.$li.length) {
485
-
486
- methods.pos_modal($nub);
487
-
488
- }
489
-
490
- if (toggle) {
491
- settings.$next_tip.hide();
492
- settings.$next_tip.css('visibility', 'visible');
493
- }
494
- },
495
-
496
- pos_modal : function ($nub) {
497
- methods.center();
498
- $nub.hide();
499
-
500
- if ($('.joyride-modal-bg').length < 1) {
501
- $('body').append('<div class="joyride-modal-bg">').show();
502
- }
503
-
504
- if (/pop/i.test(settings.tipAnimation)) {
505
- $('.joyride-modal-bg').show();
506
- } else {
507
- $('.joyride-modal-bg').fadeIn(settings.tipAnimationFadeSpeed);
508
- }
509
- },
510
-
511
- center : function () {
512
- var $w = settings.$window;
513
-
514
- settings.$next_tip.css({
515
- top : ((($w.height() - settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
516
- left : ((($w.width() - settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
517
- });
518
-
519
- return true;
520
- },
521
-
522
- bottom : function () {
523
- return /bottom/i.test(settings.tipSettings.tipLocation);
524
- },
525
-
526
- top : function () {
527
- return /top/i.test(settings.tipSettings.tipLocation);
528
- },
529
-
530
- right : function () {
531
- return /right/i.test(settings.tipSettings.tipLocation);
532
- },
533
-
534
- left : function () {
535
- return /left/i.test(settings.tipSettings.tipLocation);
536
- },
537
-
538
- corners : function (el) {
539
- var w = settings.$window,
540
- right = w.width() + w.scrollLeft(),
541
- bottom = w.width() + w.scrollTop();
542
-
543
- return [
544
- el.offset().top <= w.scrollTop(),
545
- right <= el.offset().left + el.outerWidth(),
546
- bottom <= el.offset().top + el.outerHeight(),
547
- w.scrollLeft() >= el.offset().left
548
- ];
549
- },
550
-
551
- visible : function (hidden_corners) {
552
- var i = hidden_corners.length;
553
-
554
- while (i--) {
555
- if (hidden_corners[i]) return false;
556
- }
557
-
558
- return true;
559
- },
560
-
561
- nub_position : function (nub, pos, def) {
562
- if (pos === 'auto') {
563
- nub.addClass(def);
564
- } else {
565
- nub.addClass(pos);
566
- }
567
- },
568
-
569
- startTimer : function () {
570
- if (settings.$li.length) {
571
- settings.automate = setTimeout(function () {
572
- methods.hide();
573
- methods.show();
574
- methods.startTimer();
575
- }, settings.timer);
576
- } else {
577
- clearTimeout(settings.automate);
578
- }
579
- },
580
-
581
- end : function () {
582
- if (settings.cookieMonster) {
583
- $.cookie(settings.cookieName, 'ridden', { expires: 365, domain: settings.cookieDomain });
584
- }
585
-
586
- if (settings.timer > 0) {
587
- clearTimeout(settings.automate);
588
- }
589
-
590
- $('.joyride-modal-bg').hide();
591
- settings.$current_tip.hide();
592
- settings.postStepCallback(settings.$li.index(), settings.$current_tip);
593
- settings.postRideCallback(settings.$li.index(), settings.$current_tip);
594
- },
595
-
596
- jquery_check : function () {
597
- // define on() and off() for older jQuery
598
- if (!$.isFunction($.fn.on)) {
599
-
600
- $.fn.on = function (types, sel, fn) {
601
-
602
- return this.delegate(sel, types, fn);
603
-
604
- };
605
-
606
- $.fn.off = function (types, sel, fn) {
607
-
608
- return this.undelegate(sel, types, fn);
609
-
610
- };
611
-
612
- return false;
613
- }
614
-
615
- return true;
616
- },
617
-
618
- outerHTML : function (el) {
619
- // support FireFox < 11
620
- return el.outerHTML || new XMLSerializer().serializeToString(el);
621
- },
622
-
623
- version : function () {
624
- return settings.version;
625
- }
626
-
627
- };
628
-
629
- $.fn.joyride = function (method) {
630
- if (methods[method]) {
631
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
632
- } else if (typeof method === 'object' || !method) {
633
- return methods.init.apply(this, arguments);
634
- } else {
635
- $.error('Method ' + method + ' does not exist on jQuery.joyride');
636
- }
637
- };
638
-
639
- }(jQuery, this));