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
@@ -1,106 +0,0 @@
1
- /**
2
- * ResponsiveToggle module.
3
- * @module foundation.responsiveToggle
4
- * @requires foundation.util.mediaQuery
5
- */
6
- !function($, Foundation) {
7
-
8
- 'use strict';
9
-
10
- /**
11
- * Creates a new instance of Tab Bar.
12
- * @class
13
- * @fires ResponsiveToggle#init
14
- * @param {jQuery} element - jQuery object to attach tab bar functionality to.
15
- * @param {Object} options - Overrides to the default plugin settings.
16
- */
17
- function ResponsiveToggle(element, options) {
18
- this.$element = $(element);
19
- this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options);
20
-
21
- this._init();
22
- this._events();
23
-
24
- Foundation.registerPlugin(this, 'ResponsiveToggle');
25
- }
26
-
27
- ResponsiveToggle.defaults = {
28
- /**
29
- * The breakpoint after which the menu is always shown, and the tab bar is hidden.
30
- * @option
31
- * @example 'medium'
32
- */
33
- hideFor: 'medium'
34
- };
35
-
36
- /**
37
- * Initializes the tab bar by finding the target element, toggling element, and running update().
38
- * @function
39
- * @private
40
- */
41
- ResponsiveToggle.prototype._init = function() {
42
- var targetID = this.$element.data('responsive-toggle');
43
- if (!targetID) {
44
- console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.');
45
- }
46
-
47
- this.$targetMenu = $('#'+targetID);
48
- this.$toggler = this.$element.find('[data-toggle]');
49
-
50
- this._update();
51
- };
52
-
53
- /**
54
- * Adds necessary event handlers for the tab bar to work.
55
- * @function
56
- * @private
57
- */
58
- ResponsiveToggle.prototype._events = function() {
59
- var _this = this;
60
-
61
- $(window).on('changed.zf.mediaquery', this._update.bind(this));
62
-
63
- this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this));
64
- };
65
-
66
- /**
67
- * Checks the current media query to determine if the tab bar should be visible or hidden.
68
- * @function
69
- * @private
70
- */
71
- ResponsiveToggle.prototype._update = function() {
72
- // Mobile
73
- if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
74
- this.$element.show();
75
- this.$targetMenu.hide();
76
- }
77
-
78
- // Desktop
79
- else {
80
- this.$element.hide();
81
- this.$targetMenu.show();
82
- }
83
- };
84
-
85
- /**
86
- * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it.
87
- * @function
88
- * @fires ResponsiveToggle#toggled
89
- */
90
- ResponsiveToggle.prototype.toggleMenu = function() {
91
- if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
92
- this.$targetMenu.toggle(0);
93
-
94
- /**
95
- * Fires when the element attached to the tab bar toggles.
96
- * @event ResponsiveToggle#toggled
97
- */
98
- this.$element.trigger('toggled.zf.responsiveToggle');
99
- }
100
- };
101
- ResponsiveToggle.prototype.destroy = function(){
102
- //TODO this...
103
- };
104
- Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle');
105
-
106
- }(jQuery, Foundation);
@@ -1,514 +0,0 @@
1
- /**
2
- * Reveal module.
3
- * @module foundation.reveal
4
- * @requires foundation.util.keyboard
5
- * @requires foundation.util.box
6
- * @requires foundation.util.triggers
7
- * @requires foundation.util.mediaQuery
8
- * @requires foundation.util.motion if using animations
9
- */
10
- !function(Foundation, $) {
11
- 'use strict';
12
-
13
- /**
14
- * Creates a new instance of Reveal.
15
- * @class
16
- * @param {jQuery} element - jQuery object to use for the modal.
17
- * @param {Object} options - optional parameters.
18
- */
19
-
20
- function Reveal(element, options) {
21
- this.$element = element;
22
- this.options = $.extend({}, Reveal.defaults, this.$element.data(), options);
23
- this._init();
24
-
25
- Foundation.registerPlugin(this, 'Reveal');
26
- Foundation.Keyboard.register('Reveal', {
27
- 'ENTER': 'open',
28
- 'SPACE': 'open',
29
- 'ESCAPE': 'close',
30
- 'TAB': 'tab_forward',
31
- 'SHIFT_TAB': 'tab_backward'
32
- });
33
- }
34
-
35
- Reveal.defaults = {
36
- /**
37
- * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
38
- * @option
39
- * @example 'slide-in-left'
40
- */
41
- animationIn: '',
42
- /**
43
- * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
44
- * @option
45
- * @example 'slide-out-right'
46
- */
47
- animationOut: '',
48
- /**
49
- * Time, in ms, to delay the opening of a modal after a click if no animation used.
50
- * @option
51
- * @example 10
52
- */
53
- showDelay: 0,
54
- /**
55
- * Time, in ms, to delay the closing of a modal after a click if no animation used.
56
- * @option
57
- * @example 10
58
- */
59
- hideDelay: 0,
60
- /**
61
- * Allows a click on the body/overlay to close the modal.
62
- * @option
63
- * @example true
64
- */
65
- closeOnClick: true,
66
- /**
67
- * Allows the modal to close if the user presses the `ESCAPE` key.
68
- * @option
69
- * @example true
70
- */
71
- closeOnEsc: true,
72
- /**
73
- * If true, allows multiple modals to be displayed at once.
74
- * @option
75
- * @example false
76
- */
77
- multipleOpened: false,
78
- /**
79
- * Distance, in pixels, the modal should push down from the top of the screen.
80
- * @option
81
- * @example 100
82
- */
83
- vOffset: 100,
84
- /**
85
- * Distance, in pixels, the modal should push in from the side of the screen.
86
- * @option
87
- * @example 0
88
- */
89
- hOffset: 0,
90
- /**
91
- * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
92
- * @option
93
- * @example false
94
- */
95
- fullScreen: false,
96
- /**
97
- * Percentage of screen height the modal should push up from the bottom of the view.
98
- * @option
99
- * @example 10
100
- */
101
- btmOffsetPct: 10,
102
- /**
103
- * Allows the modal to generate an overlay div, which will cover the view when modal opens.
104
- * @option
105
- * @example true
106
- */
107
- overlay: true,
108
- /**
109
- * 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.
110
- * @option
111
- * @example false
112
- */
113
- resetOnClose: false,
114
- /**
115
- * 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.
116
- * @option
117
- * @example false
118
- */
119
- deepLink: false
120
- };
121
-
122
- /**
123
- * Initializes the modal by adding the overlay and close buttons, (if selected).
124
- * @private
125
- */
126
- Reveal.prototype._init = function(){
127
- this.id = this.$element.attr('id');
128
- this.isActive = false;
129
-
130
- this.$anchor = $('[data-open="' + this.id + '"]').length ? $('[data-open="' + this.id + '"]') : $('[data-toggle="' + this.id + '"]');
131
-
132
- if(this.$anchor.length){
133
- var anchorId = this.$anchor[0].id || Foundation.GetYoDigits(6, 'reveal');
134
-
135
- this.$anchor.attr({
136
- 'aria-controls': this.id,
137
- 'id': anchorId,
138
- 'aria-haspopup': true,
139
- 'tabindex': 0
140
- });
141
- this.$element.attr({'aria-labelledby': anchorId});
142
- }
143
-
144
- // this.options.fullScreen = this.$element.hasClass('full');
145
- if(this.options.fullScreen || this.$element.hasClass('full')){
146
- this.options.fullScreen = true;
147
- this.options.overlay = false;
148
- }
149
- if(this.options.overlay && !this.$overlay){
150
- this.$overlay = this._makeOverlay(this.id);
151
- }
152
-
153
- this.$element.attr({
154
- 'role': 'dialog',
155
- 'aria-hidden': true,
156
- 'data-yeti-box': this.id,
157
- 'data-resize': this.id
158
- });
159
-
160
- this._events();
161
- if(this.options.deepLink && window.location.hash === ( '#' + this.id)){
162
- $(window).one('load.zf.reveal', this.open.bind(this));
163
- }
164
- };
165
-
166
- /**
167
- * Creates an overlay div to display behind the modal.
168
- * @private
169
- */
170
- Reveal.prototype._makeOverlay = function(id){
171
- var $overlay = $('<div></div>')
172
- .addClass('reveal-overlay')
173
- .attr({'tabindex': -1, 'aria-hidden': true})
174
- .appendTo('body');
175
- if(this.options.closeOnClick){
176
- $overlay.attr({
177
- 'data-close': id
178
- });
179
- }
180
- return $overlay;
181
- };
182
-
183
- /**
184
- * Adds event handlers for the modal.
185
- * @private
186
- */
187
- Reveal.prototype._events = function(){
188
- var _this = this;
189
-
190
- this.$element.on({
191
- 'open.zf.trigger': this.open.bind(this),
192
- 'close.zf.trigger': this.close.bind(this),
193
- 'toggle.zf.trigger': this.toggle.bind(this),
194
- 'resizeme.zf.trigger': function(){
195
- if(_this.$element.is(':visible')){
196
- _this._setPosition(function(){});
197
- }
198
- }
199
- });
200
-
201
- if(this.$anchor.length){
202
- this.$anchor.on('keydown.zf.reveal', function(e){
203
- if(e.which === 13 || e.which === 32){
204
- e.stopPropagation();
205
- e.preventDefault();
206
- _this.open();
207
- }
208
- });
209
- }
210
-
211
-
212
- if(this.options.closeOnClick && this.options.overlay){
213
- this.$overlay.off('.zf.reveal').on('click.zf.reveal', this.close.bind(this));
214
- }
215
- if(this.options.deepLink){
216
- $(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this));
217
- }
218
- };
219
- /**
220
- * Handles modal methods on back/forward button clicks or any other event that triggers popstate.
221
- * @private
222
- */
223
- Reveal.prototype._handleState = function(e){
224
- if(window.location.hash === ( '#' + this.id) && !this.isActive){ this.open(); }
225
- else{ this.close(); }
226
- };
227
- /**
228
- * Sets the position of the modal before opening
229
- * @param {Function} cb - a callback function to execute when positioning is complete.
230
- * @private
231
- */
232
- Reveal.prototype._setPosition = function(cb){
233
- var eleDims = Foundation.Box.GetDimensions(this.$element);
234
- var elePos = this.options.fullScreen ? 'reveal full' : (eleDims.height >= (0.5 * eleDims.windowDims.height)) ? 'reveal' : 'center';
235
-
236
- if(elePos === 'reveal full'){
237
- //set to full height/width
238
- this.$element
239
- .offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset))
240
- .css({
241
- 'height': eleDims.windowDims.height,
242
- 'width': eleDims.windowDims.width
243
- });
244
- }else if(!Foundation.MediaQuery.atLeast('medium') || !Foundation.Box.ImNotTouchingYou(this.$element, null, true, false)){
245
- //if smaller than medium, resize to 100% width minus any custom L/R margin
246
- this.$element
247
- .css({
248
- 'width': eleDims.windowDims.width - (this.options.hOffset * 2)
249
- })
250
- .offset(Foundation.Box.GetOffsets(this.$element, null, 'center', this.options.vOffset, this.options.hOffset));
251
- //flag a boolean so we can reset the size after the element is closed.
252
- this.changedSize = true;
253
- }else{
254
- this.$element
255
- .css({
256
- 'max-height': eleDims.windowDims.height - (this.options.vOffset * (this.options.btmOffsetPct / 100 + 1)),
257
- 'width': ''
258
- })
259
- .offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset));
260
- //the max height based on a percentage of vertical offset plus vertical offset
261
- }
262
-
263
- cb();
264
- };
265
-
266
- /**
267
- * Opens the modal controlled by `this.$anchor`, and closes all others by default.
268
- * @function
269
- * @fires Reveal#closeme
270
- * @fires Reveal#open
271
- */
272
- Reveal.prototype.open = function(){
273
- if(this.options.deepLink){
274
- var hash = '#' + this.id;
275
-
276
- if(window.history.pushState){
277
- window.history.pushState(null, null, hash);
278
- }else{
279
- window.location.hash = hash;
280
- }
281
- }
282
-
283
- var _this = this;
284
- this.isActive = true;
285
- //make element invisible, but remove display: none so we can get size and positioning
286
- this.$element
287
- .css({'visibility': 'hidden'})
288
- .show()
289
- .scrollTop(0);
290
-
291
- this._setPosition(function(){
292
- _this.$element.hide()
293
- .css({'visibility': ''});
294
- if(!_this.options.multipleOpened){
295
- /**
296
- * Fires immediately before the modal opens.
297
- * Closes any other modals that are currently open
298
- * @event Reveal#closeme
299
- */
300
- _this.$element.trigger('closeme.zf.reveal', _this.id);
301
- }
302
- if(_this.options.animationIn){
303
- if(_this.options.overlay){
304
- Foundation.Motion.animateIn(_this.$overlay, 'fade-in', function(){
305
- Foundation.Motion.animateIn(_this.$element, _this.options.animationIn, function(){
306
- _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
307
- });
308
- });
309
- }else{
310
- Foundation.Motion.animateIn(_this.$element, _this.options.animationIn, function(){
311
- _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
312
- });
313
- }
314
- }else{
315
- if(_this.options.overlay){
316
- _this.$overlay.show(0, function(){
317
- _this.$element.show(_this.options.showDelay, function(){
318
- });
319
- });
320
- }else{
321
- _this.$element.show(_this.options.showDelay, function(){
322
- });
323
- }
324
- }
325
- });
326
-
327
-
328
- // handle accessibility
329
- this.$element.attr({'aria-hidden': false}).attr('tabindex', -1).focus()
330
- /**
331
- * Fires when the modal has successfully opened.
332
- * @event Reveal#open
333
- */
334
- .trigger('open.zf.reveal');
335
-
336
- $('body').addClass('is-reveal-open')
337
- .attr({'aria-hidden': (this.options.overlay || this.options.fullScreen) ? true : false});
338
- setTimeout(function(){
339
- _this._extraHandlers();
340
- }, 0);
341
- };
342
-
343
- /**
344
- * Adds extra event handlers for the body and window if necessary.
345
- * @private
346
- */
347
- Reveal.prototype._extraHandlers = function(){
348
- var _this = this;
349
- this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
350
-
351
- if(!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen){
352
- $('body').on('click.zf.reveal', function(e){
353
- if(e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)){ return; }
354
- _this.close();
355
- });
356
- }
357
- if(this.options.closeOnEsc){
358
- $(window).on('keydown.zf.reveal', function(e){
359
- Foundation.Keyboard.handleKey(e, 'Reveal', {
360
- close: function() {
361
- if (_this.options.closeOnEsc) {
362
- _this.close();
363
- _this.$anchor.focus();
364
- }
365
- }
366
- });
367
- if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
368
- e.preventDefault();
369
- }
370
- });
371
- }
372
-
373
- // lock focus within modal while tabbing
374
- this.$element.on('keydown.zf.reveal', function(e) {
375
- var $target = $(this);
376
- // handle keyboard event with keyboard util
377
- Foundation.Keyboard.handleKey(e, 'Reveal', {
378
- tab_forward: function() {
379
- if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { // left modal downwards, setting focus to first element
380
- _this.focusableElements.eq(0).focus();
381
- e.preventDefault();
382
- }
383
- },
384
- tab_backward: function() {
385
- if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element
386
- _this.focusableElements.eq(-1).focus();
387
- e.preventDefault();
388
- }
389
- },
390
- open: function() {
391
- if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {
392
- setTimeout(function() { // set focus back to anchor if close button has been activated
393
- _this.$anchor.focus();
394
- }, 1);
395
- } else if ($target.is(_this.focusableElements)) { // dont't trigger if acual element has focus (i.e. inputs, links, ...)
396
- _this.open();
397
- }
398
- },
399
- close: function() {
400
- if (_this.options.closeOnEsc) {
401
- _this.close();
402
- _this.$anchor.focus();
403
- }
404
- }
405
- });
406
- });
407
-
408
- };
409
-
410
- /**
411
- * Closes the modal.
412
- * @function
413
- * @fires Reveal#closed
414
- */
415
- Reveal.prototype.close = function(){
416
- if(!this.isActive || !this.$element.is(':visible')){
417
- return false;
418
- }
419
- var _this = this;
420
-
421
- if(this.options.animationOut){
422
- Foundation.Motion.animateOut(this.$element, this.options.animationOut, function(){
423
- if(_this.options.overlay){
424
- Foundation.Motion.animateOut(_this.$overlay, 'fade-out', finishUp);
425
- }else{ finishUp(); }
426
- });
427
- }else{
428
- this.$element.hide(_this.options.hideDelay, function(){
429
- if(_this.options.overlay){
430
- _this.$overlay.hide(0, finishUp);
431
- }else{ finishUp(); }
432
- });
433
- }
434
- //conditionals to remove extra event listeners added on open
435
- if(this.options.closeOnEsc){
436
- $(window).off('keydown.zf.reveal');
437
- }
438
- if(!this.options.overlay && this.options.closeOnClick){
439
- $('body').off('click.zf.reveal');
440
- }
441
- this.$element.off('keydown.zf.reveal');
442
- function finishUp(){
443
- //if the modal changed size, reset it
444
- if(_this.changedSize){
445
- _this.$element.css({
446
- 'height': '',
447
- 'width': ''
448
- });
449
- }
450
- $('body').removeClass('is-reveal-open').attr({'aria-hidden': false, 'tabindex': ''});
451
- _this.$element.attr({'aria-hidden': true})
452
- /**
453
- * Fires when the modal is done closing.
454
- * @event Reveal#closed
455
- */
456
- .trigger('closed.zf.reveal');
457
- }
458
-
459
-
460
- /**
461
- * Resets the modal content
462
- * This prevents a running video to keep going in the background
463
- */
464
- if(this.options.resetOnClose) {
465
- this.$element.html(this.$element.html());
466
- }
467
-
468
- this.isActive = false;
469
- if(_this.options.deepLink){
470
- if(window.history.replaceState){
471
- window.history.replaceState("", document.title, window.location.pathname);
472
- }else{
473
- window.location.hash = '';
474
- }
475
- }
476
- };
477
- /**
478
- * Toggles the open/closed state of a modal.
479
- * @function
480
- */
481
- Reveal.prototype.toggle = function(){
482
- if(this.isActive){
483
- this.close();
484
- }else{
485
- this.open();
486
- }
487
- };
488
-
489
- /**
490
- * Destroys an instance of a modal.
491
- * @function
492
- */
493
- Reveal.prototype.destroy = function() {
494
- if(this.options.overlay){
495
- this.$overlay.hide().off().remove();
496
- }
497
- this.$element.hide().off();
498
- this.$anchor.off('.zf');
499
- $(window).off('.zf.reveal:' + this.id);
500
-
501
- Foundation.unregisterPlugin(this);
502
- };
503
-
504
- Foundation.plugin(Reveal, 'Reveal');
505
-
506
- // Exports for AMD/Browserify
507
- if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
508
- module.exports = Reveal;
509
- if (typeof define === 'function')
510
- define(['foundation'], function() {
511
- return Reveal;
512
- });
513
-
514
- }(Foundation, jQuery);