!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from 'foundation.util.keyboard'
+ let GetYoDigits = Foundation.GetYoDigits; // currently part of foundation.core. Refactor?
+
/**
* Accordion module.
* @module foundation.accordion
* @requires foundation.util.keyboard
- * @requires foundation.util.motion
*/
class Accordion {
this._init();
Foundation.registerPlugin(this, 'Accordion');
- Foundation.Keyboard.register('Accordion', {
+ Keyboard.register('Accordion', {
'ENTER': 'toggle',
'SPACE': 'toggle',
'ARROW_DOWN': 'next',
this.$tabs.each(function(idx, el) {
var $el = $(el),
$content = $el.children('[data-tab-content]'),
- id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'),
+ id = $content[0].id || GetYoDigits(6, 'accordion'),
linkId = el.id || `${id}-label`;
$el.find('a:first').attr({
e.preventDefault();
_this.toggle($tabContent);
}).on('keydown.zf.accordion', function(e){
- Foundation.Keyboard.handleKey(e, 'Accordion', {
+ Keyboard.handleKey(e, 'Accordion', {
toggle: function() {
_this.toggle($tabContent);
},
return;
}
- // Foundation.Move(this.options.slideSpeed, $target, function(){
- $target.slideUp(_this.options.slideSpeed, function () {
- /**
- * Fires when the tab is done collapsing up.
- * @event Accordion#up
- */
- _this.$element.trigger('up.zf.accordion', [$target]);
- });
- // });
+ $target.slideUp(_this.options.slideSpeed, function () {
+ /**
+ * Fires when the tab is done collapsing up.
+ * @event Accordion#up
+ */
+ _this.$element.trigger('up.zf.accordion', [$target]);
+ });
$target.attr('aria-hidden', true)
.parent().removeClass('is-active');
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard"
+ let Nest = Foundation.Nest; // import Nest from "foundation.util.nest"
+ let GetYoDigits = Foundation.GetYoDigits; // add import after refactor
+
/**
* AccordionMenu module.
* @module foundation.accordionMenu
* @requires foundation.util.keyboard
- * @requires foundation.util.motion
* @requires foundation.util.nest
*/
this.$element = element;
this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options);
- Foundation.Nest.Feather(this.$element, 'accordion');
+ Nest.Feather(this.$element, 'accordion');
this._init();
Foundation.registerPlugin(this, 'AccordionMenu');
- Foundation.Keyboard.register('AccordionMenu', {
+ Keyboard.register('AccordionMenu', {
'ENTER': 'toggle',
'SPACE': 'toggle',
'ARROW_RIGHT': 'open',
this.$menuLinks = this.$element.find('.is-accordion-submenu-parent');
this.$menuLinks.each(function(){
- var linkId = this.id || Foundation.GetYoDigits(6, 'acc-menu-link'),
+ var linkId = this.id || GetYoDigits(6, 'acc-menu-link'),
$elem = $(this),
$sub = $elem.children('[data-submenu]'),
- subId = $sub[0].id || Foundation.GetYoDigits(6, 'acc-menu'),
+ subId = $sub[0].id || GetYoDigits(6, 'acc-menu'),
isActive = $sub.hasClass('is-active');
$elem.attr({
'aria-controls': subId,
}
});
- Foundation.Keyboard.handleKey(e, 'AccordionMenu', {
+ Keyboard.handleKey(e, 'AccordionMenu', {
open: function() {
if ($target.is(':hidden')) {
_this.down($target);
$target.addClass('is-active').attr({'aria-hidden': false})
.parent('.is-accordion-submenu-parent').attr({'aria-expanded': true});
- //Foundation.Move(this.options.slideSpeed, $target, function() {
- $target.slideDown(_this.options.slideSpeed, function () {
- /**
- * Fires when the menu is done opening.
- * @event AccordionMenu#down
- */
- _this.$element.trigger('down.zf.accordionMenu', [$target]);
- });
- //});
+ $target.slideDown(_this.options.slideSpeed, function () {
+ /**
+ * Fires when the menu is done opening.
+ * @event AccordionMenu#down
+ */
+ _this.$element.trigger('down.zf.accordionMenu', [$target]);
+ });
}
/**
*/
up($target) {
var _this = this;
- //Foundation.Move(this.options.slideSpeed, $target, function(){
- $target.slideUp(_this.options.slideSpeed, function () {
- /**
- * Fires when the menu is done collapsing up.
- * @event AccordionMenu#up
- */
- _this.$element.trigger('up.zf.accordionMenu', [$target]);
- });
- //});
+ $target.slideUp(_this.options.slideSpeed, function () {
+ /**
+ * Fires when the menu is done collapsing up.
+ * @event AccordionMenu#up
+ */
+ _this.$element.trigger('up.zf.accordionMenu', [$target]);
+ });
var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true);
this.$element.find('[data-submenu]').slideDown(0).css('display', '');
this.$element.find('a').off('click.zf.accordionMenu');
- Foundation.Nest.Burn(this.$element, 'accordion');
+ Nest.Burn(this.$element, 'accordion');
Foundation.unregisterPlugin(this);
}
}
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let Nest = Foundation.Nest; // import Nest from "foundation.util.nest";
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor
+ let transitionend = Foundation.transitionend; // figure out import after refactor
+ let Box = Foundation.Box; // import Box from "foundation.util.box";
+
/**
* Drilldown module.
* @module foundation.drilldown
* @requires foundation.util.keyboard
- * @requires foundation.util.motion
* @requires foundation.util.nest
+ * @requires foundation.util.box
*/
class Drilldown {
this.$element = element;
this.options = $.extend({}, Drilldown.defaults, this.$element.data(), options);
- Foundation.Nest.Feather(this.$element, 'drilldown');
+ Nest.Feather(this.$element, 'drilldown');
this._init();
Foundation.registerPlugin(this, 'Drilldown');
- Foundation.Keyboard.register('Drilldown', {
+ Keyboard.register('Drilldown', {
'ENTER': 'open',
'SPACE': 'open',
'ARROW_RIGHT': 'next',
this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a');
this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]');
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem').find('a');
- this.$element.attr('data-mutate', (this.$element.attr('data-drilldown') || Foundation.GetYoDigits(6, 'drilldown')));
+ this.$element.attr('data-mutate', (this.$element.attr('data-drilldown') || GetYoDigits(6, 'drilldown')));
this._prepareMenu();
this._registerEvents();
}
});
- Foundation.Keyboard.handleKey(e, 'Drilldown', {
+ Keyboard.handleKey(e, 'Drilldown', {
next: function() {
if ($element.is(_this.$submenuAnchors)) {
_this._show($element.parent('li'));
- $element.parent('li').one(Foundation.transitionend($element), function(){
+ $element.parent('li').one(transitionend($element), function(){
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
});
return true;
},
previous: function() {
_this._hide($element.parent('li').parent('ul'));
- $element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
+ $element.parent('li').parent('ul').one(transitionend($element), function(){
setTimeout(function() {
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
}, 1);
open: function() {
if (!$element.is(_this.$menuItems)) { // not menu item means back button
_this._hide($element.parent('li').parent('ul'));
- $element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
+ $element.parent('li').parent('ul').one(transitionend($element), function(){
setTimeout(function() {
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
}, 1);
return true;
} else if ($element.is(_this.$submenuAnchors)) {
_this._show($element.parent('li'));
- $element.parent('li').one(Foundation.transitionend($element), function(){
+ $element.parent('li').one(transitionend($element), function(){
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
});
return true;
_hideAll() {
var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing');
if(this.options.autoHeight) this.$wrapper.css({height:$elem.parent().closest('ul').data('calcHeight')});
- $elem.one(Foundation.transitionend($elem), function(e){
+ $elem.one(transitionend($elem), function(e){
$elem.removeClass('is-active is-closing');
});
/**
$elem.parent('li').attr('aria-expanded', false);
$elem.attr('aria-hidden', true).addClass('is-closing')
$elem.addClass('is-closing')
- .one(Foundation.transitionend($elem), function(){
+ .one(transitionend($elem), function(){
$elem.removeClass('is-active is-closing');
$elem.blur().addClass('invisible');
});
var maxHeight = 0, result = {}, _this = this;
this.$submenus.add(this.$element).each(function(){
var numOfElems = $(this).children('li').length;
- var height = Foundation.Box.GetDimensions(this).height;
+ var height = Box.GetDimensions(this).height;
maxHeight = height > maxHeight ? height : maxHeight;
if(_this.options.autoHeight) {
$(this).data('calcHeight',height);
if(this.options.scrollTop) this.$element.off('.zf.drilldown',this._bindHandler);
this._hideAll();
this.$element.off('mutateme.zf.trigger');
- Foundation.Nest.Burn(this.$element, 'drilldown');
+ Nest.Burn(this.$element, 'drilldown');
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')
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let Box = Foundation.Box; // import Box from "foundation.util.box";
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor
+
+ // import "foundation.util.triggers.js";
+ // TODO: Figure out what a triggers import "means", since triggers are always accessed indirectly.
+
+
/**
* Dropdown module.
* @module foundation.dropdown
this._init();
Foundation.registerPlugin(this, 'Dropdown');
- Foundation.Keyboard.register('Dropdown', {
+ Keyboard.register('Dropdown', {
'ENTER': 'open',
'SPACE': 'open',
'ESCAPE': 'close'
'aria-hidden': 'true',
'data-yeti-box': $id,
'data-resize': $id,
- 'aria-labelledby': this.$anchor[0].id || Foundation.GetYoDigits(6, 'dd-anchor')
+ 'aria-labelledby': this.$anchor[0].id || GetYoDigits(6, 'dd-anchor')
});
this._events();
}
_setPosition() {
if(this.$anchor.attr('aria-expanded') === 'false'){ return false; }
var position = this.getPositionClass(),
- $eleDims = Foundation.Box.GetDimensions(this.$element),
- $anchorDims = Foundation.Box.GetDimensions(this.$anchor),
+ $eleDims = Box.GetDimensions(this.$element),
+ $anchorDims = Box.GetDimensions(this.$anchor),
_this = this,
direction = (position === 'left' ? 'left' : ((position === 'right') ? 'left' : 'top')),
param = (direction === 'top') ? 'height' : 'width',
offset = (param === 'height') ? this.options.vOffset : this.options.hOffset;
- if(($eleDims.width >= $eleDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.$element, this.$parent))){
+ if(($eleDims.width >= $eleDims.windowDims.width) || (!this.counter && !Box.ImNotTouchingYou(this.$element, this.$parent))){
var newWidth = $eleDims.windowDims.width,
parentHOffset = 0;
if(this.$parent){
- var $parentDims = Foundation.Box.GetDimensions(this.$parent),
+ var $parentDims = Box.GetDimensions(this.$parent),
parentHOffset = $parentDims.offset.left;
if ($parentDims.width < newWidth){
newWidth = $parentDims.width;
}
}
- this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset + parentHOffset, true)).css({
+ this.$element.offset(Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset + parentHOffset, true)).css({
'width': newWidth - (this.options.hOffset * 2),
'height': 'auto'
});
return false;
}
- this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset));
+ this.$element.offset(Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset));
- while(!Foundation.Box.ImNotTouchingYou(this.$element, this.$parent, true) && this.counter){
+ while(!Box.ImNotTouchingYou(this.$element, this.$parent, true) && this.counter){
this._reposition(position);
this._setPosition();
}
this.$anchor.add(this.$element).on('keydown.zf.dropdown', function(e) {
var $target = $(this),
- visibleFocusableElements = Foundation.Keyboard.findFocusable(_this.$element);
+ visibleFocusableElements = Keyboard.findFocusable(_this.$element);
- Foundation.Keyboard.handleKey(e, 'Dropdown', {
+ Keyboard.handleKey(e, 'Dropdown', {
open: function() {
if ($target.is(_this.$anchor)) {
_this.open();
.attr({'aria-hidden': false});
if(this.options.autoFocus){
- var $focusable = Foundation.Keyboard.findFocusable(this.$element);
+ var $focusable = Keyboard.findFocusable(this.$element);
if($focusable.length){
$focusable.eq(0).focus();
}
if(this.options.closeOnClick){ this._addBodyHandler(); }
if (this.options.trapFocus) {
- Foundation.Keyboard.trapFocus(this.$element);
+ Keyboard.trapFocus(this.$element);
}
/**
this.$element.trigger('hide.zf.dropdown', [this.$element]);
if (this.options.trapFocus) {
- Foundation.Keyboard.releaseFocus(this.$element);
+ Keyboard.releaseFocus(this.$element);
}
}
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let Nest = Foundation.Nest; // import Nest from "foundation.util.nest";
+ let Box = Foundation.Box; // import Box from "foundation.util.box";
+ let Rtl = Foundation.rtl; // Figure out import after refactor
+
/**
* DropdownMenu module.
* @module foundation.dropdown-menu
this.$element = element;
this.options = $.extend({}, DropdownMenu.defaults, this.$element.data(), options);
- Foundation.Nest.Feather(this.$element, 'dropdown');
+ Nest.Feather(this.$element, 'dropdown');
this._init();
Foundation.registerPlugin(this, 'DropdownMenu');
- Foundation.Keyboard.register('DropdownMenu', {
+ Keyboard.register('DropdownMenu', {
'ENTER': 'open',
'SPACE': 'open',
'ARROW_RIGHT': 'next',
this.$tabs = this.$element.children('[role="menuitem"]');
this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
- if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl() || this.$element.parents('.top-bar-right').is('*')) {
+ if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Rtl() || this.$element.parents('.top-bar-right').is('*')) {
this.options.alignment = 'right';
subs.addClass('opens-left');
} else {
if (isTab) {
if (_this._isVertical()) { // vertical menu
- if (Foundation.rtl()) { // right aligned
+ if (Rtl()) { // right aligned
$.extend(functions, {
down: nextSibling,
up: prevSibling,
});
}
} else { // horizontal menu
- if (Foundation.rtl()) { // right aligned
+ if (Rtl()) { // right aligned
$.extend(functions, {
next: prevSibling,
previous: nextSibling,
}
}
} else { // not tabs -> one sub
- if (Foundation.rtl()) { // right aligned
+ if (Rtl()) { // right aligned
$.extend(functions, {
next: closeSub,
previous: openSub,
});
}
}
- Foundation.Keyboard.handleKey(e, 'DropdownMenu', functions);
+ Keyboard.handleKey(e, 'DropdownMenu', functions);
});
}
this._hide($sibs, idx);
$sub.css('visibility', 'hidden').addClass('js-dropdown-active')
.parent('li.is-dropdown-submenu-parent').addClass('is-active');
- var clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
+ var clear = Box.ImNotTouchingYou($sub, null, true);
if (!clear) {
var oldClass = this.options.alignment === 'left' ? '-right' : '-left',
$parentLi = $sub.parent('.is-dropdown-submenu-parent');
$parentLi.removeClass(`opens${oldClass}`).addClass(`opens-${this.options.alignment}`);
- clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
+ clear = Box.ImNotTouchingYou($sub, null, true);
if (!clear) {
$parentLi.removeClass(`opens-${this.options.alignment}`).addClass('opens-inner');
}
this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click')
.removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner');
$(document.body).off('.zf.dropdownmenu');
- Foundation.Nest.Burn(this.$element, 'dropdown');
+ Nest.Burn(this.$element, 'dropdown');
Foundation.unregisterPlugin(this);
}
}
!function($) {
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery.js";
+ let onImagesLoaded = Foundation.onImagesLoaded; // TODO9438: Separate out foundation.util.timerAndImageLoader
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor;
+
/**
* Equalizer module.
* @module foundation.equalizer
var $watched = this.$element.find(`[data-equalizer-watch="${eqId}"]`);
this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]');
- this.$element.attr('data-resize', (eqId || Foundation.GetYoDigits(6, 'eq')));
- this.$element.attr('data-mutate', (eqId || Foundation.GetYoDigits(6, 'eq')));
+ this.$element.attr('data-resize', (eqId || GetYoDigits(6, 'eq')));
+ this.$element.attr('data-mutate', (eqId || GetYoDigits(6, 'eq')));
this.hasNested = this.$element.find('[data-equalizer]').length > 0;
this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0;
}
if((tooSmall !== undefined && tooSmall === false) || tooSmall === undefined){
if(imgs.length){
- Foundation.onImagesLoaded(imgs, this._reflow.bind(this));
+ onImagesLoaded(imgs, this._reflow.bind(this));
}else{
this._reflow();
}
* @private
*/
_checkMQ() {
- var tooSmall = !Foundation.MediaQuery.is(this.options.equalizeOn);
+ var tooSmall = !MediaQuery.is(this.options.equalizeOn);
if(tooSmall){
if(this.isOn){
this._pauseEvents();
!function($) {
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery.js";
+
+
/**
* Interchange module.
* @module foundation.interchange
* @requires foundation.util.mediaQuery
- * @requires foundation.util.timerAndImageLoader
*/
class Interchange {
* @private
*/
_addBreakpoints() {
- for (var i in Foundation.MediaQuery.queries) {
- if (Foundation.MediaQuery.queries.hasOwnProperty(i)) {
- var query = Foundation.MediaQuery.queries[i];
+ for (var i in MediaQuery.queries) {
+ if (MediaQuery.queries.hasOwnProperty(i)) {
+ var query = MediaQuery.queries[i];
Interchange.SPECIAL_QUERIES[query.name] = query.value;
}
}
else {
rules = this.$element.data('interchange');
}
-
+
rules = typeof rules === 'string' ? rules.match(/\[.*?\]/g) : rules;
for (var i in rules) {
!function($) {
+ let GetYoDigits = Foundation.GetYoDigits; // TODO: Separate this out?
+
/**
* Magellan module.
* @module foundation.magellan
* @private
*/
_init() {
- var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan');
+ var id = this.$element[0].id || GetYoDigits(6, 'magellan');
var _this = this;
this.$targets = $('[data-magellan-target]');
this.$links = this.$element.find('a');
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
+
+ let transitionend = Foundation.transitionend; // Should transitionend be refactored into it's own module?
+
+ // import "foundation.util.triggers.js";
+ // TODO: Figure out what triggers import should actually do, given how indirect their use is
+
/**
* OffCanvas module.
* @module foundation.offcanvas
* @requires foundation.util.keyboard
* @requires foundation.util.mediaQuery
* @requires foundation.util.triggers
- * @requires foundation.util.motion
*/
class OffCanvas {
this._events();
Foundation.registerPlugin(this, 'OffCanvas')
- Foundation.Keyboard.register('OffCanvas', {
+ Keyboard.register('OffCanvas', {
'ESCAPE': 'close'
});
var _this = this;
$(window).on('changed.zf.mediaquery', function() {
- if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
+ if (MediaQuery.atLeast(_this.options.revealOn)) {
_this.reveal(true);
} else {
_this.reveal(false);
}
}).one('load.zf.offcanvas', function() {
- if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
+ if (MediaQuery.atLeast(_this.options.revealOn)) {
_this.reveal(true);
}
});
}
if (this.options.autoFocus === true) {
- this.$element.one(Foundation.transitionend(this.$element), function() {
+ this.$element.one(transitionend(this.$element), function() {
var canvasFocus = _this.$element.find('[data-autofocus]');
if (canvasFocus.length) {
canvasFocus.eq(0).focus();
if (this.options.trapFocus === true) {
this.$element.siblings('[data-off-canvas-content]').attr('tabindex', '-1');
- Foundation.Keyboard.trapFocus(this.$element);
+ Keyboard.trapFocus(this.$element);
}
}
if (this.options.trapFocus === true) {
this.$element.siblings('[data-off-canvas-content]').removeAttr('tabindex');
- Foundation.Keyboard.releaseFocus(this.$element);
+ Keyboard.releaseFocus(this.$element);
}
}
* @private
*/
_handleKeyboard(e) {
- Foundation.Keyboard.handleKey(e, 'OffCanvas', {
+ Keyboard.handleKey(e, 'OffCanvas', {
close: () => {
this.close();
this.$lastTrigger.focus();
!function($) {
+
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let Motion = Foundation.Motion; // import { Motion } from "foundation.util.move"
+ let Timer = Foundation.Timer; // Add import after refactoring to separate timer & image loader
+ let onImagesLoaded = Foundation.onImagesLoaded; // Add import after refactoring to separate timer & image loader
+ let GetYoDigits = Foundation.GetYoDigits; // Add import after refactor
+
+ // import "foundation.util.touch.js"
+ // TODO: Figure out what a touch import should really do.
+
/**
* Orbit module.
* @module foundation.orbit
this._init();
Foundation.registerPlugin(this, 'Orbit');
- Foundation.Keyboard.register('Orbit', {
+ Keyboard.register('Orbit', {
'ltr': {
'ARROW_RIGHT': 'next',
'ARROW_LEFT': 'previous'
var $images = this.$element.find('img'),
initActive = this.$slides.filter('.is-active'),
- id = this.$element[0].id || Foundation.GetYoDigits(6, 'orbit');
+ id = this.$element[0].id || GetYoDigits(6, 'orbit');
this.$element.attr({
'data-resize': id,
}
if ($images.length) {
- Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this));
+ onImagesLoaded($images, this._prepareForOrbit.bind(this));
} else {
this._prepareForOrbit();//hehe
}
*/
geoSync() {
var _this = this;
- this.timer = new Foundation.Timer(
+ this.timer = new Timer(
this.$element,
{
duration: this.options.timerDelay,
if (this.options.accessible) {
this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) {
// handle keyboard event with keyboard util
- Foundation.Keyboard.handleKey(e, 'Orbit', {
+ Keyboard.handleKey(e, 'Orbit', {
next: function() {
_this.changeSlide(true);
},
}
if (this.options.useMUI && !this.$element.is(':hidden')) {
- Foundation.Motion.animateIn(
+ Motion.animateIn(
$newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}),
this.options[`animInFrom${dirIn}`],
function(){
.attr('aria-live', 'polite');
});
- Foundation.Motion.animateOut(
+ Motion.animateOut(
$curSlide.removeClass('is-active'),
this.options[`animOutTo${dirOut}`],
function(){
!function($) {
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
+ let GetYoDigits = Foundation.GetYoDigits; // separate out GetYoDigits into util
+
+ // import "foundation.util.triggers.js";
+
+
/**
* ResponsiveMenu module.
* @module foundation.responsiveMenu
this._checkMediaQueries();
}
// Add data-mutate since children may need it.
- this.$element.attr('data-mutate', (this.$element.attr('data-mutate') || Foundation.GetYoDigits(6, 'responsive-menu')));
+ this.$element.attr('data-mutate', (this.$element.attr('data-mutate') || GetYoDigits(6, 'responsive-menu')));
}
/**
var matchedMq, _this = this;
// Iterate through each rule and find the last matching rule
$.each(this.rules, function(key) {
- if (Foundation.MediaQuery.atLeast(key)) {
+ if (MediaQuery.atLeast(key)) {
matchedMq = key;
}
});
ResponsiveMenu.defaults = {};
+// TODO9438: refactor this to happen on init, rather than as side effect.
+//
// The plugin matches the plugin classes with these plugin instances.
var MenuPlugins = {
dropdown: {
!function($) {
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
+ let Motion = Foundation.Motion; // import { Motion } from "foundation.util.motion";
+
/**
* ResponsiveToggle module.
* @module foundation.responsiveToggle
* @requires foundation.util.mediaQuery
+ * @requires foundation.util.motion
*/
class ResponsiveToggle {
*/
_update() {
// Mobile
- if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
+ if (!MediaQuery.atLeast(this.options.hideFor)) {
this.$element.show();
this.$targetMenu.hide();
}
* @fires ResponsiveToggle#toggled
*/
toggleMenu() {
- if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
+ if (!MediaQuery.atLeast(this.options.hideFor)) {
/**
* Fires when the element attached to the tab bar toggles.
* @event ResponsiveToggle#toggled
});
}
else {
- Foundation.Motion.animateOut(this.$targetMenu, this.animationOut, () => {
+ Motion.animateOut(this.$targetMenu, this.animationOut, () => {
this.$element.trigger('toggled.zf.responsiveToggle');
});
}
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
+ let Motion = Foundation.Motion; // import { Motion } from "foundation.util.motion";
+
/**
* Reveal module.
* @module foundation.reveal
* @requires foundation.util.keyboard
- * @requires foundation.util.box
* @requires foundation.util.triggers
* @requires foundation.util.mediaQuery
* @requires foundation.util.motion if using animations
this._init();
Foundation.registerPlugin(this, 'Reveal');
- Foundation.Keyboard.register('Reveal', {
+ Keyboard.register('Reveal', {
'ENTER': 'open',
'SPACE': 'open',
'ESCAPE': 'close',
_init() {
this.id = this.$element.attr('id');
this.isActive = false;
- this.cached = {mq: Foundation.MediaQuery.current};
+ this.cached = {mq: MediaQuery.current};
this.isMobile = mobileSniff();
this.$anchor = $(`[data-open="${this.id}"]`).length ? $(`[data-open="${this.id}"]`) : $(`[data-toggle="${this.id}"]`);
})
.focus();
addRevealOpenClasses();
- Foundation.Keyboard.trapFocus(_this.$element);
+ Keyboard.trapFocus(_this.$element);
}
if (this.options.overlay) {
- Foundation.Motion.animateIn(this.$overlay, 'fade-in');
+ Motion.animateIn(this.$overlay, 'fade-in');
}
- Foundation.Motion.animateIn(this.$element, this.options.animationIn, () => {
+ Motion.animateIn(this.$element, this.options.animationIn, () => {
if(this.$element) { // protect against object having been removed
- this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
+ this.focusableElements = Keyboard.findFocusable(this.$element);
afterAnimation();
}
});
'tabindex': -1
})
.focus();
- Foundation.Keyboard.trapFocus(this.$element);
+ Keyboard.trapFocus(this.$element);
/**
* Fires when the modal has successfully opened.
_extraHandlers() {
var _this = this;
if(!this.$element) { return; } // If we're in the middle of cleanup, don't freak out
- this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
+ this.focusableElements = Keyboard.findFocusable(this.$element);
if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
$('body').on('click.zf.reveal', function(e) {
if (this.options.closeOnEsc) {
$(window).on('keydown.zf.reveal', function(e) {
- Foundation.Keyboard.handleKey(e, 'Reveal', {
+ Keyboard.handleKey(e, 'Reveal', {
close: function() {
if (_this.options.closeOnEsc) {
_this.close();
this.$element.on('keydown.zf.reveal', function(e) {
var $target = $(this);
// handle keyboard event with keyboard util
- Foundation.Keyboard.handleKey(e, 'Reveal', {
+ Keyboard.handleKey(e, 'Reveal', {
open: function() {
if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {
setTimeout(function() { // set focus back to anchor if close button has been activated
// Motion UI method of hiding
if (this.options.animationOut) {
if (this.options.overlay) {
- Foundation.Motion.animateOut(this.$overlay, 'fade-out');
+ Motion.animateOut(this.$overlay, 'fade-out');
}
- Foundation.Motion.animateOut(this.$element, this.options.animationOut, finishUp);
+ Motion.animateOut(this.$element, this.options.animationOut, finishUp);
}
// jQuery method of hiding
else {
}
- Foundation.Keyboard.releaseFocus(_this.$element);
+ Keyboard.releaseFocus(_this.$element);
_this.$element.attr('aria-hidden', true);
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let Move = Foundation.Move; // import { Move } from "foundation.util.motion";
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor TODO9438
+ let Rtl = Foundation.rtl; // figure out import/refactor for encapsulation of rtl() TODO9438
/**
* Slider module.
* @module foundation.slider
this._init();
Foundation.registerPlugin(this, 'Slider');
- Foundation.Keyboard.register('Slider', {
+ Keyboard.register('Slider', {
'ltr': {
'ARROW_RIGHT': 'increase',
'ARROW_UP': 'increase',
//because we don't know exactly how the handle will be moved, check the amount of time it should take to move.
var moveTime = this.$element.data('dragging') ? 1000/60 : this.options.moveTime;
- Foundation.Move(moveTime, $hndl, function() {
+ Move(moveTime, $hndl, function() {
// adjusting the left/top property of the handle, based on the percentage calculated above
// if movement isNaN, that is because the slider is hidden and we cannot determine handle width,
// fall back to next best guess.
*/
_setInitAttr(idx) {
var initVal = (idx === 0 ? this.options.initialStart : this.options.initialEnd)
- var id = this.inputs.eq(idx).attr('id') || Foundation.GetYoDigits(6, 'slider');
+ var id = this.inputs.eq(idx).attr('id') || GetYoDigits(6, 'slider');
this.inputs.eq(idx).attr({
'id': id,
'max': this.options.end,
value = this._value(offsetPct);
// turn everything around for RTL, yay math!
- if (Foundation.rtl() && !this.options.vertical) {value = this.options.end - value;}
+ if (Rtl() && !this.options.vertical) {value = this.options.end - value;}
value = _this._adjustValue(null, value);
//boolean flag for the setHandlePos fn, specifically for vertical sliders
newValue;
// handle keyboard event with keyboard util
- Foundation.Keyboard.handleKey(e, 'Slider', {
+ Keyboard.handleKey(e, 'Slider', {
decrease: function() {
newValue = oldValue - _this.options.step;
},
!function($) {
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor TODO9438
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
/**
* Sticky module.
* @module foundation.sticky
*/
_init() {
var $parent = this.$element.parent('[data-sticky-container]'),
- id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'),
+ id = this.$element[0].id || GetYoDigits(6, 'sticky'),
_this = this;
if($parent.length){
* @private
*/
_setSizes(cb) {
- this.canStick = Foundation.MediaQuery.is(this.options.stickyOn);
+ this.canStick = MediaQuery.is(this.options.stickyOn);
if (!this.canStick) {
if (cb && typeof cb === 'function') { cb(); }
}
!function($) {
+ let Keyboard = Foundation.Keyboard; // import Keyboard from "foundation.util.keyboard";
+ let onImagesLoaded = Foundation.onImagesLoaded; // add import after refactor TODO9438;
/**
* Tabs module.
* @module foundation.tabs
this._init();
Foundation.registerPlugin(this, 'Tabs');
- Foundation.Keyboard.register('Tabs', {
+ Keyboard.register('Tabs', {
'ENTER': 'open',
'SPACE': 'open',
'ARROW_RIGHT': 'next',
var $images = this.$tabContent.find('img');
if ($images.length) {
- Foundation.onImagesLoaded($images, this._setHeight.bind(this));
+ onImagesLoaded($images, this._setHeight.bind(this));
} else {
this._setHeight();
}
});
// handle keyboard event with keyboard util
- Foundation.Keyboard.handleKey(e, 'Tabs', {
+ Keyboard.handleKey(e, 'Tabs', {
open: function() {
$element.find('[role="tab"]').focus();
_this._handleTabChange($element);
!function($) {
+ let Motion = Foundation.Motion; // import { Motion } from "foundation.util.motion";
+
+ // import "foundation.util.triggersjs";
+
/**
* Toggler module.
* @module foundation.toggler
var _this = this;
if (this.$element.is(':hidden')) {
- Foundation.Motion.animateIn(this.$element, this.animationIn, function() {
+ Motion.animateIn(this.$element, this.animationIn, function() {
_this._updateARIA(true);
this.trigger('on.zf.toggler');
this.find('[data-mutate]').trigger('mutateme.zf.trigger');
});
}
else {
- Foundation.Motion.animateOut(this.$element, this.animationOut, function() {
+ Motion.animateOut(this.$element, this.animationOut, function() {
_this._updateARIA(false);
this.trigger('off.zf.toggler');
this.find('[data-mutate]').trigger('mutateme.zf.trigger');
!function($) {
+ let Box = Foundation.Box; // import Box from "foundation.utils.box";
+ let GetYoDigits = Foundation.GetYoDigits; // figure out import after refactor. TODO9438
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.utils.mediaQuery";
+
+ // import "foundation.util.triggers";
+
/**
* Tooltip module.
* @module foundation.tooltip
* @private
*/
_init() {
- var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip');
+ var elemId = this.$element.attr('aria-describedby') || GetYoDigits(6, 'tooltip');
this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element);
this.options.tipText = this.options.tipText || this.$element.attr('title');
*/
_setPosition() {
var position = this._getPositionClass(this.template),
- $tipDims = Foundation.Box.GetDimensions(this.template),
- $anchorDims = Foundation.Box.GetDimensions(this.$element),
+ $tipDims = Box.GetDimensions(this.template),
+ $anchorDims = Box.GetDimensions(this.$element),
direction = (position === 'left' ? 'left' : ((position === 'right') ? 'left' : 'top')),
param = (direction === 'top') ? 'height' : 'width',
offset = (param === 'height') ? this.options.vOffset : this.options.hOffset,
_this = this;
- if (($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.template))) {
- this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
- // this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
+ if (($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Box.ImNotTouchingYou(this.template))) {
+ this.template.offset(Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
'width': $anchorDims.windowDims.width - (this.options.hOffset * 2),
'height': 'auto'
});
return false;
}
- this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element,'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset));
+ this.template.offset(Box.GetOffsets(this.template, this.$element,'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset));
- while(!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) {
+ while(!Box.ImNotTouchingYou(this.template) && this.counter) {
this._reposition(position);
this._setPosition();
}
* @function
*/
show() {
- if (this.options.showOn !== 'all' && !Foundation.MediaQuery.is(this.options.showOn)) {
+ if (this.options.showOn !== 'all' && !MediaQuery.is(this.options.showOn)) {
// console.error('The screen is too small to display this tooltip');
return false;
}
!function($) {
+ let Rtl = Foundation.rtl; // Figure out imports after refactor
+
Foundation.Box = {
ImNotTouchingYou: ImNotTouchingYou,
GetDimensions: GetDimensions,
switch (position) {
case 'top':
return {
- left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),
+ left: (Rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
}
break;
break;
default:
return {
- left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left + hOffset),
+ left: (Rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left + hOffset),
top: $anchorDims.offset.top + $anchorDims.height + vOffset
}
}
!function($) {
+ let Rtl = Foundation.rtl; // Figure out import after refactor
+
const keyCodes = {
9: 'TAB',
13: 'ENTER',
if (typeof commandList.ltr === 'undefined') { // this component does not differentiate between ltr and rtl
cmds = commandList; // use plain list
} else { // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa
- if (Foundation.rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);
+ if (Rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);
else cmds = $.extend({}, commandList.rtl, commandList.ltr);
}
register(componentName, cmds) {
commands[componentName] = cmds;
- },
+ },
+
+ // TODO9438: These references to Keyboard need to not require global. Will 'this' work in this context?
+ //
/**
* Traps the focus in the given element.
* @param {jQuery} $element jQuery object to trap the foucs into.
!function($) {
+ let Motion = Foundation.Motion; // import { Motion } from "foundation.util.motion";
+
const MutationObserver = (function () {
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
for (var i=0; i < prefixes.length; i++) {
let animation = $(this).data('closable');
if(animation !== ''){
- Foundation.Motion.animateOut($(this), animation, function() {
+ Motion.animateOut($(this), animation, function() {
$(this).trigger('closed.zf');
});
}else{
!function($) {
+ let MediaQuery = Foundation.MediaQuery; // import MediaQuery from "foundation.util.mediaQuery";
+ let GetYoDigits = Foundation.GetYoDigits;
+
/**
* ResponsiveAccordionTabs module.
* @module foundation.responsiveAccordionTabs
- * @requires foundation.util.keyboard
* @requires foundation.util.timerAndImageLoader
* @requires foundation.util.motion
* @requires foundation.accordion
this.currentMq = null;
this.currentPlugin = null;
if (!this.$element.attr('id')) {
- this.$element.attr('id',Foundation.GetYoDigits(6, 'responsiveaccordiontabs'));
+ this.$element.attr('id',GetYoDigits(6, 'responsiveaccordiontabs'));
};
this._init();
var matchedMq, _this = this;
// Iterate through each rule and find the last matching rule
$.each(this.rules, function(key) {
- if (Foundation.MediaQuery.atLeast(key)) {
+ if (MediaQuery.atLeast(key)) {
matchedMq = key;
}
});
$panels.each(function(key,value){
var tempValue = $(value).appendTo($tabsContent).addClass(tabsPanel);
var hash = $liHeadsA.get(key).hash.slice(1);
- var id = $(value).attr('id') || Foundation.GetYoDigits(6, 'accordion');
+ var id = $(value).attr('id') || GetYoDigits(6, 'accordion');
if (hash !== id) {
if (hash !== '') {
$(value).attr('id',hash);
ResponsiveAccordionTabs.defaults = {};
+// TODO9438 move this to initialize in order to eliminate side effects
+//
// The plugin matches the plugin classes with these plugin instances.
var MenuPlugins = {
tabs: {