ns-styleguide 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/style-guide/_style-guide.scss +4 -0
  3. data/style-guide/global/_base.scss +33 -0
  4. data/style-guide/global/_colors.scss +24 -0
  5. data/style-guide/global/_extendables.scss +16 -0
  6. data/style-guide/global/_functions.scss +5 -0
  7. data/style-guide/global/_mixins.scss +5 -0
  8. data/style-guide/global/_variables.scss +15 -0
  9. data/templates/project/assets/6.jpg +0 -0
  10. data/templates/project/assets/_nsfont/_comment.svg +8 -0
  11. data/templates/project/assets/_nsfont/_default-user.svg +12 -0
  12. data/templates/project/assets/_nsfont/_home.svg +12 -0
  13. data/templates/project/assets/_nsfont/_notify.svg +13 -0
  14. data/templates/project/assets/_nsfont/_pillbox.svg +27 -0
  15. data/templates/project/assets/_nsfont/_search.svg +12 -0
  16. data/templates/project/assets/_nsfont/bs-circulatory.svg +26 -0
  17. data/templates/project/assets/_nsfont/bs-digestive.svg +28 -0
  18. data/templates/project/assets/_nsfont/bs-endocrine.svg +33 -0
  19. data/templates/project/assets/_nsfont/bs-immune.svg +31 -0
  20. data/templates/project/assets/_nsfont/bs-muscular-skeletal.svg +119 -0
  21. data/templates/project/assets/_nsfont/bs-nervous.svg +31 -0
  22. data/templates/project/assets/_nsfont/bs-reprodutive.svg +29 -0
  23. data/templates/project/assets/_nsfont/bs-respiratory.svg +17 -0
  24. data/templates/project/assets/_nsfont/ls-athletic.svg +17 -0
  25. data/templates/project/assets/_nsfont/ls-diet.svg +21 -0
  26. data/templates/project/assets/_nsfont/ls-energyvitality.svg +14 -0
  27. data/templates/project/assets/_nsfont/ls-mentalacuity.svg +34 -0
  28. data/templates/project/assets/_nsfont/ls-sexual.svg +42 -0
  29. data/templates/project/assets/_nsfont/ls-weightcontrol.svg +17 -0
  30. data/templates/project/assets/_nsfont/nsa-check.svg +7 -0
  31. data/templates/project/assets/_nsfont/nsa-questionmark.svg +15 -0
  32. data/templates/project/assets/_nsfont/nsa-xmark.svg +10 -0
  33. data/templates/project/assets/_nsfont/st-botanical.svg +18 -0
  34. data/templates/project/assets/_nsfont/st-food.svg +24 -0
  35. data/templates/project/assets/_nsfont/st-mineral.svg +15 -0
  36. data/templates/project/assets/_nsfont/st-other.svg +9 -0
  37. data/templates/project/assets/_nsfont/st-vitamin.svg +25 -0
  38. data/templates/project/assets/_nsfont/vote-down.svg +10 -0
  39. data/templates/project/assets/_nsfont/vote-up.svg +10 -0
  40. data/templates/project/assets/_nsfont/yp-age.svg +22 -0
  41. data/templates/project/assets/_nsfont/yp-gender.svg +16 -0
  42. data/templates/project/assets/_nsfont/yp-preventiontherapy.svg +109 -0
  43. data/templates/project/assets/aloe-vera.jpg +0 -0
  44. data/templates/project/assets/alzheimers-brainpuzzle-512.jpg +0 -0
  45. data/templates/project/assets/blurred1.jpg +0 -0
  46. data/templates/project/assets/blurred5.jpg +0 -0
  47. data/templates/project/assets/blurred6.jpg +0 -0
  48. data/templates/project/assets/botanical.svg +18 -0
  49. data/templates/project/assets/capsule.jpg +0 -0
  50. data/templates/project/assets/clouds.jpg +0 -0
  51. data/templates/project/assets/clouds.png +0 -0
  52. data/templates/project/assets/factorfiction-s3d0b80354a.png +0 -0
  53. data/templates/project/assets/factorfiction/factorfiction.png +0 -0
  54. data/templates/project/assets/factorfiction/factorfiction.svg +420 -0
  55. data/templates/project/assets/fff.png +0 -0
  56. data/templates/project/assets/food.svg +24 -0
  57. data/templates/project/assets/foundation/orbit/bullets.jpg +0 -0
  58. data/templates/project/assets/foundation/orbit/left-arrow-small.png +0 -0
  59. data/templates/project/assets/foundation/orbit/left-arrow.png +0 -0
  60. data/templates/project/assets/foundation/orbit/loading.gif +0 -0
  61. data/templates/project/assets/foundation/orbit/mask-black.png +0 -0
  62. data/templates/project/assets/foundation/orbit/pause-black.png +0 -0
  63. data/templates/project/assets/foundation/orbit/right-arrow-small.png +0 -0
  64. data/templates/project/assets/foundation/orbit/right-arrow.png +0 -0
  65. data/templates/project/assets/foundation/orbit/rotator-black.png +0 -0
  66. data/templates/project/assets/foundation/orbit/timer-black.png +0 -0
  67. data/templates/project/assets/glyphicons-halflings-white.png +0 -0
  68. data/templates/project/assets/glyphicons-halflings.png +0 -0
  69. data/templates/project/assets/hero.jpg +0 -0
  70. data/templates/project/assets/hero2.jpg +0 -0
  71. data/templates/project/assets/hero3.jpg +0 -0
  72. data/templates/project/assets/ice.jpg +0 -0
  73. data/templates/project/assets/iceberg.jpg +0 -0
  74. data/templates/project/assets/landing.jpg +0 -0
  75. data/templates/project/assets/mineral.svg +15 -0
  76. data/templates/project/assets/moon.jpg +0 -0
  77. data/templates/project/assets/ns-logo.svg +177 -0
  78. data/templates/project/assets/nslogo-s56b550b473.png +0 -0
  79. data/templates/project/assets/nslogo/nslogo.png +0 -0
  80. data/templates/project/assets/nslogo/nslogo.svg +177 -0
  81. data/templates/project/assets/other.svg +9 -0
  82. data/templates/project/assets/pillbox-hover.svg +33 -0
  83. data/templates/project/assets/pillbox-image.png +0 -0
  84. data/templates/project/assets/pillbox-image.svg +7880 -0
  85. data/templates/project/assets/pillbox.svg +27 -0
  86. data/templates/project/assets/rocket.jpg +0 -0
  87. data/templates/project/assets/shuttle.jpeg +0 -0
  88. data/templates/project/assets/svg/community-clear.svg +82 -0
  89. data/templates/project/assets/svg/community.svg +64 -0
  90. data/templates/project/assets/svg/conditions.svg +18 -0
  91. data/templates/project/assets/svg/experts.svg +32 -0
  92. data/templates/project/assets/svg/fact-or-fiction.svg +420 -0
  93. data/templates/project/assets/svg/lifestyle.svg +22 -0
  94. data/templates/project/assets/svg/perspective.svg +22 -0
  95. data/templates/project/assets/svg/supplements.svg +19 -0
  96. data/templates/project/assets/svgicons-s95620826ea.png +0 -0
  97. data/templates/project/assets/svgicons/community.png +0 -0
  98. data/templates/project/assets/svgicons/community.svg +55 -0
  99. data/templates/project/assets/svgicons/conditions.png +0 -0
  100. data/templates/project/assets/svgicons/conditions.svg +16 -0
  101. data/templates/project/assets/svgicons/experts.png +0 -0
  102. data/templates/project/assets/svgicons/experts.svg +30 -0
  103. data/templates/project/assets/svgicons/lifestyle.png +0 -0
  104. data/templates/project/assets/svgicons/lifestyle.svg +20 -0
  105. data/templates/project/assets/svgicons/supplements.png +0 -0
  106. data/templates/project/assets/svgicons/supplements.svg +17 -0
  107. data/templates/project/assets/svgicons/your-perspective.png +0 -0
  108. data/templates/project/assets/svgicons/your-perspective.svg +20 -0
  109. data/templates/project/assets/users/kp.jpg +0 -0
  110. data/templates/project/assets/video_placeholder.jpg +0 -0
  111. data/templates/project/assets/vitamin.svg +25 -0
  112. data/templates/project/component.json +9 -0
  113. data/templates/project/libs/bootstrap-modal.js +374 -0
  114. data/templates/project/libs/bootstrap/README.md +106 -0
  115. data/templates/project/libs/bootstrap/application.js +156 -0
  116. data/templates/project/libs/bootstrap/bootstrap-affix.js +117 -0
  117. data/templates/project/libs/bootstrap/bootstrap-alert.js +99 -0
  118. data/templates/project/libs/bootstrap/bootstrap-button.js +105 -0
  119. data/templates/project/libs/bootstrap/bootstrap-carousel.js +207 -0
  120. data/templates/project/libs/bootstrap/bootstrap-collapse.js +167 -0
  121. data/templates/project/libs/bootstrap/bootstrap-dropdown.js +165 -0
  122. data/templates/project/libs/bootstrap/bootstrap-modal.js +251 -0
  123. data/templates/project/libs/bootstrap/bootstrap-popover.js +114 -0
  124. data/templates/project/libs/bootstrap/bootstrap-scrollspy.js +162 -0
  125. data/templates/project/libs/bootstrap/bootstrap-tab.js +144 -0
  126. data/templates/project/libs/bootstrap/bootstrap-tooltip.js +361 -0
  127. data/templates/project/libs/bootstrap/bootstrap-transition.js +60 -0
  128. data/templates/project/libs/bootstrap/bootstrap-typeahead.js +335 -0
  129. data/templates/project/libs/bootstrap/bootstrap.js +2280 -0
  130. data/templates/project/libs/bootstrap/bootstrap.min.js +6 -0
  131. data/templates/project/libs/bootstrap/holder/holder.js +401 -0
  132. data/templates/project/libs/bootstrap/html5shiv.js +8 -0
  133. data/templates/project/libs/bootstrap/jquery.js +5 -0
  134. data/templates/project/libs/bootstrap/respond/respond.min.js +6 -0
  135. data/templates/project/libs/equalheights.js +46 -0
  136. data/templates/project/libs/foundation/foundation.alerts.js +50 -0
  137. data/templates/project/libs/foundation/foundation.clearing.js +516 -0
  138. data/templates/project/libs/foundation/foundation.cookie.js +74 -0
  139. data/templates/project/libs/foundation/foundation.dropdown.js +175 -0
  140. data/templates/project/libs/foundation/foundation.forms.js +513 -0
  141. data/templates/project/libs/foundation/foundation.joyride.js +831 -0
  142. data/templates/project/libs/foundation/foundation.js +401 -0
  143. data/templates/project/libs/foundation/foundation.magellan.js +130 -0
  144. data/templates/project/libs/foundation/foundation.orbit.js +373 -0
  145. data/templates/project/libs/foundation/foundation.placeholder.js +159 -0
  146. data/templates/project/libs/foundation/foundation.reveal.js +277 -0
  147. data/templates/project/libs/foundation/foundation.section.js +407 -0
  148. data/templates/project/libs/foundation/foundation.tooltips.js +200 -0
  149. data/templates/project/libs/foundation/foundation.topbar.js +245 -0
  150. data/templates/project/libs/hello.coffee +1 -0
  151. data/templates/project/libs/helper.js +385 -0
  152. data/templates/project/libs/jquery.magnific-popup.js +1783 -0
  153. data/templates/project/libs/jquery.magnific-popup.min.js +4 -0
  154. data/templates/project/libs/jquery.mixitup.min.js +43 -0
  155. data/templates/project/libs/main.js +1 -0
  156. data/templates/project/libs/ns.js +128 -0
  157. data/templates/project/libs/select2-3.4.0/README.md +83 -0
  158. data/templates/project/libs/select2-3.4.0/component.json +8 -0
  159. data/templates/project/libs/select2-3.4.0/release.sh +69 -0
  160. data/templates/project/libs/select2-3.4.0/select2-spinner.gif +0 -0
  161. data/templates/project/libs/select2-3.4.0/select2.css +652 -0
  162. data/templates/project/libs/select2-3.4.0/select2.jquery.json +36 -0
  163. data/templates/project/libs/select2-3.4.0/select2.js +3054 -0
  164. data/templates/project/libs/select2-3.4.0/select2.min.js +22 -0
  165. data/templates/project/libs/select2-3.4.0/select2.png +0 -0
  166. data/templates/project/libs/select2-3.4.0/select2_locale_ca.js +17 -0
  167. data/templates/project/libs/select2-3.4.0/select2_locale_cs.js +49 -0
  168. data/templates/project/libs/select2-3.4.0/select2_locale_da.js +17 -0
  169. data/templates/project/libs/select2-3.4.0/select2_locale_de.js +15 -0
  170. data/templates/project/libs/select2-3.4.0/select2_locale_en.js.template +17 -0
  171. data/templates/project/libs/select2-3.4.0/select2_locale_es.js +15 -0
  172. data/templates/project/libs/select2-3.4.0/select2_locale_et.js +17 -0
  173. data/templates/project/libs/select2-3.4.0/select2_locale_eu.js +43 -0
  174. data/templates/project/libs/select2-3.4.0/select2_locale_fr.js +15 -0
  175. data/templates/project/libs/select2-3.4.0/select2_locale_gl.js +43 -0
  176. data/templates/project/libs/select2-3.4.0/select2_locale_he.js +17 -0
  177. data/templates/project/libs/select2-3.4.0/select2_locale_hr.js +42 -0
  178. data/templates/project/libs/select2-3.4.0/select2_locale_hu.js +15 -0
  179. data/templates/project/libs/select2-3.4.0/select2_locale_is.js +16 -0
  180. data/templates/project/libs/select2-3.4.0/select2_locale_it.js +15 -0
  181. data/templates/project/libs/select2-3.4.0/select2_locale_ja.js +15 -0
  182. data/templates/project/libs/select2-3.4.0/select2_locale_lt.js +29 -0
  183. data/templates/project/libs/select2-3.4.0/select2_locale_lv.js +16 -0
  184. data/templates/project/libs/select2-3.4.0/select2_locale_mk.js +17 -0
  185. data/templates/project/libs/select2-3.4.0/select2_locale_nl.js +15 -0
  186. data/templates/project/libs/select2-3.4.0/select2_locale_no.js +18 -0
  187. data/templates/project/libs/select2-3.4.0/select2_locale_pl.js +37 -0
  188. data/templates/project/libs/select2-3.4.0/select2_locale_pt-BR.js +15 -0
  189. data/templates/project/libs/select2-3.4.0/select2_locale_pt-PT.js +15 -0
  190. data/templates/project/libs/select2-3.4.0/select2_locale_ro.js +15 -0
  191. data/templates/project/libs/select2-3.4.0/select2_locale_ru.js +15 -0
  192. data/templates/project/libs/select2-3.4.0/select2_locale_sk.js +48 -0
  193. data/templates/project/libs/select2-3.4.0/select2_locale_sv.js +17 -0
  194. data/templates/project/libs/select2-3.4.0/select2_locale_tr.js +17 -0
  195. data/templates/project/libs/select2-3.4.0/select2_locale_ua.js +17 -0
  196. data/templates/project/libs/select2-3.4.0/select2_locale_vi.js +18 -0
  197. data/templates/project/libs/select2-3.4.0/select2_locale_zh-CN.js +14 -0
  198. data/templates/project/libs/select2-3.4.0/select2_locale_zh-TW.js +14 -0
  199. data/templates/project/libs/select2-3.4.0/select2x2.png +0 -0
  200. data/templates/project/libs/vendor/modernizr-2.6.2.min.js +4 -0
  201. data/templates/project/libs/vendor/zepto.js +1884 -0
  202. data/templates/project/libs/vendor/zepto.min.js +2 -0
  203. data/templates/project/manifest.rb +9 -0
  204. data/templates/project/style.scss.erb +2 -0
  205. metadata +288 -0
