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.
- checksums.yaml +4 -4
- data/.travis.yml +7 -6
- data/README.md +1 -1
- data/Rakefile +5 -1
- data/bower.json +3 -3
- data/foundation-rails.gemspec +1 -0
- data/lib/foundation-rails.rb +1 -0
- data/lib/foundation/rails/version.rb +1 -1
- data/lib/generators/foundation/templates/foundation_and_overrides.scss +2 -2
- data/vendor/assets/js/foundation.abide.js.es6 +462 -0
- data/vendor/assets/js/{foundation.accordion.js → foundation.accordion.js.es6} +55 -47
- data/vendor/assets/js/{foundation.accordionMenu.js → foundation.accordionMenu.js.es6} +46 -35
- data/vendor/assets/js/{foundation.core.js → foundation.core.js.es6} +10 -8
- data/vendor/assets/js/{foundation.drilldown.js → foundation.drilldown.js.es6} +75 -49
- data/vendor/assets/js/{foundation.dropdown.js → foundation.dropdown.js.es6} +100 -88
- data/vendor/assets/js/{foundation.dropdownMenu.js → foundation.dropdownMenu.js.es6} +134 -128
- data/vendor/assets/js/{foundation.equalizer.js → foundation.equalizer.js.es6} +72 -61
- data/vendor/assets/js/{foundation.interchange.js → foundation.interchange.js.es6} +44 -45
- data/vendor/assets/js/{foundation.js → foundation.js.es6} +0 -0
- data/vendor/assets/js/{foundation.magellan.js → foundation.magellan.js.es6} +80 -83
- data/vendor/assets/js/foundation.offcanvas.js.es6 +395 -0
- data/vendor/assets/js/foundation.orbit.js.es6 +445 -0
- data/vendor/assets/js/{foundation.responsiveMenu.js → foundation.responsiveMenu.js.es6} +37 -31
- data/vendor/assets/js/foundation.responsiveToggle.js.es6 +112 -0
- data/vendor/assets/js/foundation.reveal.js.es6 +544 -0
- data/vendor/assets/js/{foundation.slider.js → foundation.slider.js.es6} +235 -184
- data/vendor/assets/js/{foundation.sticky.js → foundation.sticky.js.es6} +177 -166
- data/vendor/assets/js/{foundation.tabs.js → foundation.tabs.js.es6} +138 -118
- data/vendor/assets/js/{foundation.toggler.js → foundation.toggler.js.es6} +34 -37
- data/vendor/assets/js/{foundation.tooltip.js → foundation.tooltip.js.es6} +162 -153
- data/vendor/assets/js/foundation.util.box.js.es6 +183 -0
- data/vendor/assets/js/{foundation.util.keyboard.js → foundation.util.keyboard.js.es6} +54 -54
- data/vendor/assets/js/{foundation.util.mediaQuery.js → foundation.util.mediaQuery.js.es6} +46 -46
- data/vendor/assets/js/{foundation.util.motion.js → foundation.util.motion.js.es6} +58 -48
- data/vendor/assets/js/foundation.util.nest.js.es6 +76 -0
- data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +86 -0
- data/vendor/assets/js/{foundation.util.touch.js → foundation.util.touch.js.es6} +2 -2
- data/vendor/assets/js/foundation.util.triggers.js.es6 +239 -0
- data/vendor/assets/scss/_global.scss +28 -27
- data/vendor/assets/scss/components/_badge.scss +1 -1
- data/vendor/assets/scss/components/_button-group.scss +77 -26
- data/vendor/assets/scss/components/_button.scss +8 -8
- data/vendor/assets/scss/components/_callout.scss +2 -2
- data/vendor/assets/scss/components/_drilldown.scss +4 -0
- data/vendor/assets/scss/components/_dropdown-menu.scss +104 -54
- data/vendor/assets/scss/components/_flex.scss +28 -0
- data/vendor/assets/scss/components/_label.scss +1 -1
- data/vendor/assets/scss/components/_media-object.scss +37 -7
- data/vendor/assets/scss/components/_menu-icon.scss +9 -0
- data/vendor/assets/scss/components/_menu.scss +127 -29
- data/vendor/assets/scss/components/_off-canvas.scss +1 -0
- data/vendor/assets/scss/components/_pagination.scss +3 -3
- data/vendor/assets/scss/components/_progress-bar.scss +1 -25
- data/vendor/assets/scss/components/_reveal.scss +12 -6
- data/vendor/assets/scss/components/_slider.scss +3 -35
- data/vendor/assets/scss/components/_table.scss +8 -0
- data/vendor/assets/scss/components/_tabs.scss +5 -10
- data/vendor/assets/scss/components/_title-bar.scss +27 -10
- data/vendor/assets/scss/components/_tooltip.scss +0 -4
- data/vendor/assets/scss/components/_top-bar.scss +93 -21
- data/vendor/assets/scss/components/_visibility.scss +1 -1
- data/vendor/assets/scss/forms/_checkbox.scss +1 -1
- data/vendor/assets/scss/forms/_error.scss +7 -5
- data/vendor/assets/scss/forms/_forms.scss +3 -0
- data/vendor/assets/scss/forms/_help-text.scss +1 -1
- data/vendor/assets/scss/forms/_input-group.scss +44 -9
- data/vendor/assets/scss/forms/_meter.scss +109 -0
- data/vendor/assets/scss/forms/_progress.scss +85 -0
- data/vendor/assets/scss/forms/_range.scss +144 -0
- data/vendor/assets/scss/forms/_select.scss +1 -1
- data/vendor/assets/scss/forms/_text.scss +10 -1
- data/vendor/assets/scss/foundation.scss +16 -5
- data/vendor/assets/scss/grid/_classes.scss +5 -18
- data/vendor/assets/scss/grid/_column.scss +13 -11
- data/vendor/assets/scss/grid/_flex-grid.scss +54 -80
- data/vendor/assets/scss/grid/_grid.scss +22 -10
- data/vendor/assets/scss/grid/_layout.scss +18 -0
- data/vendor/assets/scss/grid/_row.scss +11 -15
- data/vendor/assets/scss/motion-ui/_classes.scss +10 -3
- data/vendor/assets/scss/motion-ui/effects/_fade.scss +4 -1
- data/vendor/assets/scss/motion-ui/effects/_zoom.scss +1 -1
- data/vendor/assets/scss/motion-ui/transitions/_slide.scss +1 -1
- data/vendor/assets/scss/motion-ui/util/_transition.scss +1 -1
- data/vendor/assets/scss/settings/_settings.scss +64 -47
- data/vendor/assets/scss/typography/_base.scss +4 -0
- data/vendor/assets/scss/typography/_print.scss +9 -5
- data/vendor/assets/scss/util/_breakpoint.scss +31 -25
- data/vendor/assets/scss/util/_color.scss +19 -0
- data/vendor/assets/scss/util/_flex.scss +68 -0
- data/vendor/assets/scss/util/_mixins.scss +13 -7
- data/vendor/assets/scss/util/_util.scss +1 -5
- data/vendor/assets/scss/util/_value.scss +9 -28
- metadata +51 -31
- data/vendor/assets/js/foundation.abide.js +0 -418
- data/vendor/assets/js/foundation.offcanvas.js +0 -376
- data/vendor/assets/js/foundation.orbit.js +0 -421
- data/vendor/assets/js/foundation.responsiveToggle.js +0 -106
- data/vendor/assets/js/foundation.reveal.js +0 -514
- data/vendor/assets/js/foundation.util.box.js +0 -169
- data/vendor/assets/js/foundation.util.nest.js +0 -63
- data/vendor/assets/js/foundation.util.timerAndImageLoader.js +0 -82
- data/vendor/assets/js/foundation.util.triggers.js +0 -224
@@ -1,12 +1,15 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
!function($) {
|
4
|
+
|
1
5
|
/**
|
2
6
|
* Accordion module.
|
3
7
|
* @module foundation.accordion
|
4
8
|
* @requires foundation.util.keyboard
|
5
9
|
* @requires foundation.util.motion
|
6
10
|
*/
|
7
|
-
!function($, Foundation) {
|
8
|
-
'use strict';
|
9
11
|
|
12
|
+
class Accordion {
|
10
13
|
/**
|
11
14
|
* Creates a new instance of an accordion.
|
12
15
|
* @class
|
@@ -14,7 +17,7 @@
|
|
14
17
|
* @param {jQuery} element - jQuery object to make into an accordion.
|
15
18
|
* @param {Object} options - a plain object with settings to override the default options.
|
16
19
|
*/
|
17
|
-
|
20
|
+
constructor(element, options) {
|
18
21
|
this.$element = element;
|
19
22
|
this.options = $.extend({}, Accordion.defaults, this.$element.data(), options);
|
20
23
|
|
@@ -29,32 +32,11 @@
|
|
29
32
|
});
|
30
33
|
}
|
31
34
|
|
32
|
-
Accordion.defaults = {
|
33
|
-
/**
|
34
|
-
* Amount of time to animate the opening of an accordion pane.
|
35
|
-
* @option
|
36
|
-
* @example 250
|
37
|
-
*/
|
38
|
-
slideSpeed: 250,
|
39
|
-
/**
|
40
|
-
* Allow the accordion to have multiple open panes.
|
41
|
-
* @option
|
42
|
-
* @example false
|
43
|
-
*/
|
44
|
-
multiExpand: false,
|
45
|
-
/**
|
46
|
-
* Allow the accordion to close all panes.
|
47
|
-
* @option
|
48
|
-
* @example false
|
49
|
-
*/
|
50
|
-
allowAllClosed: false
|
51
|
-
};
|
52
|
-
|
53
35
|
/**
|
54
36
|
* Initializes the accordion by animating the preset active pane(s).
|
55
37
|
* @private
|
56
38
|
*/
|
57
|
-
|
39
|
+
_init() {
|
58
40
|
this.$element.attr('role', 'tablist');
|
59
41
|
this.$tabs = this.$element.children('li');
|
60
42
|
if (this.$tabs.length === 0) {
|
@@ -65,7 +47,7 @@
|
|
65
47
|
var $el = $(el),
|
66
48
|
$content = $el.find('[data-tab-content]'),
|
67
49
|
id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'),
|
68
|
-
linkId = el.id || id
|
50
|
+
linkId = el.id || `${id}-label`;
|
69
51
|
|
70
52
|
$el.find('a:first').attr({
|
71
53
|
'aria-controls': id,
|
@@ -81,21 +63,21 @@
|
|
81
63
|
this.down($initActive, true);
|
82
64
|
}
|
83
65
|
this._events();
|
84
|
-
}
|
66
|
+
}
|
85
67
|
|
86
68
|
/**
|
87
69
|
* Adds event handlers for items within the accordion.
|
88
70
|
* @private
|
89
71
|
*/
|
90
|
-
|
72
|
+
_events() {
|
91
73
|
var _this = this;
|
92
74
|
|
93
|
-
this.$tabs.each(function(){
|
75
|
+
this.$tabs.each(function() {
|
94
76
|
var $elem = $(this);
|
95
77
|
var $tabContent = $elem.children('[data-tab-content]');
|
96
78
|
if ($tabContent.length) {
|
97
79
|
$elem.children('a').off('click.zf.accordion keydown.zf.accordion')
|
98
|
-
.on('click.zf.accordion', function(e){
|
80
|
+
.on('click.zf.accordion', function(e) {
|
99
81
|
// $(this).children('a').on('click.zf.accordion', function(e) {
|
100
82
|
e.preventDefault();
|
101
83
|
if ($elem.hasClass('is-active')) {
|
@@ -125,21 +107,23 @@
|
|
125
107
|
});
|
126
108
|
}
|
127
109
|
});
|
128
|
-
}
|
110
|
+
}
|
111
|
+
|
129
112
|
/**
|
130
113
|
* Toggles the selected content pane's open/close state.
|
131
114
|
* @param {jQuery} $target - jQuery object of the pane to toggle.
|
132
115
|
* @function
|
133
116
|
*/
|
134
|
-
|
135
|
-
if($target.parent().hasClass('is-active')){
|
117
|
+
toggle($target) {
|
118
|
+
if($target.parent().hasClass('is-active')) {
|
136
119
|
if(this.options.allowAllClosed || $target.parent().siblings().hasClass('is-active')){
|
137
120
|
this.up($target);
|
138
|
-
}else{ return; }
|
139
|
-
}else{
|
121
|
+
} else { return; }
|
122
|
+
} else {
|
140
123
|
this.down($target);
|
141
124
|
}
|
142
|
-
}
|
125
|
+
}
|
126
|
+
|
143
127
|
/**
|
144
128
|
* Opens the accordion tab defined by `$target`.
|
145
129
|
* @param {jQuery} $target - Accordion pane to open.
|
@@ -147,7 +131,7 @@
|
|
147
131
|
* @fires Accordion#down
|
148
132
|
* @function
|
149
133
|
*/
|
150
|
-
|
134
|
+
down($target, firstTime) {
|
151
135
|
var _this = this;
|
152
136
|
if(!this.options.multiExpand && !firstTime){
|
153
137
|
var $currentActive = this.$element.find('.is-active').children('[data-tab-content]');
|
@@ -175,11 +159,11 @@
|
|
175
159
|
// if(!firstTime){
|
176
160
|
// Foundation._reflow(this.$element.attr('data-accordion'));
|
177
161
|
// }
|
178
|
-
$(
|
162
|
+
$(`#${$target.attr('aria-labelledby')}`).attr({
|
179
163
|
'aria-expanded': true,
|
180
164
|
'aria-selected': true
|
181
165
|
});
|
182
|
-
}
|
166
|
+
}
|
183
167
|
|
184
168
|
/**
|
185
169
|
* Closes the tab defined by `$target`.
|
@@ -187,12 +171,12 @@
|
|
187
171
|
* @fires Accordion#up
|
188
172
|
* @function
|
189
173
|
*/
|
190
|
-
|
174
|
+
up($target) {
|
191
175
|
var $aunts = $target.parent().siblings(),
|
192
176
|
_this = this;
|
193
177
|
var canClose = this.options.multiExpand ? $aunts.hasClass('is-active') : $target.parent().hasClass('is-active');
|
194
178
|
|
195
|
-
if(!this.options.allowAllClosed && !canClose){
|
179
|
+
if(!this.options.allowAllClosed && !canClose) {
|
196
180
|
return;
|
197
181
|
}
|
198
182
|
|
@@ -209,23 +193,47 @@
|
|
209
193
|
$target.attr('aria-hidden', true)
|
210
194
|
.parent().removeClass('is-active');
|
211
195
|
|
212
|
-
$(
|
196
|
+
$(`#${$target.attr('aria-labelledby')}`).attr({
|
213
197
|
'aria-expanded': false,
|
214
198
|
'aria-selected': false
|
215
199
|
});
|
216
|
-
}
|
200
|
+
}
|
217
201
|
|
218
202
|
/**
|
219
203
|
* Destroys an instance of an accordion.
|
220
204
|
* @fires Accordion#destroyed
|
221
205
|
* @function
|
222
206
|
*/
|
223
|
-
|
207
|
+
destroy() {
|
224
208
|
this.$element.find('[data-tab-content]').slideUp(0).css('display', '');
|
225
209
|
this.$element.find('a').off('.zf.accordion');
|
226
210
|
|
227
211
|
Foundation.unregisterPlugin(this);
|
228
|
-
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
Accordion.defaults = {
|
216
|
+
/**
|
217
|
+
* Amount of time to animate the opening of an accordion pane.
|
218
|
+
* @option
|
219
|
+
* @example 250
|
220
|
+
*/
|
221
|
+
slideSpeed: 250,
|
222
|
+
/**
|
223
|
+
* Allow the accordion to have multiple open panes.
|
224
|
+
* @option
|
225
|
+
* @example false
|
226
|
+
*/
|
227
|
+
multiExpand: false,
|
228
|
+
/**
|
229
|
+
* Allow the accordion to close all panes.
|
230
|
+
* @option
|
231
|
+
* @example false
|
232
|
+
*/
|
233
|
+
allowAllClosed: false
|
234
|
+
};
|
235
|
+
|
236
|
+
// Window exports
|
237
|
+
Foundation.plugin(Accordion, 'Accordion');
|
229
238
|
|
230
|
-
|
231
|
-
}(jQuery, window.Foundation);
|
239
|
+
}(jQuery);
|
@@ -1,3 +1,7 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
!function($) {
|
4
|
+
|
1
5
|
/**
|
2
6
|
* AccordionMenu module.
|
3
7
|
* @module foundation.accordionMenu
|
@@ -5,9 +9,8 @@
|
|
5
9
|
* @requires foundation.util.motion
|
6
10
|
* @requires foundation.util.nest
|
7
11
|
*/
|
8
|
-
!function($) {
|
9
|
-
'use strict';
|
10
12
|
|
13
|
+
class AccordionMenu {
|
11
14
|
/**
|
12
15
|
* Creates a new instance of an accordion menu.
|
13
16
|
* @class
|
@@ -15,7 +18,7 @@
|
|
15
18
|
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
16
19
|
* @param {Object} options - Overrides to the default plugin settings.
|
17
20
|
*/
|
18
|
-
|
21
|
+
constructor(element, options) {
|
19
22
|
this.$element = element;
|
20
23
|
this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options);
|
21
24
|
|
@@ -37,26 +40,13 @@
|
|
37
40
|
});
|
38
41
|
}
|
39
42
|
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Amount of time to animate the opening of a submenu in ms.
|
43
|
-
* @option
|
44
|
-
* @example 250
|
45
|
-
*/
|
46
|
-
slideSpeed: 250,
|
47
|
-
/**
|
48
|
-
* Allow the menu to have multiple open panes.
|
49
|
-
* @option
|
50
|
-
* @example true
|
51
|
-
*/
|
52
|
-
multiOpen: true
|
53
|
-
};
|
43
|
+
|
54
44
|
|
55
45
|
/**
|
56
46
|
* Initializes the accordion menu by hiding all nested menus.
|
57
47
|
* @private
|
58
48
|
*/
|
59
|
-
|
49
|
+
_init() {
|
60
50
|
this.$element.find('[data-submenu]').not('.is-active').slideUp(0);//.find('a').css('padding-left', '1rem');
|
61
51
|
this.$element.attr({
|
62
52
|
'role': 'tablist',
|
@@ -91,13 +81,13 @@
|
|
91
81
|
});
|
92
82
|
}
|
93
83
|
this._events();
|
94
|
-
}
|
84
|
+
}
|
95
85
|
|
96
86
|
/**
|
97
87
|
* Adds event handlers for items within the menu.
|
98
88
|
* @private
|
99
89
|
*/
|
100
|
-
|
90
|
+
_events() {
|
101
91
|
var _this = this;
|
102
92
|
|
103
93
|
this.$element.find('li').each(function() {
|
@@ -172,20 +162,22 @@
|
|
172
162
|
}
|
173
163
|
});
|
174
164
|
});//.attr('tabindex', 0);
|
175
|
-
}
|
165
|
+
}
|
166
|
+
|
176
167
|
/**
|
177
168
|
* Closes all panes of the menu.
|
178
169
|
* @function
|
179
170
|
*/
|
180
|
-
|
171
|
+
hideAll() {
|
181
172
|
this.$element.find('[data-submenu]').slideUp(this.options.slideSpeed);
|
182
|
-
}
|
173
|
+
}
|
174
|
+
|
183
175
|
/**
|
184
176
|
* Toggles the open/close state of a submenu.
|
185
177
|
* @function
|
186
178
|
* @param {jQuery} $target - the submenu to toggle
|
187
179
|
*/
|
188
|
-
|
180
|
+
toggle($target){
|
189
181
|
if(!$target.is(':animated')) {
|
190
182
|
if (!$target.is(':hidden')) {
|
191
183
|
this.up($target);
|
@@ -194,23 +186,24 @@
|
|
194
186
|
this.down($target);
|
195
187
|
}
|
196
188
|
}
|
197
|
-
}
|
189
|
+
}
|
190
|
+
|
198
191
|
/**
|
199
192
|
* Opens the sub-menu defined by `$target`.
|
200
193
|
* @param {jQuery} $target - Sub-menu to open.
|
201
194
|
* @fires AccordionMenu#down
|
202
195
|
*/
|
203
|
-
|
196
|
+
down($target) {
|
204
197
|
var _this = this;
|
205
198
|
|
206
|
-
if(!this.options.multiOpen){
|
199
|
+
if(!this.options.multiOpen) {
|
207
200
|
this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target)));
|
208
201
|
}
|
209
202
|
|
210
203
|
$target.addClass('is-active').attr({'aria-hidden': false})
|
211
204
|
.parent('.is-accordion-submenu-parent').attr({'aria-expanded': true});
|
212
205
|
|
213
|
-
Foundation.Move(this.options.slideSpeed, $target, function(){
|
206
|
+
Foundation.Move(this.options.slideSpeed, $target, function() {
|
214
207
|
$target.slideDown(_this.options.slideSpeed, function () {
|
215
208
|
/**
|
216
209
|
* Fires when the menu is done opening.
|
@@ -219,14 +212,14 @@
|
|
219
212
|
_this.$element.trigger('down.zf.accordionMenu', [$target]);
|
220
213
|
});
|
221
214
|
});
|
222
|
-
}
|
215
|
+
}
|
223
216
|
|
224
217
|
/**
|
225
218
|
* Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well.
|
226
219
|
* @param {jQuery} $target - Sub-menu to close.
|
227
220
|
* @fires AccordionMenu#up
|
228
221
|
*/
|
229
|
-
|
222
|
+
up($target) {
|
230
223
|
var _this = this;
|
231
224
|
Foundation.Move(this.options.slideSpeed, $target, function(){
|
232
225
|
$target.slideUp(_this.options.slideSpeed, function () {
|
@@ -241,19 +234,37 @@
|
|
241
234
|
var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true);
|
242
235
|
|
243
236
|
$menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false);
|
244
|
-
}
|
237
|
+
}
|
245
238
|
|
246
239
|
/**
|
247
240
|
* Destroys an instance of accordion menu.
|
248
241
|
* @fires AccordionMenu#destroyed
|
249
242
|
*/
|
250
|
-
|
243
|
+
destroy() {
|
251
244
|
this.$element.find('[data-submenu]').slideDown(0).css('display', '');
|
252
245
|
this.$element.find('a').off('click.zf.accordionMenu');
|
253
246
|
|
254
247
|
Foundation.Nest.Burn(this.$element, 'accordion');
|
255
248
|
Foundation.unregisterPlugin(this);
|
256
|
-
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
AccordionMenu.defaults = {
|
253
|
+
/**
|
254
|
+
* Amount of time to animate the opening of a submenu in ms.
|
255
|
+
* @option
|
256
|
+
* @example 250
|
257
|
+
*/
|
258
|
+
slideSpeed: 250,
|
259
|
+
/**
|
260
|
+
* Allow the menu to have multiple open panes.
|
261
|
+
* @option
|
262
|
+
* @example true
|
263
|
+
*/
|
264
|
+
multiOpen: true
|
265
|
+
};
|
266
|
+
|
267
|
+
// Window exports
|
268
|
+
Foundation.plugin(AccordionMenu, 'AccordionMenu');
|
257
269
|
|
258
|
-
|
259
|
-
}(jQuery, window.Foundation);
|
270
|
+
}(jQuery);
|
@@ -1,7 +1,8 @@
|
|
1
1
|
!function($) {
|
2
|
+
|
2
3
|
"use strict";
|
3
4
|
|
4
|
-
var FOUNDATION_VERSION = '6.
|
5
|
+
var FOUNDATION_VERSION = '6.2.0';
|
5
6
|
|
6
7
|
// Global Foundation object
|
7
8
|
// This is attached to the window, or used as a module for AMD/Browserify
|
@@ -52,13 +53,13 @@ var Foundation = {
|
|
52
53
|
var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
|
53
54
|
plugin.uuid = this.GetYoDigits(6, pluginName);
|
54
55
|
|
55
|
-
if(!plugin.$element.attr(
|
56
|
+
if(!plugin.$element.attr(`data-${pluginName}`)){ plugin.$element.attr(`data-${pluginName}`, plugin.uuid); }
|
56
57
|
if(!plugin.$element.data('zfPlugin')){ plugin.$element.data('zfPlugin', plugin); }
|
57
58
|
/**
|
58
59
|
* Fires when the plugin has initialized.
|
59
60
|
* @event Plugin#init
|
60
61
|
*/
|
61
|
-
plugin.$element.trigger(
|
62
|
+
plugin.$element.trigger(`init.zf.${pluginName}`);
|
62
63
|
|
63
64
|
this._uuids.push(plugin.uuid);
|
64
65
|
|
@@ -76,12 +77,12 @@ var Foundation = {
|
|
76
77
|
var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
|
77
78
|
|
78
79
|
this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
|
79
|
-
plugin.$element.removeAttr(
|
80
|
+
plugin.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')
|
80
81
|
/**
|
81
82
|
* Fires when the plugin has been destroyed.
|
82
83
|
* @event Plugin#destroyed
|
83
84
|
*/
|
84
|
-
.trigger(
|
85
|
+
.trigger(`destroyed.zf.${pluginName}`);
|
85
86
|
for(var prop in plugin){
|
86
87
|
plugin[prop] = null;//clean up script to prep for garbage collection.
|
87
88
|
}
|
@@ -107,10 +108,12 @@ var Foundation = {
|
|
107
108
|
fns = {
|
108
109
|
'object': function(plgs){
|
109
110
|
plgs.forEach(function(p){
|
111
|
+
p = hyphenate(p);
|
110
112
|
$('[data-'+ p +']').foundation('_init');
|
111
113
|
});
|
112
114
|
},
|
113
115
|
'string': function(){
|
116
|
+
plugins = hyphenate(plugins);
|
114
117
|
$('[data-'+ plugins +']').foundation('_init');
|
115
118
|
},
|
116
119
|
'undefined': function(){
|
@@ -136,7 +139,7 @@ var Foundation = {
|
|
136
139
|
*/
|
137
140
|
GetYoDigits: function(length, namespace){
|
138
141
|
length = length || 6;
|
139
|
-
return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ?
|
142
|
+
return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : '');
|
140
143
|
},
|
141
144
|
/**
|
142
145
|
* Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
|
@@ -217,7 +220,6 @@ var Foundation = {
|
|
217
220
|
}
|
218
221
|
};
|
219
222
|
|
220
|
-
|
221
223
|
Foundation.util = {
|
222
224
|
/**
|
223
225
|
* Function for applying a debounce effect to a function call.
|
@@ -279,7 +281,7 @@ var foundation = function(method) {
|
|
279
281
|
throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
|
280
282
|
}
|
281
283
|
}else{//error for invalid argument type
|
282
|
-
throw new TypeError(
|
284
|
+
throw new TypeError(`We're sorry, ${type} is not a valid parameter. You must use a string representing the method you wish to invoke.`);
|
283
285
|
}
|
284
286
|
return this;
|
285
287
|
};
|