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,169 +0,0 @@
|
|
1
|
-
!function(Foundation, window){
|
2
|
-
/**
|
3
|
-
* Compares the dimensions of an element to a container and determines collision events with container.
|
4
|
-
* @function
|
5
|
-
* @param {jQuery} element - jQuery object to test for collisions.
|
6
|
-
* @param {jQuery} parent - jQuery object to use as bounding container.
|
7
|
-
* @param {Boolean} lrOnly - set to true to check left and right values only.
|
8
|
-
* @param {Boolean} tbOnly - set to true to check top and bottom values only.
|
9
|
-
* @default if no parent object passed, detects collisions with `window`.
|
10
|
-
* @returns {Boolean} - true if collision free, false if a collision in any direction.
|
11
|
-
*/
|
12
|
-
var ImNotTouchingYou = function(element, parent, lrOnly, tbOnly){
|
13
|
-
var eleDims = GetDimensions(element),
|
14
|
-
top, bottom, left, right;
|
15
|
-
|
16
|
-
if(parent){
|
17
|
-
var parDims = GetDimensions(parent);
|
18
|
-
|
19
|
-
bottom = (eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top);
|
20
|
-
top = (eleDims.offset.top >= parDims.offset.top);
|
21
|
-
left = (eleDims.offset.left >= parDims.offset.left);
|
22
|
-
right = (eleDims.offset.left + eleDims.width <= parDims.width);
|
23
|
-
}else{
|
24
|
-
bottom = (eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top);
|
25
|
-
top = (eleDims.offset.top >= eleDims.windowDims.offset.top);
|
26
|
-
left = (eleDims.offset.left >= eleDims.windowDims.offset.left);
|
27
|
-
right = (eleDims.offset.left + eleDims.width <= eleDims.windowDims.width);
|
28
|
-
}
|
29
|
-
var allDirs = [bottom, top, left, right];
|
30
|
-
|
31
|
-
if(lrOnly){ return left === right === true; }
|
32
|
-
if(tbOnly){ return top === bottom === true; }
|
33
|
-
|
34
|
-
return allDirs.indexOf(false) === -1;
|
35
|
-
};
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Uses native methods to return an object of dimension values.
|
39
|
-
* @function
|
40
|
-
* @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window.
|
41
|
-
* @returns {Object} - nested object of integer pixel values
|
42
|
-
* TODO - if element is window, return only those values.
|
43
|
-
*/
|
44
|
-
var GetDimensions = function(elem, test){
|
45
|
-
elem = elem.length ? elem[0] : elem;
|
46
|
-
|
47
|
-
if(elem === window || elem === document){ throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); }
|
48
|
-
|
49
|
-
var rect = elem.getBoundingClientRect(),
|
50
|
-
parRect = elem.parentNode.getBoundingClientRect(),
|
51
|
-
winRect = document.body.getBoundingClientRect(),
|
52
|
-
winY = window.pageYOffset,
|
53
|
-
winX = window.pageXOffset;
|
54
|
-
|
55
|
-
return {
|
56
|
-
width: rect.width,
|
57
|
-
height: rect.height,
|
58
|
-
offset: {
|
59
|
-
top: rect.top + winY,
|
60
|
-
left: rect.left + winX
|
61
|
-
},
|
62
|
-
parentDims: {
|
63
|
-
width: parRect.width,
|
64
|
-
height: parRect.height,
|
65
|
-
offset: {
|
66
|
-
top: parRect.top + winY,
|
67
|
-
left: parRect.left + winX
|
68
|
-
}
|
69
|
-
},
|
70
|
-
windowDims: {
|
71
|
-
width: winRect.width,
|
72
|
-
height: winRect.height,
|
73
|
-
offset: {
|
74
|
-
top: winY,
|
75
|
-
left: winX
|
76
|
-
}
|
77
|
-
}
|
78
|
-
};
|
79
|
-
};
|
80
|
-
/**
|
81
|
-
* Returns an object of top and left integer pixel values for dynamically rendered elements,
|
82
|
-
* such as: Tooltip, Reveal, and Dropdown
|
83
|
-
* @function
|
84
|
-
* @param {jQuery} element - jQuery object for the element being positioned.
|
85
|
-
* @param {jQuery} anchor - jQuery object for the element's anchor point.
|
86
|
-
* @param {String} position - a string relating to the desired position of the element, relative to it's anchor
|
87
|
-
* @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element.
|
88
|
-
* @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element.
|
89
|
-
* @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
|
90
|
-
* TODO alter/rewrite to work with `em` values as well/instead of pixels
|
91
|
-
*/
|
92
|
-
var GetOffsets = function(element, anchor, position, vOffset, hOffset, isOverflow){
|
93
|
-
var $eleDims = GetDimensions(element),
|
94
|
-
// var $eleDims = GetDimensions(element),
|
95
|
-
$anchorDims = anchor ? GetDimensions(anchor) : null;
|
96
|
-
// $anchorDims = anchor ? GetDimensions(anchor) : null;
|
97
|
-
switch(position){
|
98
|
-
case 'top':
|
99
|
-
return {
|
100
|
-
left: $anchorDims.offset.left,
|
101
|
-
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
102
|
-
};
|
103
|
-
break;
|
104
|
-
case 'left':
|
105
|
-
return {
|
106
|
-
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
107
|
-
top: $anchorDims.offset.top
|
108
|
-
};
|
109
|
-
break;
|
110
|
-
case 'right':
|
111
|
-
return {
|
112
|
-
left: $anchorDims.offset.left + $anchorDims.width + hOffset,
|
113
|
-
top: $anchorDims.offset.top
|
114
|
-
};
|
115
|
-
break;
|
116
|
-
case 'center top':
|
117
|
-
return {
|
118
|
-
left: ($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2),
|
119
|
-
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
120
|
-
};
|
121
|
-
break;
|
122
|
-
case 'center bottom':
|
123
|
-
return {
|
124
|
-
left: isOverflow ? hOffset : (($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2)),
|
125
|
-
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
126
|
-
};
|
127
|
-
break;
|
128
|
-
case 'center left':
|
129
|
-
return {
|
130
|
-
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
131
|
-
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
132
|
-
};
|
133
|
-
break;
|
134
|
-
case 'center right':
|
135
|
-
return {
|
136
|
-
left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1,
|
137
|
-
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
138
|
-
};
|
139
|
-
break;
|
140
|
-
case 'center':
|
141
|
-
return {
|
142
|
-
left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2),
|
143
|
-
top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2)
|
144
|
-
};
|
145
|
-
break;
|
146
|
-
case 'reveal':
|
147
|
-
return {
|
148
|
-
left: ($eleDims.windowDims.width - $eleDims.width) / 2,
|
149
|
-
top: $eleDims.windowDims.offset.top + vOffset
|
150
|
-
};
|
151
|
-
case 'reveal full':
|
152
|
-
return {
|
153
|
-
left: $eleDims.windowDims.offset.left,
|
154
|
-
top: $eleDims.windowDims.offset.top
|
155
|
-
};
|
156
|
-
break;
|
157
|
-
default:
|
158
|
-
return {
|
159
|
-
left: $anchorDims.offset.left,
|
160
|
-
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
161
|
-
};
|
162
|
-
}
|
163
|
-
};
|
164
|
-
Foundation.Box = {
|
165
|
-
ImNotTouchingYou: ImNotTouchingYou,
|
166
|
-
GetDimensions: GetDimensions,
|
167
|
-
GetOffsets: GetOffsets
|
168
|
-
};
|
169
|
-
}(window.Foundation, window);
|
@@ -1,63 +0,0 @@
|
|
1
|
-
!function($, Foundation){
|
2
|
-
'use strict';
|
3
|
-
Foundation.Nest = {
|
4
|
-
Feather: function(menu, type){
|
5
|
-
menu.attr('role', 'menubar');
|
6
|
-
type = type || 'zf';
|
7
|
-
var items = menu.find('li').attr({'role': 'menuitem'}),
|
8
|
-
subMenuClass = 'is-' + type + '-submenu',
|
9
|
-
subItemClass = subMenuClass + '-item',
|
10
|
-
hasSubClass = 'is-' + type + '-submenu-parent';
|
11
|
-
menu.find('a:first').attr('tabindex', 0);
|
12
|
-
items.each(function(){
|
13
|
-
var $item = $(this),
|
14
|
-
$sub = $item.children('ul');
|
15
|
-
if($sub.length){
|
16
|
-
$item.addClass(hasSubClass)
|
17
|
-
.attr({
|
18
|
-
'aria-haspopup': true,
|
19
|
-
'aria-expanded': false,
|
20
|
-
'aria-label': $item.children('a:first').text()
|
21
|
-
});
|
22
|
-
$sub.addClass('submenu ' + subMenuClass)
|
23
|
-
.attr({
|
24
|
-
'data-submenu': '',
|
25
|
-
'aria-hidden': true,
|
26
|
-
'role': 'menu'
|
27
|
-
});
|
28
|
-
}
|
29
|
-
if($item.parent('[data-submenu]').length){
|
30
|
-
$item.addClass('is-submenu-item ' + subItemClass);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
return;
|
34
|
-
},
|
35
|
-
Burn: function(menu, type){
|
36
|
-
var items = menu.find('li').removeAttr('tabindex'),
|
37
|
-
subMenuClass = 'is-' + type + '-submenu',
|
38
|
-
subItemClass = subMenuClass + '-item',
|
39
|
-
hasSubClass = 'is-' + type + '-submenu-parent';
|
40
|
-
|
41
|
-
// menu.find('.is-active').removeClass('is-active');
|
42
|
-
menu.find('*')
|
43
|
-
// menu.find('.' + subMenuClass + ', .' + subItemClass + ', .is-active, .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
44
|
-
.removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active')
|
45
|
-
.removeAttr('data-submenu').css('display', '');
|
46
|
-
|
47
|
-
// console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
48
|
-
// .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu')
|
49
|
-
// .removeAttr('data-submenu'));
|
50
|
-
// items.each(function(){
|
51
|
-
// var $item = $(this),
|
52
|
-
// $sub = $item.children('ul');
|
53
|
-
// if($item.parent('[data-submenu]').length){
|
54
|
-
// $item.removeClass('is-submenu-item ' + subItemClass);
|
55
|
-
// }
|
56
|
-
// if($sub.length){
|
57
|
-
// $item.removeClass('has-submenu');
|
58
|
-
// $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu');
|
59
|
-
// }
|
60
|
-
// });
|
61
|
-
}
|
62
|
-
};
|
63
|
-
}(jQuery, window.Foundation);
|
@@ -1,82 +0,0 @@
|
|
1
|
-
!function($, Foundation){
|
2
|
-
'use strict';
|
3
|
-
var Timer = function(elem, options, cb){
|
4
|
-
var _this = this,
|
5
|
-
duration = options.duration,//options is an object for easily adding features later.
|
6
|
-
nameSpace = Object.keys(elem.data())[0] || 'timer',
|
7
|
-
remain = -1,
|
8
|
-
start,
|
9
|
-
timer;
|
10
|
-
|
11
|
-
this.isPaused = false;
|
12
|
-
|
13
|
-
this.restart = function(){
|
14
|
-
remain = -1;
|
15
|
-
clearTimeout(timer);
|
16
|
-
this.start();
|
17
|
-
};
|
18
|
-
|
19
|
-
this.start = function(){
|
20
|
-
this.isPaused = false
|
21
|
-
// if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
22
|
-
clearTimeout(timer);
|
23
|
-
remain = remain <= 0 ? duration : remain;
|
24
|
-
elem.data('paused', false);
|
25
|
-
start = Date.now();
|
26
|
-
timer = setTimeout(function(){
|
27
|
-
if(options.infinite){
|
28
|
-
_this.restart();//rerun the timer.
|
29
|
-
}
|
30
|
-
cb();
|
31
|
-
}, remain);
|
32
|
-
elem.trigger('timerstart.zf.' + nameSpace);
|
33
|
-
};
|
34
|
-
|
35
|
-
this.pause = function(){
|
36
|
-
this.isPaused = true;
|
37
|
-
//if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
38
|
-
clearTimeout(timer);
|
39
|
-
elem.data('paused', true);
|
40
|
-
var end = Date.now();
|
41
|
-
remain = remain - (end - start);
|
42
|
-
elem.trigger('timerpaused.zf.' + nameSpace);
|
43
|
-
};
|
44
|
-
};
|
45
|
-
/**
|
46
|
-
* Runs a callback function when images are fully loaded.
|
47
|
-
* @param {Object} images - Image(s) to check if loaded.
|
48
|
-
* @param {Func} callback - Function to execute when image is fully loaded.
|
49
|
-
*/
|
50
|
-
var onImagesLoaded = function(images, callback){
|
51
|
-
var self = this,
|
52
|
-
unloaded = images.length;
|
53
|
-
|
54
|
-
if (unloaded === 0) {
|
55
|
-
callback();
|
56
|
-
}
|
57
|
-
|
58
|
-
var singleImageLoaded = function() {
|
59
|
-
unloaded--;
|
60
|
-
if (unloaded === 0) {
|
61
|
-
callback();
|
62
|
-
}
|
63
|
-
};
|
64
|
-
|
65
|
-
images.each(function() {
|
66
|
-
if (this.complete) {
|
67
|
-
singleImageLoaded();
|
68
|
-
}
|
69
|
-
else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) {
|
70
|
-
singleImageLoaded();
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
$(this).one('load', function() {
|
74
|
-
singleImageLoaded();
|
75
|
-
});
|
76
|
-
}
|
77
|
-
});
|
78
|
-
};
|
79
|
-
|
80
|
-
Foundation.Timer = Timer;
|
81
|
-
Foundation.onImagesLoaded = onImagesLoaded;
|
82
|
-
}(jQuery, window.Foundation);
|
@@ -1,224 +0,0 @@
|
|
1
|
-
!function(Foundation, $) {
|
2
|
-
'use strict';
|
3
|
-
// Elements with [data-open] will reveal a plugin that supports it when clicked.
|
4
|
-
$(document).on('click.zf.trigger', '[data-open]', function() {
|
5
|
-
var id = $(this).data('open');
|
6
|
-
$('#' + id).triggerHandler('open.zf.trigger', [$(this)]);
|
7
|
-
});
|
8
|
-
|
9
|
-
// Elements with [data-close] will close a plugin that supports it when clicked.
|
10
|
-
// If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
|
11
|
-
$(document).on('click.zf.trigger', '[data-close]', function() {
|
12
|
-
var id = $(this).data('close');
|
13
|
-
if (id) {
|
14
|
-
$('#' + id).triggerHandler('close.zf.trigger', [$(this)]);
|
15
|
-
}
|
16
|
-
else {
|
17
|
-
$(this).trigger('close.zf.trigger');
|
18
|
-
}
|
19
|
-
});
|
20
|
-
|
21
|
-
// Elements with [data-toggle] will toggle a plugin that supports it when clicked.
|
22
|
-
$(document).on('click.zf.trigger', '[data-toggle]', function() {
|
23
|
-
var id = $(this).data('toggle');
|
24
|
-
$('#' + id).triggerHandler('toggle.zf.trigger', [$(this)]);
|
25
|
-
});
|
26
|
-
|
27
|
-
// Elements with [data-closable] will respond to close.zf.trigger events.
|
28
|
-
$(document).on('close.zf.trigger', '[data-closable]', function(e){
|
29
|
-
e.stopPropagation();
|
30
|
-
var animation = $(this).data('closable');
|
31
|
-
|
32
|
-
if(animation !== ''){
|
33
|
-
Foundation.Motion.animateOut($(this), animation, function() {
|
34
|
-
$(this).trigger('closed.zf');
|
35
|
-
});
|
36
|
-
}else{
|
37
|
-
$(this).fadeOut().trigger('closed.zf');
|
38
|
-
}
|
39
|
-
});
|
40
|
-
|
41
|
-
var MutationObserver = (function () {
|
42
|
-
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
43
|
-
for (var i=0; i < prefixes.length; i++) {
|
44
|
-
if (prefixes[i] + 'MutationObserver' in window) {
|
45
|
-
return window[prefixes[i] + 'MutationObserver'];
|
46
|
-
}
|
47
|
-
}
|
48
|
-
return false;
|
49
|
-
}());
|
50
|
-
|
51
|
-
|
52
|
-
var checkListeners = function(){
|
53
|
-
eventsListener();
|
54
|
-
resizeListener();
|
55
|
-
scrollListener();
|
56
|
-
closemeListener();
|
57
|
-
};
|
58
|
-
/**
|
59
|
-
* Fires once after all other scripts have loaded
|
60
|
-
* @function
|
61
|
-
* @private
|
62
|
-
*/
|
63
|
-
$(window).load(function(){
|
64
|
-
checkListeners();
|
65
|
-
});
|
66
|
-
|
67
|
-
//******** only fires this function once on load, if there's something to watch ********
|
68
|
-
var closemeListener = function(pluginName){
|
69
|
-
var yetiBoxes = $('[data-yeti-box]'),
|
70
|
-
plugNames = ['dropdown', 'tooltip', 'reveal'];
|
71
|
-
|
72
|
-
if(pluginName){
|
73
|
-
if(typeof pluginName === 'string'){
|
74
|
-
plugNames.push(pluginName);
|
75
|
-
}else if(typeof pluginName === 'object' && typeof pluginName[0] === 'string'){
|
76
|
-
plugNames.concat(pluginName);
|
77
|
-
}else{
|
78
|
-
console.error('Plugin names must be strings');
|
79
|
-
}
|
80
|
-
}
|
81
|
-
if(yetiBoxes.length){
|
82
|
-
var listeners = plugNames.map(function(name){
|
83
|
-
return 'closeme.zf.' + name;
|
84
|
-
}).join(' ');
|
85
|
-
|
86
|
-
$(window).off(listeners).on(listeners, function(e, pluginId){
|
87
|
-
var plugin = e.namespace.split('.')[0];
|
88
|
-
var plugins = $('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]');
|
89
|
-
|
90
|
-
plugins.each(function(){
|
91
|
-
var _this = $(this);
|
92
|
-
|
93
|
-
_this.triggerHandler('close.zf.trigger', [_this]);
|
94
|
-
});
|
95
|
-
});
|
96
|
-
}
|
97
|
-
};
|
98
|
-
var resizeListener = function(debounce){
|
99
|
-
var timer,
|
100
|
-
$nodes = $('[data-resize]');
|
101
|
-
if($nodes.length){
|
102
|
-
$(window).off('resize.zf.trigger')
|
103
|
-
.on('resize.zf.trigger', function(e) {
|
104
|
-
if (timer) { clearTimeout(timer); }
|
105
|
-
|
106
|
-
timer = setTimeout(function(){
|
107
|
-
|
108
|
-
if(!MutationObserver){//fallback for IE 9
|
109
|
-
$nodes.each(function(){
|
110
|
-
$(this).triggerHandler('resizeme.zf.trigger');
|
111
|
-
});
|
112
|
-
}
|
113
|
-
//trigger all listening elements and signal a resize event
|
114
|
-
$nodes.attr('data-events', "resize");
|
115
|
-
}, debounce || 10);//default time to emit resize event
|
116
|
-
});
|
117
|
-
}
|
118
|
-
};
|
119
|
-
var scrollListener = function(debounce){
|
120
|
-
var timer,
|
121
|
-
$nodes = $('[data-scroll]');
|
122
|
-
if($nodes.length){
|
123
|
-
$(window).off('scroll.zf.trigger')
|
124
|
-
.on('scroll.zf.trigger', function(e){
|
125
|
-
if(timer){ clearTimeout(timer); }
|
126
|
-
|
127
|
-
timer = setTimeout(function(){
|
128
|
-
|
129
|
-
if(!MutationObserver){//fallback for IE 9
|
130
|
-
$nodes.each(function(){
|
131
|
-
$(this).triggerHandler('scrollme.zf.trigger');
|
132
|
-
});
|
133
|
-
}
|
134
|
-
//trigger all listening elements and signal a scroll event
|
135
|
-
$nodes.attr('data-events', "scroll");
|
136
|
-
}, debounce || 10);//default time to emit scroll event
|
137
|
-
});
|
138
|
-
}
|
139
|
-
};
|
140
|
-
// function domMutationObserver(debounce) {
|
141
|
-
// // !!! This is coming soon and needs more work; not active !!! //
|
142
|
-
// var timer,
|
143
|
-
// nodes = document.querySelectorAll('[data-mutate]');
|
144
|
-
// //
|
145
|
-
// if (nodes.length) {
|
146
|
-
// // var MutationObserver = (function () {
|
147
|
-
// // var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
148
|
-
// // for (var i=0; i < prefixes.length; i++) {
|
149
|
-
// // if (prefixes[i] + 'MutationObserver' in window) {
|
150
|
-
// // return window[prefixes[i] + 'MutationObserver'];
|
151
|
-
// // }
|
152
|
-
// // }
|
153
|
-
// // return false;
|
154
|
-
// // }());
|
155
|
-
//
|
156
|
-
//
|
157
|
-
// //for the body, we need to listen for all changes effecting the style and class attributes
|
158
|
-
// var bodyObserver = new MutationObserver(bodyMutation);
|
159
|
-
// bodyObserver.observe(document.body, { attributes: true, childList: true, characterData: false, subtree:true, attributeFilter:["style", "class"]});
|
160
|
-
//
|
161
|
-
//
|
162
|
-
// //body callback
|
163
|
-
// function bodyMutation(mutate) {
|
164
|
-
// //trigger all listening elements and signal a mutation event
|
165
|
-
// if (timer) { clearTimeout(timer); }
|
166
|
-
//
|
167
|
-
// timer = setTimeout(function() {
|
168
|
-
// bodyObserver.disconnect();
|
169
|
-
// $('[data-mutate]').attr('data-events',"mutate");
|
170
|
-
// }, debounce || 150);
|
171
|
-
// }
|
172
|
-
// }
|
173
|
-
// }
|
174
|
-
var eventsListener = function() {
|
175
|
-
if(!MutationObserver){ return false; }
|
176
|
-
var nodes = document.querySelectorAll('[data-resize], [data-scroll], [data-mutate]');
|
177
|
-
|
178
|
-
//element callback
|
179
|
-
var listeningElementsMutation = function(mutationRecordsList) {
|
180
|
-
var $target = $(mutationRecordsList[0].target);
|
181
|
-
//trigger the event handler for the element depending on type
|
182
|
-
switch ($target.attr("data-events")) {
|
183
|
-
|
184
|
-
case "resize" :
|
185
|
-
$target.triggerHandler('resizeme.zf.trigger', [$target]);
|
186
|
-
break;
|
187
|
-
|
188
|
-
case "scroll" :
|
189
|
-
$target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
|
190
|
-
break;
|
191
|
-
|
192
|
-
// case "mutate" :
|
193
|
-
// console.log('mutate', $target);
|
194
|
-
// $target.triggerHandler('mutate.zf.trigger');
|
195
|
-
//
|
196
|
-
// //make sure we don't get stuck in an infinite loop from sloppy codeing
|
197
|
-
// if ($target.index('[data-mutate]') == $("[data-mutate]").length-1) {
|
198
|
-
// domMutationObserver();
|
199
|
-
// }
|
200
|
-
// break;
|
201
|
-
|
202
|
-
default :
|
203
|
-
return false;
|
204
|
-
//nothing
|
205
|
-
}
|
206
|
-
}
|
207
|
-
|
208
|
-
if(nodes.length){
|
209
|
-
//for each element that needs to listen for resizing, scrolling, (or coming soon mutation) add a single observer
|
210
|
-
for (var i = 0; i <= nodes.length-1; i++) {
|
211
|
-
var elementObserver = new MutationObserver(listeningElementsMutation);
|
212
|
-
elementObserver.observe(nodes[i], { attributes: true, childList: false, characterData: false, subtree:false, attributeFilter:["data-events"]});
|
213
|
-
}
|
214
|
-
}
|
215
|
-
};
|
216
|
-
// ------------------------------------
|
217
|
-
|
218
|
-
// [PH]
|
219
|
-
// Foundation.CheckWatchers = checkWatchers;
|
220
|
-
Foundation.IHearYou = checkListeners;
|
221
|
-
// Foundation.ISeeYou = scrollListener;
|
222
|
-
// Foundation.IFeelYou = closemeListener;
|
223
|
-
|
224
|
-
}(window.Foundation, window.jQuery);
|