@@ -0,0 +1,831 @@
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.1.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
+ },
46
+
47
+ settings : {},
48
+
49
+ init : function (scope, method, options) {
50
+ this.scope = scope || this.scope;
51
+ Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay');
52
+
53
+ if (typeof method === 'object') {
54
+ $.extend(true, this.settings, this.defaults, method);
55
+ } else {
56
+ $.extend(true, this.settings, this.defaults, options);
57
+ }
58
+
59
+ if (typeof method != 'string') {
60
+ if (!this.settings.init) this.events();
61
+
62
+ return this.settings.init;
63
+ } else {
64
+ return this[method].call(this, options);
65
+ }
66
+ },
67
+
68
+ events : function () {
69
+ var self = this;
70
+
71
+ $(this.scope)
72
+ .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
73
+ e.preventDefault();
74
+
75
+ if (this.settings.$li.next().length < 1) {
76
+ this.end();
77
+ } else if (this.settings.timer > 0) {
78
+ clearTimeout(this.settings.automate);
79
+ this.hide();
80
+ this.show();
81
+ this.startTimer();
82
+ } else {
83
+ this.hide();
84
+ this.show();
85
+ }
86
+
87
+ }.bind(this))
88
+
89
+ .on('click.joyride', '.joyride-close-tip', function (e) {
90
+ e.preventDefault();
91
+ this.end();
92
+ }.bind(this));
93
+
94
+ $(window).on('resize.fndtn.joyride', self.throttle(function () {
95
+ if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
96
+ if (self.settings.exposed.length > 0) {
97
+ var $els = $(self.settings.exposed);
98
+
99
+ $els.each(function () {
100
+ var $this = $(this);
101
+ self.un_expose($this);
102
+ self.expose($this);
103
+ });
104
+ }
105
+
106
+ if (self.is_phone()) {
107
+ self.pos_phone();
108
+ } else {
109
+ self.pos_default(false, true);
110
+ }
111
+ }
112
+ }, 100));
113
+
114
+ this.settings.init = true;
115
+ },
116
+
117
+ start : function () {
118
+ var self = this,
119
+ $this = $(this.scope).find('[data-joyride]'),
120
+ integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
121
+ int_settings_count = integer_settings.length;
122
+
123
+ if (!this.settings.init) this.init();
124
+
125
+ // non configureable settings
126
+ this.settings.$content_el = $this;
127
+ this.settings.$body = $(this.settings.tipContainer);
128
+ this.settings.body_offset = $(this.settings.tipContainer).position();
129
+ this.settings.$tip_content = this.settings.$content_el.find('> li');
130
+ this.settings.paused = false;
131
+ this.settings.attempts = 0;
132
+
133
+ this.settings.tipLocationPatterns = {
134
+ top: ['bottom'],
135
+ bottom: [], // bottom should not need to be repositioned
136
+ left: ['right', 'top', 'bottom'],
137
+ right: ['left', 'top', 'bottom']
138
+ };
139
+
140
+ // can we create cookies?
141
+ if (typeof $.cookie !== 'function') {
142
+ this.settings.cookieMonster = false;
143
+ }
144
+
145
+ // generate the tips and insert into dom.
146
+ if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) {
147
+ this.settings.$tip_content.each(function (index) {
148
+ var $this = $(this);
149
+ $.extend(true, self.settings, self.data_options($this));
150
+ // Make sure that settings parsed from data_options are integers where necessary
151
+ for (var i = int_settings_count - 1; i >= 0; i--) {
152
+ self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
153
+ }
154
+ self.create({$li : $this, index : index});
155
+ });
156
+
157
+ // show first tip
158
+ if (!this.settings.startTimerOnClick && this.settings.timer > 0) {
159
+ this.show('init');
160
+ this.startTimer();
161
+ } else {
162
+ this.show('init');
163
+ }
164
+
165
+ }
166
+ },
167
+
168
+ resume : function () {
169
+ this.set_li();
170
+ this.show();
171
+ },
172
+
173
+ tip_template : function (opts) {
174
+ var $blank, content;
175
+
176
+ opts.tip_class = opts.tip_class || '';
177
+
178
+ $blank = $(this.settings.template.tip).addClass(opts.tip_class);
179
+ content = $.trim($(opts.li).html()) +
180
+ this.button_text(opts.button_text) +
181
+ this.settings.template.link +
182
+ this.timer_instance(opts.index);
183
+
184
+ $blank.append($(this.settings.template.wrapper));
185
+ $blank.first().attr('data-index', opts.index);
186
+ $('.joyride-content-wrapper', $blank).append(content);
187
+
188
+ return $blank[0];
189
+ },
190
+
191
+ timer_instance : function (index) {
192
+ var txt;
193
+
194
+ if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) {
195
+ txt = '';
196
+ } else {
197
+ txt = this.outerHTML($(this.settings.template.timer)[0]);
198
+ }
199
+ return txt;
200
+ },
201
+
202
+ button_text : function (txt) {
203
+ if (this.settings.nextButton) {
204
+ txt = $.trim(txt) || 'Next';
205
+ txt = this.outerHTML($(this.settings.template.button).append(txt)[0]);
206
+ } else {
207
+ txt = '';
208
+ }
209
+ return txt;
210
+ },
211
+
212
+ create : function (opts) {
213
+ var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
214
+ tipClass = opts.$li.attr('class'),
215
+ $tip_content = $(this.tip_template({
216
+ tip_class : tipClass,
217
+ index : opts.index,
218
+ button_text : buttonText,
219
+ li : opts.$li
220
+ }));
221
+
222
+ $(this.settings.tipContainer).append($tip_content);
223
+ },
224
+
225
+ show : function (init) {
226
+ var $timer = null;
227
+
228
+ // are we paused?
229
+ if (this.settings.$li === undefined
230
+ || ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) {
231
+
232
+ // don't go to the next li if the tour was paused
233
+ if (this.settings.paused) {
234
+ this.settings.paused = false;
235
+ } else {
236
+ this.set_li(init);
237
+ }
238
+
239
+ this.settings.attempts = 0;
240
+
241
+ if (this.settings.$li.length && this.settings.$target.length > 0) {
242
+ if (init) { //run when we first start
243
+ this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip);
244
+ if (this.settings.modal) {
245
+ this.show_modal();
246
+ }
247
+ }
248
+
249
+ this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip);
250
+
251
+ if (this.settings.modal && this.settings.expose) {
252
+ this.expose();
253
+ }
254
+
255
+ this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li));
256
+
257
+ this.settings.timer = parseInt(this.settings.timer, 10);
258
+
259
+ this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation];
260
+
261
+ // scroll if not modal
262
+ if (!/body/i.test(this.settings.$target.selector)) {
263
+ this.scroll_to();
264
+ }
265
+
266
+ if (this.is_phone()) {
267
+ this.pos_phone(true);
268
+ } else {
269
+ this.pos_default(true);
270
+ }
271
+
272
+ $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
273
+
274
+ if (/pop/i.test(this.settings.tipAnimation)) {
275
+
276
+ $timer.width(0);
277
+
278
+ if (this.settings.timer > 0) {
279
+
280
+ this.settings.$next_tip.show();
281
+
282
+ this.delay(function () {
283
+ $timer.animate({
284
+ width: $timer.parent().width()
285
+ }, this.settings.timer, 'linear');
286
+ }.bind(this), this.settings.tipAnimationFadeSpeed);
287
+
288
+ } else {
289
+ this.settings.$next_tip.show();
290
+
291
+ }
292
+
293
+
294
+ } else if (/fade/i.test(this.settings.tipAnimation)) {
295
+
296
+ $timer.width(0);
297
+
298
+ if (this.settings.timer > 0) {
299
+
300
+ this.settings.$next_tip
301
+ .fadeIn(this.settings.tipAnimationFadeSpeed)
302
+ .show();
303
+
304
+ this.delay(function () {
305
+ $timer.animate({
306
+ width: $timer.parent().width()
307
+ }, this.settings.timer, 'linear');
308
+ }.bind(this), this.settings.tipAnimationFadeSpeed);
309
+
310
+ } else {
311
+ this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed);
312
+
313
+ }
314
+ }
315
+
316
+ this.settings.$current_tip = this.settings.$next_tip;
317
+
318
+ // skip non-existant targets
319
+ } else if (this.settings.$li && this.settings.$target.length < 1) {
320
+
321
+ this.show();
322
+
323
+ } else {
324
+
325
+ this.end();
326
+
327
+ }
328
+ } else {
329
+
330
+ this.settings.paused = true;
331
+
332
+ }
333
+
334
+ },
335
+
336
+ is_phone : function () {
337
+ if (Modernizr) {
338
+ return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;
339
+ }
340
+
341
+ return (this.settings.$window.width() < 767);
342
+ },
343
+
344
+ hide : function () {
345
+ if (this.settings.modal && this.settings.expose) {
346
+ this.un_expose();
347
+ }
348
+
349
+ if (!this.settings.modal) {
350
+ $('.joyride-modal-bg').hide();
351
+ }
352
+ this.settings.$current_tip.hide();
353
+ this.settings.postStepCallback(this.settings.$li.index(),
354
+ this.settings.$current_tip);
355
+ },
356
+
357
+ set_li : function (init) {
358
+ if (init) {
359
+ this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset);
360
+ this.set_next_tip();
361
+ this.settings.$current_tip = this.settings.$next_tip;
362
+ } else {
363
+ this.settings.$li = this.settings.$li.next();
364
+ this.set_next_tip();
365
+ }
366
+
367
+ this.set_target();
368
+ },
369
+
370
+ set_next_tip : function () {
371
+ this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");
372
+ this.settings.$next_tip.data('closed', '');
373
+ },
374
+
375
+ set_target : function () {
376
+ var cl = this.settings.$li.attr('data-class'),
377
+ id = this.settings.$li.attr('data-id'),
378
+ $sel = function () {
379
+ if (id) {
380
+ return $(document.getElementById(id));
381
+ } else if (cl) {
382
+ return $('.' + cl).first();
383
+ } else {
384
+ return $('body');
385
+ }
386
+ };
387
+
388
+ this.settings.$target = $sel();
389
+ },
390
+
391
+ scroll_to : function () {
392
+ var window_half, tipOffset;
393
+
394
+ window_half = $(window).height() / 2;
395
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip));
396
+ if (tipOffset > 0) {
397
+ this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed);
398
+ }
399
+ },
400
+
401
+ paused : function () {
402
+ return ($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1);
403
+ },
404
+
405
+ restart : function () {
406
+ this.hide();
407
+ this.settings.$li = undefined;
408
+ this.show('init');
409
+ },
410
+
411
+ pos_default : function (init, resizing) {
412
+ var half_fold = Math.ceil($(window).height() / 2),
413
+ tip_position = this.settings.$next_tip.offset(),
414
+ $nub = this.settings.$next_tip.find('.joyride-nub'),
415
+ nub_width = Math.ceil(this.outerWidth($nub) / 2),
416
+ nub_height = Math.ceil(this.outerHeight($nub) / 2),
417
+ toggle = init || false;
418
+
419
+ // tip must not be "display: none" to calculate position
420
+ if (toggle) {
421
+ this.settings.$next_tip.css('visibility', 'hidden');
422
+ this.settings.$next_tip.show();
423
+ }
424
+
425
+ if (typeof resizing === 'undefined') {
426
+ resizing = false;
427
+ }
428
+
429
+ if (!/body/i.test(this.settings.$target.selector)) {
430
+
431
+ if (this.bottom()) {
432
+ var leftOffset = this.settings.$target.offset().left;
433
+ if (Foundation.rtl) {
434
+ leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
435
+ }
436
+ this.settings.$next_tip.css({
437
+ top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)),
438
+ left: leftOffset});
439
+
440
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top');
441
+
442
+ } else if (this.top()) {
443
+ var leftOffset = this.settings.$target.offset().left;
444
+ if (Foundation.rtl) {
445
+ leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
446
+ }
447
+ this.settings.$next_tip.css({
448
+ top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height),
449
+ left: leftOffset});
450
+
451
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom');
452
+
453
+ } else if (this.right()) {
454
+
455
+ this.settings.$next_tip.css({
456
+ top: this.settings.$target.offset().top,
457
+ left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
458
+
459
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left');
460
+
461
+ } else if (this.left()) {
462
+
463
+ this.settings.$next_tip.css({
464
+ top: this.settings.$target.offset().top,
465
+ left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
466
+
467
+ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right');
468
+
469
+ }
470
+
471
+ if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) {
472
+
473
+ $nub.removeClass('bottom')
474
+ .removeClass('top')
475
+ .removeClass('right')
476
+ .removeClass('left');
477
+
478
+ this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts];
479
+
480
+ this.settings.attempts++;
481
+
482
+ this.pos_default();
483
+
484
+ }
485
+
486
+ } else if (this.settings.$li.length) {
487
+
488
+ this.pos_modal($nub);
489
+
490
+ }
491
+
492
+ if (toggle) {
493
+ this.settings.$next_tip.hide();
494
+ this.settings.$next_tip.css('visibility', 'visible');
495
+ }
496
+
497
+ },
498
+
499
+ pos_phone : function (init) {
500
+ var tip_height = this.outerHeight(this.settings.$next_tip),
501
+ tip_offset = this.settings.$next_tip.offset(),
502
+ target_height = this.outerHeight(this.settings.$target),
503
+ $nub = $('.joyride-nub', this.settings.$next_tip),
504
+ nub_height = Math.ceil(this.outerHeight($nub) / 2),
505
+ toggle = init || false;
506
+
507
+ $nub.removeClass('bottom')
508
+ .removeClass('top')
509
+ .removeClass('right')
510
+ .removeClass('left');
511
+
512
+ if (toggle) {
513
+ this.settings.$next_tip.css('visibility', 'hidden');
514
+ this.settings.$next_tip.show();
515
+ }
516
+
517
+ if (!/body/i.test(this.settings.$target.selector)) {
518
+
519
+ if (this.top()) {
520
+
521
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
522
+ $nub.addClass('bottom');
523
+
524
+ } else {
525
+
526
+ this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
527
+ $nub.addClass('top');
528
+
529
+ }
530
+
531
+ } else if (this.settings.$li.length) {
532
+ this.pos_modal($nub);
533
+ }
534
+
535
+ if (toggle) {
536
+ this.settings.$next_tip.hide();
537
+ this.settings.$next_tip.css('visibility', 'visible');
538
+ }
539
+ },
540
+
541
+ pos_modal : function ($nub) {
542
+ this.center();
543
+ $nub.hide();
544
+
545
+ this.show_modal();
546
+ },
547
+
548
+ show_modal : function () {
549
+ if (!this.settings.$next_tip.data('closed')) {
550
+ var joyridemodalbg = $('.joyride-modal-bg');
551
+ if (joyridemodalbg.length < 1) {
552
+ $('body').append(this.settings.template.modal).show();
553
+ }
554
+
555
+ if (/pop/i.test(this.settings.tipAnimation)) {
556
+ joyridemodalbg.show();
557
+ } else {
558
+ joyridemodalbg.fadeIn(this.settings.tipAnimationFadeSpeed);
559
+ }
560
+ }
561
+ },
562
+
563
+ expose : function () {
564
+ var expose,
565
+ exposeCover,
566
+ el,
567
+ origCSS,
568
+ randId = 'expose-'+Math.floor(Math.random()*10000);
569
+
570
+ if (arguments.length > 0 && arguments[0] instanceof $) {
571
+ el = arguments[0];
572
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
573
+ el = this.settings.$target;
574
+ } else {
575
+ return false;
576
+ }
577
+
578
+ if(el.length < 1){
579
+ if(window.console){
580
+ console.error('element not valid', el);
581
+ }
582
+ return false;
583
+ }
584
+
585
+ expose = $(this.settings.template.expose);
586
+ this.settings.$body.append(expose);
587
+ expose.css({
588
+ top: el.offset().top,
589
+ left: el.offset().left,
590
+ width: this.outerWidth(el, true),
591
+ height: this.outerHeight(el, true)
592
+ });
593
+
594
+ exposeCover = $(this.settings.template.exposeCover);
595
+
596
+ origCSS = {
597
+ zIndex: el.css('z-index'),
598
+ position: el.css('position')
599
+ };
600
+
601
+ el.css('z-index',parseInt(expose.css('z-index'))+1);
602
+
603
+ if (origCSS.position == 'static') {
604
+ el.css('position','relative');
605
+ }
606
+
607
+ el.data('expose-css',origCSS);
608
+
609
+ exposeCover.css({
610
+ top: el.offset().top,
611
+ left: el.offset().left,
612
+ width: this.outerWidth(el, true),
613
+ height: this.outerHeight(el, true)
614
+ });
615
+
616
+ this.settings.$body.append(exposeCover);
617
+ expose.addClass(randId);
618
+ exposeCover.addClass(randId);
619
+ el.data('expose', randId);
620
+ this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el);
621
+ this.add_exposed(el);
622
+ },
623
+
624
+ un_expose : function () {
625
+ var exposeId,
626
+ el,
627
+ expose ,
628
+ origCSS,
629
+ clearAll = false;
630
+
631
+ if (arguments.length > 0 && arguments[0] instanceof $) {
632
+ el = arguments[0];
633
+ } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
634
+ el = this.settings.$target;
635
+ } else {
636
+ return false;
637
+ }
638
+
639
+ if(el.length < 1){
640
+ if (window.console) {
641
+ console.error('element not valid', el);
642
+ }
643
+ return false;
644
+ }
645
+
646
+ exposeId = el.data('expose');
647
+ expose = $('.' + exposeId);
648
+
649
+ if (arguments.length > 1) {
650
+ clearAll = arguments[1];
651
+ }
652
+
653
+ if (clearAll === true) {
654
+ $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
655
+ } else {
656
+ expose.remove();
657
+ }
658
+
659
+ origCSS = el.data('expose-css');
660
+
661
+ if (origCSS.zIndex == 'auto') {
662
+ el.css('z-index', '');
663
+ } else {
664
+ el.css('z-index', origCSS.zIndex);
665
+ }
666
+
667
+ if (origCSS.position != el.css('position')) {
668
+ if(origCSS.position == 'static') {// this is default, no need to set it.
669
+ el.css('position', '');
670
+ } else {
671
+ el.css('position', origCSS.position);
672
+ }
673
+ }
674
+
675
+ el.removeData('expose');
676
+ el.removeData('expose-z-index');
677
+ this.remove_exposed(el);
678
+ },
679
+
680
+ add_exposed: function(el){
681
+ this.settings.exposed = this.settings.exposed || [];
682
+ if (el instanceof $ || typeof el === 'object') {
683
+ this.settings.exposed.push(el[0]);
684
+ } else if (typeof el == 'string') {
685
+ this.settings.exposed.push(el);
686
+ }
687
+ },
688
+
689
+ remove_exposed: function(el){
690
+ var search, count;
691
+ if (el instanceof $) {
692
+ search = el[0]
693
+ } else if (typeof el == 'string'){
694
+ search = el;
695
+ }
696
+
697
+ this.settings.exposed = this.settings.exposed || [];
698
+ count = this.settings.exposed.length;
699
+
700
+ for (var i=0; i < count; i++) {
701
+ if (this.settings.exposed[i] == search) {
702
+ this.settings.exposed.splice(i, 1);
703
+ return;
704
+ }
705
+ }
706
+ },
707
+
708
+ center : function () {
709
+ var $w = $(window);
710
+
711
+ this.settings.$next_tip.css({
712
+ top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()),
713
+ left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w))
714
+ });
715
+
716
+ return true;
717
+ },
718
+
719
+ bottom : function () {
720
+ return /bottom/i.test(this.settings.tipSettings.tipLocation);
721
+ },
722
+
723
+ top : function () {
724
+ return /top/i.test(this.settings.tipSettings.tipLocation);
725
+ },
726
+
727
+ right : function () {
728
+ return /right/i.test(this.settings.tipSettings.tipLocation);
729
+ },
730
+
731
+ left : function () {
732
+ return /left/i.test(this.settings.tipSettings.tipLocation);
733
+ },
734
+
735
+ corners : function (el) {
736
+ var w = $(window),
737
+ window_half = w.height() / 2,
738
+ //using this to calculate since scroll may not have finished yet.
739
+ tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
740
+ right = w.width() + this.scrollLeft(w),
741
+ offsetBottom = w.height() + tipOffset,
742
+ bottom = w.height() + w.scrollTop(),
743
+ top = w.scrollTop();
744
+
745
+ if (tipOffset < top) {
746
+ if (tipOffset < 0) {
747
+ top = 0;
748
+ } else {
749
+ top = tipOffset;
750
+ }
751
+ }
752
+
753
+ if (offsetBottom > bottom) {
754
+ bottom = offsetBottom;
755
+ }
756
+
757
+ return [
758
+ el.offset().top < top,
759
+ right < el.offset().left + el.outerWidth(),
760
+ bottom < el.offset().top + el.outerHeight(),
761
+ this.scrollLeft(w) > el.offset().left
762
+ ];
763
+ },
764
+
765
+ visible : function (hidden_corners) {
766
+ var i = hidden_corners.length;
767
+
768
+ while (i--) {
769
+ if (hidden_corners[i]) return false;
770
+ }
771
+
772
+ return true;
773
+ },
774
+
775
+ nub_position : function (nub, pos, def) {
776
+ if (pos === 'auto') {
777
+ nub.addClass(def);
778
+ } else {
779
+ nub.addClass(pos);
780
+ }
781
+ },
782
+
783
+ startTimer : function () {
784
+ if (this.settings.$li.length) {
785
+ this.settings.automate = setTimeout(function () {
786
+ this.hide();
787
+ this.show();
788
+ this.startTimer();
789
+ }.bind(this), this.settings.timer);
790
+ } else {
791
+ clearTimeout(this.settings.automate);
792
+ }
793
+ },
794
+
795
+ end : function () {
796
+ if (this.settings.cookieMonster) {
797
+ $.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain });
798
+ }
799
+
800
+ if (this.settings.timer > 0) {
801
+ clearTimeout(this.settings.automate);
802
+ }
803
+
804
+ if (this.settings.modal && this.settings.expose) {
805
+ this.un_expose();
806
+ }
807
+
808
+ this.settings.$next_tip.data('closed', true);
809
+
810
+ $('.joyride-modal-bg').hide();
811
+ this.settings.$current_tip.hide();
812
+ this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);
813
+ this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip);
814
+ $('.joyride-tip-guide').remove();
815
+ },
816
+
817
+ outerHTML : function (el) {
818
+ // support FireFox < 11
819
+ return el.outerHTML || new XMLSerializer().serializeToString(el);
820
+ },
821
+
822
+ off : function () {
823
+ $(this.scope).off('.joyride');
824
+ $(window).off('.joyride');
825
+ $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
826
+ $('.joyride-tip-guide, .joyride-modal-bg').remove();
827
+ clearTimeout(this.settings.automate);
828
+ this.settings = {};
829
+ }
830
+ };
831
+ }(Foundation.zj, this, this.document));