foundation6-jekyll-base 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/_includes/footer.html +1 -0
- data/_includes/head.html +16 -0
- data/_includes/header.html +1 -0
- data/_includes/javascripts.html +4 -0
- data/_layouts/default.html +18 -0
- data/_layouts/home.html +26 -0
- data/_layouts/page.html +15 -0
- data/_layouts/post.html +25 -0
- data/_sass/_vendor/normalize-scss/sass/_normalize.scss +3 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
- data/_sass/foundation/_global.scss +219 -0
- data/_sass/foundation/components/_accordion-menu.scss +36 -0
- data/_sass/foundation/components/_accordion.scss +150 -0
- data/_sass/foundation/components/_badge.scss +63 -0
- data/_sass/foundation/components/_breadcrumbs.scss +97 -0
- data/_sass/foundation/components/_button-group.scss +249 -0
- data/_sass/foundation/components/_button.scss +303 -0
- data/_sass/foundation/components/_callout.scss +106 -0
- data/_sass/foundation/components/_card.scss +121 -0
- data/_sass/foundation/components/_close-button.scss +102 -0
- data/_sass/foundation/components/_drilldown.scss +93 -0
- data/_sass/foundation/components/_dropdown-menu.scss +226 -0
- data/_sass/foundation/components/_dropdown.scss +72 -0
- data/_sass/foundation/components/_flex-video.scss +1 -0
- data/_sass/foundation/components/_flex.scss +28 -0
- data/_sass/foundation/components/_float.scss +27 -0
- data/_sass/foundation/components/_label.scss +64 -0
- data/_sass/foundation/components/_media-object.scss +114 -0
- data/_sass/foundation/components/_menu-icon.scss +9 -0
- data/_sass/foundation/components/_menu.scss +371 -0
- data/_sass/foundation/components/_off-canvas.scss +329 -0
- data/_sass/foundation/components/_orbit.scss +196 -0
- data/_sass/foundation/components/_pagination.scss +193 -0
- data/_sass/foundation/components/_progress-bar.scss +64 -0
- data/_sass/foundation/components/_responsive-embed.scss +67 -0
- data/_sass/foundation/components/_reveal.scss +178 -0
- data/_sass/foundation/components/_slider.scss +138 -0
- data/_sass/foundation/components/_sticky.scss +38 -0
- data/_sass/foundation/components/_switch.scss +247 -0
- data/_sass/foundation/components/_table.scss +329 -0
- data/_sass/foundation/components/_tabs.scss +196 -0
- data/_sass/foundation/components/_thumbnail.scss +67 -0
- data/_sass/foundation/components/_title-bar.scss +84 -0
- data/_sass/foundation/components/_tooltip.scss +107 -0
- data/_sass/foundation/components/_top-bar.scss +173 -0
- data/_sass/foundation/components/_visibility.scss +132 -0
- data/_sass/foundation/forms/_checkbox.scss +41 -0
- data/_sass/foundation/forms/_error.scss +88 -0
- data/_sass/foundation/forms/_fieldset.scss +54 -0
- data/_sass/foundation/forms/_forms.scss +34 -0
- data/_sass/foundation/forms/_help-text.scss +30 -0
- data/_sass/foundation/forms/_input-group.scss +135 -0
- data/_sass/foundation/forms/_label.scss +50 -0
- data/_sass/foundation/forms/_meter.scss +110 -0
- data/_sass/foundation/forms/_progress.scss +94 -0
- data/_sass/foundation/forms/_range.scss +149 -0
- data/_sass/foundation/forms/_select.scss +85 -0
- data/_sass/foundation/forms/_text.scss +170 -0
- data/_sass/foundation/foundation.scss +118 -0
- data/_sass/foundation/grid/_classes.scss +176 -0
- data/_sass/foundation/grid/_column.scss +112 -0
- data/_sass/foundation/grid/_flex-grid.scss +307 -0
- data/_sass/foundation/grid/_grid.scss +44 -0
- data/_sass/foundation/grid/_gutter.scss +82 -0
- data/_sass/foundation/grid/_layout.scss +76 -0
- data/_sass/foundation/grid/_position.scss +76 -0
- data/_sass/foundation/grid/_row.scss +99 -0
- data/_sass/foundation/grid/_size.scss +24 -0
- data/_sass/foundation/settings/_settings.scss +621 -0
- data/_sass/foundation/typography/_alignment.scss +22 -0
- data/_sass/foundation/typography/_base.scss +509 -0
- data/_sass/foundation/typography/_helpers.scss +78 -0
- data/_sass/foundation/typography/_print.scss +81 -0
- data/_sass/foundation/typography/_typography.scss +26 -0
- data/_sass/foundation/util/_breakpoint.scss +281 -0
- data/_sass/foundation/util/_color.scss +126 -0
- data/_sass/foundation/util/_direction.scss +31 -0
- data/_sass/foundation/util/_flex.scss +85 -0
- data/_sass/foundation/util/_math.scss +72 -0
- data/_sass/foundation/util/_mixins.scss +276 -0
- data/_sass/foundation/util/_selector.scss +41 -0
- data/_sass/foundation/util/_unit.scss +152 -0
- data/_sass/foundation/util/_util.scss +13 -0
- data/_sass/foundation/util/_value.scss +140 -0
- data/assets/js/app.js +1 -0
- data/assets/js/vendor/foundation/foundation.d.ts +496 -0
- data/assets/js/vendor/foundation/foundation.js +10207 -0
- data/assets/js/vendor/foundation/foundation.min.js +4 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.js +637 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.js +252 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.js +318 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.js +386 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.js +565 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.js +465 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.js +486 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.js +374 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.js +285 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.js +474 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.js +566 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.js +177 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.js +633 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.js +762 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.js +518 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.js +512 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.js +492 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.js +196 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.js +163 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.js +103 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.js +74 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.js +90 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.js +352 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.js +261 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.js +262 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.min.js +1 -0
- data/assets/main.scss +6 -0
- metadata +232 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _classCallCheck(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function n(n,e){for(var i=0;i<e.length;i++){var t=e[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,t.key,t)}}return function(e,i,t){return i&&n(e.prototype,i),t&&n(e,t),e}}();!function(n){var e=function(){function e(i,t){_classCallCheck(this,e),this.$element=i,this.options=n.extend({},e.defaults,this.$element.data(),t),Foundation.Nest.Feather(this.$element,"accordion"),this._init(),Foundation.registerPlugin(this,"AccordionMenu"),Foundation.Keyboard.register("AccordionMenu",{ENTER:"toggle",SPACE:"toggle",ARROW_RIGHT:"open",ARROW_UP:"up",ARROW_DOWN:"down",ARROW_LEFT:"close",ESCAPE:"closeAll"})}return _createClass(e,[{key:"_init",value:function(){this.$element.find("[data-submenu]").not(".is-active").slideUp(0),this.$element.attr({role:"menu","aria-multiselectable":this.options.multiOpen}),this.$menuLinks=this.$element.find(".is-accordion-submenu-parent"),this.$menuLinks.each(function(){var e=this.id||Foundation.GetYoDigits(6,"acc-menu-link"),i=n(this),t=i.children("[data-submenu]"),a=t[0].id||Foundation.GetYoDigits(6,"acc-menu"),s=t.hasClass("is-active");i.attr({"aria-controls":a,"aria-expanded":s,role:"menuitem",id:e}),t.attr({"aria-labelledby":e,"aria-hidden":!s,role:"menu",id:a})});var e=this.$element.find(".is-active");if(e.length){var i=this;e.each(function(){i.down(n(this))})}this._events()}},{key:"_events",value:function(){var e=this;this.$element.find("li").each(function(){var i=n(this).children("[data-submenu]");i.length&&n(this).children("a").off("click.zf.accordionMenu").on("click.zf.accordionMenu",function(n){n.preventDefault(),e.toggle(i)})}).on("keydown.zf.accordionmenu",function(i){var t,a,s=n(this),o=s.parent("ul").children("li"),d=s.children("[data-submenu]");o.each(function(e){if(n(this).is(s))return t=o.eq(Math.max(0,e-1)).find("a").first(),a=o.eq(Math.min(e+1,o.length-1)).find("a").first(),n(this).children("[data-submenu]:visible").length&&(a=s.find("li:first-child").find("a").first()),n(this).is(":first-child")?t=s.parents("li").first().find("a").first():t.parents("li").first().children("[data-submenu]:visible").length&&(t=t.parents("li").find("li:last-child").find("a").first()),void(n(this).is(":last-child")&&(a=s.parents("li").first().next("li").find("a").first()))}),Foundation.Keyboard.handleKey(i,"AccordionMenu",{open:function(){d.is(":hidden")&&(e.down(d),d.find("li").first().find("a").first().focus())},close:function(){d.length&&!d.is(":hidden")?e.up(d):s.parent("[data-submenu]").length&&(e.up(s.parent("[data-submenu]")),s.parents("li").first().find("a").first().focus())},up:function(){return t.focus(),!0},down:function(){return a.focus(),!0},toggle:function(){s.children("[data-submenu]").length&&e.toggle(s.children("[data-submenu]"))},closeAll:function(){e.hideAll()},handled:function(n){n&&i.preventDefault(),i.stopImmediatePropagation()}})})}},{key:"hideAll",value:function(){this.up(this.$element.find("[data-submenu]"))}},{key:"showAll",value:function(){this.down(this.$element.find("[data-submenu]"))}},{key:"toggle",value:function(n){n.is(":animated")||(n.is(":hidden")?this.down(n):this.up(n))}},{key:"down",value:function(n){var e=this;this.options.multiOpen||this.up(this.$element.find(".is-active").not(n.parentsUntil(this.$element).add(n))),n.addClass("is-active").attr({"aria-hidden":!1}).parent(".is-accordion-submenu-parent").attr({"aria-expanded":!0}),n.slideDown(e.options.slideSpeed,function(){e.$element.trigger("down.zf.accordionMenu",[n])})}},{key:"up",value:function(n){var e=this;n.slideUp(e.options.slideSpeed,function(){e.$element.trigger("up.zf.accordionMenu",[n])});var i=n.find("[data-submenu]").slideUp(0).addBack().attr("aria-hidden",!0);i.parent(".is-accordion-submenu-parent").attr("aria-expanded",!1)}},{key:"destroy",value:function(){this.$element.find("[data-submenu]").slideDown(0).css("display",""),this.$element.find("a").off("click.zf.accordionMenu"),Foundation.Nest.Burn(this.$element,"accordion"),Foundation.unregisterPlugin(this)}}]),e}();e.defaults={slideSpeed:250,multiOpen:!0},Foundation.plugin(e,"AccordionMenu")}(jQuery);
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
!function ($) {
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
var FOUNDATION_VERSION = '6.3.1';
|
|
6
|
+
|
|
7
|
+
// Global Foundation object
|
|
8
|
+
// This is attached to the window, or used as a module for AMD/Browserify
|
|
9
|
+
var Foundation = {
|
|
10
|
+
version: FOUNDATION_VERSION,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Stores initialized plugins.
|
|
14
|
+
*/
|
|
15
|
+
_plugins: {},
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Stores generated unique ids for plugin instances
|
|
19
|
+
*/
|
|
20
|
+
_uuids: [],
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns a boolean for RTL support
|
|
24
|
+
*/
|
|
25
|
+
rtl: function () {
|
|
26
|
+
return $('html').attr('dir') === 'rtl';
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing.
|
|
30
|
+
* @param {Object} plugin - The constructor of the plugin.
|
|
31
|
+
*/
|
|
32
|
+
plugin: function (plugin, name) {
|
|
33
|
+
// Object key to use when adding to global Foundation object
|
|
34
|
+
// Examples: Foundation.Reveal, Foundation.OffCanvas
|
|
35
|
+
var className = name || functionName(plugin);
|
|
36
|
+
// Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin
|
|
37
|
+
// Examples: data-reveal, data-off-canvas
|
|
38
|
+
var attrName = hyphenate(className);
|
|
39
|
+
|
|
40
|
+
// Add to the Foundation object and the plugins list (for reflowing)
|
|
41
|
+
this._plugins[attrName] = this[className] = plugin;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* @function
|
|
45
|
+
* Populates the _uuids array with pointers to each individual plugin instance.
|
|
46
|
+
* Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls.
|
|
47
|
+
* Also fires the initialization event for each plugin, consolidating repetitive code.
|
|
48
|
+
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
|
|
49
|
+
* @param {String} name - the name of the plugin, passed as a camelCased string.
|
|
50
|
+
* @fires Plugin#init
|
|
51
|
+
*/
|
|
52
|
+
registerPlugin: function (plugin, name) {
|
|
53
|
+
var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
|
|
54
|
+
plugin.uuid = this.GetYoDigits(6, pluginName);
|
|
55
|
+
|
|
56
|
+
if (!plugin.$element.attr('data-' + pluginName)) {
|
|
57
|
+
plugin.$element.attr('data-' + pluginName, plugin.uuid);
|
|
58
|
+
}
|
|
59
|
+
if (!plugin.$element.data('zfPlugin')) {
|
|
60
|
+
plugin.$element.data('zfPlugin', plugin);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Fires when the plugin has initialized.
|
|
64
|
+
* @event Plugin#init
|
|
65
|
+
*/
|
|
66
|
+
plugin.$element.trigger('init.zf.' + pluginName);
|
|
67
|
+
|
|
68
|
+
this._uuids.push(plugin.uuid);
|
|
69
|
+
|
|
70
|
+
return;
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* @function
|
|
74
|
+
* Removes the plugins uuid from the _uuids array.
|
|
75
|
+
* Removes the zfPlugin data attribute, as well as the data-plugin-name attribute.
|
|
76
|
+
* Also fires the destroyed event for the plugin, consolidating repetitive code.
|
|
77
|
+
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
|
|
78
|
+
* @fires Plugin#destroyed
|
|
79
|
+
*/
|
|
80
|
+
unregisterPlugin: function (plugin) {
|
|
81
|
+
var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
|
|
82
|
+
|
|
83
|
+
this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
|
|
84
|
+
plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin')
|
|
85
|
+
/**
|
|
86
|
+
* Fires when the plugin has been destroyed.
|
|
87
|
+
* @event Plugin#destroyed
|
|
88
|
+
*/
|
|
89
|
+
.trigger('destroyed.zf.' + pluginName);
|
|
90
|
+
for (var prop in plugin) {
|
|
91
|
+
plugin[prop] = null; //clean up script to prep for garbage collection.
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @function
|
|
98
|
+
* Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc.
|
|
99
|
+
* @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'`
|
|
100
|
+
* @default If no argument is passed, reflow all currently active plugins.
|
|
101
|
+
*/
|
|
102
|
+
reInit: function (plugins) {
|
|
103
|
+
var isJQ = plugins instanceof $;
|
|
104
|
+
try {
|
|
105
|
+
if (isJQ) {
|
|
106
|
+
plugins.each(function () {
|
|
107
|
+
$(this).data('zfPlugin')._init();
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
var type = typeof plugins,
|
|
111
|
+
_this = this,
|
|
112
|
+
fns = {
|
|
113
|
+
'object': function (plgs) {
|
|
114
|
+
plgs.forEach(function (p) {
|
|
115
|
+
p = hyphenate(p);
|
|
116
|
+
$('[data-' + p + ']').foundation('_init');
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
'string': function () {
|
|
120
|
+
plugins = hyphenate(plugins);
|
|
121
|
+
$('[data-' + plugins + ']').foundation('_init');
|
|
122
|
+
},
|
|
123
|
+
'undefined': function () {
|
|
124
|
+
this['object'](Object.keys(_this._plugins));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
fns[type](plugins);
|
|
128
|
+
}
|
|
129
|
+
} catch (err) {
|
|
130
|
+
console.error(err);
|
|
131
|
+
} finally {
|
|
132
|
+
return plugins;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* returns a random base-36 uid with namespacing
|
|
138
|
+
* @function
|
|
139
|
+
* @param {Number} length - number of random base-36 digits desired. Increase for more random strings.
|
|
140
|
+
* @param {String} namespace - name of plugin to be incorporated in uid, optional.
|
|
141
|
+
* @default {String} '' - if no plugin name is provided, nothing is appended to the uid.
|
|
142
|
+
* @returns {String} - unique id
|
|
143
|
+
*/
|
|
144
|
+
GetYoDigits: function (length, namespace) {
|
|
145
|
+
length = length || 6;
|
|
146
|
+
return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? '-' + namespace : '');
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
|
|
150
|
+
* @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object.
|
|
151
|
+
* @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything.
|
|
152
|
+
*/
|
|
153
|
+
reflow: function (elem, plugins) {
|
|
154
|
+
|
|
155
|
+
// If plugins is undefined, just grab everything
|
|
156
|
+
if (typeof plugins === 'undefined') {
|
|
157
|
+
plugins = Object.keys(this._plugins);
|
|
158
|
+
}
|
|
159
|
+
// If plugins is a string, convert it to an array with one item
|
|
160
|
+
else if (typeof plugins === 'string') {
|
|
161
|
+
plugins = [plugins];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var _this = this;
|
|
165
|
+
|
|
166
|
+
// Iterate through each plugin
|
|
167
|
+
$.each(plugins, function (i, name) {
|
|
168
|
+
// Get the current plugin
|
|
169
|
+
var plugin = _this._plugins[name];
|
|
170
|
+
|
|
171
|
+
// Localize the search to all elements inside elem, as well as elem itself, unless elem === document
|
|
172
|
+
var $elem = $(elem).find('[data-' + name + ']').addBack('[data-' + name + ']');
|
|
173
|
+
|
|
174
|
+
// For each plugin found, initialize it
|
|
175
|
+
$elem.each(function () {
|
|
176
|
+
var $el = $(this),
|
|
177
|
+
opts = {};
|
|
178
|
+
// Don't double-dip on plugins
|
|
179
|
+
if ($el.data('zfPlugin')) {
|
|
180
|
+
console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin.");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if ($el.attr('data-options')) {
|
|
185
|
+
var thing = $el.attr('data-options').split(';').forEach(function (e, i) {
|
|
186
|
+
var opt = e.split(':').map(function (el) {
|
|
187
|
+
return el.trim();
|
|
188
|
+
});
|
|
189
|
+
if (opt[0]) opts[opt[0]] = parseValue(opt[1]);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
$el.data('zfPlugin', new plugin($(this), opts));
|
|
194
|
+
} catch (er) {
|
|
195
|
+
console.error(er);
|
|
196
|
+
} finally {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
getFnName: functionName,
|
|
203
|
+
transitionend: function ($elem) {
|
|
204
|
+
var transitions = {
|
|
205
|
+
'transition': 'transitionend',
|
|
206
|
+
'WebkitTransition': 'webkitTransitionEnd',
|
|
207
|
+
'MozTransition': 'transitionend',
|
|
208
|
+
'OTransition': 'otransitionend'
|
|
209
|
+
};
|
|
210
|
+
var elem = document.createElement('div'),
|
|
211
|
+
end;
|
|
212
|
+
|
|
213
|
+
for (var t in transitions) {
|
|
214
|
+
if (typeof elem.style[t] !== 'undefined') {
|
|
215
|
+
end = transitions[t];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (end) {
|
|
219
|
+
return end;
|
|
220
|
+
} else {
|
|
221
|
+
end = setTimeout(function () {
|
|
222
|
+
$elem.triggerHandler('transitionend', [$elem]);
|
|
223
|
+
}, 1);
|
|
224
|
+
return 'transitionend';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
Foundation.util = {
|
|
230
|
+
/**
|
|
231
|
+
* Function for applying a debounce effect to a function call.
|
|
232
|
+
* @function
|
|
233
|
+
* @param {Function} func - Function to be called at end of timeout.
|
|
234
|
+
* @param {Number} delay - Time in ms to delay the call of `func`.
|
|
235
|
+
* @returns function
|
|
236
|
+
*/
|
|
237
|
+
throttle: function (func, delay) {
|
|
238
|
+
var timer = null;
|
|
239
|
+
|
|
240
|
+
return function () {
|
|
241
|
+
var context = this,
|
|
242
|
+
args = arguments;
|
|
243
|
+
|
|
244
|
+
if (timer === null) {
|
|
245
|
+
timer = setTimeout(function () {
|
|
246
|
+
func.apply(context, args);
|
|
247
|
+
timer = null;
|
|
248
|
+
}, delay);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// TODO: consider not making this a jQuery function
|
|
255
|
+
// TODO: need way to reflow vs. re-initialize
|
|
256
|
+
/**
|
|
257
|
+
* The Foundation jQuery method.
|
|
258
|
+
* @param {String|Array} method - An action to perform on the current jQuery object.
|
|
259
|
+
*/
|
|
260
|
+
var foundation = function (method) {
|
|
261
|
+
var type = typeof method,
|
|
262
|
+
$meta = $('meta.foundation-mq'),
|
|
263
|
+
$noJS = $('.no-js');
|
|
264
|
+
|
|
265
|
+
if (!$meta.length) {
|
|
266
|
+
$('<meta class="foundation-mq">').appendTo(document.head);
|
|
267
|
+
}
|
|
268
|
+
if ($noJS.length) {
|
|
269
|
+
$noJS.removeClass('no-js');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (type === 'undefined') {
|
|
273
|
+
//needs to initialize the Foundation object, or an individual plugin.
|
|
274
|
+
Foundation.MediaQuery._init();
|
|
275
|
+
Foundation.reflow(this);
|
|
276
|
+
} else if (type === 'string') {
|
|
277
|
+
//an individual method to invoke on a plugin or group of plugins
|
|
278
|
+
var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary
|
|
279
|
+
var plugClass = this.data('zfPlugin'); //determine the class of plugin
|
|
280
|
+
|
|
281
|
+
if (plugClass !== undefined && plugClass[method] !== undefined) {
|
|
282
|
+
//make sure both the class and method exist
|
|
283
|
+
if (this.length === 1) {
|
|
284
|
+
//if there's only one, call it directly.
|
|
285
|
+
plugClass[method].apply(plugClass, args);
|
|
286
|
+
} else {
|
|
287
|
+
this.each(function (i, el) {
|
|
288
|
+
//otherwise loop through the jQuery collection and invoke the method on each
|
|
289
|
+
plugClass[method].apply($(el).data('zfPlugin'), args);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
//error for no class or no method
|
|
294
|
+
throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
//error for invalid argument type
|
|
298
|
+
throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.');
|
|
299
|
+
}
|
|
300
|
+
return this;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
window.Foundation = Foundation;
|
|
304
|
+
$.fn.foundation = foundation;
|
|
305
|
+
|
|
306
|
+
// Polyfill for requestAnimationFrame
|
|
307
|
+
(function () {
|
|
308
|
+
if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () {
|
|
309
|
+
return new Date().getTime();
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
var vendors = ['webkit', 'moz'];
|
|
313
|
+
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
|
314
|
+
var vp = vendors[i];
|
|
315
|
+
window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
|
|
316
|
+
window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame'];
|
|
317
|
+
}
|
|
318
|
+
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
|
319
|
+
var lastTime = 0;
|
|
320
|
+
window.requestAnimationFrame = function (callback) {
|
|
321
|
+
var now = Date.now();
|
|
322
|
+
var nextTime = Math.max(lastTime + 16, now);
|
|
323
|
+
return setTimeout(function () {
|
|
324
|
+
callback(lastTime = nextTime);
|
|
325
|
+
}, nextTime - now);
|
|
326
|
+
};
|
|
327
|
+
window.cancelAnimationFrame = clearTimeout;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Polyfill for performance.now, required by rAF
|
|
331
|
+
*/
|
|
332
|
+
if (!window.performance || !window.performance.now) {
|
|
333
|
+
window.performance = {
|
|
334
|
+
start: Date.now(),
|
|
335
|
+
now: function () {
|
|
336
|
+
return Date.now() - this.start;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
})();
|
|
341
|
+
if (!Function.prototype.bind) {
|
|
342
|
+
Function.prototype.bind = function (oThis) {
|
|
343
|
+
if (typeof this !== 'function') {
|
|
344
|
+
// closest thing possible to the ECMAScript 5
|
|
345
|
+
// internal IsCallable function
|
|
346
|
+
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
350
|
+
fToBind = this,
|
|
351
|
+
fNOP = function () {},
|
|
352
|
+
fBound = function () {
|
|
353
|
+
return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
if (this.prototype) {
|
|
357
|
+
// native functions don't have a prototype
|
|
358
|
+
fNOP.prototype = this.prototype;
|
|
359
|
+
}
|
|
360
|
+
fBound.prototype = new fNOP();
|
|
361
|
+
|
|
362
|
+
return fBound;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
// Polyfill to get the name of a function in IE9
|
|
366
|
+
function functionName(fn) {
|
|
367
|
+
if (Function.prototype.name === undefined) {
|
|
368
|
+
var funcNameRegex = /function\s([^(]{1,})\(/;
|
|
369
|
+
var results = funcNameRegex.exec(fn.toString());
|
|
370
|
+
return results && results.length > 1 ? results[1].trim() : "";
|
|
371
|
+
} else if (fn.prototype === undefined) {
|
|
372
|
+
return fn.constructor.name;
|
|
373
|
+
} else {
|
|
374
|
+
return fn.prototype.constructor.name;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function parseValue(str) {
|
|
378
|
+
if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str);
|
|
379
|
+
return str;
|
|
380
|
+
}
|
|
381
|
+
// Convert PascalCase to kebab-case
|
|
382
|
+
// Thank you: http://stackoverflow.com/a/8955580
|
|
383
|
+
function hyphenate(str) {
|
|
384
|
+
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
385
|
+
}
|
|
386
|
+
}(jQuery);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t){"use strict";function n(t){if(void 0===Function.prototype.name){var n=/function\s([^(]{1,})\(/,i=n.exec(t.toString());return i&&i.length>1?i[1].trim():""}return void 0===t.prototype?t.constructor.name:t.prototype.constructor.name}function i(t){return"true"===t||"false"!==t&&(isNaN(1*t)?t:parseFloat(t))}function e(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var o="6.3.1",r={version:o,_plugins:{},_uuids:[],rtl:function(){return"rtl"===t("html").attr("dir")},plugin:function(t,i){var o=i||n(t),r=e(o);this._plugins[r]=this[o]=t},registerPlugin:function(t,i){var o=i?e(i):n(t.constructor).toLowerCase();t.uuid=this.GetYoDigits(6,o),t.$element.attr("data-"+o)||t.$element.attr("data-"+o,t.uuid),t.$element.data("zfPlugin")||t.$element.data("zfPlugin",t),t.$element.trigger("init.zf."+o),this._uuids.push(t.uuid)},unregisterPlugin:function(t){var i=e(n(t.$element.data("zfPlugin").constructor));this._uuids.splice(this._uuids.indexOf(t.uuid),1),t.$element.removeAttr("data-"+i).removeData("zfPlugin").trigger("destroyed.zf."+i);for(var o in t)t[o]=null},reInit:function(n){var i=n instanceof t;try{if(i)n.each(function(){t(this).data("zfPlugin")._init()});else{var o=typeof n,r=this,a={object:function(n){n.forEach(function(n){n=e(n),t("[data-"+n+"]").foundation("_init")})},string:function(){n=e(n),t("[data-"+n+"]").foundation("_init")},undefined:function(){this.object(Object.keys(r._plugins))}};a[o](n)}}catch(t){console.error(t)}finally{return n}},GetYoDigits:function(t,n){return t=t||6,Math.round(Math.pow(36,t+1)-Math.random()*Math.pow(36,t)).toString(36).slice(1)+(n?"-"+n:"")},reflow:function(n,e){"undefined"==typeof e?e=Object.keys(this._plugins):"string"==typeof e&&(e=[e]);var o=this;t.each(e,function(e,r){var a=o._plugins[r],u=t(n).find("[data-"+r+"]").addBack("[data-"+r+"]");u.each(function(){var n=t(this),e={};if(n.data("zfPlugin"))return void console.warn("Tried to initialize "+r+" on an element that already has a Foundation plugin.");if(n.attr("data-options")){n.attr("data-options").split(";").forEach(function(t,n){var o=t.split(":").map(function(t){return t.trim()});o[0]&&(e[o[0]]=i(o[1]))})}try{n.data("zfPlugin",new a(t(this),e))}catch(t){console.error(t)}finally{return}})})},getFnName:n,transitionend:function(t){var n,i={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend"},e=document.createElement("div");for(var o in i)"undefined"!=typeof e.style[o]&&(n=i[o]);return n?n:(n=setTimeout(function(){t.triggerHandler("transitionend",[t])},1),"transitionend")}};r.util={throttle:function(t,n){var i=null;return function(){var e=this,o=arguments;null===i&&(i=setTimeout(function(){t.apply(e,o),i=null},n))}}};var a=function(i){var e=typeof i,o=t("meta.foundation-mq"),a=t(".no-js");if(o.length||t('<meta class="foundation-mq">').appendTo(document.head),a.length&&a.removeClass("no-js"),"undefined"===e)r.MediaQuery._init(),r.reflow(this);else{if("string"!==e)throw new TypeError("We're sorry, "+e+" is not a valid parameter. You must use a string representing the method you wish to invoke.");var u=Array.prototype.slice.call(arguments,1),s=this.data("zfPlugin");if(void 0===s||void 0===s[i])throw new ReferenceError("We're sorry, '"+i+"' is not an available method for "+(s?n(s):"this element")+".");1===this.length?s[i].apply(s,u):this.each(function(n,e){s[i].apply(t(e).data("zfPlugin"),u)})}return this};window.Foundation=r,t.fn.foundation=a,function(){Date.now&&window.Date.now||(window.Date.now=Date.now=function(){return(new Date).getTime()});for(var t=["webkit","moz"],n=0;n<t.length&&!window.requestAnimationFrame;++n){var i=t[n];window.requestAnimationFrame=window[i+"RequestAnimationFrame"],window.cancelAnimationFrame=window[i+"CancelAnimationFrame"]||window[i+"CancelRequestAnimationFrame"]}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var e=0;window.requestAnimationFrame=function(t){var n=Date.now(),i=Math.max(e+16,n);return setTimeout(function(){t(e=i)},i-n)},window.cancelAnimationFrame=clearTimeout}window.performance&&window.performance.now||(window.performance={start:Date.now(),now:function(){return Date.now()-this.start}})}(),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var n=Array.prototype.slice.call(arguments,1),i=this,e=function(){},o=function(){return i.apply(this instanceof e?this:t,n.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(e.prototype=this.prototype),o.prototype=new e,o})}(jQuery);
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
4
|
+
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
|
|
7
|
+
!function ($) {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Drilldown module.
|
|
11
|
+
* @module foundation.drilldown
|
|
12
|
+
* @requires foundation.util.keyboard
|
|
13
|
+
* @requires foundation.util.motion
|
|
14
|
+
* @requires foundation.util.nest
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var Drilldown = function () {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of a drilldown menu.
|
|
20
|
+
* @class
|
|
21
|
+
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
|
22
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
|
23
|
+
*/
|
|
24
|
+
function Drilldown(element, options) {
|
|
25
|
+
_classCallCheck(this, Drilldown);
|
|
26
|
+
|
|
27
|
+
this.$element = element;
|
|
28
|
+
this.options = $.extend({}, Drilldown.defaults, this.$element.data(), options);
|
|
29
|
+
|
|
30
|
+
Foundation.Nest.Feather(this.$element, 'drilldown');
|
|
31
|
+
|
|
32
|
+
this._init();
|
|
33
|
+
|
|
34
|
+
Foundation.registerPlugin(this, 'Drilldown');
|
|
35
|
+
Foundation.Keyboard.register('Drilldown', {
|
|
36
|
+
'ENTER': 'open',
|
|
37
|
+
'SPACE': 'open',
|
|
38
|
+
'ARROW_RIGHT': 'next',
|
|
39
|
+
'ARROW_UP': 'up',
|
|
40
|
+
'ARROW_DOWN': 'down',
|
|
41
|
+
'ARROW_LEFT': 'previous',
|
|
42
|
+
'ESCAPE': 'close',
|
|
43
|
+
'TAB': 'down',
|
|
44
|
+
'SHIFT_TAB': 'up'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initializes the drilldown by creating jQuery collections of elements
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
_createClass(Drilldown, [{
|
|
55
|
+
key: '_init',
|
|
56
|
+
value: function _init() {
|
|
57
|
+
this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a');
|
|
58
|
+
this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]');
|
|
59
|
+
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem').find('a');
|
|
60
|
+
this.$element.attr('data-mutate', this.$element.attr('data-drilldown') || Foundation.GetYoDigits(6, 'drilldown'));
|
|
61
|
+
|
|
62
|
+
this._prepareMenu();
|
|
63
|
+
this._registerEvents();
|
|
64
|
+
|
|
65
|
+
this._keyboardEvents();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* prepares drilldown menu by setting attributes to links and elements
|
|
70
|
+
* sets a min height to prevent content jumping
|
|
71
|
+
* wraps the element if not already wrapped
|
|
72
|
+
* @private
|
|
73
|
+
* @function
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
}, {
|
|
77
|
+
key: '_prepareMenu',
|
|
78
|
+
value: function _prepareMenu() {
|
|
79
|
+
var _this = this;
|
|
80
|
+
// if(!this.options.holdOpen){
|
|
81
|
+
// this._menuLinkEvents();
|
|
82
|
+
// }
|
|
83
|
+
this.$submenuAnchors.each(function () {
|
|
84
|
+
var $link = $(this);
|
|
85
|
+
var $sub = $link.parent();
|
|
86
|
+
if (_this.options.parentLink) {
|
|
87
|
+
$link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>');
|
|
88
|
+
}
|
|
89
|
+
$link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0);
|
|
90
|
+
$link.children('[data-submenu]').attr({
|
|
91
|
+
'aria-hidden': true,
|
|
92
|
+
'tabindex': 0,
|
|
93
|
+
'role': 'menu'
|
|
94
|
+
});
|
|
95
|
+
_this._events($link);
|
|
96
|
+
});
|
|
97
|
+
this.$submenus.each(function () {
|
|
98
|
+
var $menu = $(this),
|
|
99
|
+
$back = $menu.find('.js-drilldown-back');
|
|
100
|
+
if (!$back.length) {
|
|
101
|
+
switch (_this.options.backButtonPosition) {
|
|
102
|
+
case "bottom":
|
|
103
|
+
$menu.append(_this.options.backButton);
|
|
104
|
+
break;
|
|
105
|
+
case "top":
|
|
106
|
+
$menu.prepend(_this.options.backButton);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
console.error("Unsupported backButtonPosition value '" + _this.options.backButtonPosition + "'");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
_this._back($menu);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
this.$submenus.addClass('invisible');
|
|
116
|
+
if (!this.options.autoHeight) {
|
|
117
|
+
this.$submenus.addClass('drilldown-submenu-cover-previous');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// create a wrapper on element if it doesn't exist.
|
|
121
|
+
if (!this.$element.parent().hasClass('is-drilldown')) {
|
|
122
|
+
this.$wrapper = $(this.options.wrapper).addClass('is-drilldown');
|
|
123
|
+
if (this.options.animateHeight) this.$wrapper.addClass('animate-height');
|
|
124
|
+
this.$element.wrap(this.$wrapper);
|
|
125
|
+
}
|
|
126
|
+
// set wrapper
|
|
127
|
+
this.$wrapper = this.$element.parent();
|
|
128
|
+
this.$wrapper.css(this._getMaxDims());
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: '_resize',
|
|
132
|
+
value: function _resize() {
|
|
133
|
+
this.$wrapper.css({ 'max-width': 'none', 'min-height': 'none' });
|
|
134
|
+
// _getMaxDims has side effects (boo) but calling it should update all other necessary heights & widths
|
|
135
|
+
this.$wrapper.css(this._getMaxDims());
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Adds event handlers to elements in the menu.
|
|
140
|
+
* @function
|
|
141
|
+
* @private
|
|
142
|
+
* @param {jQuery} $elem - the current menu item to add handlers to.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
}, {
|
|
146
|
+
key: '_events',
|
|
147
|
+
value: function _events($elem) {
|
|
148
|
+
var _this = this;
|
|
149
|
+
|
|
150
|
+
$elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) {
|
|
151
|
+
if ($(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) {
|
|
152
|
+
e.stopImmediatePropagation();
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// if(e.target !== e.currentTarget.firstElementChild){
|
|
157
|
+
// return false;
|
|
158
|
+
// }
|
|
159
|
+
_this._show($elem.parent('li'));
|
|
160
|
+
|
|
161
|
+
if (_this.options.closeOnClick) {
|
|
162
|
+
var $body = $('body');
|
|
163
|
+
$body.off('.zf.drilldown').on('click.zf.drilldown', function (e) {
|
|
164
|
+
if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
_this._hideAll();
|
|
169
|
+
$body.off('.zf.drilldown');
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
this.$element.on('mutateme.zf.trigger', this._resize.bind(this));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Adds event handlers to the menu element.
|
|
178
|
+
* @function
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
}, {
|
|
183
|
+
key: '_registerEvents',
|
|
184
|
+
value: function _registerEvents() {
|
|
185
|
+
if (this.options.scrollTop) {
|
|
186
|
+
this._bindHandler = this._scrollTop.bind(this);
|
|
187
|
+
this.$element.on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown', this._bindHandler);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Scroll to Top of Element or data-scroll-top-element
|
|
193
|
+
* @function
|
|
194
|
+
* @fires Drilldown#scrollme
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
}, {
|
|
198
|
+
key: '_scrollTop',
|
|
199
|
+
value: function _scrollTop() {
|
|
200
|
+
var _this = this;
|
|
201
|
+
var $scrollTopElement = _this.options.scrollTopElement != '' ? $(_this.options.scrollTopElement) : _this.$element,
|
|
202
|
+
scrollPos = parseInt($scrollTopElement.offset().top + _this.options.scrollTopOffset);
|
|
203
|
+
$('html, body').stop(true).animate({ scrollTop: scrollPos }, _this.options.animationDuration, _this.options.animationEasing, function () {
|
|
204
|
+
/**
|
|
205
|
+
* Fires after the menu has scrolled
|
|
206
|
+
* @event Drilldown#scrollme
|
|
207
|
+
*/
|
|
208
|
+
if (this === $('html')[0]) _this.$element.trigger('scrollme.zf.drilldown');
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Adds keydown event listener to `li`'s in the menu.
|
|
214
|
+
* @private
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
}, {
|
|
218
|
+
key: '_keyboardEvents',
|
|
219
|
+
value: function _keyboardEvents() {
|
|
220
|
+
var _this = this;
|
|
221
|
+
|
|
222
|
+
this.$menuItems.add(this.$element.find('.js-drilldown-back > a, .is-submenu-parent-item > a')).on('keydown.zf.drilldown', function (e) {
|
|
223
|
+
var $element = $(this),
|
|
224
|
+
$elements = $element.parent('li').parent('ul').children('li').children('a'),
|
|
225
|
+
$prevElement,
|
|
226
|
+
$nextElement;
|
|
227
|
+
|
|
228
|
+
$elements.each(function (i) {
|
|
229
|
+
if ($(this).is($element)) {
|
|
230
|
+
$prevElement = $elements.eq(Math.max(0, i - 1));
|
|
231
|
+
$nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1));
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
Foundation.Keyboard.handleKey(e, 'Drilldown', {
|
|
237
|
+
next: function () {
|
|
238
|
+
if ($element.is(_this.$submenuAnchors)) {
|
|
239
|
+
_this._show($element.parent('li'));
|
|
240
|
+
$element.parent('li').one(Foundation.transitionend($element), function () {
|
|
241
|
+
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
|
242
|
+
});
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
previous: function () {
|
|
247
|
+
_this._hide($element.parent('li').parent('ul'));
|
|
248
|
+
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function () {
|
|
249
|
+
setTimeout(function () {
|
|
250
|
+
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
|
251
|
+
}, 1);
|
|
252
|
+
});
|
|
253
|
+
return true;
|
|
254
|
+
},
|
|
255
|
+
up: function () {
|
|
256
|
+
$prevElement.focus();
|
|
257
|
+
// Don't tap focus on first element in root ul
|
|
258
|
+
return !$element.is(_this.$element.find('> li:first-child > a'));
|
|
259
|
+
},
|
|
260
|
+
down: function () {
|
|
261
|
+
$nextElement.focus();
|
|
262
|
+
// Don't tap focus on last element in root ul
|
|
263
|
+
return !$element.is(_this.$element.find('> li:last-child > a'));
|
|
264
|
+
},
|
|
265
|
+
close: function () {
|
|
266
|
+
// Don't close on element in root ul
|
|
267
|
+
if (!$element.is(_this.$element.find('> li > a'))) {
|
|
268
|
+
_this._hide($element.parent().parent());
|
|
269
|
+
$element.parent().parent().siblings('a').focus();
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
open: function () {
|
|
273
|
+
if (!$element.is(_this.$menuItems)) {
|
|
274
|
+
// not menu item means back button
|
|
275
|
+
_this._hide($element.parent('li').parent('ul'));
|
|
276
|
+
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function () {
|
|
277
|
+
setTimeout(function () {
|
|
278
|
+
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
|
279
|
+
}, 1);
|
|
280
|
+
});
|
|
281
|
+
return true;
|
|
282
|
+
} else if ($element.is(_this.$submenuAnchors)) {
|
|
283
|
+
_this._show($element.parent('li'));
|
|
284
|
+
$element.parent('li').one(Foundation.transitionend($element), function () {
|
|
285
|
+
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
|
286
|
+
});
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
handled: function (preventDefault) {
|
|
291
|
+
if (preventDefault) {
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
}
|
|
294
|
+
e.stopImmediatePropagation();
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}); // end keyboardAccess
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Closes all open elements, and returns to root menu.
|
|
302
|
+
* @function
|
|
303
|
+
* @fires Drilldown#closed
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
}, {
|
|
307
|
+
key: '_hideAll',
|
|
308
|
+
value: function _hideAll() {
|
|
309
|
+
var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing');
|
|
310
|
+
if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') });
|
|
311
|
+
$elem.one(Foundation.transitionend($elem), function (e) {
|
|
312
|
+
$elem.removeClass('is-active is-closing');
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* Fires when the menu is fully closed.
|
|
316
|
+
* @event Drilldown#closed
|
|
317
|
+
*/
|
|
318
|
+
this.$element.trigger('closed.zf.drilldown');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Adds event listener for each `back` button, and closes open menus.
|
|
323
|
+
* @function
|
|
324
|
+
* @fires Drilldown#back
|
|
325
|
+
* @param {jQuery} $elem - the current sub-menu to add `back` event.
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
}, {
|
|
329
|
+
key: '_back',
|
|
330
|
+
value: function _back($elem) {
|
|
331
|
+
var _this = this;
|
|
332
|
+
$elem.off('click.zf.drilldown');
|
|
333
|
+
$elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) {
|
|
334
|
+
e.stopImmediatePropagation();
|
|
335
|
+
// console.log('mouseup on back');
|
|
336
|
+
_this._hide($elem);
|
|
337
|
+
|
|
338
|
+
// If there is a parent submenu, call show
|
|
339
|
+
var parentSubMenu = $elem.parent('li').parent('ul').parent('li');
|
|
340
|
+
if (parentSubMenu.length) {
|
|
341
|
+
_this._show(parentSubMenu);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Adds event listener to menu items w/o submenus to close open menus on click.
|
|
348
|
+
* @function
|
|
349
|
+
* @private
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
}, {
|
|
353
|
+
key: '_menuLinkEvents',
|
|
354
|
+
value: function _menuLinkEvents() {
|
|
355
|
+
var _this = this;
|
|
356
|
+
this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) {
|
|
357
|
+
// e.stopImmediatePropagation();
|
|
358
|
+
setTimeout(function () {
|
|
359
|
+
_this._hideAll();
|
|
360
|
+
}, 0);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Opens a submenu.
|
|
366
|
+
* @function
|
|
367
|
+
* @fires Drilldown#open
|
|
368
|
+
* @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag.
|
|
369
|
+
*/
|
|
370
|
+
|
|
371
|
+
}, {
|
|
372
|
+
key: '_show',
|
|
373
|
+
value: function _show($elem) {
|
|
374
|
+
if (this.options.autoHeight) this.$wrapper.css({ height: $elem.children('[data-submenu]').data('calcHeight') });
|
|
375
|
+
$elem.attr('aria-expanded', true);
|
|
376
|
+
$elem.children('[data-submenu]').addClass('is-active').removeClass('invisible').attr('aria-hidden', false);
|
|
377
|
+
/**
|
|
378
|
+
* Fires when the submenu has opened.
|
|
379
|
+
* @event Drilldown#open
|
|
380
|
+
*/
|
|
381
|
+
this.$element.trigger('open.zf.drilldown', [$elem]);
|
|
382
|
+
}
|
|
383
|
+
}, {
|
|
384
|
+
key: '_hide',
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Hides a submenu
|
|
389
|
+
* @function
|
|
390
|
+
* @fires Drilldown#hide
|
|
391
|
+
* @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag.
|
|
392
|
+
*/
|
|
393
|
+
value: function _hide($elem) {
|
|
394
|
+
if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') });
|
|
395
|
+
var _this = this;
|
|
396
|
+
$elem.parent('li').attr('aria-expanded', false);
|
|
397
|
+
$elem.attr('aria-hidden', true).addClass('is-closing');
|
|
398
|
+
$elem.addClass('is-closing').one(Foundation.transitionend($elem), function () {
|
|
399
|
+
$elem.removeClass('is-active is-closing');
|
|
400
|
+
$elem.blur().addClass('invisible');
|
|
401
|
+
});
|
|
402
|
+
/**
|
|
403
|
+
* Fires when the submenu has closed.
|
|
404
|
+
* @event Drilldown#hide
|
|
405
|
+
*/
|
|
406
|
+
$elem.trigger('hide.zf.drilldown', [$elem]);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Iterates through the nested menus to calculate the min-height, and max-width for the menu.
|
|
411
|
+
* Prevents content jumping.
|
|
412
|
+
* @function
|
|
413
|
+
* @private
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
}, {
|
|
417
|
+
key: '_getMaxDims',
|
|
418
|
+
value: function _getMaxDims() {
|
|
419
|
+
var maxHeight = 0,
|
|
420
|
+
result = {},
|
|
421
|
+
_this = this;
|
|
422
|
+
this.$submenus.add(this.$element).each(function () {
|
|
423
|
+
var numOfElems = $(this).children('li').length;
|
|
424
|
+
var height = Foundation.Box.GetDimensions(this).height;
|
|
425
|
+
maxHeight = height > maxHeight ? height : maxHeight;
|
|
426
|
+
if (_this.options.autoHeight) {
|
|
427
|
+
$(this).data('calcHeight', height);
|
|
428
|
+
if (!$(this).hasClass('is-drilldown-submenu')) result['height'] = height;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
if (!this.options.autoHeight) result['min-height'] = maxHeight + 'px';
|
|
433
|
+
|
|
434
|
+
result['max-width'] = this.$element[0].getBoundingClientRect().width + 'px';
|
|
435
|
+
|
|
436
|
+
return result;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Destroys the Drilldown Menu
|
|
441
|
+
* @function
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
}, {
|
|
445
|
+
key: 'destroy',
|
|
446
|
+
value: function destroy() {
|
|
447
|
+
if (this.options.scrollTop) this.$element.off('.zf.drilldown', this._bindHandler);
|
|
448
|
+
this._hideAll();
|
|
449
|
+
this.$element.off('mutateme.zf.trigger');
|
|
450
|
+
Foundation.Nest.Burn(this.$element, 'drilldown');
|
|
451
|
+
this.$element.unwrap().find('.js-drilldown-back, .is-submenu-parent-item').remove().end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu').end().find('[data-submenu]').removeAttr('aria-hidden tabindex role');
|
|
452
|
+
this.$submenuAnchors.each(function () {
|
|
453
|
+
$(this).off('.zf.drilldown');
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
this.$submenus.removeClass('drilldown-submenu-cover-previous');
|
|
457
|
+
|
|
458
|
+
this.$element.find('a').each(function () {
|
|
459
|
+
var $link = $(this);
|
|
460
|
+
$link.removeAttr('tabindex');
|
|
461
|
+
if ($link.data('savedHref')) {
|
|
462
|
+
$link.attr('href', $link.data('savedHref')).removeData('savedHref');
|
|
463
|
+
} else {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
Foundation.unregisterPlugin(this);
|
|
468
|
+
}
|
|
469
|
+
}]);
|
|
470
|
+
|
|
471
|
+
return Drilldown;
|
|
472
|
+
}();
|
|
473
|
+
|
|
474
|
+
Drilldown.defaults = {
|
|
475
|
+
/**
|
|
476
|
+
* Markup used for JS generated back button. Prepended or appended (see backButtonPosition) to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting.
|
|
477
|
+
* @option
|
|
478
|
+
* @type {string}
|
|
479
|
+
* @default '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>'
|
|
480
|
+
*/
|
|
481
|
+
backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>',
|
|
482
|
+
/**
|
|
483
|
+
* Position the back button either at the top or bottom of drilldown submenus. Can be `'left'` or `'bottom'`.
|
|
484
|
+
* @option
|
|
485
|
+
* @type {string}
|
|
486
|
+
* @default top
|
|
487
|
+
*/
|
|
488
|
+
backButtonPosition: 'top',
|
|
489
|
+
/**
|
|
490
|
+
* Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting.
|
|
491
|
+
* @option
|
|
492
|
+
* @type {string}
|
|
493
|
+
* @default '<div></div>'
|
|
494
|
+
*/
|
|
495
|
+
wrapper: '<div></div>',
|
|
496
|
+
/**
|
|
497
|
+
* Adds the parent link to the submenu.
|
|
498
|
+
* @option
|
|
499
|
+
* @type {boolean}
|
|
500
|
+
* @default false
|
|
501
|
+
*/
|
|
502
|
+
parentLink: false,
|
|
503
|
+
/**
|
|
504
|
+
* Allow the menu to return to root list on body click.
|
|
505
|
+
* @option
|
|
506
|
+
* @type {boolean}
|
|
507
|
+
* @default false
|
|
508
|
+
*/
|
|
509
|
+
closeOnClick: false,
|
|
510
|
+
/**
|
|
511
|
+
* Allow the menu to auto adjust height.
|
|
512
|
+
* @option
|
|
513
|
+
* @type {boolean}
|
|
514
|
+
* @default false
|
|
515
|
+
*/
|
|
516
|
+
autoHeight: false,
|
|
517
|
+
/**
|
|
518
|
+
* Animate the auto adjust height.
|
|
519
|
+
* @option
|
|
520
|
+
* @type {boolean}
|
|
521
|
+
* @default false
|
|
522
|
+
*/
|
|
523
|
+
animateHeight: false,
|
|
524
|
+
/**
|
|
525
|
+
* Scroll to the top of the menu after opening a submenu or navigating back using the menu back button
|
|
526
|
+
* @option
|
|
527
|
+
* @type {boolean}
|
|
528
|
+
* @default false
|
|
529
|
+
*/
|
|
530
|
+
scrollTop: false,
|
|
531
|
+
/**
|
|
532
|
+
* String jquery selector (for example 'body') of element to take offset().top from, if empty string the drilldown menu offset().top is taken
|
|
533
|
+
* @option
|
|
534
|
+
* @type {string}
|
|
535
|
+
* @default ''
|
|
536
|
+
*/
|
|
537
|
+
scrollTopElement: '',
|
|
538
|
+
/**
|
|
539
|
+
* ScrollTop offset
|
|
540
|
+
* @option
|
|
541
|
+
* @type {number}
|
|
542
|
+
* @default 0
|
|
543
|
+
*/
|
|
544
|
+
scrollTopOffset: 0,
|
|
545
|
+
/**
|
|
546
|
+
* Scroll animation duration
|
|
547
|
+
* @option
|
|
548
|
+
* @type {number}
|
|
549
|
+
* @default 500
|
|
550
|
+
*/
|
|
551
|
+
animationDuration: 500,
|
|
552
|
+
/**
|
|
553
|
+
* Scroll animation easing. Can be `'swing'` or `'linear'`.
|
|
554
|
+
* @option
|
|
555
|
+
* @type {string}
|
|
556
|
+
* @see {@link https://api.jquery.com/animate|JQuery animate}
|
|
557
|
+
* @default 'swing'
|
|
558
|
+
*/
|
|
559
|
+
animationEasing: 'swing'
|
|
560
|
+
// holdOpen: false
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// Window exports
|
|
564
|
+
Foundation.plugin(Drilldown, 'Drilldown');
|
|
565
|
+
}(jQuery);
|