1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2024-11-23 10:59:03 +01:00

Update to Foundation.js

This commit is contained in:
MW install maintain even with core development 2018-02-08 21:02:47 -05:00
parent cd535df66e
commit 8ae56081c1
21 changed files with 1239 additions and 799 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,15 +4,18 @@
Foundation.libs.abide = {
name : 'abide',
version : '5.5.2',
version : '5.5.3',
settings : {
live_validate : true,
validate_on_blur : true,
live_validate : true, // validate the form as you go
validate_on_blur : true, // validate whenever you focus/blur on an input field
// validate_on: 'tab', // tab (when user tabs between fields), change (input changes), manual (call custom events)
focus_on_invalid : true,
error_labels : true, // labels with a for="inputId" will recieve an `error` class
error_class : 'error',
focus_on_invalid : true, // automatically bring the focus to an invalid input field
error_labels : true, // labels with a for="inputId" will receive an `error` class
error_class : 'error', // labels with a for="inputId" will receive an `error` class
// the amount of time Abide will take before it validates the form (in ms).
// smaller time will result in faster validation
timeout : 1000,
patterns : {
alpha : /^[a-zA-Z]+$/,
@ -77,7 +80,6 @@
}.bind(originalSelf), settings.timeout);
}
form
.off('.abide')
.on('submit.fndtn.abide', function (e) {
@ -95,22 +97,34 @@
.find('input, textarea, select').not(":hidden, [data-abide-ignore]")
.off('.abide')
.on('blur.fndtn.abide change.fndtn.abide', function (e) {
var id = this.getAttribute('id'),
eqTo = form.find('[data-equalto="'+ id +'"]');
// old settings fallback
// will be deprecated with F6 release
if (settings.validate_on_blur && settings.validate_on_blur === true) {
validate(this, e);
}
// checks if there is an equalTo equivalent related by id
if(typeof eqTo.get(0) !== "undefined" && eqTo.val().length){
validate(eqTo.get(0),e);
}
// new settings combining validate options into one setting
if (settings.validate_on === 'change') {
validate(this, e);
}
})
.on('keydown.fndtn.abide', function (e) {
var id = this.getAttribute('id'),
eqTo = form.find('[data-equalto="'+ id +'"]');
// old settings fallback
// will be deprecated with F6 release
if (settings.live_validate && settings.live_validate === true && e.which != 9) {
validate(this, e);
}
// checks if there is an equalTo equivalent related by id
if(typeof eqTo.get(0) !== "undefined" && eqTo.val().length){
validate(eqTo.get(0),e);
}
// new settings combining validate options into one setting
if (settings.validate_on === 'tab' && e.which === 9) {
validate(this, e);
@ -203,8 +217,11 @@
// TODO: Break this up into smaller methods, getting hard to read.
check_validation_and_apply_styles : function (el_patterns) {
var i = el_patterns.length,
validations = [],
form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'),
validations = [];
if (i == 0) {
return validations;
}
var form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'),
settings = form.data(this.attr_name(true) + '-init') || {};
while (i--) {
var el = el_patterns[i][0],
@ -299,6 +316,7 @@
}
validations = validations.concat(el_validations);
}
return validations;
},

View File

@ -4,7 +4,7 @@
Foundation.libs.accordion = {
name : 'accordion',
version : '5.5.2',
version : '5.5.3',
settings : {
content_class : 'content',
@ -74,13 +74,50 @@
settings = accordion.data(self.attr_name(true) + '-init') || self.settings;
aunts.children('a').attr('aria-expanded','false');
aunts.has('.' + settings.content_class + '.' + settings.active_class).children('a').attr('aria-expanded','true');
aunts.has('.' + settings.content_class + '.' + settings.active_class).addClass(settings.active_class).children('a').attr('aria-expanded','true');
if (settings.multi_expand) {
$instance.attr('aria-multiselectable','true');
}
},
toggle : function(options) {
var options = typeof options !== 'undefined' ? options : {};
var selector = typeof options.selector !== 'undefined' ? options.selector : '';
var toggle_state = typeof options.toggle_state !== 'undefined' ? options.toggle_state : '';
var $accordion = typeof options.$accordion !== 'undefined' ? options.$accordion : this.S(this.scope).closest('[' + this.attr_name() + ']');
var $items = $accordion.find('> dd' + selector + ', > li' + selector);
if ( $items.length < 1 ) {
if ( window.console ) {
console.error('Selection not found.', selector);
}
return false;
}
var S = this.S;
var active_class = this.settings.active_class;
$items.each(function() {
var $item = S(this);
var is_active = $item.hasClass(active_class);
if ( ( is_active && toggle_state === 'close' ) || ( !is_active && toggle_state === 'open' ) || toggle_state === '' ) {
$item.find('> a').trigger('click.fndtn.accordion');
}
});
},
open : function(options) {
var options = typeof options !== 'undefined' ? options : {};
options.toggle_state = 'open';
this.toggle(options);
},
close : function(options) {
var options = typeof options !== 'undefined' ? options : {};
options.toggle_state = 'close';
this.toggle(options);
},
off : function () {},
reflow : function () {}

View File

@ -4,7 +4,7 @@
Foundation.libs.alert = {
name : 'alert',
version : '5.5.2',
version : '5.5.3',
settings : {
callback : function () {}

View File

@ -4,7 +4,7 @@
Foundation.libs.clearing = {
name : 'clearing',
version : '5.5.2',
version : '5.5.3',
settings : {
templates : {
@ -28,7 +28,7 @@
touch_label : '',
// event initializers and locks
// event initializer and locks
init : false,
locked : false
},
@ -453,9 +453,9 @@
var caption = $image.attr('data-caption');
if (caption) {
container
.html(caption)
.show();
var containerPlain = container.get(0);
containerPlain.innerHTML = caption;
container.show();
} else {
container
.text('')

View File

@ -4,7 +4,7 @@
Foundation.libs.dropdown = {
name : 'dropdown',
version : '5.5.2',
version : '5.5.3',
settings : {
active_class : 'open',
@ -258,7 +258,7 @@
// `this` is the dropdown
dirs : {
// Calculate target offset
_base : function (t) {
_base : function (t, s) {
var o_p = this.offsetParent(),
o = o_p.offset(),
p = t.offset();
@ -275,31 +275,36 @@
//lets see if the panel will be off the screen
//get the actual width of the page and store it
var actualBodyWidth;
var windowWidth = window.innerWidth;
if (document.getElementsByClassName('row')[0]) {
actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
} else {
actualBodyWidth = window.innerWidth;
actualBodyWidth = windowWidth;
}
var actualMarginWidth = (window.innerWidth - actualBodyWidth) / 2;
var actualMarginWidth = (windowWidth - actualBodyWidth) / 2;
var actualBoundary = actualBodyWidth;
if (!this.hasClass('mega')) {
if (!this.hasClass('mega') && !s.ignore_repositioning) {
var outerWidth = this.outerWidth();
var o_left = t.offset().left;
//miss top
if (t.offset().top <= this.outerHeight()) {
p.missTop = true;
actualBoundary = window.innerWidth - actualMarginWidth;
actualBoundary = windowWidth - actualMarginWidth;
p.leftRightFlag = true;
}
//miss right
if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
if (o_left + outerWidth > o_left + actualMarginWidth && o_left - actualMarginWidth > outerWidth) {
p.missRight = true;
p.missLeft = false;
}
//miss left
if (t.offset().left - this.outerWidth() <= 0) {
if (o_left - outerWidth <= 0) {
p.missLeft = true;
p.missRight = false;
}
@ -310,7 +315,7 @@
top : function (t, s) {
var self = Foundation.libs.dropdown,
p = self.dirs._base.call(this, t);
p = self.dirs._base.call(this, t, s);
this.addClass('drop-top');
@ -337,7 +342,7 @@
bottom : function (t, s) {
var self = Foundation.libs.dropdown,
p = self.dirs._base.call(this, t);
p = self.dirs._base.call(this, t, s);
if (p.missRight == true) {
p.left = p.left - this.outerWidth() + t.outerWidth();
@ -355,7 +360,7 @@
},
left : function (t, s) {
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
var p = Foundation.libs.dropdown.dirs._base.call(this, t, s);
this.addClass('drop-left');
@ -369,7 +374,7 @@
},
right : function (t, s) {
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
var p = Foundation.libs.dropdown.dirs._base.call(this, t, s);
this.addClass('drop-right');

View File

@ -4,7 +4,7 @@
Foundation.libs.equalizer = {
name : 'equalizer',
version : '5.5.2',
version : '5.5.3',
settings : {
use_tallest : true,

View File

@ -4,7 +4,7 @@
Foundation.libs.interchange = {
name : 'interchange',
version : '5.5.2',
version : '5.5.3',
cache : {},
@ -49,7 +49,8 @@
// });
if (el !== null && /IMG/.test(el[0].nodeName)) {
var orig_path = el[0].src;
var orig_path = $.each(el, function(){this.src = path;});
// var orig_path = el[0].src;
if (new RegExp(path, 'i').test(orig_path)) {
return;

View File

@ -6,13 +6,13 @@
Foundation.libs.joyride = {
name : 'joyride',
version : '5.5.2',
version : '5.5.3',
defaults : {
expose : false, // turn on or off the expose feature
modal : true, // Whether to cover page with modal during the tour
keyboard : true, // enable left, right and esc keystrokes
tip_location : 'bottom', // 'top' or 'bottom' in relation to parent
tip_location : 'bottom', // 'top', 'bottom', 'left' or 'right' in relation to parent
nub_position : 'auto', // override on a per tooltip bases
scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation
scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI.
@ -323,8 +323,8 @@
this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
// scroll and hide bg if not modal
if (!/body/i.test(this.settings.$target.selector)) {
// scroll and hide bg if not modal and not expose
if (!/body/i.test(this.settings.$target.selector) && !this.settings.expose) {
var joyridemodalbg = $('.joyride-modal-bg');
if (/pop/i.test(this.settings.tipAnimation)) {
joyridemodalbg.hide();
@ -827,6 +827,10 @@
},
corners : function (el) {
if (el.length === 0) {
return [false, false, false, false];
}
var w = $(window),
window_half = w.height() / 2,
//using this to calculate since scroll may not have finished yet.
@ -924,7 +928,6 @@
$('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
$('.joyride-tip-guide, .joyride-modal-bg').remove();
clearTimeout(this.settings.automate);
this.settings = {};
},
reflow : function () {}

View File

@ -1,7 +1,7 @@
/*
* Foundation Responsive Library
* http://foundation.zurb.com
* Copyright 2014, ZURB
* Copyright 2015, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
@ -10,14 +10,12 @@
'use strict';
var header_helpers = function (class_array) {
var i = class_array.length;
var head = $('head');
while (i--) {
if (head.has('.' + class_array[i]).length === 0) {
head.append('<meta class="' + class_array[i] + '" />');
}
head.prepend($.map(class_array, function (class_name) {
if (head.has('.' + class_name).length === 0) {
return '<meta class="' + class_name + '" />';
}
}));
};
header_helpers([
@ -290,21 +288,30 @@
return string;
}
function MediaQuery(selector) {
this.selector = selector;
this.query = '';
}
MediaQuery.prototype.toString = function () {
return this.query || (this.query = S(this.selector).css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''));
};
window.Foundation = {
name : 'Foundation',
version : '5.5.2',
version : '5.5.3',
media_queries : {
'small' : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'small-only' : S('.foundation-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'medium' : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'medium-only' : S('.foundation-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'large' : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'large-only' : S('.foundation-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'xlarge' : S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'xlarge-only' : S('.foundation-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
'xxlarge' : S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
'small' : new MediaQuery('.foundation-mq-small'),
'small-only' : new MediaQuery('.foundation-mq-small-only'),
'medium' : new MediaQuery('.foundation-mq-medium'),
'medium-only' : new MediaQuery('.foundation-mq-medium-only'),
'large' : new MediaQuery('.foundation-mq-large'),
'large-only' : new MediaQuery('.foundation-mq-large-only'),
'xlarge' : new MediaQuery('.foundation-mq-xlarge'),
'xlarge-only' : new MediaQuery('.foundation-mq-xlarge-only'),
'xxlarge' : new MediaQuery('.foundation-mq-xxlarge')
},
stylesheet : $('<style></style>').appendTo('head')[0].sheet,

View File

@ -4,7 +4,7 @@
Foundation.libs['magellan-expedition'] = {
name : 'magellan-expedition',
version : '5.5.2',
version : '5.5.3',
settings : {
active_class : 'active',
@ -59,10 +59,9 @@
'scrollTop' : scroll_top
}, settings.duration, settings.easing, function () {
if (history.pushState) {
history.pushState(null, null, anchor.pathname + '#' + hash);
}
else {
location.hash = anchor.pathname + '#' + hash;
history.pushState(null, null, anchor.pathname + anchor.search + '#' + hash);
} else {
location.hash = anchor.pathname + anchor.search + '#' + hash;
}
});
}

View File

@ -4,7 +4,7 @@
Foundation.libs.offcanvas = {
name : 'offcanvas',
version : '5.5.2',
version : '5.5.3',
settings : {
open_method : 'move',
@ -20,16 +20,22 @@
S = self.S,
move_class = '',
right_postfix = '',
left_postfix = '';
left_postfix = '',
top_postfix = '',
bottom_postfix = '';
if (this.settings.open_method === 'move') {
move_class = 'move-';
right_postfix = 'right';
left_postfix = 'left';
top_postfix = 'top';
bottom_postfix = 'bottom';
} else if (this.settings.open_method === 'overlap_single') {
move_class = 'offcanvas-overlap-';
right_postfix = 'right';
left_postfix = 'left';
top_postfix = 'top';
bottom_postfix = 'bottom';
} else if (this.settings.open_method === 'overlap') {
move_class = 'offcanvas-overlap';
}
@ -58,6 +64,7 @@
}
$('.left-off-canvas-toggle').attr('aria-expanded', 'true');
})
//end of left canvas
.on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
self.click_toggle_class(e, move_class + left_postfix);
if (self.settings.open_method !== 'overlap') {
@ -81,6 +88,55 @@
}
$('.right-off-canvas-toggle').attr('aria-expanded', 'true');
})
//end of right canvas
.on('click.fndtn.offcanvas', '.top-off-canvas-toggle', function (e) {
self.click_toggle_class(e, move_class + bottom_postfix);
if (self.settings.open_method !== 'overlap') {
S('.top-submenu').removeClass(move_class + bottom_postfix);
}
$('.top-off-canvas-toggle').attr('aria-expanded', 'true');
})
.on('click.fndtn.offcanvas', '.top-off-canvas-menu a', function (e) {
var settings = self.get_settings(e);
var parent = S(this).parent();
if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) {
self.hide.call(self, move_class + bottom_postfix, self.get_wrapper(e));
parent.parent().removeClass(move_class + bottom_postfix);
} else if (S(this).parent().hasClass('has-submenu')) {
e.preventDefault();
S(this).siblings('.top-submenu').toggleClass(move_class + bottom_postfix);
} else if (parent.hasClass('back')) {
e.preventDefault();
parent.parent().removeClass(move_class + bottom_postfix);
}
$('.top-off-canvas-toggle').attr('aria-expanded', 'true');
})
//end of top canvas
.on('click.fndtn.offcanvas', '.bottom-off-canvas-toggle', function (e) {
self.click_toggle_class(e, move_class + top_postfix);
if (self.settings.open_method !== 'overlap') {
S('.bottom-submenu').removeClass(move_class + top_postfix);
}
$('.bottom-off-canvas-toggle').attr('aria-expanded', 'true');
})
.on('click.fndtn.offcanvas', '.bottom-off-canvas-menu a', function (e) {
var settings = self.get_settings(e);
var parent = S(this).parent();
if (settings.close_on_click && !parent.hasClass('has-submenu') && !parent.hasClass('back')) {
self.hide.call(self, move_class + top_postfix, self.get_wrapper(e));
parent.parent().removeClass(move_class + top_postfix);
} else if (S(this).parent().hasClass('has-submenu')) {
e.preventDefault();
S(this).siblings('.bottom-submenu').toggleClass(move_class + top_postfix);
} else if (parent.hasClass('back')) {
e.preventDefault();
parent.parent().removeClass(move_class + top_postfix);
}
$('.bottom-off-canvas-toggle').attr('aria-expanded', 'true');
})
//end of bottom
.on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
self.click_remove_class(e, move_class + left_postfix);
S('.right-submenu').removeClass(move_class + left_postfix);
@ -97,6 +153,23 @@
self.click_remove_class(e, move_class + right_postfix);
$('.right-off-canvas-toggle').attr('aria-expanded', 'false');
}
})
.on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
self.click_remove_class(e, move_class + top_postfix);
S('.bottom-submenu').removeClass(move_class + top_postfix);
if (bottom_postfix) {
self.click_remove_class(e, move_class + bottom_postfix);
S('.top-submenu').removeClass(move_class + top_postfix);
}
$('.bottom-off-canvas-toggle').attr('aria-expanded', 'true');
})
.on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
self.click_remove_class(e, move_class + top_postfix);
$('.top-off-canvas-toggle').attr('aria-expanded', 'false');
if (bottom_postfix) {
self.click_remove_class(e, move_class + bottom_postfix);
$('.bottom-off-canvas-toggle').attr('aria-expanded', 'false');
}
});
},

View File

@ -407,7 +407,7 @@
Foundation.libs.orbit = {
name : 'orbit',
version : '5.5.2',
version : '5.5.3',
settings : {
animation : 'slide',

View File

@ -1,10 +1,12 @@
;(function ($, window, document, undefined) {
'use strict';
var openModals = [];
Foundation.libs.reveal = {
name : 'reveal',
version : '5.5.2',
version : '5.5.3',
locked : false,
@ -155,7 +157,7 @@
settings = settings || this.settings;
if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
if (modal.hasClass('open') && target !== undefined && target.attr('data-reveal-id') == modal.attr('id')) {
return self.close(modal);
}
@ -188,16 +190,25 @@
};
}
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
if (open_modal.length > 0) {
if (settings.multiple_opened) {
var openModal = function() {
if(open_modal.length > 0) {
if(settings.multiple_opened) {
self.to_back(open_modal);
} else {
self.hide(open_modal, settings.css.close);
}
}
this.show(modal, settings.css.open);
// bl: add the open_modal that isn't already in the background to the openModals array
if(settings.multiple_opened) {
openModals.push(modal);
}
self.show(modal, settings.css.open);
};
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
openModal();
} else {
var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
$.extend(ajax_settings, {
@ -218,14 +229,7 @@
self.S(modal).foundation('section', 'reflow');
self.S(modal).children().foundation();
if (open_modal.length > 0) {
if (settings.multiple_opened) {
self.to_back(open_modal);
} else {
self.hide(open_modal, settings.css.close);
}
}
self.show(modal, settings.css.open);
openModal();
}
});
@ -263,8 +267,27 @@
}
if (settings.multiple_opened) {
var isCurrent = modal.is(':not(.toback)');
self.hide(modal, settings.css.close, settings);
self.to_front($($.makeArray(open_modals).reverse()[1]));
if(isCurrent) {
// remove the last modal since it is now closed
openModals.pop();
} else {
// if this isn't the current modal, then find it in the array and remove it
openModals = $.grep(openModals, function(elt) {
var isThis = elt[0]===modal[0];
if(isThis) {
// since it's not currently in the front, put it in the front now that it is hidden
// so that if it's re-opened, it won't be .toback
self.to_front(modal);
}
return !isThis;
});
}
// finally, show the next modal in the stack, if there is one
if(openModals.length>0) {
self.to_front(openModals[openModals.length - 1]);
}
} else {
self.hide(open_modals, settings.css.close, settings);
}
@ -337,8 +360,9 @@
}, settings.animation_speed / 2);
}
if (animData.fade) {
css.top = $(window).scrollTop() + el.data('css-top') + 'px';
if (animData.fade) {
var end_css = {opacity: 1};
return setTimeout(function () {

View File

@ -4,13 +4,13 @@
Foundation.libs.slider = {
name : 'slider',
version : '5.5.2',
version : '5.5.3',
settings : {
start : 0,
end : 100,
step : 1,
precision : null,
precision : 2,
initial : null,
display_selector : '',
vertical : false,
@ -28,7 +28,6 @@
events : function () {
var self = this;
$(this.scope)
.off('.slider')
.on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
@ -53,6 +52,23 @@
}
})
.on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function (e) {
if(!self.cache.active) {
// if the user has just clicked into the slider without starting to drag the handle
var slider = $(e.target).attr('role') === 'slider' ? $(e.target) : $(e.target).closest('.range-slider').find("[role='slider']");
if (slider.length && (!slider.parent().hasClass('disabled') && !slider.parent().attr('disabled'))) {
self.set_active_slider(slider);
if ($.data(self.cache.active[0], 'settings').vertical) {
var scroll_offset = 0;
if (!e.pageY) {
scroll_offset = window.scrollY;
}
self.calculate_position(self.cache.active, self.get_cursor_position(e, 'y') + scroll_offset);
} else {
self.calculate_position(self.cache.active, self.get_cursor_position(e, 'x'));
}
}
}
self.remove_active_slider();
})
.on('change.fndtn.slider', function (e) {
@ -72,9 +88,8 @@
if (settings.display_selector != '') {
$(settings.display_selector).each(function(){
if (this.hasOwnProperty('value')) {
$(this).change(function(){
// is there a better way to do this?
if ($(this).attr('value')) {
$(this).off('change').on('change', function () {
slider.foundation("slider", "set_value", $(this).val());
});
}

View File

@ -4,7 +4,7 @@
Foundation.libs.tab = {
name : 'tab',
version : '5.5.2',
version : '5.5.3',
settings : {
active_class : 'active',
@ -27,10 +27,6 @@
self.default_tab_hashes.push(this.hash);
});
// store the initial href, which is used to allow correct behaviour of the
// browser back button when deep linking is turned on.
self.entry_location = window.location.href;
this.bindings(method, options);
this.handle_location_hash_change();
},
@ -42,9 +38,14 @@
var usual_tab_behavior = function (e, target) {
var settings = S(target).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
if (!settings.is_hover || Modernizr.touch) {
// if user did not pressed tab key, prevent default action
var keyCode = e.keyCode || e.which;
if (keyCode !== 9) {
e.preventDefault();
e.stopPropagation();
}
self.toggle_active_tab(S(target).parent());
}
};
@ -52,12 +53,10 @@
.off('.tab')
// Key event: focus/tab key
.on('keydown.fndtn.tab', '[' + this.attr_name() + '] > * > a', function(e) {
var el = this;
var keyCode = e.keyCode || e.which;
// if user pressed tab key
if (keyCode == 9) {
e.preventDefault();
// TODO: Change usual_tab_behavior into accessibility function?
if (keyCode === 13 || keyCode === 32) { // enter or space
var el = this;
usual_tab_behavior(e, el);
}
})
@ -181,10 +180,9 @@
go_to_hash = function(hash) {
// This function allows correct behaviour of the browser's back button when deep linking is enabled. Without it
// the user would get continually redirected to the default hash.
var is_entry_location = window.location.href === self.entry_location,
default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : is_entry_location ? window.location.hash :'fndtn-' + self.default_tab_hashes[0].replace('#', '')
var default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : 'fndtn-' + self.default_tab_hashes[0].replace('#', '');
if (!(is_entry_location && hash === default_hash)) {
if (hash !== default_hash || window.location.hash) {
window.location.hash = hash;
}
};
@ -224,8 +222,8 @@
tab.addClass(settings.active_class).triggerHandler('opened');
tab_link.attr({'aria-selected' : 'true', tabindex : 0});
siblings.removeClass(settings.active_class)
siblings.find('a').attr({'aria-selected' : 'false', tabindex : -1});
target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true', tabindex : -1});
siblings.find('a').attr({'aria-selected' : 'false'/*, tabindex : -1*/});
target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true'/*, tabindex : -1*/});
target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
settings.callback(tab);
target.triggerHandler('toggled', [target]);

View File

@ -4,7 +4,7 @@
Foundation.libs.tooltip = {
name : 'tooltip',
version : '5.5.2',
version : '5.5.3',
settings : {
additional_inheritable_classes : [],
@ -13,6 +13,8 @@
touch_close_text : 'Tap To Close',
disable_for_touch : false,
hover_delay : 200,
fade_in_duration : 150,
fade_out_duration : 150,
show_on : 'all',
tip_template : function (selector, content) {
return '<span data-selector="' + selector + '" id="' + selector + '" class="'
@ -208,14 +210,14 @@
},
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
var width, nub, nubHeight, nubWidth, objPos;
tip.css('visibility', 'hidden').show();
width = target.data('width');
nub = tip.children('.nub');
nubHeight = nub.outerHeight();
nubWidth = nub.outerHeight();
nubWidth = nub.outerWidth();
if (this.small()) {
tip.css({'width' : '100%'});
@ -232,38 +234,45 @@
}).end();
};
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
var o_top = target.offset().top;
var o_left = target.offset().left;
var outerHeight = target.outerHeight();
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
if (this.small()) {
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', 12.5, $(this.scope).width());
tip.addClass('tip-override');
objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
objPos(nub, -nubHeight, 'auto', 'auto', o_left);
} else {
var left = target.offset().left;
if (Foundation.rtl) {
nub.addClass('rtl');
left = target.offset().left + target.outerWidth() - tip.outerWidth();
o_left = o_left + target.outerWidth() - tip.outerWidth();
}
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
// reset nub from small styles, if they've been applied
if (nub.attr('style')) {
nub.removeAttr('style');
}
tip.removeClass('tip-override');
var tip_outerHeight = tip.outerHeight();
if (classes && classes.indexOf('tip-top') > -1) {
if (Foundation.rtl) {
nub.addClass('rtl');
}
objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
objPos(tip, (o_top - tip_outerHeight), 'auto', 'auto', o_left)
.removeClass('tip-override');
} else if (classes && classes.indexOf('tip-left') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left - tip.outerWidth() - nubHeight))
.removeClass('tip-override');
nub.removeClass('rtl');
} else if (classes && classes.indexOf('tip-right') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left + target.outerWidth() + nubHeight))
.removeClass('tip-override');
nub.removeClass('rtl');
}
@ -307,19 +316,19 @@
show : function ($target) {
var $tip = this.getTip($target);
if ($target.data('tooltip-open-event-type') == 'touch') {
this.convert_to_touch($target);
}
this.reposition($target, $tip, $target.attr('class'));
$target.addClass('open');
$tip.fadeIn(150);
$tip.fadeIn(this.settings.fade_in_duration);
},
hide : function ($target) {
var $tip = this.getTip($target);
$tip.fadeOut(150, function () {
$tip.fadeOut(this.settings.fade_out_duration, function () {
$tip.find('.tap-to-close').remove();
$tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
$target.removeClass('open');

View File

@ -4,7 +4,7 @@
Foundation.libs.topbar = {
name : 'topbar',
version : '5.5.2',
version : '5.5.3',
settings : {
index : 0,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long