vendor/assets/js/foundation.esm.js in foundation-rails-6.6.1.0 vs vendor/assets/js/foundation.esm.js in foundation-rails-6.6.2.0
- old
+ new
@@ -203,20 +203,20 @@
'OTransition': 'otransitionend'
};
var elem = document.createElement('div'),
end;
- for (var t in transitions) {
- if (typeof elem.style[t] !== 'undefined') {
- end = transitions[t];
+ for (var transition in transitions) {
+ if (typeof elem.style[transition] !== 'undefined') {
+ end = transitions[transition];
}
}
if (end) {
return end;
} else {
- end = setTimeout(function () {
+ setTimeout(function () {
$elem.triggerHandler('transitionend', [$elem]);
}, 1);
return 'transitionend';
}
}
@@ -627,11 +627,11 @@
return ret;
}, {});
return styleObject;
}
-var FOUNDATION_VERSION = '6.6.1'; // Global Foundation object
+var FOUNDATION_VERSION = '6.6.2'; // Global Foundation object
// This is attached to the window, or used as a module for AMD/Browserify
var Foundation = {
version: FOUNDATION_VERSION,
@@ -792,12 +792,12 @@
opts = {
reflow: true
};
if ($el.attr('data-options')) {
- var thing = $el.attr('data-options').split(';').forEach(function (e, i) {
- var opt = e.split(':').map(function (el) {
+ $el.attr('data-options').split(';').forEach(function (option, _index) {
+ var opt = option.split(':').map(function (el) {
return el.trim();
});
if (opt[0]) opts[opt[0]] = parseValue(opt[1]);
});
}
@@ -1102,67 +1102,70 @@
function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) {
var $eleDims = GetDimensions(element),
$anchorDims = anchor ? GetDimensions(anchor) : null;
- var topVal, leftVal; // set position related attribute
+ var topVal, leftVal;
- switch (position) {
- case 'top':
- topVal = $anchorDims.offset.top - ($eleDims.height + vOffset);
- break;
+ if ($anchorDims !== null) {
+ // set position related attribute
+ switch (position) {
+ case 'top':
+ topVal = $anchorDims.offset.top - ($eleDims.height + vOffset);
+ break;
- case 'bottom':
- topVal = $anchorDims.offset.top + $anchorDims.height + vOffset;
- break;
+ case 'bottom':
+ topVal = $anchorDims.offset.top + $anchorDims.height + vOffset;
+ break;
- case 'left':
- leftVal = $anchorDims.offset.left - ($eleDims.width + hOffset);
- break;
+ case 'left':
+ leftVal = $anchorDims.offset.left - ($eleDims.width + hOffset);
+ break;
- case 'right':
- leftVal = $anchorDims.offset.left + $anchorDims.width + hOffset;
- break;
- } // set alignment related attribute
+ case 'right':
+ leftVal = $anchorDims.offset.left + $anchorDims.width + hOffset;
+ break;
+ } // set alignment related attribute
- switch (position) {
- case 'top':
- case 'bottom':
- switch (alignment) {
- case 'left':
- leftVal = $anchorDims.offset.left + hOffset;
- break;
+ switch (position) {
+ case 'top':
+ case 'bottom':
+ switch (alignment) {
+ case 'left':
+ leftVal = $anchorDims.offset.left + hOffset;
+ break;
- case 'right':
- leftVal = $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset;
- break;
+ case 'right':
+ leftVal = $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset;
+ break;
- case 'center':
- leftVal = isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2 + hOffset;
- break;
- }
+ case 'center':
+ leftVal = isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2 + hOffset;
+ break;
+ }
- break;
+ break;
- case 'right':
- case 'left':
- switch (alignment) {
- case 'bottom':
- topVal = $anchorDims.offset.top - vOffset + $anchorDims.height - $eleDims.height;
- break;
+ case 'right':
+ case 'left':
+ switch (alignment) {
+ case 'bottom':
+ topVal = $anchorDims.offset.top - vOffset + $anchorDims.height - $eleDims.height;
+ break;
- case 'top':
- topVal = $anchorDims.offset.top + vOffset;
- break;
+ case 'top':
+ topVal = $anchorDims.offset.top + vOffset;
+ break;
- case 'center':
- topVal = $anchorDims.offset.top + vOffset + $anchorDims.height / 2 - $eleDims.height / 2;
- break;
- }
+ case 'center':
+ topVal = $anchorDims.offset.top + vOffset + $anchorDims.height / 2 - $eleDims.height / 2;
+ break;
+ }
- break;
+ break;
+ }
}
return {
top: topVal,
left: leftVal
@@ -1436,10 +1439,14 @@
element.addClass(initClass);
if (isIn) element.show();
}); // Start the animation
requestAnimationFrame(function () {
+ // will trigger the browser to synchronously calculate the style and layout
+ // also called reflow or layout thrashing
+ // see https://gist.github.com/paulirish/5d52fb081b3570c81e3a
+ element[0].offsetWidth;
element.css('transition', '').addClass(activeClass);
}); // Clean up the animation when it finishes
element.one(transitionend(element), finish); // Hides the element (for out animations), resets the element, and runs a callback
@@ -1458,12 +1465,15 @@
var Nest = {
Feather: function Feather(menu) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'zf';
menu.attr('role', 'menubar');
- var items = menu.find('li').attr({
+ menu.find('a').attr({
'role': 'menuitem'
+ });
+ var items = menu.find('li').attr({
+ 'role': 'none'
}),
subMenuClass = "is-".concat(type, "-submenu"),
subItemClass = "".concat(subMenuClass, "-item"),
hasSubClass = "is-".concat(type, "-submenu-parent"),
applyAria = type !== 'accordion'; // Accordions handle their own ARIA attriutes.
@@ -2063,15 +2073,11 @@
function hyphenate$1(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
function getPluginName(obj) {
- if (typeof obj.constructor.name !== 'undefined') {
- return hyphenate$1(obj.constructor.name);
- } else {
- return hyphenate$1(obj.className);
- }
+ return hyphenate$1(obj.className);
}
/**
* Abide module.
* @module foundation.abide
@@ -2202,14 +2208,14 @@
// whole validation disabled
return true;
} else if (typeof this.formnovalidate === 'boolean') {
// triggered by $submit
return this.formnovalidate;
- } else {
- // triggered by Enter in non-submit input
- return this.$submits.length ? this.$submits[0].getAttribute('formnovalidate') !== null : false;
- }
+ } // triggered by Enter in non-submit input
+
+
+ return this.$submits.length ? this.$submits[0].getAttribute('formnovalidate') !== null : false;
}
/**
* Enables the whole validation
*/
@@ -2265,16 +2271,19 @@
* - Element(s) with the attribute `[data-form-error-for]` set with the element's id.
*
* This allows for multiple form errors per input, though if none are found, no form errors will be shown.
*
* @param {Object} $el - jQuery object to use as reference to find the form error selector.
+ * @param {String[]} [failedValidators] - List of failed validators.
* @returns {Object} jQuery object with the selector.
*/
}, {
key: "findFormError",
- value: function findFormError($el) {
+ value: function findFormError($el, failedValidators) {
+ var _this4 = this;
+
var id = $el.length ? $el[0].id : '';
var $error = $el.siblings(this.options.formErrorSelector);
if (!$error.length) {
$error = $el.parent().find(this.options.formErrorSelector);
@@ -2282,10 +2291,18 @@
if (id) {
$error = $error.add(this.$element.find("[data-form-error-for=\"".concat(id, "\"]")));
}
+ if (!!failedValidators) {
+ $error = $error.not('[data-form-error-on]');
+ failedValidators.forEach(function (v) {
+ $error = $error.add($el.siblings("[data-form-error-on=\"".concat(v, "\"]")));
+ $error = $error.add(_this4.$element.find("[data-form-error-for=\"".concat(id, "\"][data-form-error-on=\"").concat(v, "\"]")));
+ });
+ }
+
return $error;
}
/**
* Get the first element in this order:
* 2. The <label> with the attribute `[for="someInputId"]`
@@ -2317,16 +2334,16 @@
*/
}, {
key: "findRadioLabels",
value: function findRadioLabels($els) {
- var _this4 = this;
+ var _this5 = this;
var labels = $els.map(function (i, el) {
var id = el.id;
- var $label = _this4.$element.find("label[for=\"".concat(id, "\"]"));
+ var $label = _this5.$element.find("label[for=\"".concat(id, "\"]"));
if (!$label.length) {
$label = $(el).closest('label');
}
@@ -2344,16 +2361,16 @@
*/
}, {
key: "findCheckboxLabels",
value: function findCheckboxLabels($els) {
- var _this5 = this;
+ var _this6 = this;
var labels = $els.map(function (i, el) {
var id = el.id;
- var $label = _this5.$element.find("label[for=\"".concat(id, "\"]"));
+ var $label = _this6.$element.find("label[for=\"".concat(id, "\"]"));
if (!$label.length) {
$label = $(el).closest('label');
}
@@ -2362,17 +2379,18 @@
return $(labels);
}
/**
* Adds the CSS error class as specified by the Abide settings to the label, input, and the form
* @param {Object} $el - jQuery object to add the class to
+ * @param {String[]} [failedValidators] - List of failed validators.
*/
}, {
key: "addErrorClasses",
- value: function addErrorClasses($el) {
+ value: function addErrorClasses($el, failedValidators) {
var $label = this.findLabel($el);
- var $formError = this.findFormError($el);
+ var $formError = this.findFormError($el, failedValidators);
if ($label.length) {
$label.addClass(this.options.labelErrorClass);
}
@@ -2405,22 +2423,24 @@
if (typeof errorId === 'undefined') {
errorId = GetYoDigits(6, 'abide-error');
$error.attr('id', errorId);
}
+
$el.attr('aria-describedby', errorId);
}
if ($labels.filter('[for]').length < $labels.length) {
// Get the input ID or create one
var elemId = $el.attr('id');
if (typeof elemId === 'undefined') {
elemId = GetYoDigits(6, 'abide-input');
$el.attr('id', elemId);
- }
+ } // For each label targeting $el, set [for] if it is not set.
+
$labels.each(function (i, label) {
var $label = $(label);
if (typeof $label.attr('for') === 'undefined') $label.attr('for', elemId);
});
} // For each error targeting $el, set [role=alert] if it is not set.
@@ -2535,15 +2555,16 @@
*/
}, {
key: "validateInput",
value: function validateInput($el) {
+ var _this7 = this;
+
var clearRequire = this.requiredCheck($el),
- validated = false,
- customValidator = true,
validator = $el.attr('data-validator'),
- equalTo = true; // skip validation if disabled
+ failedValidators = [],
+ manageErrorClasses = true; // skip validation if disabled
if (this._validationIsDisabled()) {
return true;
} // don't validate ignored inputs or hidden inputs or disabled inputs
@@ -2552,37 +2573,42 @@
return true;
}
switch ($el[0].type) {
case 'radio':
- validated = this.validateRadio($el.attr('name'));
+ this.validateRadio($el.attr('name')) || failedValidators.push('required');
break;
case 'checkbox':
- validated = this.validateCheckbox($el.attr('name'));
- clearRequire = true;
+ this.validateCheckbox($el.attr('name')) || failedValidators.push('required'); // validateCheckbox() adds/removes error classes
+
+ manageErrorClasses = false;
break;
case 'select':
case 'select-one':
case 'select-multiple':
- validated = clearRequire;
+ clearRequire || failedValidators.push('required');
break;
default:
- validated = this.validateText($el);
+ clearRequire || failedValidators.push('required');
+ this.validateText($el) || failedValidators.push('pattern');
}
if (validator) {
- customValidator = this.matchValidation($el, validator, $el.attr('required'));
+ var required = $el.attr('required') ? true : false;
+ validator.split(' ').forEach(function (v) {
+ _this7.options.validators[v]($el, required, $el.parent()) || failedValidators.push(v);
+ });
}
if ($el.attr('data-equalto')) {
- equalTo = this.options.validators.equalTo($el);
+ this.options.validators.equalTo($el) || failedValidators.push('equalTo');
}
- var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1;
+ var goodToGo = failedValidators.length === 0;
var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
if (goodToGo) {
// Re-validate inputs that depend on this one with equalto
var dependentElements = this.$element.find("[data-equalto=\"".concat($el.attr('id'), "\"]"));
@@ -2596,18 +2622,25 @@
}
});
}
}
- this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el);
+ if (manageErrorClasses) {
+ this.removeErrorClasses($el);
+
+ if (!goodToGo) {
+ this.addErrorClasses($el, failedValidators);
+ }
+ }
/**
* Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide`
* Trigger includes the DOM element of the input.
* @event Abide#valid
* @event Abide#invalid
*/
+
$el.trigger(message, [$el]);
return goodToGo;
}
/**
* Goes through a form and if there are any invalid inputs, it will display the form error element
@@ -2617,11 +2650,11 @@
*/
}, {
key: "validateForm",
value: function validateForm() {
- var _this6 = this;
+ var _this8 = this;
var acc = [];
var _this = this;
@@ -2648,11 +2681,11 @@
});
var noError = acc.indexOf(false) === -1;
this.$element.find('[data-abide-error]').each(function (i, elem) {
var $elem = $(elem); // Ensure a11y attributes are set
- if (_this6.options.a11yAttributes) _this6.addGlobalErrorA11yAttributes($elem); // Show or hide the error
+ if (_this8.options.a11yAttributes) _this8.addGlobalErrorA11yAttributes($elem); // Show or hide the error
$elem.css('display', noError ? 'none' : 'block');
});
/**
* Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`.
@@ -2675,26 +2708,21 @@
key: "validateText",
value: function validateText($el, pattern) {
// A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute
pattern = pattern || $el.attr('data-pattern') || $el.attr('pattern') || $el.attr('type');
var inputText = $el.val();
- var valid = false;
+ var valid = true;
if (inputText.length) {
// If the pattern attribute on the element is in Abide's list of patterns, then test that regexp
if (this.options.patterns.hasOwnProperty(pattern)) {
valid = this.options.patterns[pattern].test(inputText);
} // If the pattern name isn't also the type attribute of the field, then test it as a regexp
else if (pattern !== $el.attr('type')) {
valid = new RegExp(pattern).test(inputText);
- } else {
- valid = true;
}
- } // An empty field is valid if it's not required
- else if (!$el.prop('required')) {
- valid = true;
- }
+ }
return valid;
}
/**
* Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group.
@@ -2724,10 +2752,11 @@
if ($(e).prop('checked')) {
valid = true;
}
});
}
+
return valid;
}
/**
* Determines whether or a not a checkbox input is valid based on whether or not it is required and checked. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all checkboxes in its group.
* @param {String} groupName - A string that specifies the name of a checkbox group
@@ -2735,11 +2764,11 @@
*/
}, {
key: "validateCheckbox",
value: function validateCheckbox(groupName) {
- var _this7 = this;
+ var _this9 = this;
// If at least one checkbox in the group has the `required` attribute, the group is considered required
// Per W3C spec, all checkboxes in a group should have `required`, but we're being nice
var $group = this.$element.find(":checkbox[name=\"".concat(groupName, "\"]"));
var valid = false,
@@ -2768,22 +2797,23 @@
}); // For the group to be valid, the minRequired amount of checkboxes have to be checked
if (checked >= minRequired) {
valid = true;
}
- }
+ } // Skip validation if more than 1 checkbox have to be checked AND if the form hasn't got submitted yet (otherwise it will already show an error during the first fill in)
+
if (this.initialized !== true && minRequired > 1) {
return true;
} // Refresh error class for all input
$group.each(function (i, e) {
if (!valid) {
- _this7.addErrorClasses($(e));
+ _this9.addErrorClasses($(e), ['required']);
} else {
- _this7.removeErrorClasses($(e));
+ _this9.removeErrorClasses($(e));
}
});
return valid;
}
/**
@@ -2795,15 +2825,15 @@
*/
}, {
key: "matchValidation",
value: function matchValidation($el, validators, required) {
- var _this8 = this;
+ var _this10 = this;
required = required ? true : false;
var clear = validators.split(' ').map(function (v) {
- return _this8.options.validators[v]($el, required, $el.parent());
+ return _this10.options.validators[v]($el, required, $el.parent());
});
return clear.indexOf(false) === -1;
}
/**
* Resets form inputs and styles
@@ -3110,11 +3140,11 @@
if (_this2.options.deepLinkSmudge) {
onLoad($(window), function () {
var offset = _this2.$element.offset();
$('html, body').animate({
- scrollTop: offset.top
+ scrollTop: offset.top - _this2.options.deepLinkSmudgeOffset
}, _this2.options.deepLinkSmudgeDelay);
});
}
/**
* Fires when the plugin has deeplinked at pageload
@@ -3298,11 +3328,11 @@
$targetItem.addClass('is-active');
$("#".concat(targetContentId)).attr({
'aria-expanded': true,
'aria-selected': true
});
- $target.slideDown(this.options.slideSpeed, function () {
+ $target.stop().slideDown(this.options.slideSpeed, function () {
/**
* Fires when the tab is done opening.
* @event Accordion#down
*/
_this3.$element.trigger('down.zf.accordion', [$target]);
@@ -3327,11 +3357,11 @@
$targetItem.removeClass('is-active');
$("#".concat(targetContentId)).attr({
'aria-expanded': false,
'aria-selected': false
});
- $target.slideUp(this.options.slideSpeed, function () {
+ $target.stop().slideUp(this.options.slideSpeed, function () {
/**
* Fires when the tab is done collapsing up.
* @event Accordion#up
*/
_this4.$element.trigger('up.zf.accordion', [$target]);
@@ -3423,10 +3453,18 @@
* @default 300
*/
deepLinkSmudgeDelay: 300,
/**
+ * If `deepLinkSmudge` is enabled, the offset for scrollToTtop to prevent overlap by a sticky element at the top of the page
+ * @option
+ * @type {number}
+ * @default 0
+ */
+ deepLinkSmudgeOffset: 0,
+
+ /**
* If `deepLink` is enabled, update the browser history with the open accordion
* @option
* @type {boolean}
* @default false
*/
@@ -3532,12 +3570,10 @@
'role': 'treeitem'
});
var initPanes = this.$element.find('.is-active');
if (initPanes.length) {
- var _this = this;
-
initPanes.each(function () {
_this.down($(this));
});
}
@@ -3924,11 +3960,11 @@
this.$submenuAnchors.each(function () {
var $link = $(this);
var $sub = $link.parent();
if (_this.options.parentLink) {
- $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li data-is-parent-link class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menuitem"></li>');
+ $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li data-is-parent-link class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="none"></li>');
}
$link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0);
$link.children('[data-submenu]').attr({
'aria-hidden': true,
@@ -4876,10 +4912,11 @@
if (typeof this.$element.attr('aria-labelledby') === 'undefined') {
// Get the anchor ID or create one
if (typeof this.$currentAnchor.attr('id') === 'undefined') {
this.$currentAnchor.attr('id', GetYoDigits(6, 'dd-anchor'));
}
+
this.$element.attr('aria-labelledby', this.$currentAnchor.attr('id'));
}
this.$element.attr({
'aria-hidden': 'true',
@@ -4963,17 +5000,15 @@
'resizeme.zf.trigger': this._setPosition.bind(this)
});
this.$anchors.off('click.zf.trigger').on('click.zf.trigger', function (e) {
_this._setCurrentAnchor(this);
- if (_this.options.forceFollow === false) {
- // if forceFollow false, always prevent default action
+ if ( // if forceFollow false, always prevent default action
+ _this.options.forceFollow === false || // if forceFollow true and hover option true, only prevent default action on 1st click
+ // on 2nd click (dropown opened) the default action (e.g. follow a href) gets executed
+ hasTouch && _this.options.hover && _this.$element.hasClass('is-open') === false) {
e.preventDefault();
- } else if (hasTouch && _this.options.hover && _this.$element.hasClass('is-open') === false) {
- // if forceFollow true and hover option true, only prevent default action on 1st click
- // on 2nd click (dropown opened) the default action (e.g. follow a href) gets executed
- e.preventDefault();
}
});
if (this.options.hover) {
this.$anchors.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () {
@@ -5347,12 +5382,12 @@
key: "_init",
value: function _init() {
Nest.Feather(this.$element, 'dropdown');
var subs = this.$element.find('li.is-dropdown-submenu-parent');
this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');
- this.$menuItems = this.$element.find('[role="menuitem"]');
- this.$tabs = this.$element.children('[role="menuitem"]');
+ this.$menuItems = this.$element.find('li[role="none"]');
+ this.$tabs = this.$element.children('li[role="none"]');
this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
if (this.options.alignment === 'auto') {
if (this.$element.hasClass(this.options.rightClass) || rtl() || this.$element.parents('.top-bar-right').is('*')) {
this.options.alignment = 'right';
@@ -5407,14 +5442,16 @@
if (hasClicked) {
if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) {
return;
}
+ e.stopImmediatePropagation();
e.preventDefault();
_this._hide($elem);
} else {
+ e.stopImmediatePropagation();
e.preventDefault();
_this._show($sub);
$elem.add($elem.parentsUntil(_this.$element, ".".concat(parClass))).attr('data-is-click', true);
@@ -5447,11 +5484,11 @@
clearTimeout($elem.data('_delay'));
$elem.data('_delay', setTimeout(function () {
_this._show($elem.children('.is-dropdown-submenu'));
}, _this.options.hoverDelay));
}
- }).on('mouseleave.zf.dropdownmenu', ignoreMousedisappear(function (e) {
+ }).on('mouseleave.zf.dropdownMenu', ignoreMousedisappear(function (e) {
var $elem = $(this),
hasSub = $elem.hasClass(parClass);
if (hasSub && _this.options.autoclose) {
if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) {
@@ -5465,11 +5502,11 @@
}
}));
}
this.$menuItems.on('keydown.zf.dropdownMenu', function (e) {
- var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'),
+ var $element = $(e.target).parentsUntil('ul', '[role="none"]'),
isTab = _this.$tabs.index($element) > -1,
$elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
$prevElement,
$nextElement;
$elements.each(function (i) {
@@ -6249,11 +6286,14 @@
this.$element = element;
this.options = $.extend({}, Interchange.defaults, this.$element.data(), options);
this.rules = [];
this.currentPath = '';
this.className = 'Interchange'; // ie9 back compat
+ // Triggers init is idempotent, just need to make sure it is initialized
+ Triggers.init($);
+
this._init();
this._events();
}
/**
@@ -6743,16 +6783,11 @@
*/
}, {
key: "_events",
value: function _events() {
- var _this = this,
- $body = $('html, body'),
- opts = {
- duration: _this.options.animationDuration,
- easing: _this.options.animationEasing
- };
+ var _this = this;
$(window).one('load', function () {
if (_this.options.deepLinking) {
if (location.hash) {
_this.scrollToLoc(location.hash);
@@ -9197,11 +9232,11 @@
this.$element.off('keydown.zf.reveal');
function finishUp() {
// Get the current top before the modal is closed and restore the scroll after.
// TODO: use component properties instead of HTML properties
- // See https://github.com/zurb/foundation-sites/pull/10786
+ // See https://github.com/foundation/foundation-sites/pull/10786
var scrollTop = parseInt($("html").css("top"));
if ($('.reveal:visible').length === 0) {
_this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
@@ -9518,12 +9553,13 @@
this.$handle2 = this.handles.eq(1);
this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $("#".concat(this.$handle2.attr('aria-controls')));
if (!this.inputs[1]) {
this.inputs = this.inputs.add(this.$input2);
- }
+ } // this.$handle.triggerHandler('click.zf.slider');
+
this._setInitAttr(1);
} // Set handle positions
this.setHandles();
@@ -9822,11 +9858,10 @@
var _this = this,
vertical = this.options.vertical,
param = vertical ? 'height' : 'width',
direction = vertical ? 'top' : 'left',
eventOffset = vertical ? e.pageY : e.pageX,
- halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2,
barDim = this.$element[0].getBoundingClientRect()[param],
windowScroll = vertical ? $(window).scrollTop() : $(window).scrollLeft();
var elemOffset = this.$element.offset()[direction]; // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates...
// best way to guess this is simulated is if clientY == pageY
@@ -11637,20 +11672,18 @@
}
}, {
key: "_getDefaultPosition",
value: function _getDefaultPosition() {
// handle legacy classnames
- var position = this.$element[0].className.match(/\b(top|left|right|bottom)\b/g);
var elementClassName = this.$element[0].className;
if (this.$element[0] instanceof SVGElement) {
elementClassName = elementClassName.baseVal;
}
+ var position = elementClassName.match(/\b(top|left|right|bottom)\b/g);
return position ? position[0] : 'top';
- var position = elementClassName.match(/\b(top|left|right)\b/g);
- position = position ? position[0] : 'tp';
}
}, {
key: "_getDefaultAlignment",
value: function _getDefaultAlignment() {
return 'center';
@@ -12271,10 +12304,11 @@
if ($panels.length) fromString = 'tabs';
if (fromString === toSet) {
return;
}
+
var tabsTitle = _this.allOptions.linkClass ? _this.allOptions.linkClass : 'tabs-title';
var tabsPanel = _this.allOptions.panelClass ? _this.allOptions.panelClass : 'tabs-panel';
this.$element.removeAttr('role');
var $liHeads = this.$element.children('.' + tabsTitle + ',[data-accordion-item]').removeClass(tabsTitle).removeClass('accordion-item').removeAttr('data-accordion-item');
var $liHeadsA = $liHeads.children('a').removeClass('accordion-title');
@@ -12283,10 +12317,11 @@
$panels = $panels.children('.' + tabsPanel).removeClass(tabsPanel).removeAttr('role').removeAttr('aria-hidden').removeAttr('aria-labelledby');
$panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected');
} else {
$panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content');
}
+
$panels.css({
display: '',
visibility: ''
});
$liHeads.css({
@@ -12311,10 +12346,11 @@
$tabsContent = $('<div class="tabs-content"></div>').insertAfter($placeholder).attr('data-tabs-content', _this.$element.attr('id'));
$placeholder.remove();
} else {
$tabsContent = $('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content', _this.$element.attr('id'));
}
+
$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') || GetYoDigits(6, 'accordion');
@@ -12325,10 +12361,11 @@
hash = id;
$(value).attr('id', hash);
$($liHeadsA.get(key)).attr('href', $($liHeadsA.get(key)).attr('href').replace('#', '') + '#' + hash);
}
}
+
var isActive = $($liHeads.get(key)).hasClass('is-active');
if (isActive) {
tempValue.addClass('is-active');
}
@@ -12344,11 +12381,11 @@
* @function
*/
}, {
key: "open",
- value: function open(target) {
+ value: function open(_target) {
if (this.currentRule && typeof this.currentRule.open === 'function') {
var _this$currentRule;
return (_this$currentRule = this.currentRule).open.apply(_this$currentRule, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
}
@@ -12360,11 +12397,11 @@
* @function
*/
}, {
key: "close",
- value: function close(target) {
+ value: function close(_target) {
if (this.currentRule && typeof this.currentRule.close === 'function') {
var _this$currentRule2;
return (_this$currentRule2 = this.currentRule).close.apply(_this$currentRule2, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
}
@@ -12376,10 +12413,10 @@
* @function
*/
}, {
key: "toggle",
- value: function toggle(target) {
+ value: function toggle(_target) {
if (this.currentRule && typeof this.currentRule.toggle === 'function') {
var _this$currentRule3;
return (_this$currentRule3 = this.currentRule).toggle.apply(_this$currentRule3, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
}