Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 2eb9273

Browse files
author
mhayes
committed
Foundation build to bower-foundation
1 parent d0c5775 commit 2eb9273

File tree

7 files changed

+61
-44
lines changed

7 files changed

+61
-44
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "foundation",
3-
"version": "5.0.2",
3+
"version": "5.0.3",
44
"main": [
55
"css/foundation.css",
66
"js/foundation.js"

js/foundation.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@
647647
Foundation.libs.accordion = {
648648
name : 'accordion',
649649

650-
version : '5.0.1',
650+
version : '5.0.3',
651651

652652
settings : {
653653
active_class: 'active',
@@ -2671,7 +2671,7 @@
26712671
Foundation.libs.offcanvas = {
26722672
name : 'offcanvas',
26732673

2674-
version : '5.0.0',
2674+
version : '5.0.3',
26752675

26762676
settings : {},
26772677

@@ -2702,6 +2702,7 @@
27022702
reflow : function () {}
27032703
};
27042704
}(jQuery, this, this.document));
2705+
27052706
;(function ($, window, document, undefined) {
27062707
'use strict';
27072708

@@ -3128,24 +3129,14 @@
31283129
after_slide_change: noop
31293130
},
31303131

3131-
init: function (scope, method, options) {
3132+
init : function (scope, method, options) {
31323133
var self = this;
3133-
31343134
this.bindings(method, options);
31353135
},
31363136

3137-
events : function () {
3138-
var self = this;
3139-
3140-
if ($(self.scope).is('[data-orbit]')) {
3141-
var $el = $(self.scope);
3142-
$el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init')));
3143-
} else {
3144-
$('[data-orbit]', self.scope).each(function(idx, el) {
3145-
var $el = $(el);
3146-
$el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init')));
3147-
});
3148-
}
3137+
events : function (instance) {
3138+
var orbit_instance = new Orbit($(instance), $(instance).data('orbit-init'));
3139+
$(instance).data(self.name + '-instance', orbit_instance);
31493140
},
31503141

31513142
reflow : function () {
@@ -3237,7 +3228,7 @@
32373228

32383229
$(this.scope)
32393230
.off('.reveal');
3240-
3231+
32413232
$(document)
32423233
.on('click.fndtn.reveal', this.close_targets(), function (e) {
32433234

@@ -3276,17 +3267,33 @@
32763267
.on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
32773268
}
32783269

3279-
$('body').on('keyup.fndtn.reveal', function ( event ) {
3270+
return true;
3271+
},
3272+
3273+
// PATCH #3: turning on key up capture only when a reveal window is open
3274+
key_up_on : function (scope) {
3275+
var self = this;
3276+
3277+
// PATCH #1: fixing multiple keyup event trigger from single key press
3278+
$('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
32803279
var open_modal = $('[data-reveal].open'),
32813280
settings = open_modal.data('reveal-init');
3282-
if ( settings && event.which === 27 && settings.close_on_esc) { // 27 is the keycode for the Escape key
3283-
open_modal.foundation('reveal', 'close');
3281+
// PATCH #2: making sure that the close event can be called only while unlocked,
3282+
// so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
3283+
if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
3284+
self.close.call(self, open_modal);
32843285
}
32853286
});
32863287

32873288
return true;
32883289
},
32893290

3291+
// PATCH #3: turning on key up capture only when a reveal window is open
3292+
key_up_off : function (scope) {
3293+
$('body').off('keyup.fndtn.reveal');
3294+
return true;
3295+
},
3296+
32903297
open : function (target, ajax_settings) {
32913298
var self = this;
32923299
if (target) {
@@ -3311,6 +3318,7 @@
33113318
.data('offset', this.cache_offset(modal));
33123319
}
33133320

3321+
this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
33143322
modal.trigger('open');
33153323

33163324
if (open_modal.length < 1) {
@@ -3362,6 +3370,7 @@
33623370

33633371
if (open_modals.length > 0) {
33643372
this.locked = true;
3373+
this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
33653374
modal.trigger('close');
33663375
this.toggle_bg(modal);
33673376
this.hide(open_modals, settings.css.close, settings);

js/foundation.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/foundation/foundation.accordion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Foundation.libs.accordion = {
55
name : 'accordion',
66

7-
version : '5.0.1',
7+
version : '5.0.3',
88

99
settings : {
1010
active_class: 'active',

js/foundation/foundation.offcanvas.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Foundation.libs.offcanvas = {
55
name : 'offcanvas',
66

7-
version : '5.0.0',
7+
version : '5.0.3',
88

99
settings : {},
1010

@@ -34,4 +34,4 @@
3434

3535
reflow : function () {}
3636
};
37-
}(jQuery, this, this.document));
37+
}(jQuery, this, this.document));

js/foundation/foundation.orbit.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -424,24 +424,14 @@
424424
after_slide_change: noop
425425
},
426426

427-
init: function (scope, method, options) {
427+
init : function (scope, method, options) {
428428
var self = this;
429-
430429
this.bindings(method, options);
431430
},
432431

433-
events : function () {
434-
var self = this;
435-
436-
if ($(self.scope).is('[data-orbit]')) {
437-
var $el = $(self.scope);
438-
$el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init')));
439-
} else {
440-
$('[data-orbit]', self.scope).each(function(idx, el) {
441-
var $el = $(el);
442-
$el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init')));
443-
});
444-
}
432+
events : function (instance) {
433+
var orbit_instance = new Orbit($(instance), $(instance).data('orbit-init'));
434+
$(instance).data(self.name + '-instance', orbit_instance);
445435
},
446436

447437
reflow : function () {

js/foundation/foundation.reveal.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
$(this.scope)
6868
.off('.reveal');
69-
69+
7070
$(document)
7171
.on('click.fndtn.reveal', this.close_targets(), function (e) {
7272

@@ -105,17 +105,33 @@
105105
.on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
106106
}
107107

108-
$('body').on('keyup.fndtn.reveal', function ( event ) {
108+
return true;
109+
},
110+
111+
// PATCH #3: turning on key up capture only when a reveal window is open
112+
key_up_on : function (scope) {
113+
var self = this;
114+
115+
// PATCH #1: fixing multiple keyup event trigger from single key press
116+
$('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
109117
var open_modal = $('[data-reveal].open'),
110118
settings = open_modal.data('reveal-init');
111-
if ( settings && event.which === 27 && settings.close_on_esc) { // 27 is the keycode for the Escape key
112-
open_modal.foundation('reveal', 'close');
119+
// PATCH #2: making sure that the close event can be called only while unlocked,
120+
// so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
121+
if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
122+
self.close.call(self, open_modal);
113123
}
114124
});
115125

116126
return true;
117127
},
118128

129+
// PATCH #3: turning on key up capture only when a reveal window is open
130+
key_up_off : function (scope) {
131+
$('body').off('keyup.fndtn.reveal');
132+
return true;
133+
},
134+
119135
open : function (target, ajax_settings) {
120136
var self = this;
121137
if (target) {
@@ -140,6 +156,7 @@
140156
.data('offset', this.cache_offset(modal));
141157
}
142158

159+
this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
143160
modal.trigger('open');
144161

145162
if (open_modal.length < 1) {
@@ -191,6 +208,7 @@
191208

192209
if (open_modals.length > 0) {
193210
this.locked = true;
211+
this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
194212
modal.trigger('close');
195213
this.toggle_bg(modal);
196214
this.hide(open_modals, settings.css.close, settings);

0 commit comments

Comments
 (0)