va_common 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/app/assets/js/va_common_main.js +16 -1
  4. data/lib/va_common/version.rb +1 -1
  5. data/lib/va_common.rb +4 -0
  6. data/va_common.gemspec +15 -0
  7. metadata +200 -177
  8. data/app/assets/js/foundation/foundation.abide.js +0 -408
  9. data/app/assets/js/foundation/foundation.accordion.js +0 -88
  10. data/app/assets/js/foundation/foundation.alert.js +0 -43
  11. data/app/assets/js/foundation/foundation.clearing.js +0 -586
  12. data/app/assets/js/foundation/foundation.dropdown.js +0 -463
  13. data/app/assets/js/foundation/foundation.equalizer.js +0 -104
  14. data/app/assets/js/foundation/foundation.interchange.js +0 -359
  15. data/app/assets/js/foundation/foundation.joyride.js +0 -932
  16. data/app/assets/js/foundation/foundation.js +0 -725
  17. data/app/assets/js/foundation/foundation.magellan.js +0 -215
  18. data/app/assets/js/foundation/foundation.offcanvas.js +0 -152
  19. data/app/assets/js/foundation/foundation.orbit.js +0 -476
  20. data/app/assets/js/foundation/foundation.reveal.js +0 -498
  21. data/app/assets/js/foundation/foundation.slider.js +0 -281
  22. data/app/assets/js/foundation/foundation.tab.js +0 -249
  23. data/app/assets/js/foundation/foundation.tooltip.js +0 -339
  24. data/app/assets/js/foundation/foundation.topbar.js +0 -458
  25. data/app/assets/js/foundation.min.js +0 -6376
  26. data/app/assets/js/vendor/html5shiv.js +0 -8
  27. data/app/assets/js/vendor/jquery-1.11.0.min.js +0 -4
  28. data/app/assets/js/vendor/jquery.js +0 -9789
  29. data/app/assets/js/vendor/jquery.smooth-scroll.js +0 -255
  30. data/app/assets/js/vendor/jquery.stellar.js +0 -651
  31. data/app/assets/js/vendor/jquery.tipsy.js +0 -258
  32. data/app/assets/js/vendor/menu.js +0 -40
  33. data/app/assets/js/vendor/modernizr.custom.js +0 -4
  34. data/app/assets/js/vendor/respond.min.js +0 -6
  35. data/app/assets/js/vendor/selectivizr-1.0.3b.js +0 -560
  36. data/app/assets/js/vendor/tota11y.min.js +0 -28
  37. data/app/assets/js/vendor/wow.min.js +0 -2
  38. data/app/assets/stylesheets/foundation/_functions.scss +0 -146
  39. data/app/assets/stylesheets/foundation/_settings.scss +0 -1467
  40. data/app/assets/stylesheets/foundation/_variables.scss +0 -1286
  41. data/app/assets/stylesheets/foundation/components/_accordion.scss +0 -157
  42. data/app/assets/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  43. data/app/assets/stylesheets/foundation/components/_block-grid.scss +0 -132
  44. data/app/assets/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  45. data/app/assets/stylesheets/foundation/components/_button-groups.scss +0 -200
  46. data/app/assets/stylesheets/foundation/components/_buttons.scss +0 -259
  47. data/app/assets/stylesheets/foundation/components/_clearing.scss +0 -256
  48. data/app/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -131
  49. data/app/assets/stylesheets/foundation/components/_dropdown.scss +0 -262
  50. data/app/assets/stylesheets/foundation/components/_flex-video.scss +0 -51
  51. data/app/assets/stylesheets/foundation/components/_forms.scss +0 -570
  52. data/app/assets/stylesheets/foundation/components/_global.scss +0 -481
  53. data/app/assets/stylesheets/foundation/components/_grid.scss +0 -289
  54. data/app/assets/stylesheets/foundation/components/_icon-bar.scss +0 -358
  55. data/app/assets/stylesheets/foundation/components/_inline-lists.scss +0 -57
  56. data/app/assets/stylesheets/foundation/components/_joyride.scss +0 -222
  57. data/app/assets/stylesheets/foundation/components/_keystrokes.scss +0 -61
  58. data/app/assets/stylesheets/foundation/components/_labels.scss +0 -106
  59. data/app/assets/stylesheets/foundation/components/_magellan.scss +0 -34
  60. data/app/assets/stylesheets/foundation/components/_offcanvas.scss +0 -515
  61. data/app/assets/stylesheets/foundation/components/_orbit.scss +0 -368
  62. data/app/assets/stylesheets/foundation/components/_pagination.scss +0 -162
  63. data/app/assets/stylesheets/foundation/components/_panels.scss +0 -101
  64. data/app/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  65. data/app/assets/stylesheets/foundation/components/_progress-bars.scss +0 -79
  66. data/app/assets/stylesheets/foundation/components/_range-slider.scss +0 -169
  67. data/app/assets/stylesheets/foundation/components/_reveal.scss +0 -202
  68. data/app/assets/stylesheets/foundation/components/_side-nav.scss +0 -116
  69. data/app/assets/stylesheets/foundation/components/_split-buttons.scss +0 -199
  70. data/app/assets/stylesheets/foundation/components/_sub-nav.scss +0 -123
  71. data/app/assets/stylesheets/foundation/components/_switches.scss +0 -238
  72. data/app/assets/stylesheets/foundation/components/_tables.scss +0 -135
  73. data/app/assets/stylesheets/foundation/components/_tabs.scss +0 -123
  74. data/app/assets/stylesheets/foundation/components/_thumbs.scss +0 -66
  75. data/app/assets/stylesheets/foundation/components/_toolbar.scss +0 -70
  76. data/app/assets/stylesheets/foundation/components/_tooltips.scss +0 -142
  77. data/app/assets/stylesheets/foundation/components/_top-bar.scss +0 -691
  78. data/app/assets/stylesheets/foundation/components/_type.scss +0 -525
  79. data/app/assets/stylesheets/foundation/components/_visibility.scss +0 -408
  80. data/app/assets/stylesheets/lib/_normalize.scss +0 -427
  81. data/app/assets/stylesheets/lib/bourbon/_bourbon-deprecated-upcoming.scss +0 -411
  82. data/app/assets/stylesheets/lib/bourbon/_bourbon.scss +0 -87
  83. data/app/assets/stylesheets/lib/bourbon/addons/_border-color.scss +0 -26
  84. data/app/assets/stylesheets/lib/bourbon/addons/_border-radius.scss +0 -48
  85. data/app/assets/stylesheets/lib/bourbon/addons/_border-style.scss +0 -25
  86. data/app/assets/stylesheets/lib/bourbon/addons/_border-width.scss +0 -25
  87. data/app/assets/stylesheets/lib/bourbon/addons/_buttons.scss +0 -64
  88. data/app/assets/stylesheets/lib/bourbon/addons/_clearfix.scss +0 -25
  89. data/app/assets/stylesheets/lib/bourbon/addons/_ellipsis.scss +0 -30
  90. data/app/assets/stylesheets/lib/bourbon/addons/_font-stacks.scss +0 -31
  91. data/app/assets/stylesheets/lib/bourbon/addons/_hide-text.scss +0 -27
  92. data/app/assets/stylesheets/lib/bourbon/addons/_margin.scss +0 -26
  93. data/app/assets/stylesheets/lib/bourbon/addons/_padding.scss +0 -26
  94. data/app/assets/stylesheets/lib/bourbon/addons/_position.scss +0 -48
  95. data/app/assets/stylesheets/lib/bourbon/addons/_prefixer.scss +0 -66
  96. data/app/assets/stylesheets/lib/bourbon/addons/_retina-image.scss +0 -25
  97. data/app/assets/stylesheets/lib/bourbon/addons/_size.scss +0 -51
  98. data/app/assets/stylesheets/lib/bourbon/addons/_text-inputs.scss +0 -112
  99. data/app/assets/stylesheets/lib/bourbon/addons/_timing-functions.scss +0 -34
  100. data/app/assets/stylesheets/lib/bourbon/addons/_triangle.scss +0 -63
  101. data/app/assets/stylesheets/lib/bourbon/addons/_word-wrap.scss +0 -29
  102. data/app/assets/stylesheets/lib/bourbon/css3/_animation.scss +0 -43
  103. data/app/assets/stylesheets/lib/bourbon/css3/_appearance.scss +0 -3
  104. data/app/assets/stylesheets/lib/bourbon/css3/_backface-visibility.scss +0 -3
  105. data/app/assets/stylesheets/lib/bourbon/css3/_background-image.scss +0 -42
  106. data/app/assets/stylesheets/lib/bourbon/css3/_background.scss +0 -55
  107. data/app/assets/stylesheets/lib/bourbon/css3/_border-image.scss +0 -59
  108. data/app/assets/stylesheets/lib/bourbon/css3/_calc.scss +0 -4
  109. data/app/assets/stylesheets/lib/bourbon/css3/_columns.scss +0 -47
  110. data/app/assets/stylesheets/lib/bourbon/css3/_filter.scss +0 -4
  111. data/app/assets/stylesheets/lib/bourbon/css3/_flex-box.scss +0 -287
  112. data/app/assets/stylesheets/lib/bourbon/css3/_font-face.scss +0 -24
  113. data/app/assets/stylesheets/lib/bourbon/css3/_font-feature-settings.scss +0 -4
  114. data/app/assets/stylesheets/lib/bourbon/css3/_hidpi-media-query.scss +0 -10
  115. data/app/assets/stylesheets/lib/bourbon/css3/_hyphens.scss +0 -4
  116. data/app/assets/stylesheets/lib/bourbon/css3/_image-rendering.scss +0 -14
  117. data/app/assets/stylesheets/lib/bourbon/css3/_keyframes.scss +0 -36
  118. data/app/assets/stylesheets/lib/bourbon/css3/_linear-gradient.scss +0 -38
  119. data/app/assets/stylesheets/lib/bourbon/css3/_perspective.scss +0 -8
  120. data/app/assets/stylesheets/lib/bourbon/css3/_placeholder.scss +0 -8
  121. data/app/assets/stylesheets/lib/bourbon/css3/_radial-gradient.scss +0 -39
  122. data/app/assets/stylesheets/lib/bourbon/css3/_selection.scss +0 -42
  123. data/app/assets/stylesheets/lib/bourbon/css3/_text-decoration.scss +0 -19
  124. data/app/assets/stylesheets/lib/bourbon/css3/_transform.scss +0 -15
  125. data/app/assets/stylesheets/lib/bourbon/css3/_transition.scss +0 -71
  126. data/app/assets/stylesheets/lib/bourbon/css3/_user-select.scss +0 -3
  127. data/app/assets/stylesheets/lib/bourbon/functions/_assign-inputs.scss +0 -11
  128. data/app/assets/stylesheets/lib/bourbon/functions/_contains-falsy.scss +0 -20
  129. data/app/assets/stylesheets/lib/bourbon/functions/_contains.scss +0 -26
  130. data/app/assets/stylesheets/lib/bourbon/functions/_is-length.scss +0 -11
  131. data/app/assets/stylesheets/lib/bourbon/functions/_is-light.scss +0 -21
  132. data/app/assets/stylesheets/lib/bourbon/functions/_is-number.scss +0 -11
  133. data/app/assets/stylesheets/lib/bourbon/functions/_is-size.scss +0 -13
  134. data/app/assets/stylesheets/lib/bourbon/functions/_modular-scale.scss +0 -69
  135. data/app/assets/stylesheets/lib/bourbon/functions/_px-to-em.scss +0 -13
  136. data/app/assets/stylesheets/lib/bourbon/functions/_px-to-rem.scss +0 -15
  137. data/app/assets/stylesheets/lib/bourbon/functions/_shade.scss +0 -24
  138. data/app/assets/stylesheets/lib/bourbon/functions/_strip-units.scss +0 -17
  139. data/app/assets/stylesheets/lib/bourbon/functions/_tint.scss +0 -24
  140. data/app/assets/stylesheets/lib/bourbon/functions/_transition-property-name.scss +0 -22
  141. data/app/assets/stylesheets/lib/bourbon/functions/_unpack.scss +0 -27
  142. data/app/assets/stylesheets/lib/bourbon/helpers/_convert-units.scss +0 -21
  143. data/app/assets/stylesheets/lib/bourbon/helpers/_directional-values.scss +0 -96
  144. data/app/assets/stylesheets/lib/bourbon/helpers/_font-source-declaration.scss +0 -43
  145. data/app/assets/stylesheets/lib/bourbon/helpers/_gradient-positions-parser.scss +0 -13
  146. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-angle-parser.scss +0 -25
  147. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-gradient-parser.scss +0 -41
  148. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-positions-parser.scss +0 -61
  149. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-side-corner-parser.scss +0 -31
  150. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-arg-parser.scss +0 -69
  151. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-gradient-parser.scss +0 -50
  152. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-positions-parser.scss +0 -18
  153. data/app/assets/stylesheets/lib/bourbon/helpers/_render-gradients.scss +0 -26
  154. data/app/assets/stylesheets/lib/bourbon/helpers/_shape-size-stripper.scss +0 -10
  155. data/app/assets/stylesheets/lib/bourbon/helpers/_str-to-num.scss +0 -50
  156. data/app/assets/stylesheets/lib/bourbon/settings/_asset-pipeline.scss +0 -7
  157. data/app/assets/stylesheets/lib/bourbon/settings/_prefixer.scss +0 -9
  158. data/app/assets/stylesheets/lib/bourbon/settings/_px-to-em.scss +0 -1
  159. data/app/assets/stylesheets/lib/neat/_neat-helpers.scss +0 -8
  160. data/app/assets/stylesheets/lib/neat/_neat.scss +0 -23
  161. data/app/assets/stylesheets/lib/neat/functions/_new-breakpoint.scss +0 -49
  162. data/app/assets/stylesheets/lib/neat/functions/_private.scss +0 -114
  163. data/app/assets/stylesheets/lib/neat/grid/_box-sizing.scss +0 -15
  164. data/app/assets/stylesheets/lib/neat/grid/_direction-context.scss +0 -33
  165. data/app/assets/stylesheets/lib/neat/grid/_display-context.scss +0 -28
  166. data/app/assets/stylesheets/lib/neat/grid/_fill-parent.scss +0 -22
  167. data/app/assets/stylesheets/lib/neat/grid/_media.scss +0 -92
  168. data/app/assets/stylesheets/lib/neat/grid/_omega.scss +0 -87
  169. data/app/assets/stylesheets/lib/neat/grid/_outer-container.scss +0 -38
  170. data/app/assets/stylesheets/lib/neat/grid/_pad.scss +0 -25
  171. data/app/assets/stylesheets/lib/neat/grid/_private.scss +0 -35
  172. data/app/assets/stylesheets/lib/neat/grid/_row.scss +0 -52
  173. data/app/assets/stylesheets/lib/neat/grid/_shift.scss +0 -50
  174. data/app/assets/stylesheets/lib/neat/grid/_span-columns.scss +0 -94
  175. data/app/assets/stylesheets/lib/neat/grid/_to-deprecate.scss +0 -97
  176. data/app/assets/stylesheets/lib/neat/grid/_visual-grid.scss +0 -42
  177. data/app/assets/stylesheets/lib/neat/settings/_disable-warnings.scss +0 -13
  178. data/app/assets/stylesheets/lib/neat/settings/_grid.scss +0 -51
  179. data/app/assets/stylesheets/lib/neat/settings/_visual-grid.scss +0 -27
  180. data/app/assets/stylesheets/va_common_main.css.scss +0 -18
  181. /data/app/assets/js/{vendor/scroll-settings.js → scroll-settings.js} +0 -0
  182. /data/app/assets/js/{vendor/stellar-settings.js → stellar-settings.js} +0 -0
