Commit c51f0150 authored by Maneesha Fernando's avatar Maneesha Fernando Committed by GitHub

Delete js directory

parent 8f1feacb
This diff is collapsed.
This diff is collapsed.
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.accordion = {
name : 'accordion',
version : '5.3.3',
settings : {
active_class: 'active',
multi_expand: false,
toggleable: true,
callback : function () {}
},
init : function (scope, method, options) {
this.bindings(method, options);
},
events : function () {
var self = this;
var S = this.S;
S(this.scope)
.off('.fndtn.accordion')
.on('click.fndtn.accordion', '[' + this.attr_name() + '] > dd > a', function (e) {
var accordion = S(this).closest('[' + self.attr_name() + ']'),
groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()),
settings = accordion.data(self.attr_name(true) + '-init'),
target = S('#' + this.href.split('#')[1]),
aunts = $('> dd', accordion),
siblings = aunts.children('.content'),
active_content = siblings.filter('.' + settings.active_class);
e.preventDefault();
if (accordion.attr(self.attr_name())) {
siblings = siblings.add('[' + groupSelector + '] dd > .content');
aunts = aunts.add('[' + groupSelector + '] dd');
}
if (settings.toggleable && target.is(active_content)) {
target.parent('dd').toggleClass(settings.active_class, false);
target.toggleClass(settings.active_class, false);
settings.callback(target);
target.triggerHandler('toggled', [accordion]);
accordion.triggerHandler('toggled', [target]);
return;
}
if (!settings.multi_expand) {
siblings.removeClass(settings.active_class);
aunts.removeClass(settings.active_class);
}
target.addClass(settings.active_class).parent().addClass(settings.active_class);
settings.callback(target);
target.triggerHandler('toggled', [accordion]);
accordion.triggerHandler('toggled', [target]);
});
},
off : function () {},
reflow : function () {}
};
}(jQuery, window, window.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.alert = {
name : 'alert',
version : '5.3.3',
settings : {
callback: function (){}
},
init : function (scope, method, options) {
this.bindings(method, options);
},
events : function () {
var self = this,
S = this.S;
$(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] a.close', function (e) {
var alertBox = S(this).closest('[' + self.attr_name() + ']'),
settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
e.preventDefault();
if (Modernizr.csstransitions) {
alertBox.addClass("alert-close");
alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function(e) {
S(this).trigger('close').trigger('close.fndtn.alert').remove();
settings.callback();
});
} else {
alertBox.fadeOut(300, function () {
S(this).trigger('close').trigger('close.fndtn.alert').remove();
settings.callback();
});
}
});
},
reflow : function () {}
};
}(jQuery, window, window.document));
This diff is collapsed.
This diff is collapsed.
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.equalizer = {
name : 'equalizer',
version : '5.3.3',
settings : {
use_tallest: true,
before_height_change: $.noop,
after_height_change: $.noop,
equalize_on_stack: false
},
init : function (scope, method, options) {
Foundation.inherit(this, 'image_loaded');
this.bindings(method, options);
this.reflow();
},
events : function () {
this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
this.reflow();
}.bind(this));
},
equalize: function(equalizer) {
var isStacked = false,
vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
settings = equalizer.data(this.attr_name(true)+'-init');
if (vals.length === 0) return;
var firstTopOffset = vals.first().offset().top;
settings.before_height_change();
equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
vals.height('inherit');
vals.each(function(){
var el = $(this);
if (el.offset().top !== firstTopOffset) {
isStacked = true;
}
});
if (settings.equalize_on_stack === false) {
if (isStacked) return;
};
var heights = vals.map(function(){ return $(this).outerHeight(false) }).get();
if (settings.use_tallest) {
var max = Math.max.apply(null, heights);
vals.css('height', max);
} else {
var min = Math.min.apply(null, heights);
vals.css('height', min);
}
settings.after_height_change();
equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
},
reflow : function () {
var self = this;
this.S('[' + this.attr_name() + ']', this.scope).each(function(){
var $eq_target = $(this);
self.image_loaded(self.S('img', this), function(){
self.equalize($eq_target)
});
});
}
};
})(jQuery, window, window.document);
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.interchange = {
name : 'interchange',
version : '5.3.3',
cache : {},
images_loaded : false,
nodes_loaded : false,
settings : {
load_attr : 'interchange',
named_queries : {
'default' : 'only screen',
small : Foundation.media_queries.small,
medium : Foundation.media_queries.medium,
large : Foundation.media_queries.large,
xlarge : Foundation.media_queries.xlarge,
xxlarge: Foundation.media_queries.xxlarge,
landscape : 'only screen and (orientation: landscape)',
portrait : 'only screen and (orientation: portrait)',
retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
'only screen and (min--moz-device-pixel-ratio: 2),' +
'only screen and (-o-min-device-pixel-ratio: 2/1),' +
'only screen and (min-device-pixel-ratio: 2),' +
'only screen and (min-resolution: 192dpi),' +
'only screen and (min-resolution: 2dppx)'
},
directives : {
replace: function (el, path, trigger) {
// The trigger argument, if called within the directive, fires
// an event named after the directive on the element, passing
// any parameters along to the event that you pass to trigger.
//
// ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
//
// This allows you to bind a callback like so:
// $('#interchangeContainer').on('replace', function (e, a, b, c) {
// console.log($(this).html(), a, b, c);
// });
if (/IMG/.test(el[0].nodeName)) {
var orig_path = el[0].src;
if (new RegExp(path, 'i').test(orig_path)) return;
el[0].src = path;
return trigger(el[0].src);
}
var last_path = el.data(this.data_attr + '-last-path'),
self = this;
if (last_path == path) return;
if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
$(el).css('background-image', 'url('+path+')');
el.data('interchange-last-path', path);
return trigger(path);
}
return $.get(path, function (response) {
el.html(response);
el.data(self.data_attr + '-last-path', path);
trigger();
});
}
}
},
init : function (scope, method, options) {
Foundation.inherit(this, 'throttle random_str');
this.data_attr = this.set_data_attr();
$.extend(true, this.settings, method, options);
this.bindings(method, options);
this.load('images');
this.load('nodes');
},
get_media_hash : function() {
var mediaHash='';
for (var queryName in this.settings.named_queries ) {
mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
}
return mediaHash;
},
events : function () {
var self = this, prevMediaHash;
$(window)
.off('.interchange')
.on('resize.fndtn.interchange', self.throttle(function () {
var currMediaHash = self.get_media_hash();
if (currMediaHash !== prevMediaHash) {
self.resize();
}
prevMediaHash = currMediaHash;
}, 50));
return this;
},
resize : function () {
var cache = this.cache;
if(!this.images_loaded || !this.nodes_loaded) {
setTimeout($.proxy(this.resize, this), 50);
return;
}
for (var uuid in cache) {
if (cache.hasOwnProperty(uuid)) {
var passed = this.results(uuid, cache[uuid]);
if (passed) {
this.settings.directives[passed
.scenario[1]].call(this, passed.el, passed.scenario[0], function () {
if (arguments[0] instanceof Array) {
var args = arguments[0];
} else {
var args = Array.prototype.slice.call(arguments, 0);
}
passed.el.trigger(passed.scenario[1], args);
});
}
}
}
},
results : function (uuid, scenarios) {
var count = scenarios.length;
if (count > 0) {
var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
while (count--) {
var mq, rule = scenarios[count][2];
if (this.settings.named_queries.hasOwnProperty(rule)) {
mq = matchMedia(this.settings.named_queries[rule]);
} else {
mq = matchMedia(rule);
}
if (mq.matches) {
return {el: el, scenario: scenarios[count]};
}
}
}
return false;
},
load : function (type, force_update) {
if (typeof this['cached_' + type] === 'undefined' || force_update) {
this['update_' + type]();
}
return this['cached_' + type];
},
update_images : function () {
var images = this.S('img[' + this.data_attr + ']'),
count = images.length,
i = count,
loaded_count = 0,
data_attr = this.data_attr;
this.cache = {};
this.cached_images = [];
this.images_loaded = (count === 0);
while (i--) {
loaded_count++;
if (images[i]) {
var str = images[i].getAttribute(data_attr) || '';
if (str.length > 0) {
this.cached_images.push(images[i]);
}
}
if (loaded_count === count) {
this.images_loaded = true;
this.enhance('images');
}
}
return this;
},
update_nodes : function () {
var nodes = this.S('[' + this.data_attr + ']').not('img'),
count = nodes.length,
i = count,
loaded_count = 0,
data_attr = this.data_attr;
this.cached_nodes = [];
this.nodes_loaded = (count === 0);
while (i--) {
loaded_count++;
var str = nodes[i].getAttribute(data_attr) || '';
if (str.length > 0) {
this.cached_nodes.push(nodes[i]);
}
if(loaded_count === count) {
this.nodes_loaded = true;
this.enhance('nodes');
}
}
return this;
},
enhance : function (type) {
var i = this['cached_' + type].length;
while (i--) {
this.object($(this['cached_' + type][i]));
}
return $(window).trigger('resize').trigger('resize.fndtn.interchange');
},
convert_directive : function (directive) {
var trimmed = this.trim(directive);
if (trimmed.length > 0) {
return trimmed;
}
return 'replace';
},
parse_scenario : function (scenario) {
// This logic had to be made more complex since some users were using commas in the url path
// So we cannot simply just split on a comma
var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
media_query = scenario[1];
if (directive_match) {
var path = directive_match[1],
directive = directive_match[2];
}
else {
var cached_split = scenario[0].split(/,\s*$/),
path = cached_split[0],
directive = '';
}
return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
},
object : function(el) {
var raw_arr = this.parse_data_attr(el),
scenarios = [],
i = raw_arr.length;
if (i > 0) {
while (i--) {
var split = raw_arr[i].split(/\((.*?)(\))$/);
if (split.length > 1) {
var params = this.parse_scenario(split);
scenarios.push(params);
}
}
}
return this.store(el, scenarios);
},
store : function (el, scenarios) {
var uuid = this.random_str(),
current_uuid = el.data(this.add_namespace('uuid', true));
if (this.cache[current_uuid]) return this.cache[current_uuid];
el.attr(this.add_namespace('data-uuid'), uuid);
return this.cache[uuid] = scenarios;
},
trim : function(str) {
if (typeof str === 'string') {
return $.trim(str);
}
return str;
},
set_data_attr: function (init) {
if (init) {
if (this.namespace.length > 0) {
return this.namespace + '-' + this.settings.load_attr;
}
return this.settings.load_attr;
}
if (this.namespace.length > 0) {
return 'data-' + this.namespace + '-' + this.settings.load_attr;
}
return 'data-' + this.settings.load_attr;
},
parse_data_attr : function (el) {
var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
i = raw.length,
output = [];
while (i--) {
if (raw[i].replace(/[\W\d]+/, '').length > 4) {
output.push(raw[i]);
}
}
return output;
},
reflow : function () {
this.load('images', true);
this.load('nodes', true);
}
};
}(jQuery, window, window.document));
This diff is collapsed.
This diff is collapsed.
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs['magellan-expedition'] = {
name : 'magellan-expedition',
version : '5.3.3',
settings : {
active_class: 'active',
threshold: 0, // pixels from the top of the expedition for it to become fixes
destination_threshold: 20, // pixels from the top of destination for it to be considered active
throttle_delay: 30, // calculation throttling to increase framerate
fixed_top: 0 // top distance in pixels assigend to the fixed element on scroll
},
init : function (scope, method, options) {
Foundation.inherit(this, 'throttle');
this.bindings(method, options);
},
events : function () {
var self = this,
S = self.S,
settings = self.settings;
// initialize expedition offset
self.set_expedition_position();
S(self.scope)
.off('.magellan')
.on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
e.preventDefault();
var expedition = $(this).closest('[' + self.attr_name() + ']'),
settings = expedition.data('magellan-expedition-init'),
hash = this.hash.split('#').join(''),
target = $("a[name='"+hash+"']");
if (target.length === 0) {
target = $('#'+hash);
}
// Account for expedition height if fixed position
var scroll_top = target.offset().top - settings.destination_threshold + 1;
scroll_top = scroll_top - expedition.outerHeight();
$('html, body').stop().animate({
'scrollTop': scroll_top
}, 700, 'swing', function () {
if(history.pushState) {
history.pushState(null, null, '#'+hash);
}
else {
location.hash = '#'+hash;
}
});
})
.on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay));
$(window)
.on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
},
check_for_arrivals : function() {
var self = this;
self.update_arrivals();
self.update_expedition_positions();
},
set_expedition_position : function() {
var self = this;
$('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
var expedition = $(this),
settings = expedition.data('magellan-expedition-init'),
styles = expedition.attr('styles'), // save styles
top_offset, fixed_top;
expedition.attr('style', '');
top_offset = expedition.offset().top + settings.threshold;
//set fixed-top by attribute
fixed_top = parseInt(expedition.data('magellan-fixed-top'));
if(!isNaN(fixed_top))
self.settings.fixed_top = fixed_top;
expedition.data(self.data_attr('magellan-top-offset'), top_offset);
expedition.attr('style', styles);
});
},
update_expedition_positions : function() {
var self = this,
window_top_offset = $(window).scrollTop();
$('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
var expedition = $(this),
settings = expedition.data('magellan-expedition-init'),
styles = expedition.attr('style'), // save styles
top_offset = expedition.data('magellan-top-offset');
//scroll to the top distance
if (window_top_offset+self.settings.fixed_top >= top_offset) {
// Placeholder allows height calculations to be consistent even when
// appearing to switch between fixed/non-fixed placement
var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
if (placeholder.length === 0) {
placeholder = expedition.clone();
placeholder.removeAttr(self.attr_name());
placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
expedition.before(placeholder);
}
expedition.css({position:'fixed', top: settings.fixed_top}).addClass('fixed');
} else {
expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
expedition.attr('style',styles).css('position','').css('top','').removeClass('fixed');
}
});
},
update_arrivals : function() {
var self = this,
window_top_offset = $(window).scrollTop();
$('[' + this.attr_name() + ']', self.scope).each(function() {
var expedition = $(this),
settings = expedition.data(self.attr_name(true) + '-init'),
offsets = self.offsets(expedition, window_top_offset),
arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
active_item = false;
offsets.each(function(idx, item) {
if (item.viewport_offset >= item.top_offset) {
var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
arrivals.not(item.arrival).removeClass(settings.active_class);
item.arrival.addClass(settings.active_class);
active_item = true;
return true;
}
});
if (!active_item) arrivals.removeClass(settings.active_class);
});
},
offsets : function(expedition, window_offset) {
var self = this,
settings = expedition.data(self.attr_name(true) + '-init'),
viewport_offset = window_offset;
return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
var name = $(this).data(self.data_attr('magellan-arrival')),
dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
if (dest.length > 0) {
var top_offset = Math.floor(dest.offset().top - settings.destination_threshold - expedition.outerHeight());
return {
destination : dest,
arrival : $(this),
top_offset : top_offset,
viewport_offset : viewport_offset
}
}
}).sort(function(a, b) {
if (a.top_offset < b.top_offset) return -1;
if (a.top_offset > b.top_offset) return 1;
return 0;
});
},
data_attr: function (str) {
if (this.namespace.length > 0) {
return this.namespace + '-' + str;
}
return str;
},
off : function () {
this.S(this.scope).off('.magellan');
this.S(window).off('.magellan');
},
reflow : function () {
var self = this;
// remove placeholder expeditions used for height calculation purposes
$('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
}
};
}(jQuery, window, window.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.offcanvas = {
name : 'offcanvas',
version : '5.3.3',
settings : {
open_method: 'move',
close_on_click: false
},
init : function (scope, method, options) {
this.bindings(method, options);
},
events : function () {
var self = this,
S = self.S,
move_class = '',
right_postfix = '',
left_postfix = '';
if (this.settings.open_method === 'move') {
move_class = 'move-';
right_postfix = 'right';
left_postfix = 'left';
} else if (this.settings.open_method === 'overlap_single') {
move_class = 'offcanvas-overlap-';
right_postfix = 'right';
left_postfix = 'left';
} else if (this.settings.open_method === 'overlap') {
move_class = 'offcanvas-overlap';
}
S(this.scope).off('.offcanvas')
.on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
self.click_toggle_class(e, move_class + right_postfix);
if (self.settings.open_method !== 'overlap'){
S(".left-submenu").removeClass(move_class + right_postfix);
}
})
.on('click.fndtn.offcanvas', '.left-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 + right_postfix, self.get_wrapper(e));
parent.parent().removeClass(move_class + right_postfix);
}else if(S(this).parent().hasClass("has-submenu")){
e.preventDefault();
S(this).siblings(".left-submenu").toggleClass(move_class + right_postfix);
}else if(parent.hasClass("back")){
e.preventDefault();
parent.parent().removeClass(move_class + right_postfix);
}
})
.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'){
S(".right-submenu").removeClass(move_class + left_postfix);
}
})
.on('click.fndtn.offcanvas', '.right-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 + left_postfix, self.get_wrapper(e));
parent.parent().removeClass(move_class + left_postfix);
}else if(S(this).parent().hasClass("has-submenu")){
e.preventDefault();
S(this).siblings(".right-submenu").toggleClass(move_class + left_postfix);
}else if(parent.hasClass("back")){
e.preventDefault();
parent.parent().removeClass(move_class + left_postfix);
}
})
.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);
if (right_postfix){
self.click_remove_class(e, move_class + right_postfix);
S(".left-submenu").removeClass(move_class + left_postfix);
}
});
},
toggle: function(class_name, $off_canvas) {
$off_canvas = $off_canvas || this.get_wrapper();
if ($off_canvas.is('.' + class_name)) {
this.hide(class_name, $off_canvas);
} else {
this.show(class_name, $off_canvas);
}
},
show: function(class_name, $off_canvas) {
$off_canvas = $off_canvas || this.get_wrapper();
$off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
$off_canvas.addClass(class_name);
},
hide: function(class_name, $off_canvas) {
$off_canvas = $off_canvas || this.get_wrapper();
$off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
$off_canvas.removeClass(class_name);
},
click_toggle_class: function(e, class_name) {
e.preventDefault();
var $off_canvas = this.get_wrapper(e);
this.toggle(class_name, $off_canvas);
},
click_remove_class: function(e, class_name) {
e.preventDefault();
var $off_canvas = this.get_wrapper(e);
this.hide(class_name, $off_canvas);
},
get_settings: function(e) {
var offcanvas = this.S(e.target).closest('[' + this.attr_name() + ']');
return offcanvas.data(this.attr_name(true) + '-init') || this.settings;
},
get_wrapper: function(e) {
var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap');
if ($off_canvas.length === 0) {
$off_canvas = this.S('.off-canvas-wrap');
}
return $off_canvas;
},
reflow : function () {}
};
}(jQuery, window, window.document));
This diff is collapsed.
This diff is collapsed.
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.slider = {
name : 'slider',
version : '5.3.3',
settings: {
start: 0,
end: 100,
step: 1,
initial: null,
display_selector: '',
vertical: false,
on_change: function(){}
},
cache : {},
init : function (scope, method, options) {
Foundation.inherit(this,'throttle');
this.bindings(method, options);
this.reflow();
},
events : function() {
var self = this;
$(this.scope)
.off('.slider')
.on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
'[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) {
if (!self.cache.active) {
e.preventDefault();
self.set_active_slider($(e.target));
}
})
.on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) {
if (!!self.cache.active) {
e.preventDefault();
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, (e.pageY ||
e.originalEvent.clientY ||
e.originalEvent.touches[0].clientY ||
e.currentPoint.y)
+ scroll_offset);
} else {
self.calculate_position(self.cache.active, e.pageX ||
e.originalEvent.clientX ||
e.originalEvent.touches[0].clientX ||
e.currentPoint.x);
}
}
})
.on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
self.remove_active_slider();
})
.on('change.fndtn.slider', function(e) {
self.settings.on_change();
});
self.S(window)
.on('resize.fndtn.slider', self.throttle(function(e) {
self.reflow();
}, 300));
},
set_active_slider : function($handle) {
this.cache.active = $handle;
},
remove_active_slider : function() {
this.cache.active = null;
},
calculate_position : function($handle, cursor_x) {
var self = this,
settings = $.data($handle[0], 'settings'),
handle_l = $.data($handle[0], 'handle_l'),
handle_o = $.data($handle[0], 'handle_o'),
bar_l = $.data($handle[0], 'bar_l'),
bar_o = $.data($handle[0], 'bar_o');
requestAnimationFrame(function(){
var pct;
if (Foundation.rtl && !settings.vertical) {
pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1);
} else {
pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1);
}
pct = settings.vertical ? 1-pct : pct;
var norm = self.normalized_value(pct, settings.start, settings.end, settings.step);
self.set_ui($handle, norm);
});
},
set_ui : function($handle, value) {
var settings = $.data($handle[0], 'settings'),
handle_l = $.data($handle[0], 'handle_l'),
bar_l = $.data($handle[0], 'bar_l'),
norm_pct = this.normalized_percentage(value, settings.start, settings.end),
handle_offset = norm_pct*(bar_l-handle_l)-1,
progress_bar_length = norm_pct*100;
if (Foundation.rtl && !settings.vertical) {
handle_offset = -handle_offset;
}
handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
this.set_translate($handle, handle_offset, settings.vertical);
if (settings.vertical) {
$handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
} else {
$handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
}
$handle.parent().attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
$handle.parent().children('input[type=hidden]').val(value);
if (settings.input_id != '') {
$(settings.display_selector).each(function(){
if (this.hasOwnProperty('value')) {
$(this).val(value);
} else {
$(this).text(value);
}
});
}
},
normalized_percentage : function(val, start, end) {
return Math.min(1, (val - start)/(end - start));
},
normalized_value : function(val, start, end, step) {
var range = end - start,
point = val*range,
mod = (point-(point%step)) / step,
rem = point % step,
round = ( rem >= step*0.5 ? step : 0);
return (mod*step + round) + start;
},
set_translate : function(ele, offset, vertical) {
if (vertical) {
$(ele)
.css('-webkit-transform', 'translateY('+offset+'px)')
.css('-moz-transform', 'translateY('+offset+'px)')
.css('-ms-transform', 'translateY('+offset+'px)')
.css('-o-transform', 'translateY('+offset+'px)')
.css('transform', 'translateY('+offset+'px)');
} else {
$(ele)
.css('-webkit-transform', 'translateX('+offset+'px)')
.css('-moz-transform', 'translateX('+offset+'px)')
.css('-ms-transform', 'translateX('+offset+'px)')
.css('-o-transform', 'translateX('+offset+'px)')
.css('transform', 'translateX('+offset+'px)');
}
},
limit_to : function(val, min, max) {
return Math.min(Math.max(val, min), max);
},
initialize_settings : function(handle) {
var settings = $.extend({}, this.settings, this.data_options($(handle).parent()));
if (settings.vertical) {
$.data(handle, 'bar_o', $(handle).parent().offset().top);
$.data(handle, 'bar_l', $(handle).parent().outerHeight());
$.data(handle, 'handle_o', $(handle).offset().top);
$.data(handle, 'handle_l', $(handle).outerHeight());
} else {
$.data(handle, 'bar_o', $(handle).parent().offset().left);
$.data(handle, 'bar_l', $(handle).parent().outerWidth());
$.data(handle, 'handle_o', $(handle).offset().left);
$.data(handle, 'handle_l', $(handle).outerWidth());
}
$.data(handle, 'bar', $(handle).parent());
$.data(handle, 'settings', settings);
},
set_initial_position : function($ele) {
var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
initial = (!!settings.initial ? settings.initial : Math.floor((settings.end-settings.start)*0.5/settings.step)*settings.step+settings.start),
$handle = $ele.children('.range-slider-handle');
this.set_ui($handle, initial);
},
set_value : function(value) {
var self = this;
$('[' + self.attr_name() + ']', this.scope).each(function(){
$(this).attr(self.attr_name(), value);
});
if (!!$(this.scope).attr(self.attr_name())) {
$(this.scope).attr(self.attr_name(), value);
}
self.reflow();
},
reflow : function() {
var self = this;
self.S('[' + this.attr_name() + ']').each(function() {
var handle = $(this).children('.range-slider-handle')[0],
val = $(this).attr(self.attr_name());
self.initialize_settings(handle);
if (val) {
self.set_ui($(handle), parseFloat(val));
} else {
self.set_initial_position($(this));
}
});
}
};
}(jQuery, window, window.document));
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.tab = {
name : 'tab',
version : '5.3.3',
settings : {
active_class: 'active',
callback : function () {},
deep_linking: false,
scroll_to_content: true,
is_hover: false
},
default_tab_hashes: [],
init : function (scope, method, options) {
var self = this,
S = this.S;
this.bindings(method, options);
this.handle_location_hash_change();
// Store the default active tabs which will be referenced when the
// location hash is absent, as in the case of navigating the tabs and
// returning to the first viewing via the browser Back button.
S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
self.default_tab_hashes.push(this.hash);
});
},
events : function () {
var self = this,
S = this.S;
S(this.scope)
.off('.tab')
// Click event: tab title
.on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
if (!settings.is_hover || Modernizr.touch) {
e.preventDefault();
e.stopPropagation();
self.toggle_active_tab(S(this).parent());
}
})
// Hover event: tab title
.on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
if (settings.is_hover) self.toggle_active_tab(S(this).parent());
});
// Location hash change event
S(window).on('hashchange.fndtn.tab', function (e) {
e.preventDefault();
self.handle_location_hash_change();
});
},
handle_location_hash_change : function () {
var self = this,
S = this.S;
S('[' + this.attr_name() + ']', this.scope).each(function () {
var settings = S(this).data(self.attr_name(true) + '-init');
if (settings.deep_linking) {
// Match the location hash to a label
var hash = self.scope.location.hash;
if (hash != '') {
// Check whether the location hash references a tab content div or
// another element on the page (inside or outside the tab content div)
var hash_element = S(hash);
if (hash_element.hasClass('content') && hash_element.parent().hasClass('tab-content')) {
// Tab content div
self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
} else {
// Not the tab content div. If inside the tab content, find the
// containing tab and toggle it as active.
var hash_tab_container_id = hash_element.closest('.content').attr('id');
if (hash_tab_container_id != undefined) {
self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
}
}
} else {
// Reference the default tab hashes which were initialized in the init function
for (var ind in self.default_tab_hashes) {
self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
}
}
}
});
},
toggle_active_tab: function (tab, location_hash) {
var S = this.S,
tabs = tab.closest('[' + this.attr_name() + ']'),
anchor = tab.children('a').first(),
target_hash = '#' + anchor.attr('href').split('#')[1],
target = S(target_hash),
siblings = tab.siblings(),
settings = tabs.data(this.attr_name(true) + '-init');
// allow usage of data-tab-content attribute instead of href
if (S(this).data(this.data_attr('tab-content'))) {
target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
target = S(target_hash);
}
if (settings.deep_linking) {
// Get the scroll Y position prior to moving to the hash ID
var cur_ypos = $('body,html').scrollTop();
// Update the location hash to preserve browser history
// Note that the hash does not need to correspond to the
// tab content ID anchor; it can be an ID inside or outside of the tab
// content div.
if (location_hash != undefined) {
window.location.hash = location_hash;
} else {
window.location.hash = target_hash;
}
if (settings.scroll_to_content) {
// If the user is requesting the content of a tab, then scroll to the
// top of the title area; otherwise, scroll to the element within
// the content area as defined by the hash value.
if (location_hash == undefined || location_hash == target_hash) {
tab.parent()[0].scrollIntoView();
} else {
S(target_hash)[0].scrollIntoView();
}
} else {
// Adjust the scrollbar to the Y position prior to setting the hash
// Only do this for the tab content anchor, otherwise there will be
// conflicts with in-tab anchor links nested in the tab-content div
if (location_hash == undefined || location_hash == target_hash) {
$('body,html').scrollTop(cur_ypos);
}
}
}
// WARNING: The activation and deactivation of the tab content must
// occur after the deep linking in order to properly refresh the browser
// window (notably in Chrome).
tab.addClass(settings.active_class).triggerHandler('opened');
siblings.removeClass(settings.active_class);
target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
settings.callback(tab);
target.triggerHandler('toggled', [tab]);
tabs.triggerHandler('toggled', [target]);
},
data_attr: function (str) {
if (this.namespace.length > 0) {
return this.namespace + '-' + str;
}
return str;
},
off : function () {},
reflow : function () {}
};
}(jQuery, window, window.document));
This diff is collapsed.
This diff is collapsed.
/**
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
*
* @version 1.0.3
* @codingstandard ftlabs-jsv2
* @copyright The Financial Times Limited [All Rights Reserved]
* @license MIT License (see LICENSE.txt)
*/
function FastClick(a,b){"use strict";function c(a,b){return function(){return a.apply(b,arguments)}}var d;if(b=b||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=b.touchBoundary||10,this.layer=a,this.tapDelay=b.tapDelay||200,!FastClick.notNeeded(a)){for(var e=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],f=this,g=0,h=e.length;h>g;g++)f[e[g]]=c(f[e[g]],f);deviceIsAndroid&&(a.addEventListener("mouseover",this.onMouse,!0),a.addEventListener("mousedown",this.onMouse,!0),a.addEventListener("mouseup",this.onMouse,!0)),a.addEventListener("click",this.onClick,!0),a.addEventListener("touchstart",this.onTouchStart,!1),a.addEventListener("touchmove",this.onTouchMove,!1),a.addEventListener("touchend",this.onTouchEnd,!1),a.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(a.removeEventListener=function(b,c,d){var e=Node.prototype.removeEventListener;"click"===b?e.call(a,b,c.hijacked||c,d):e.call(a,b,c,d)},a.addEventListener=function(b,c,d){var e=Node.prototype.addEventListener;"click"===b?e.call(a,b,c.hijacked||(c.hijacked=function(a){a.propagationStopped||c(a)}),d):e.call(a,b,c,d)}),"function"==typeof a.onclick&&(d=a.onclick,a.addEventListener("click",function(a){d(a)},!1),a.onclick=null)}}var deviceIsAndroid=navigator.userAgent.indexOf("Android")>0,deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent),deviceIsIOS4=deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),deviceIsIOSWithBadTarget=deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent),deviceIsBlackBerry10=navigator.userAgent.indexOf("BB10")>0;FastClick.prototype.needsClick=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(a.disabled)return!0;break;case"input":if(deviceIsIOS&&"file"===a.type||a.disabled)return!0;break;case"label":case"video":return!0}return/\bneedsclick\b/.test(a.className)},FastClick.prototype.needsFocus=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!deviceIsAndroid;case"input":switch(a.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}},FastClick.prototype.sendClick=function(a,b){"use strict";var c,d;document.activeElement&&document.activeElement!==a&&document.activeElement.blur(),d=b.changedTouches[0],c=document.createEvent("MouseEvents"),c.initMouseEvent(this.determineEventType(a),!0,!0,window,1,d.screenX,d.screenY,d.clientX,d.clientY,!1,!1,!1,!1,0,null),c.forwardedTouchEvent=!0,a.dispatchEvent(c)},FastClick.prototype.determineEventType=function(a){"use strict";return deviceIsAndroid&&"select"===a.tagName.toLowerCase()?"mousedown":"click"},FastClick.prototype.focus=function(a){"use strict";var b;deviceIsIOS&&a.setSelectionRange&&0!==a.type.indexOf("date")&&"time"!==a.type?(b=a.value.length,a.setSelectionRange(b,b)):a.focus()},FastClick.prototype.updateScrollParent=function(a){"use strict";var b,c;if(b=a.fastClickScrollParent,!b||!b.contains(a)){c=a;do{if(c.scrollHeight>c.offsetHeight){b=c,a.fastClickScrollParent=c;break}c=c.parentElement}while(c)}b&&(b.fastClickLastScrollTop=b.scrollTop)},FastClick.prototype.getTargetElementFromEventTarget=function(a){"use strict";return a.nodeType===Node.TEXT_NODE?a.parentNode:a},FastClick.prototype.onTouchStart=function(a){"use strict";var b,c,d;if(a.targetTouches.length>1)return!0;if(b=this.getTargetElementFromEventTarget(a.target),c=a.targetTouches[0],deviceIsIOS){if(d=window.getSelection(),d.rangeCount&&!d.isCollapsed)return!0;if(!deviceIsIOS4){if(c.identifier&&c.identifier===this.lastTouchIdentifier)return a.preventDefault(),!1;this.lastTouchIdentifier=c.identifier,this.updateScrollParent(b)}}return this.trackingClick=!0,this.trackingClickStart=a.timeStamp,this.targetElement=b,this.touchStartX=c.pageX,this.touchStartY=c.pageY,a.timeStamp-this.lastClickTime<this.tapDelay&&a.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(a){"use strict";var b=a.changedTouches[0],c=this.touchBoundary;return Math.abs(b.pageX-this.touchStartX)>c||Math.abs(b.pageY-this.touchStartY)>c?!0:!1},FastClick.prototype.onTouchMove=function(a){"use strict";return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(a.target)||this.touchHasMoved(a))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},FastClick.prototype.findControl=function(a){"use strict";return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(a){"use strict";var b,c,d,e,f,g=this.targetElement;if(!this.trackingClick)return!0;if(a.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(this.cancelNextClick=!1,this.lastClickTime=a.timeStamp,c=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,deviceIsIOSWithBadTarget&&(f=a.changedTouches[0],g=document.elementFromPoint(f.pageX-window.pageXOffset,f.pageY-window.pageYOffset)||g,g.fastClickScrollParent=this.targetElement.fastClickScrollParent),d=g.tagName.toLowerCase(),"label"===d){if(b=this.findControl(g)){if(this.focus(g),deviceIsAndroid)return!1;g=b}}else if(this.needsFocus(g))return a.timeStamp-c>100||deviceIsIOS&&window.top!==window&&"input"===d?(this.targetElement=null,!1):(this.focus(g),this.sendClick(g,a),deviceIsIOS&&"select"===d||(this.targetElement=null,a.preventDefault()),!1);return deviceIsIOS&&!deviceIsIOS4&&(e=g.fastClickScrollParent,e&&e.fastClickLastScrollTop!==e.scrollTop)?!0:(this.needsClick(g)||(a.preventDefault(),this.sendClick(g,a)),!1)},FastClick.prototype.onTouchCancel=function(){"use strict";this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onMouse=function(a){"use strict";return this.targetElement?a.forwardedTouchEvent?!0:a.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(a.stopImmediatePropagation?a.stopImmediatePropagation():a.propagationStopped=!0,a.stopPropagation(),a.preventDefault(),!1):!0:!0},FastClick.prototype.onClick=function(a){"use strict";var b;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===a.target.type&&0===a.detail?!0:(b=this.onMouse(a),b||(this.targetElement=null),b)},FastClick.prototype.destroy=function(){"use strict";var a=this.layer;deviceIsAndroid&&(a.removeEventListener("mouseover",this.onMouse,!0),a.removeEventListener("mousedown",this.onMouse,!0),a.removeEventListener("mouseup",this.onMouse,!0)),a.removeEventListener("click",this.onClick,!0),a.removeEventListener("touchstart",this.onTouchStart,!1),a.removeEventListener("touchmove",this.onTouchMove,!1),a.removeEventListener("touchend",this.onTouchEnd,!1),a.removeEventListener("touchcancel",this.onTouchCancel,!1)},FastClick.notNeeded=function(a){"use strict";var b,c,d;if("undefined"==typeof window.ontouchstart)return!0;if(c=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!deviceIsAndroid)return!0;if(b=document.querySelector("meta[name=viewport]")){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(c>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(deviceIsBlackBerry10&&(d=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),d[1]>=10&&d[2]>=3&&(b=document.querySelector("meta[name=viewport]")))){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===a.style.msTouchAction?!0:!1},FastClick.attach=function(a,b){"use strict";return new FastClick(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){"use strict";return FastClick}):"undefined"!=typeof module&&module.exports?(module.exports=FastClick.attach,module.exports.FastClick=FastClick):window.FastClick=FastClick;
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
This diff is collapsed.
This diff is collapsed.
/*! http://mths.be/placeholder v2.0.8 by @mathias */
!function(a,b,c){function d(a){var b={},d=/^jQuery\d+$/;return c.each(a.attributes,function(a,c){c.specified&&!d.test(c.name)&&(b[c.name]=c.value)}),b}function e(a,b){var d=this,e=c(d);if(d.value==e.attr("placeholder")&&e.hasClass("placeholder"))if(e.data("placeholder-password")){if(e=e.hide().next().show().attr("id",e.removeAttr("id").data("placeholder-id")),a===!0)return e[0].value=b;e.focus()}else d.value="",e.removeClass("placeholder"),d==g()&&d.select()}function f(){var a,b=this,f=c(b),g=this.id;if(""==b.value){if("password"==b.type){if(!f.data("placeholder-textinput")){try{a=f.clone().attr({type:"text"})}catch(h){a=c("<input>").attr(c.extend(d(this),{type:"text"}))}a.removeAttr("name").data({"placeholder-password":f,"placeholder-id":g}).bind("focus.placeholder",e),f.data({"placeholder-textinput":a,"placeholder-id":g}).before(a)}f=f.removeAttr("id").hide().prev().attr("id",g).show()}f.addClass("placeholder"),f[0].value=f.attr("placeholder")}else f.removeClass("placeholder")}function g(){try{return b.activeElement}catch(a){}}var h,i,j="[object OperaMini]"==Object.prototype.toString.call(a.operamini),k="placeholder"in b.createElement("input")&&!j,l="placeholder"in b.createElement("textarea")&&!j,m=c.fn,n=c.valHooks,o=c.propHooks;k&&l?(i=m.placeholder=function(){return this},i.input=i.textarea=!0):(i=m.placeholder=function(){var a=this;return a.filter((k?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":e,"blur.placeholder":f}).data("placeholder-enabled",!0).trigger("blur.placeholder"),a},i.input=k,i.textarea=l,h={get:function(a){var b=c(a),d=b.data("placeholder-password");return d?d[0].value:b.data("placeholder-enabled")&&b.hasClass("placeholder")?"":a.value},set:function(a,b){var d=c(a),h=d.data("placeholder-password");return h?h[0].value=b:d.data("placeholder-enabled")?(""==b?(a.value=b,a!=g()&&f.call(a)):d.hasClass("placeholder")?e.call(a,!0,b)||(a.value=b):a.value=b,d):a.value=b}},k||(n.input=h,o.value=h),l||(n.textarea=h,o.value=h),c(function(){c(b).delegate("form","submit.placeholder",function(){var a=c(".placeholder",this).each(e);setTimeout(function(){a.each(f)},10)})}),c(a).bind("beforeunload.placeholder",function(){c(".placeholder").each(function(){this.value=""})}))}(this,document,jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment