foundation-rails 6.1.2.0 → 6.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -6
  3. data/README.md +1 -1
  4. data/Rakefile +5 -1
  5. data/bower.json +3 -3
  6. data/foundation-rails.gemspec +1 -0
  7. data/lib/foundation-rails.rb +1 -0
  8. data/lib/foundation/rails/version.rb +1 -1
  9. data/lib/generators/foundation/templates/foundation_and_overrides.scss +2 -2
  10. data/vendor/assets/js/foundation.abide.js.es6 +462 -0
  11. data/vendor/assets/js/{foundation.accordion.js → foundation.accordion.js.es6} +55 -47
  12. data/vendor/assets/js/{foundation.accordionMenu.js → foundation.accordionMenu.js.es6} +46 -35
  13. data/vendor/assets/js/{foundation.core.js → foundation.core.js.es6} +10 -8
  14. data/vendor/assets/js/{foundation.drilldown.js → foundation.drilldown.js.es6} +75 -49
  15. data/vendor/assets/js/{foundation.dropdown.js → foundation.dropdown.js.es6} +100 -88
  16. data/vendor/assets/js/{foundation.dropdownMenu.js → foundation.dropdownMenu.js.es6} +134 -128
  17. data/vendor/assets/js/{foundation.equalizer.js → foundation.equalizer.js.es6} +72 -61
  18. data/vendor/assets/js/{foundation.interchange.js → foundation.interchange.js.es6} +44 -45
  19. data/vendor/assets/js/{foundation.js → foundation.js.es6} +0 -0
  20. data/vendor/assets/js/{foundation.magellan.js → foundation.magellan.js.es6} +80 -83
  21. data/vendor/assets/js/foundation.offcanvas.js.es6 +395 -0
  22. data/vendor/assets/js/foundation.orbit.js.es6 +445 -0
  23. data/vendor/assets/js/{foundation.responsiveMenu.js → foundation.responsiveMenu.js.es6} +37 -31
  24. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +112 -0
  25. data/vendor/assets/js/foundation.reveal.js.es6 +544 -0
  26. data/vendor/assets/js/{foundation.slider.js → foundation.slider.js.es6} +235 -184
  27. data/vendor/assets/js/{foundation.sticky.js → foundation.sticky.js.es6} +177 -166
  28. data/vendor/assets/js/{foundation.tabs.js → foundation.tabs.js.es6} +138 -118
  29. data/vendor/assets/js/{foundation.toggler.js → foundation.toggler.js.es6} +34 -37
  30. data/vendor/assets/js/{foundation.tooltip.js → foundation.tooltip.js.es6} +162 -153
  31. data/vendor/assets/js/foundation.util.box.js.es6 +183 -0
  32. data/vendor/assets/js/{foundation.util.keyboard.js → foundation.util.keyboard.js.es6} +54 -54
  33. data/vendor/assets/js/{foundation.util.mediaQuery.js → foundation.util.mediaQuery.js.es6} +46 -46
  34. data/vendor/assets/js/{foundation.util.motion.js → foundation.util.motion.js.es6} +58 -48
  35. data/vendor/assets/js/foundation.util.nest.js.es6 +76 -0
  36. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +86 -0
  37. data/vendor/assets/js/{foundation.util.touch.js → foundation.util.touch.js.es6} +2 -2
  38. data/vendor/assets/js/foundation.util.triggers.js.es6 +239 -0
  39. data/vendor/assets/scss/_global.scss +28 -27
  40. data/vendor/assets/scss/components/_badge.scss +1 -1
  41. data/vendor/assets/scss/components/_button-group.scss +77 -26
  42. data/vendor/assets/scss/components/_button.scss +8 -8
  43. data/vendor/assets/scss/components/_callout.scss +2 -2
  44. data/vendor/assets/scss/components/_drilldown.scss +4 -0
  45. data/vendor/assets/scss/components/_dropdown-menu.scss +104 -54
  46. data/vendor/assets/scss/components/_flex.scss +28 -0
  47. data/vendor/assets/scss/components/_label.scss +1 -1
  48. data/vendor/assets/scss/components/_media-object.scss +37 -7
  49. data/vendor/assets/scss/components/_menu-icon.scss +9 -0
  50. data/vendor/assets/scss/components/_menu.scss +127 -29
  51. data/vendor/assets/scss/components/_off-canvas.scss +1 -0
  52. data/vendor/assets/scss/components/_pagination.scss +3 -3
  53. data/vendor/assets/scss/components/_progress-bar.scss +1 -25
  54. data/vendor/assets/scss/components/_reveal.scss +12 -6
  55. data/vendor/assets/scss/components/_slider.scss +3 -35
  56. data/vendor/assets/scss/components/_table.scss +8 -0
  57. data/vendor/assets/scss/components/_tabs.scss +5 -10
  58. data/vendor/assets/scss/components/_title-bar.scss +27 -10
  59. data/vendor/assets/scss/components/_tooltip.scss +0 -4
  60. data/vendor/assets/scss/components/_top-bar.scss +93 -21
  61. data/vendor/assets/scss/components/_visibility.scss +1 -1
  62. data/vendor/assets/scss/forms/_checkbox.scss +1 -1
  63. data/vendor/assets/scss/forms/_error.scss +7 -5
  64. data/vendor/assets/scss/forms/_forms.scss +3 -0
  65. data/vendor/assets/scss/forms/_help-text.scss +1 -1
  66. data/vendor/assets/scss/forms/_input-group.scss +44 -9
  67. data/vendor/assets/scss/forms/_meter.scss +109 -0
  68. data/vendor/assets/scss/forms/_progress.scss +85 -0
  69. data/vendor/assets/scss/forms/_range.scss +144 -0
  70. data/vendor/assets/scss/forms/_select.scss +1 -1
  71. data/vendor/assets/scss/forms/_text.scss +10 -1
  72. data/vendor/assets/scss/foundation.scss +16 -5
  73. data/vendor/assets/scss/grid/_classes.scss +5 -18
  74. data/vendor/assets/scss/grid/_column.scss +13 -11
  75. data/vendor/assets/scss/grid/_flex-grid.scss +54 -80
  76. data/vendor/assets/scss/grid/_grid.scss +22 -10
  77. data/vendor/assets/scss/grid/_layout.scss +18 -0
  78. data/vendor/assets/scss/grid/_row.scss +11 -15
  79. data/vendor/assets/scss/motion-ui/_classes.scss +10 -3
  80. data/vendor/assets/scss/motion-ui/effects/_fade.scss +4 -1
  81. data/vendor/assets/scss/motion-ui/effects/_zoom.scss +1 -1
  82. data/vendor/assets/scss/motion-ui/transitions/_slide.scss +1 -1
  83. data/vendor/assets/scss/motion-ui/util/_transition.scss +1 -1
  84. data/vendor/assets/scss/settings/_settings.scss +64 -47
  85. data/vendor/assets/scss/typography/_base.scss +4 -0
  86. data/vendor/assets/scss/typography/_print.scss +9 -5
  87. data/vendor/assets/scss/util/_breakpoint.scss +31 -25
  88. data/vendor/assets/scss/util/_color.scss +19 -0
  89. data/vendor/assets/scss/util/_flex.scss +68 -0
  90. data/vendor/assets/scss/util/_mixins.scss +13 -7
  91. data/vendor/assets/scss/util/_util.scss +1 -5
  92. data/vendor/assets/scss/util/_value.scss +9 -28
  93. metadata +51 -31
  94. data/vendor/assets/js/foundation.abide.js +0 -418
  95. data/vendor/assets/js/foundation.offcanvas.js +0 -376
  96. data/vendor/assets/js/foundation.orbit.js +0 -421
  97. data/vendor/assets/js/foundation.responsiveToggle.js +0 -106
  98. data/vendor/assets/js/foundation.reveal.js +0 -514
  99. data/vendor/assets/js/foundation.util.box.js +0 -169
  100. data/vendor/assets/js/foundation.util.nest.js +0 -63
  101. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +0 -82
  102. data/vendor/assets/js/foundation.util.triggers.js +0 -224
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ !function($) {
4
+
5
+ /**
6
+ * ResponsiveToggle module.
7
+ * @module foundation.responsiveToggle
8
+ * @requires foundation.util.mediaQuery
9
+ */
10
+
11
+ class ResponsiveToggle {
12
+ /**
13
+ * Creates a new instance of Tab Bar.
14
+ * @class
15
+ * @fires ResponsiveToggle#init
16
+ * @param {jQuery} element - jQuery object to attach tab bar functionality to.
17
+ * @param {Object} options - Overrides to the default plugin settings.
18
+ */
19
+ constructor(element, options) {
20
+ this.$element = $(element);
21
+ this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options);
22
+
23
+ this._init();
24
+ this._events();
25
+
26
+ Foundation.registerPlugin(this, 'ResponsiveToggle');
27
+ }
28
+
29
+ /**
30
+ * Initializes the tab bar by finding the target element, toggling element, and running update().
31
+ * @function
32
+ * @private
33
+ */
34
+ _init() {
35
+ var targetID = this.$element.data('responsive-toggle');
36
+ if (!targetID) {
37
+ console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.');
38
+ }
39
+
40
+ this.$targetMenu = $(`#${targetID}`);
41
+ this.$toggler = this.$element.find('[data-toggle]');
42
+
43
+ this._update();
44
+ }
45
+
46
+ /**
47
+ * Adds necessary event handlers for the tab bar to work.
48
+ * @function
49
+ * @private
50
+ */
51
+ _events() {
52
+ var _this = this;
53
+
54
+ $(window).on('changed.zf.mediaquery', this._update.bind(this));
55
+
56
+ this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this));
57
+ }
58
+
59
+ /**
60
+ * Checks the current media query to determine if the tab bar should be visible or hidden.
61
+ * @function
62
+ * @private
63
+ */
64
+ _update() {
65
+ // Mobile
66
+ if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
67
+ this.$element.show();
68
+ this.$targetMenu.hide();
69
+ }
70
+
71
+ // Desktop
72
+ else {
73
+ this.$element.hide();
74
+ this.$targetMenu.show();
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it.
80
+ * @function
81
+ * @fires ResponsiveToggle#toggled
82
+ */
83
+ toggleMenu() {
84
+ if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
85
+ this.$targetMenu.toggle(0);
86
+
87
+ /**
88
+ * Fires when the element attached to the tab bar toggles.
89
+ * @event ResponsiveToggle#toggled
90
+ */
91
+ this.$element.trigger('toggled.zf.responsiveToggle');
92
+ }
93
+ };
94
+
95
+ destroy() {
96
+ //TODO this...
97
+ }
98
+ }
99
+
100
+ ResponsiveToggle.defaults = {
101
+ /**
102
+ * The breakpoint after which the menu is always shown, and the tab bar is hidden.
103
+ * @option
104
+ * @example 'medium'
105
+ */
106
+ hideFor: 'medium'
107
+ };
108
+
109
+ // Window exports
110
+ Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle');
111
+
112
+ }(jQuery);
@@ -0,0 +1,544 @@
1
+ 'use strict';
2
+
3
+ !function($) {
4
+
5
+ /**
6
+ * Reveal module.
7
+ * @module foundation.reveal
8
+ * @requires foundation.util.keyboard
9
+ * @requires foundation.util.box
10
+ * @requires foundation.util.triggers
11
+ * @requires foundation.util.mediaQuery
12
+ * @requires foundation.util.motion if using animations
13
+ */
14
+
15
+ class Reveal {
16
+ /**
17
+ * Creates a new instance of Reveal.
18
+ * @class
19
+ * @param {jQuery} element - jQuery object to use for the modal.
20
+ * @param {Object} options - optional parameters.
21
+ */
22
+ constructor(element, options) {
23
+ this.$element = element;
24
+ this.options = $.extend({}, Reveal.defaults, this.$element.data(), options);
25
+ this._init();
26
+
27
+ Foundation.registerPlugin(this, 'Reveal');
28
+ Foundation.Keyboard.register('Reveal', {
29
+ 'ENTER': 'open',
30
+ 'SPACE': 'open',
31
+ 'ESCAPE': 'close',
32
+ 'TAB': 'tab_forward',
33
+ 'SHIFT_TAB': 'tab_backward'
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Initializes the modal by adding the overlay and close buttons, (if selected).
39
+ * @private
40
+ */
41
+ _init() {
42
+ this.id = this.$element.attr('id');
43
+ this.isActive = false;
44
+ this.cached = {mq: Foundation.MediaQuery.current};
45
+ this.isiOS = iPhoneSniff();
46
+
47
+ if(this.isiOS){ this.$element.addClass('is-ios'); }
48
+
49
+ this.$anchor = $(`[data-open="${this.id}"]`).length ? $(`[data-open="${this.id}"]`) : $(`[data-toggle="${this.id}"]`);
50
+
51
+ if (this.$anchor.length) {
52
+ var anchorId = this.$anchor[0].id || Foundation.GetYoDigits(6, 'reveal');
53
+
54
+ this.$anchor.attr({
55
+ 'aria-controls': this.id,
56
+ 'id': anchorId,
57
+ 'aria-haspopup': true,
58
+ 'tabindex': 0
59
+ });
60
+ this.$element.attr({'aria-labelledby': anchorId});
61
+ }
62
+
63
+ if (this.options.fullScreen || this.$element.hasClass('full')) {
64
+ this.options.fullScreen = true;
65
+ this.options.overlay = false;
66
+ }
67
+ if (this.options.overlay && !this.$overlay) {
68
+ this.$overlay = this._makeOverlay(this.id);
69
+ }
70
+
71
+ this.$element.attr({
72
+ 'role': 'dialog',
73
+ 'aria-hidden': true,
74
+ 'data-yeti-box': this.id,
75
+ 'data-resize': this.id
76
+ });
77
+
78
+ if(this.$overlay) {
79
+ this.$element.detach().appendTo(this.$overlay);
80
+ } else {
81
+ this.$element.detach().appendTo($('body'));
82
+ this.$element.addClass('without-overlay');
83
+ }
84
+ this._events();
85
+ if (this.options.deepLink && window.location.hash === ( `#${this.id}`)) {
86
+ $(window).one('load.zf.reveal', this.open.bind(this));
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Creates an overlay div to display behind the modal.
92
+ * @private
93
+ */
94
+ _makeOverlay(id) {
95
+ var $overlay = $('<div></div>')
96
+ .addClass('reveal-overlay')
97
+ .attr({'tabindex': -1, 'aria-hidden': true})
98
+ .appendTo('body');
99
+ return $overlay;
100
+ }
101
+
102
+ /**
103
+ * Updates position of modal
104
+ * TODO: Figure out if we actually need to cache these values or if it doesn't matter
105
+ * @private
106
+ */
107
+ _updatePosition() {
108
+ var width = this.$element.outerWidth();
109
+ var outerWidth = $(window).width();
110
+ var height = this.$element.outerHeight();
111
+ var outerHeight = $(window).height();
112
+ var left = parseInt((outerWidth - width) / 2, 10);
113
+ var top;
114
+ if (height > outerHeight) {
115
+ top = parseInt(Math.min(100, outerHeight / 10), 10);
116
+ } else {
117
+ top = parseInt((outerHeight - height) / 4, 10);
118
+ }
119
+ this.$element.css({top: top + 'px'});
120
+ // only worry about left if we don't have an overlay, otherwise we're perfectly in the middle
121
+ if(!this.$overlay) {
122
+ this.$element.css({left: left + 'px'});
123
+ }
124
+
125
+ }
126
+
127
+ /**
128
+ * Adds event handlers for the modal.
129
+ * @private
130
+ */
131
+ _events() {
132
+ var _this = this;
133
+
134
+ this.$element.on({
135
+ 'open.zf.trigger': this.open.bind(this),
136
+ 'close.zf.trigger': this.close.bind(this),
137
+ 'toggle.zf.trigger': this.toggle.bind(this),
138
+ 'resizeme.zf.trigger': function() {
139
+ _this._updatePosition();
140
+ }
141
+ });
142
+
143
+ if (this.$anchor.length) {
144
+ this.$anchor.on('keydown.zf.reveal', function(e) {
145
+ if (e.which === 13 || e.which === 32) {
146
+ e.stopPropagation();
147
+ e.preventDefault();
148
+ _this.open();
149
+ }
150
+ });
151
+ }
152
+
153
+ if (this.options.closeOnClick && this.options.overlay) {
154
+ this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) {
155
+ if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
156
+ _this.close();
157
+ });
158
+ }
159
+ if (this.options.deepLink) {
160
+ $(window).on(`popstate.zf.reveal:${this.id}`, this._handleState.bind(this));
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Handles modal methods on back/forward button clicks or any other event that triggers popstate.
166
+ * @private
167
+ */
168
+ _handleState(e) {
169
+ if(window.location.hash === ( '#' + this.id) && !this.isActive){ this.open(); }
170
+ else{ this.close(); }
171
+ }
172
+
173
+
174
+ /**
175
+ * Opens the modal controlled by `this.$anchor`, and closes all others by default.
176
+ * @function
177
+ * @fires Reveal#closeme
178
+ * @fires Reveal#open
179
+ */
180
+ open() {
181
+ if (this.options.deepLink) {
182
+ var hash = `#${this.id}`;
183
+
184
+ if (window.history.pushState) {
185
+ window.history.pushState(null, null, hash);
186
+ } else {
187
+ window.location.hash = hash;
188
+ }
189
+ }
190
+
191
+ this.isActive = true;
192
+
193
+ // Make elements invisible, but remove display: none so we can get size and positioning
194
+ this.$element
195
+ .css({ 'visibility': 'hidden' })
196
+ .show()
197
+ .scrollTop(0);
198
+ if (this.options.overlay) {
199
+ this.$overlay.css({'visibility': 'hidden'}).show();
200
+ }
201
+
202
+ this._updatePosition();
203
+
204
+ this.$element
205
+ .hide()
206
+ .css({ 'visibility': '' });
207
+
208
+ if(this.$overlay) {
209
+ this.$overlay.css({'visibility': ''}).hide();
210
+ }
211
+
212
+
213
+ if (!this.options.multipleOpened) {
214
+ /**
215
+ * Fires immediately before the modal opens.
216
+ * Closes any other modals that are currently open
217
+ * @event Reveal#closeme
218
+ */
219
+ this.$element.trigger('closeme.zf.reveal', this.id);
220
+ }
221
+
222
+ // Motion UI method of reveal
223
+ if (this.options.animationIn) {
224
+ if (this.options.overlay) {
225
+ Foundation.Motion.animateIn(this.$overlay, 'fade-in');
226
+ }
227
+ Foundation.Motion.animateIn(this.$element, this.options.animationIn, function() {
228
+ this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
229
+ });
230
+ }
231
+ // jQuery method of reveal
232
+ else {
233
+ if (this.options.overlay) {
234
+ this.$overlay.show(0);
235
+ }
236
+ this.$element.show(this.options.showDelay);
237
+ }
238
+
239
+ // handle accessibility
240
+ this.$element
241
+ .attr({
242
+ 'aria-hidden': false,
243
+ 'tabindex': -1
244
+ })
245
+ .focus();
246
+
247
+ /**
248
+ * Fires when the modal has successfully opened.
249
+ * @event Reveal#open
250
+ */
251
+ this.$element.trigger('open.zf.reveal');
252
+
253
+ if (this.isiOS) {
254
+ var scrollPos = window.pageYOffset;
255
+ $('html, body').addClass('is-reveal-open').scrollTop(scrollPos);
256
+ }
257
+ else {
258
+ $('body').addClass('is-reveal-open');
259
+ }
260
+
261
+ $('body')
262
+ .addClass('is-reveal-open')
263
+ .attr('aria-hidden', (this.options.overlay || this.options.fullScreen) ? true : false);
264
+
265
+ setTimeout(() => {
266
+ this._extraHandlers();
267
+ }, 0);
268
+ }
269
+
270
+ /**
271
+ * Adds extra event handlers for the body and window if necessary.
272
+ * @private
273
+ */
274
+ _extraHandlers() {
275
+ var _this = this;
276
+ this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
277
+
278
+ if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
279
+ $('body').on('click.zf.reveal', function(e) {
280
+ if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
281
+ _this.close();
282
+ });
283
+ }
284
+
285
+ if (this.options.closeOnEsc) {
286
+ $(window).on('keydown.zf.reveal', function(e) {
287
+ Foundation.Keyboard.handleKey(e, 'Reveal', {
288
+ close: function() {
289
+ if (_this.options.closeOnEsc) {
290
+ _this.close();
291
+ _this.$anchor.focus();
292
+ }
293
+ }
294
+ });
295
+ if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
296
+ e.preventDefault();
297
+ }
298
+ });
299
+ }
300
+
301
+ // lock focus within modal while tabbing
302
+ this.$element.on('keydown.zf.reveal', function(e) {
303
+ var $target = $(this);
304
+ // handle keyboard event with keyboard util
305
+ Foundation.Keyboard.handleKey(e, 'Reveal', {
306
+ tab_forward: function() {
307
+ if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { // left modal downwards, setting focus to first element
308
+ _this.focusableElements.eq(0).focus();
309
+ e.preventDefault();
310
+ }
311
+ },
312
+ tab_backward: function() {
313
+ if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element
314
+ _this.focusableElements.eq(-1).focus();
315
+ e.preventDefault();
316
+ }
317
+ },
318
+ open: function() {
319
+ if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {
320
+ setTimeout(function() { // set focus back to anchor if close button has been activated
321
+ _this.$anchor.focus();
322
+ }, 1);
323
+ } else if ($target.is(_this.focusableElements)) { // dont't trigger if acual element has focus (i.e. inputs, links, ...)
324
+ _this.open();
325
+ }
326
+ },
327
+ close: function() {
328
+ if (_this.options.closeOnEsc) {
329
+ _this.close();
330
+ _this.$anchor.focus();
331
+ }
332
+ }
333
+ });
334
+ });
335
+ }
336
+
337
+ /**
338
+ * Closes the modal.
339
+ * @function
340
+ * @fires Reveal#closed
341
+ */
342
+ close() {
343
+ if (!this.isActive || !this.$element.is(':visible')) {
344
+ return false;
345
+ }
346
+ var _this = this;
347
+
348
+ // Motion UI method of hiding
349
+ if (this.options.animationOut) {
350
+ if (this.options.overlay) {
351
+ Foundation.Motion.animateOut(this.$overlay, 'fade-out', finishUp);
352
+ }
353
+ else {
354
+ finishUp();
355
+ }
356
+
357
+ Foundation.Motion.animateOut(this.$element, this.options.animationOut);
358
+ }
359
+ // jQuery method of hiding
360
+ else {
361
+ if (this.options.overlay) {
362
+ this.$overlay.hide(0, finishUp);
363
+ }
364
+ else {
365
+ finishUp();
366
+ }
367
+
368
+ this.$element.hide(this.options.hideDelay);
369
+ }
370
+
371
+ // Conditionals to remove extra event listeners added on open
372
+ if (this.options.closeOnEsc) {
373
+ $(window).off('keydown.zf.reveal');
374
+ }
375
+
376
+ if (!this.options.overlay && this.options.closeOnClick) {
377
+ $('body').off('click.zf.reveal');
378
+ }
379
+
380
+ this.$element.off('keydown.zf.reveal');
381
+
382
+ function finishUp() {
383
+ if (_this.isiOS) {
384
+ $('html, body').removeClass('is-reveal-open');
385
+ }
386
+ else {
387
+ $('body').removeClass('is-reveal-open');
388
+ }
389
+
390
+ $('body').attr({
391
+ 'aria-hidden': false,
392
+ 'tabindex': ''
393
+ });
394
+
395
+ _this.$element.attr('aria-hidden', true);
396
+
397
+ /**
398
+ * Fires when the modal is done closing.
399
+ * @event Reveal#closed
400
+ */
401
+ _this.$element.trigger('closed.zf.reveal');
402
+ }
403
+
404
+ /**
405
+ * Resets the modal content
406
+ * This prevents a running video to keep going in the background
407
+ */
408
+ if (this.options.resetOnClose) {
409
+ this.$element.html(this.$element.html());
410
+ }
411
+
412
+ this.isActive = false;
413
+ if (_this.options.deepLink) {
414
+ if (window.history.replaceState) {
415
+ window.history.replaceState("", document.title, window.location.pathname);
416
+ } else {
417
+ window.location.hash = '';
418
+ }
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Toggles the open/closed state of a modal.
424
+ * @function
425
+ */
426
+ toggle() {
427
+ if (this.isActive) {
428
+ this.close();
429
+ } else {
430
+ this.open();
431
+ }
432
+ };
433
+
434
+ /**
435
+ * Destroys an instance of a modal.
436
+ * @function
437
+ */
438
+ destroy() {
439
+ if (this.options.overlay) {
440
+ this.$overlay.hide().off().remove();
441
+ }
442
+ this.$element.hide().off();
443
+ this.$anchor.off('.zf');
444
+ $(window).off(`.zf.reveal:${this.id}`);
445
+
446
+ Foundation.unregisterPlugin(this);
447
+ };
448
+ }
449
+
450
+ Reveal.defaults = {
451
+ /**
452
+ * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
453
+ * @option
454
+ * @example 'slide-in-left'
455
+ */
456
+ animationIn: '',
457
+ /**
458
+ * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
459
+ * @option
460
+ * @example 'slide-out-right'
461
+ */
462
+ animationOut: '',
463
+ /**
464
+ * Time, in ms, to delay the opening of a modal after a click if no animation used.
465
+ * @option
466
+ * @example 10
467
+ */
468
+ showDelay: 0,
469
+ /**
470
+ * Time, in ms, to delay the closing of a modal after a click if no animation used.
471
+ * @option
472
+ * @example 10
473
+ */
474
+ hideDelay: 0,
475
+ /**
476
+ * Allows a click on the body/overlay to close the modal.
477
+ * @option
478
+ * @example true
479
+ */
480
+ closeOnClick: true,
481
+ /**
482
+ * Allows the modal to close if the user presses the `ESCAPE` key.
483
+ * @option
484
+ * @example true
485
+ */
486
+ closeOnEsc: true,
487
+ /**
488
+ * If true, allows multiple modals to be displayed at once.
489
+ * @option
490
+ * @example false
491
+ */
492
+ multipleOpened: false,
493
+ /**
494
+ * Distance, in pixels, the modal should push down from the top of the screen.
495
+ * @option
496
+ * @example 100
497
+ */
498
+ vOffset: 100,
499
+ /**
500
+ * Distance, in pixels, the modal should push in from the side of the screen.
501
+ * @option
502
+ * @example 0
503
+ */
504
+ hOffset: 0,
505
+ /**
506
+ * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
507
+ * @option
508
+ * @example false
509
+ */
510
+ fullScreen: false,
511
+ /**
512
+ * Percentage of screen height the modal should push up from the bottom of the view.
513
+ * @option
514
+ * @example 10
515
+ */
516
+ btmOffsetPct: 10,
517
+ /**
518
+ * Allows the modal to generate an overlay div, which will cover the view when modal opens.
519
+ * @option
520
+ * @example true
521
+ */
522
+ overlay: true,
523
+ /**
524
+ * Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background.
525
+ * @option
526
+ * @example false
527
+ */
528
+ resetOnClose: false,
529
+ /**
530
+ * Allows the modal to alter the url on open/close, and allows the use of the `back` button to close modals. ALSO, allows a modal to auto-maniacally open on page load IF the hash === the modal's user-set id.
531
+ * @option
532
+ * @example false
533
+ */
534
+ deepLink: false
535
+ };
536
+
537
+ // Window exports
538
+ Foundation.plugin(Reveal, 'Reveal');
539
+
540
+ function iPhoneSniff() {
541
+ return /iP(ad|hone|od).*OS/.test(window.navigator.userAgent);
542
+ }
543
+
544
+ }(jQuery);