@@ -1,498 +0,0 @@
1
- ;(function ($, window, document, undefined) {
2
- 'use strict';
3
-
4
- Foundation.libs.reveal = {
5
- name : 'reveal',
6
-
7
- version : '5.5.2',
8
-
9
- locked : false,
10
-
11
- settings : {
12
- animation : 'fadeAndPop',
13
- animation_speed : 250,
14
- close_on_background_click : true,
15
- close_on_esc : true,
16
- dismiss_modal_class : 'close-reveal-modal',
17
- multiple_opened : false,
18
- bg_class : 'reveal-modal-bg',
19
- root_element : 'body',
20
- open : function(){},
21
- opened : function(){},
22
- close : function(){},
23
- closed : function(){},
24
- on_ajax_error: $.noop,
25
- bg : $('.reveal-modal-bg'),
26
- css : {
27
- open : {
28
- 'opacity' : 0,
29
- 'visibility' : 'visible',
30
- 'display' : 'block'
31
- },
32
- close : {
33
- 'opacity' : 1,
34
- 'visibility' : 'hidden',
35
- 'display' : 'none'
36
- }
37
- }
38
- },
39
-
40
- init : function (scope, method, options) {
41
- $.extend(true, this.settings, method, options);
42
- this.bindings(method, options);
43
- },
44
-
45
- events : function (scope) {
46
- var self = this,
47
- S = self.S;
48
-
49
- S(this.scope)
50
- .off('.reveal')
51
- .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
52
- e.preventDefault();
53
-
54
- if (!self.locked) {
55
- var element = S(this),
56
- ajax = element.data(self.data_attr('reveal-ajax')),
57
- replaceContentSel = element.data(self.data_attr('reveal-replace-content'));
58
-
59
- self.locked = true;
60
-
61
- if (typeof ajax === 'undefined') {
62
- self.open.call(self, element);
63
- } else {
64
- var url = ajax === true ? element.attr('href') : ajax;
65
- self.open.call(self, element, {url : url}, { replaceContentSel : replaceContentSel });
66
- }
67
- }
68
- });
69
-
70
- S(document)
71
- .on('click.fndtn.reveal', this.close_targets(), function (e) {
72
- e.preventDefault();
73
- if (!self.locked) {
74
- var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
75
- bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
76
-
77
- if (bg_clicked) {
78
- if (settings.close_on_background_click) {
79
- e.stopPropagation();
80
- } else {
81
- return;
82
- }
83
- }
84
-
85
- self.locked = true;
86
- self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open:not(.toback)') : S(this).closest('[' + self.attr_name() + ']'));
87
- }
88
- });
89
-
90
- if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
91
- S(this.scope)
92
- // .off('.reveal')
93
- .on('open.fndtn.reveal', this.settings.open)
94
- .on('opened.fndtn.reveal', this.settings.opened)
95
- .on('opened.fndtn.reveal', this.open_video)
96
- .on('close.fndtn.reveal', this.settings.close)
97
- .on('closed.fndtn.reveal', this.settings.closed)
98
- .on('closed.fndtn.reveal', this.close_video);
99
- } else {
100
- S(this.scope)
101
- // .off('.reveal')
102
- .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
103
- .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
104
- .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
105
- .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
106
- .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
107
- .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
108
- }
109
-
110
- return true;
111
- },
112
-
113
- // PATCH #3: turning on key up capture only when a reveal window is open
114
- key_up_on : function (scope) {
115
- var self = this;
116
-
117
- // PATCH #1: fixing multiple keyup event trigger from single key press
118
- self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
119
- var open_modal = self.S('[' + self.attr_name() + '].open'),
120
- settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
121
- // PATCH #2: making sure that the close event can be called only while unlocked,
122
- // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
123
- if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
124
- self.close.call(self, open_modal);
125
- }
126
- });
127
-
128
- return true;
129
- },
130
-
131
- // PATCH #3: turning on key up capture only when a reveal window is open
132
- key_up_off : function (scope) {
133
- this.S('body').off('keyup.fndtn.reveal');
134
- return true;
135
- },
136
-
137
- open : function (target, ajax_settings) {
138
- var self = this,
139
- modal;
140
-
141
- if (target) {
142
- if (typeof target.selector !== 'undefined') {
143
- // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
144
- modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
145
- } else {
146
- modal = self.S(this.scope);
147
-
148
- ajax_settings = target;
149
- }
150
- } else {
151
- modal = self.S(this.scope);
152
- }
153
-
154
- var settings = modal.data(self.attr_name(true) + '-init');
155
- settings = settings || this.settings;
156
-
157
-
158
- if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
159
- return self.close(modal);
160
- }
161
-
162
- if (!modal.hasClass('open')) {
163
- var open_modal = self.S('[' + self.attr_name() + '].open');
164
-
165
- if (typeof modal.data('css-top') === 'undefined') {
166
- modal.data('css-top', parseInt(modal.css('top'), 10))
167
- .data('offset', this.cache_offset(modal));
168
- }
169
-
170
- modal.attr('tabindex','0').attr('aria-hidden','false');
171
-
172
- this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
173
-
174
- // Prevent namespace event from triggering twice
175
- modal.on('open.fndtn.reveal', function(e) {
176
- if (e.namespace !== 'fndtn.reveal') return;
177
- });
178
-
179
- modal.on('open.fndtn.reveal').trigger('open.fndtn.reveal');
180
-
181
- if (open_modal.length < 1) {
182
- this.toggle_bg(modal, true);
183
- }
184
-
185
- if (typeof ajax_settings === 'string') {
186
- ajax_settings = {
187
- url : ajax_settings
188
- };
189
- }
190
-
191
- if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
192
- if (open_modal.length > 0) {
193
- if (settings.multiple_opened) {
194
- self.to_back(open_modal);
195
- } else {
196
- self.hide(open_modal, settings.css.close);
197
- }
198
- }
199
-
200
- this.show(modal, settings.css.open);
201
- } else {
202
- var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
203
- $.extend(ajax_settings, {
204
- success : function (data, textStatus, jqXHR) {
205
- if ( $.isFunction(old_success) ) {
206
- var result = old_success(data, textStatus, jqXHR);
207
- if (typeof result == 'string') {
208
- data = result;
209
- }
210
- }
211
-
212
- if (typeof options !== 'undefined' && typeof options.replaceContentSel !== 'undefined') {
213
- modal.find(options.replaceContentSel).html(data);
214
- } else {
215
- modal.html(data);
216
- }
217
-
218
- self.S(modal).foundation('section', 'reflow');
219
- self.S(modal).children().foundation();
220
-
221
- if (open_modal.length > 0) {
222
- if (settings.multiple_opened) {
223
- self.to_back(open_modal);
224
- } else {
225
- self.hide(open_modal, settings.css.close);
226
- }
227
- }
228
- self.show(modal, settings.css.open);
229
- }
230
- });
231
-
232
- // check for if user initalized with error callback
233
- if (settings.on_ajax_error !== $.noop) {
234
- $.extend(ajax_settings, {
235
- error : settings.on_ajax_error
236
- });
237
- }
238
-
239
- $.ajax(ajax_settings);
240
- }
241
- }
242
- self.S(window).trigger('resize');
243
- },
244
-
245
- close : function (modal) {
246
- var modal = modal && modal.length ? modal : this.S(this.scope),
247
- open_modals = this.S('[' + this.attr_name() + '].open'),
248
- settings = modal.data(this.attr_name(true) + '-init') || this.settings,
249
- self = this;
250
-
251
- if (open_modals.length > 0) {
252
-
253
- modal.removeAttr('tabindex','0').attr('aria-hidden','true');
254
-
255
- this.locked = true;
256
- this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
257
-
258
- modal.trigger('close.fndtn.reveal');
259
-
260
- if ((settings.multiple_opened && open_modals.length === 1) || !settings.multiple_opened || modal.length > 1) {
261
- self.toggle_bg(modal, false);
262
- self.to_front(modal);
263
- }
264
-
265
- if (settings.multiple_opened) {
266
- self.hide(modal, settings.css.close, settings);
267
- self.to_front($($.makeArray(open_modals).reverse()[1]));
268
- } else {
269
- self.hide(open_modals, settings.css.close, settings);
270
- }
271
- }
272
- },
273
-
274
- close_targets : function () {
275
- var base = '.' + this.settings.dismiss_modal_class;
276
-
277
- if (this.settings.close_on_background_click) {
278
- return base + ', .' + this.settings.bg_class;
279
- }
280
-
281
- return base;
282
- },
283
-
284
- toggle_bg : function (modal, state) {
285
- if (this.S('.' + this.settings.bg_class).length === 0) {
286
- this.settings.bg = $('<div />', {'class': this.settings.bg_class})
287
- .appendTo('body').hide();
288
- }
289
-
290
- var visible = this.settings.bg.filter(':visible').length > 0;
291
- if ( state != visible ) {
292
- if ( state == undefined ? visible : !state ) {
293
- this.hide(this.settings.bg);
294
- } else {
295
- this.show(this.settings.bg);
296
- }
297
- }
298
- },
299
-
300
- show : function (el, css) {
301
- // is modal
302
- if (css) {
303
- var settings = el.data(this.attr_name(true) + '-init') || this.settings,
304
- root_element = settings.root_element,
305
- context = this;
306
-
307
- if (el.parent(root_element).length === 0) {
308
- var placeholder = el.wrap('<div style="display: none;" />').parent();
309
-
310
- el.on('closed.fndtn.reveal.wrapped', function () {
311
- el.detach().appendTo(placeholder);
312
- el.unwrap().unbind('closed.fndtn.reveal.wrapped');
313
- });
314
-
315
- el.detach().appendTo(root_element);
316
- }
317
-
318
- var animData = getAnimationData(settings.animation);
319
- if (!animData.animate) {
320
- this.locked = false;
321
- }
322
- if (animData.pop) {
323
- css.top = $(window).scrollTop() - el.data('offset') + 'px';
324
- var end_css = {
325
- top: $(window).scrollTop() + el.data('css-top') + 'px',
326
- opacity: 1
327
- };
328
-
329
- return setTimeout(function () {
330
- return el
331
- .css(css)
332
- .animate(end_css, settings.animation_speed, 'linear', function () {
333
- context.locked = false;
334
- el.trigger('opened.fndtn.reveal');
335
- })
336
- .addClass('open');
337
- }, settings.animation_speed / 2);
338
- }
339
-
340
- if (animData.fade) {
341
- css.top = $(window).scrollTop() + el.data('css-top') + 'px';
342
- var end_css = {opacity: 1};
343
-
344
- return setTimeout(function () {
345
- return el
346
- .css(css)
347
- .animate(end_css, settings.animation_speed, 'linear', function () {
348
- context.locked = false;
349
- el.trigger('opened.fndtn.reveal');
350
- })
351
- .addClass('open');
352
- }, settings.animation_speed / 2);
353
- }
354
-
355
- return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened.fndtn.reveal');
356
- }
357
-
358
- var settings = this.settings;
359
-
360
- // should we animate the background?
361
- if (getAnimationData(settings.animation).fade) {
362
- return el.fadeIn(settings.animation_speed / 2);
363
- }
364
-
365
- this.locked = false;
366
-
367
- return el.show();
368
- },
369
-
370
- to_back : function(el) {
371
- el.addClass('toback');
372
- },
373
-
374
- to_front : function(el) {
375
- el.removeClass('toback');
376
- },
377
-
378
- hide : function (el, css) {
379
- // is modal
380
- if (css) {
381
- var settings = el.data(this.attr_name(true) + '-init'),
382
- context = this;
383
- settings = settings || this.settings;
384
-
385
- var animData = getAnimationData(settings.animation);
386
- if (!animData.animate) {
387
- this.locked = false;
388
- }
389
- if (animData.pop) {
390
- var end_css = {
391
- top: - $(window).scrollTop() - el.data('offset') + 'px',
392
- opacity: 0
393
- };
394
-
395
- return setTimeout(function () {
396
- return el
397
- .animate(end_css, settings.animation_speed, 'linear', function () {
398
- context.locked = false;
399
- el.css(css).trigger('closed.fndtn.reveal');
400
- })
401
- .removeClass('open');
402
- }, settings.animation_speed / 2);
403
- }
404
-
405
- if (animData.fade) {
406
- var end_css = {opacity : 0};
407
-
408
- return setTimeout(function () {
409
- return el
410
- .animate(end_css, settings.animation_speed, 'linear', function () {
411
- context.locked = false;
412
- el.css(css).trigger('closed.fndtn.reveal');
413
- })
414
- .removeClass('open');
415
- }, settings.animation_speed / 2);
416
- }
417
-
418
- return el.hide().css(css).removeClass('open').trigger('closed.fndtn.reveal');
419
- }
420
-
421
- var settings = this.settings;
422
-
423
- // should we animate the background?
424
- if (getAnimationData(settings.animation).fade) {
425
- return el.fadeOut(settings.animation_speed / 2);
426
- }
427
-
428
- return el.hide();
429
- },
430
-
431
- close_video : function (e) {
432
- var video = $('.flex-video', e.target),
433
- iframe = $('iframe', video);
434
-
435
- if (iframe.length > 0) {
436
- iframe.attr('data-src', iframe[0].src);
437
- iframe.attr('src', iframe.attr('src'));
438
- video.hide();
439
- }
440
- },
441
-
442
- open_video : function (e) {
443
- var video = $('.flex-video', e.target),
444
- iframe = video.find('iframe');
445
-
446
- if (iframe.length > 0) {
447
- var data_src = iframe.attr('data-src');
448
- if (typeof data_src === 'string') {
449
- iframe[0].src = iframe.attr('data-src');
450
- } else {
451
- var src = iframe[0].src;
452
- iframe[0].src = undefined;
453
- iframe[0].src = src;
454
- }
455
- video.show();
456
- }
457
- },
458
-
459
- data_attr : function (str) {
460
- if (this.namespace.length > 0) {
461
- return this.namespace + '-' + str;
462
- }
463
-
464
- return str;
465
- },
466
-
467
- cache_offset : function (modal) {
468
- var offset = modal.show().height() + parseInt(modal.css('top'), 10) + modal.scrollY;
469
-
470
- modal.hide();
471
-
472
- return offset;
473
- },
474
-
475
- off : function () {
476
- $(this.scope).off('.fndtn.reveal');
477
- },
478
-
479
- reflow : function () {}
480
- };
481
-
482
- /*
483
- * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
484
- * getAnimationData('fade') // {animate: true, pop: false, fade: true}
485
- * getAnimationData('pop') // {animate: true, pop: true, fade: false}
486
- * getAnimationData('foo') // {animate: false, pop: false, fade: false}
487
- * getAnimationData(null) // {animate: false, pop: false, fade: false}
488
- */
489
- function getAnimationData(str) {
490
- var fade = /fade/i.test(str);
491
- var pop = /pop/i.test(str);
492
- return {
493
- animate : fade || pop,
494
- pop : pop,
495
- fade : fade
496
- };
497
- }
498
- }(jQuery, window, window.document));