first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
@@ -0,0 +1,150 @@
/*!
* To enable the support for Woocommerce Grid-List button
*
* Javascript Cookie v1.5.1
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*
*/
(function (factory) {
var jQuery;
if (typeof define === 'function' && define.amd) {
// AMD (Register as an anonymous module)
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
try {
jQuery = require('jquery');
} catch(e) {}
module.exports = factory(jQuery);
} else {
// Browser globals
var _OldCookies = window.Cookies;
var api = window.Cookies = factory(window.jQuery);
api.noConflict = function() {
window.Cookies = _OldCookies;
return api;
};
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return api.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return api.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(api.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return api.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = api.raw ? s : parseCookieValue(s);
return isFunction(converter) ? converter(value) : value;
}
function extend() {
var key, options;
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
options = arguments[ i ];
for (key in options) {
result[key] = options[key];
}
}
return result;
}
function isFunction(obj) {
return Object.prototype.toString.call(obj) === '[object Function]';
}
var api = function (key, value, options) {
// Write
if (arguments.length > 1 && !isFunction(value)) {
options = extend(api.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {},
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()".
cookies = document.cookie ? document.cookie.split('; ') : [],
i = 0,
l = cookies.length;
for (; i < l; i++) {
var parts = cookies[i].split('='),
name = decode(parts.shift()),
cookie = parts.join('=');
if (key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
api.get = api.set = api;
api.defaults = {};
api.remove = function (key, options) {
// Must not alter options, thus extending a fresh object...
api(key, '', extend(options, { expires: -1 }));
return !api(key);
};
if ( $ ) {
$.cookie = api;
$.removeCookie = api.remove;
}
return api;
}));
@@ -0,0 +1,152 @@
/*!
* jquery.customSelect() - v0.5.1
* http://adam.co/lab/jquery/customselect/
* 2014-03-19
*
* Copyright 2013 Adam Coulombe
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @license http://www.gnu.org/licenses/gpl.html GPL2 License
*/
(function ($) {
'use strict';
$.fn.extend({
customSelect: function (options) {
// filter out <= IE6
if (typeof document.body.style.maxHeight === 'undefined') {
return this;
}
var defaults = {
customClass: 'customSelect',
mapClass: true,
mapStyle: true
},
options = $.extend(defaults, options),
prefix = options.customClass,
changed = function ($select,customSelectSpan) {
var currentSelected = $select.find(':selected'),
customSelectSpanInner = customSelectSpan.children(':first'),
html = currentSelected.html() || '&nbsp;';
customSelectSpanInner.html(html);
if (currentSelected.attr('disabled')) {
customSelectSpan.addClass(getClass('DisabledOption'));
} else {
customSelectSpan.removeClass(getClass('DisabledOption'));
}
setTimeout(function () {
customSelectSpan.removeClass(getClass('Open'));
$(document).off('mouseup.customSelect');
}, 60);
},
getClass = function(suffix){
return prefix + suffix;
};
return this.each(function () {
var $select = $(this),
customSelectInnerSpan = $('<span />').addClass(getClass('Inner')),
customSelectSpan = $('<span />');
$select.after(customSelectSpan.append(customSelectInnerSpan));
customSelectSpan.addClass(prefix);
if (options.mapClass) {
customSelectSpan.addClass($select.attr('class'));
}
if (options.mapStyle) {
customSelectSpan.attr('style', $select.attr('style'));
}
$select
.addClass('hasCustomSelect')
.on('render.customSelect', function () {
changed($select,customSelectSpan);
$select.css('width','');
var selectBoxWidth = parseInt($select.outerWidth(), 10) -
(parseInt(customSelectSpan.outerWidth(), 10) -
parseInt(customSelectSpan.width(), 10));
// Set to inline-block before calculating outerHeight
customSelectSpan.css({
display: 'inline-block'
});
var selectBoxHeight = customSelectSpan.outerHeight();
if ($select.attr('disabled')) {
customSelectSpan.addClass(getClass('Disabled'));
} else {
customSelectSpan.removeClass(getClass('Disabled'));
}
customSelectInnerSpan.css({
display: 'inline-block'
});
$select.css({
'-webkit-appearance': 'menulist-button',
width: customSelectSpan.outerWidth(),
position: 'absolute',
opacity: 0,
height: selectBoxHeight,
fontSize: customSelectSpan.css('font-size')
});
})
.on('change.customSelect', function () {
customSelectSpan.addClass(getClass('Changed'));
changed($select,customSelectSpan);
})
.on('keyup.customSelect', function (e) {
if(!customSelectSpan.hasClass(getClass('Open'))){
$select.trigger('blur.customSelect');
$select.trigger('focus.customSelect');
}else{
if(e.which==13||e.which==27){
changed($select,customSelectSpan);
}
}
})
.on('mousedown.customSelect', function () {
customSelectSpan.removeClass(getClass('Changed'));
})
.on('mouseup.customSelect', function (e) {
if( !customSelectSpan.hasClass(getClass('Open'))){
// if FF and there are other selects open, just apply focus
if($('.'+getClass('Open')).not(customSelectSpan).length>0 && typeof InstallTrigger !== 'undefined'){
$select.trigger('focus.customSelect');
}else{
customSelectSpan.addClass(getClass('Open'));
e.stopPropagation();
$(document).one('mouseup.customSelect', function (e) {
if( e.target != $select.get(0) && $.inArray(e.target,$select.find('*').get()) < 0 ){
$select.trigger('blur.customSelect');
}else{
changed($select,customSelectSpan);
}
});
}
}
})
.on('focus.customSelect', function () {
customSelectSpan.removeClass(getClass('Changed')).addClass(getClass('Focus'));
})
.on('blur.customSelect', function () {
customSelectSpan.removeClass(getClass('Focus')+' '+getClass('Open'));
})
.on('mouseenter.customSelect', function () {
customSelectSpan.addClass(getClass('Hover'));
})
.on('mouseleave.customSelect', function () {
customSelectSpan.removeClass(getClass('Hover'));
})
.trigger('render.customSelect');
});
}
});
})(jQuery);
@@ -0,0 +1,87 @@
/*jshint browser:true */
/*!
* FitVids 1.1
*
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
*/
;(function( $ ){
'use strict';
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null,
ignore: null
};
if(!document.getElementById('fit-vids-style')) {
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
var head = document.head || document.getElementsByTagName('head')[0];
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
var div = document.createElement("div");
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
head.appendChild(div.childNodes[1]);
}
if ( options ) {
$.extend( settings, options );
}
return this.each(function(){
var selectors = [
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];
if (settings.customSelector) {
selectors.push(settings.customSelector);
}
var ignoreList = '.fitvidsignore';
if(settings.ignore) {
ignoreList = ignoreList + ', ' + settings.ignore;
}
var $allVideos = $(this).find(selectors.join(','));
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
$allVideos.each(function(){
var $this = $(this);
if($this.parents(ignoreList).length > 0) {
return; // Disable FitVids on this video.
}
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
{
$this.attr('height', 9);
$this.attr('width', 16);
}
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
aspectRatio = height / width;
if(!$this.attr('name')){
var videoName = 'fitvid' + $.fn.fitVids._count;
$this.attr('name', videoName);
$.fn.fitVids._count++;
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
$this.removeAttr('height').removeAttr('width');
});
});
};
// Internal counter for unique video names.
$.fn.fitVids._count = 0;
// Works with either jQuery or Zepto
})( window.jQuery || window.Zepto );
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,388 @@
/**
* jquery-match-height 0.7.2 by @liabru
* http://brm.io/jquery-match-height/
* License: MIT
*/
;(function(factory) { // eslint-disable-line no-extra-semi
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof module !== 'undefined' && module.exports) {
// CommonJS
module.exports = factory(require('jquery'));
} else {
// Global
factory(jQuery);
}
})(function($) {
/*
* internal
*/
var _previousResizeWidth = -1,
_updateTimeout = -1;
/*
* _parse
* value parse utility function
*/
var _parse = function(value) {
// parse value and convert NaN to 0
return parseFloat(value) || 0;
};
/*
* _rows
* utility function returns array of jQuery selections representing each row
* (as displayed after float wrapping applied by browser)
*/
var _rows = function(elements) {
var tolerance = 1,
$elements = $(elements),
lastTop = null,
rows = [];
// group elements by their top position
$elements.each(function(){
var $that = $(this),
top = $that.offset().top - _parse($that.css('margin-top')),
lastRow = rows.length > 0 ? rows[rows.length - 1] : null;
if (lastRow === null) {
// first item on the row, so just push it
rows.push($that);
} else {
// if the row top is the same, add to the row group
if (Math.floor(Math.abs(lastTop - top)) <= tolerance) {
rows[rows.length - 1] = lastRow.add($that);
} else {
// otherwise start a new row group
rows.push($that);
}
}
// keep track of the last row top
lastTop = top;
});
return rows;
};
/*
* _parseOptions
* handle plugin options
*/
var _parseOptions = function(options) {
var opts = {
byRow: true,
property: 'height',
target: null,
remove: false
};
if (typeof options === 'object') {
return $.extend(opts, options);
}
if (typeof options === 'boolean') {
opts.byRow = options;
} else if (options === 'remove') {
opts.remove = true;
}
return opts;
};
/*
* matchHeight
* plugin definition
*/
var matchHeight = $.fn.matchHeight = function(options) {
var opts = _parseOptions(options);
// handle remove
if (opts.remove) {
var that = this;
// remove fixed height from all selected elements
this.css(opts.property, '');
// remove selected elements from all groups
$.each(matchHeight._groups, function(key, group) {
group.elements = group.elements.not(that);
});
// TODO: cleanup empty groups
return this;
}
if (this.length <= 1 && !opts.target) {
return this;
}
// keep track of this group so we can re-apply later on load and resize events
matchHeight._groups.push({
elements: this,
options: opts
});
// match each element's height to the tallest element in the selection
matchHeight._apply(this, opts);
return this;
};
/*
* plugin global options
*/
matchHeight.version = '0.7.2';
matchHeight._groups = [];
matchHeight._throttle = 80;
matchHeight._maintainScroll = false;
matchHeight._beforeUpdate = null;
matchHeight._afterUpdate = null;
matchHeight._rows = _rows;
matchHeight._parse = _parse;
matchHeight._parseOptions = _parseOptions;
/*
* matchHeight._apply
* apply matchHeight to given elements
*/
matchHeight._apply = function(elements, options) {
var opts = _parseOptions(options),
$elements = $(elements),
rows = [$elements];
// take note of scroll position
var scrollTop = $(window).scrollTop(),
htmlHeight = $('html').outerHeight(true);
// get hidden parents
var $hiddenParents = $elements.parents().filter(':hidden');
// cache the original inline style
$hiddenParents.each(function() {
var $that = $(this);
$that.data('style-cache', $that.attr('style'));
});
// temporarily must force hidden parents visible
$hiddenParents.css('display', 'block');
// get rows if using byRow, otherwise assume one row
if (opts.byRow && !opts.target) {
// must first force an arbitrary equal height so floating elements break evenly
$elements.each(function() {
var $that = $(this),
display = $that.css('display');
// temporarily force a usable display value
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
display = 'block';
}
// cache the original inline style
$that.data('style-cache', $that.attr('style'));
$that.css({
'display': display,
'padding-top': '0',
'padding-bottom': '0',
'margin-top': '0',
'margin-bottom': '0',
'border-top-width': '0',
'border-bottom-width': '0',
'height': '100px',
'overflow': 'hidden'
});
});
// get the array of rows (based on element top position)
rows = _rows($elements);
// revert original inline styles
$elements.each(function() {
var $that = $(this);
$that.attr('style', $that.data('style-cache') || '');
});
}
$.each(rows, function(key, row) {
var $row = $(row),
targetHeight = 0;
if (!opts.target) {
// skip apply to rows with only one item
if (opts.byRow && $row.length <= 1) {
$row.css(opts.property, '');
return;
}
// iterate the row and find the max height
$row.each(function(){
var $that = $(this),
style = $that.attr('style'),
display = $that.css('display');
// temporarily force a usable display value
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
display = 'block';
}
// ensure we get the correct actual height (and not a previously set height value)
var css = { 'display': display };
css[opts.property] = '';
$that.css(css);
// find the max height (including padding, but not margin)
if ($that.outerHeight(false) > targetHeight) {
targetHeight = $that.outerHeight(false);
}
// revert styles
if (style) {
$that.attr('style', style);
} else {
$that.css('display', '');
}
});
} else {
// if target set, use the height of the target element
targetHeight = opts.target.outerHeight(false);
}
// iterate the row and apply the height to all elements
$row.each(function(){
var $that = $(this),
verticalPadding = 0;
// don't apply to a target
if (opts.target && $that.is(opts.target)) {
return;
}
// handle padding and border correctly (required when not using border-box)
if ($that.css('box-sizing') !== 'border-box') {
verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width'));
verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom'));
}
// set the height (accounting for padding and border)
$that.css(opts.property, (targetHeight - verticalPadding) + 'px');
});
});
// revert hidden parents
$hiddenParents.each(function() {
var $that = $(this);
$that.attr('style', $that.data('style-cache') || null);
});
// restore scroll position if enabled
if (matchHeight._maintainScroll) {
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
}
return this;
};
/*
* matchHeight._applyDataApi
* applies matchHeight to all elements with a data-match-height attribute
*/
matchHeight._applyDataApi = function() {
var groups = {};
// generate groups by their groupId set by elements using data-match-height
$('[data-match-height], [data-mh]').each(function() {
var $this = $(this),
groupId = $this.attr('data-mh') || $this.attr('data-match-height');
if (groupId in groups) {
groups[groupId] = groups[groupId].add($this);
} else {
groups[groupId] = $this;
}
});
// apply matchHeight to each group
$.each(groups, function() {
this.matchHeight(true);
});
};
/*
* matchHeight._update
* updates matchHeight on all current groups with their correct options
*/
var _update = function(event) {
if (matchHeight._beforeUpdate) {
matchHeight._beforeUpdate(event, matchHeight._groups);
}
$.each(matchHeight._groups, function() {
matchHeight._apply(this.elements, this.options);
});
if (matchHeight._afterUpdate) {
matchHeight._afterUpdate(event, matchHeight._groups);
}
};
matchHeight._update = function(throttle, event) {
// prevent update if fired from a resize event
// where the viewport width hasn't actually changed
// fixes an event looping bug in IE8
if (event && event.type === 'resize') {
var windowWidth = $(window).width();
if (windowWidth === _previousResizeWidth) {
return;
}
_previousResizeWidth = windowWidth;
}
// throttle updates
if (!throttle) {
_update(event);
} else if (_updateTimeout === -1) {
_updateTimeout = setTimeout(function() {
_update(event);
_updateTimeout = -1;
}, matchHeight._throttle);
}
};
/*
* bind events
*/
// apply on DOM ready event
$(matchHeight._applyDataApi);
// use on or bind where supported
var on = $.fn.on ? 'on' : 'bind';
// update heights on load and resize events
$(window)[on]('load', function(event) {
matchHeight._update(false, event);
});
// throttled update heights on resize events
$(window)[on]('resize orientationchange', function(event) {
matchHeight._update(true, event);
});
});
@@ -0,0 +1,579 @@
/*! sidr - v2.2.1 - 2016-02-17
* http://www.berriart.com/sidr/
* Copyright (c) 2013-2016 Alberto Varela; Licensed MIT */
(function () {
'use strict';
var babelHelpers = {};
babelHelpers.classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
babelHelpers.createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
babelHelpers;
var sidrStatus = {
moving: false,
opened: false
};
var helper = {
// Check for valids urls
// From : http://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-an-url
isUrl: function isUrl(str) {
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
if (pattern.test(str)) {
return true;
} else {
return false;
}
},
// Add sidr prefixes
addPrefixes: function addPrefixes($element) {
this.addPrefix($element, 'id');
this.addPrefix($element, 'class');
$element.removeAttr('style');
},
addPrefix: function addPrefix($element, attribute) {
var toReplace = $element.attr(attribute);
if (typeof toReplace === 'string' && toReplace !== '' && toReplace !== 'sidr-inner') {
$element.attr(attribute, toReplace.replace(/([A-Za-z0-9_.\-]+)/g, 'sidr-' + attribute + '-$1'));
}
},
// Check if transitions is supported
transitions: function () {
var body = document.body || document.documentElement,
style = body.style,
supported = false,
property = 'transition';
if (property in style) {
supported = true;
} else {
(function () {
var prefixes = ['moz', 'webkit', 'o', 'ms'],
prefix = undefined,
i = undefined;
property = property.charAt(0).toUpperCase() + property.substr(1);
supported = function () {
for (i = 0; i < prefixes.length; i++) {
prefix = prefixes[i];
if (prefix + property in style) {
return true;
}
}
return false;
}();
property = supported ? '-' + prefix.toLowerCase() + '-' + property.toLowerCase() : null;
})();
}
return {
supported: supported,
property: property
};
}()
};
var $$2 = jQuery;
var bodyAnimationClass = 'sidr-animating';
var openAction = 'open';
var closeAction = 'close';
var transitionEndEvent = 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend';
var Menu = function () {
function Menu(name) {
babelHelpers.classCallCheck(this, Menu);
this.name = name;
this.item = $$2('#' + name);
this.openClass = name === 'sidr' ? 'sidr-open' : 'sidr-open ' + name + '-open';
this.menuWidth = this.item.outerWidth(true);
this.speed = this.item.data('speed');
this.side = this.item.data('side');
this.displace = this.item.data('displace');
this.timing = this.item.data('timing');
this.method = this.item.data('method');
this.onOpenCallback = this.item.data('onOpen');
this.onCloseCallback = this.item.data('onClose');
this.onOpenEndCallback = this.item.data('onOpenEnd');
this.onCloseEndCallback = this.item.data('onCloseEnd');
this.body = $$2(this.item.data('body'));
}
babelHelpers.createClass(Menu, [{
key: 'getAnimation',
value: function getAnimation(action, element) {
var animation = {},
prop = this.side;
if (action === 'open' && element === 'body') {
animation[prop] = this.menuWidth + 'px';
} else if (action === 'close' && element === 'menu') {
animation[prop] = '-' + this.menuWidth + 'px';
} else {
animation[prop] = 0;
}
return animation;
}
}, {
key: 'prepareBody',
value: function prepareBody(action) {
var prop = action === 'open' ? 'hidden' : '';
// Prepare page if container is body
if (this.body.is('body')) {
var $html = $$2('html'),
scrollTop = $html.scrollTop();
$html.css('overflow-x', prop).scrollTop(scrollTop);
}
}
}, {
key: 'openBody',
value: function openBody() {
if (this.displace) {
var transitions = helper.transitions,
$body = this.body;
if (transitions.supported) {
$body.css(transitions.property, this.side + ' ' + this.speed / 1000 + 's ' + this.timing).css(this.side, 0).css({
width: $body.width(),
position: 'absolute'
});
$body.css(this.side, this.menuWidth + 'px');
} else {
var bodyAnimation = this.getAnimation(openAction, 'body');
$body.css({
width: $body.width(),
position: 'absolute'
}).animate(bodyAnimation, {
queue: false,
duration: this.speed
});
}
}
}
}, {
key: 'onCloseBody',
value: function onCloseBody() {
var transitions = helper.transitions,
resetStyles = {
width: '',
position: '',
right: '',
left: ''
};
if (transitions.supported) {
resetStyles[transitions.property] = '';
}
this.body.css(resetStyles).unbind(transitionEndEvent);
}
}, {
key: 'closeBody',
value: function closeBody() {
var _this = this;
if (this.displace) {
if (helper.transitions.supported) {
this.body.css(this.side, 0).one(transitionEndEvent, function () {
_this.onCloseBody();
});
} else {
var bodyAnimation = this.getAnimation(closeAction, 'body');
this.body.animate(bodyAnimation, {
queue: false,
duration: this.speed,
complete: function complete() {
_this.onCloseBody();
}
});
}
}
}
}, {
key: 'moveBody',
value: function moveBody(action) {
if (action === openAction) {
this.openBody();
} else {
this.closeBody();
}
}
}, {
key: 'onOpenMenu',
value: function onOpenMenu(callback) {
var name = this.name;
sidrStatus.moving = false;
sidrStatus.opened = name;
this.item.unbind(transitionEndEvent);
this.body.removeClass(bodyAnimationClass).addClass(this.openClass);
this.onOpenEndCallback();
if (typeof callback === 'function') {
callback(name);
}
}
}, {
key: 'openMenu',
value: function openMenu(callback) {
var _this2 = this;
var $item = this.item;
if (helper.transitions.supported) {
$item.css(this.side, 0).one(transitionEndEvent, function () {
_this2.onOpenMenu(callback);
});
} else {
var menuAnimation = this.getAnimation(openAction, 'menu');
$item.css('display', 'block').animate(menuAnimation, {
queue: false,
duration: this.speed,
complete: function complete() {
_this2.onOpenMenu(callback);
}
});
}
}
}, {
key: 'onCloseMenu',
value: function onCloseMenu(callback) {
this.item.css({
left: '',
right: ''
}).unbind(transitionEndEvent);
$$2('html').css('overflow-x', '');
sidrStatus.moving = false;
sidrStatus.opened = false;
this.body.removeClass(bodyAnimationClass).removeClass(this.openClass);
this.onCloseEndCallback();
// Callback
if (typeof callback === 'function') {
callback(name);
}
}
}, {
key: 'closeMenu',
value: function closeMenu(callback) {
var _this3 = this;
var item = this.item;
if (helper.transitions.supported) {
item.css(this.side, '').one(transitionEndEvent, function () {
_this3.onCloseMenu(callback);
});
} else {
var menuAnimation = this.getAnimation(closeAction, 'menu');
item.animate(menuAnimation, {
queue: false,
duration: this.speed,
complete: function complete() {
_this3.onCloseMenu();
}
});
}
}
}, {
key: 'moveMenu',
value: function moveMenu(action, callback) {
this.body.addClass(bodyAnimationClass);
if (action === openAction) {
this.openMenu(callback);
} else {
this.closeMenu(callback);
}
}
}, {
key: 'move',
value: function move(action, callback) {
// Lock sidr
sidrStatus.moving = true;
this.prepareBody(action);
this.moveBody(action);
this.moveMenu(action, callback);
}
}, {
key: 'open',
value: function open(callback) {
var _this4 = this;
// Check if is already opened or moving
if (sidrStatus.opened === this.name || sidrStatus.moving) {
return;
}
// If another menu opened close first
if (sidrStatus.opened !== false) {
var alreadyOpenedMenu = new Menu(sidrStatus.opened);
alreadyOpenedMenu.close(function () {
_this4.open(callback);
});
return;
}
this.move('open', callback);
// onOpen callback
this.onOpenCallback();
}
}, {
key: 'close',
value: function close(callback) {
// Check if is already closed or moving
if (sidrStatus.opened !== this.name || sidrStatus.moving) {
return;
}
this.move('close', callback);
// onClose callback
this.onCloseCallback();
}
}, {
key: 'toggle',
value: function toggle(callback) {
if (sidrStatus.opened === this.name) {
this.close(callback);
} else {
this.open(callback);
}
}
}]);
return Menu;
}();
var $$1 = jQuery;
function execute(action, name, callback) {
var sidr = new Menu(name);
switch (action) {
case 'open':
sidr.open(callback);
break;
case 'close':
sidr.close(callback);
break;
case 'toggle':
sidr.toggle(callback);
break;
default:
$$1.error('Method ' + action + ' does not exist on jQuery.sidr');
break;
}
}
var i;
var $ = jQuery;
var publicMethods = ['open', 'close', 'toggle'];
var methodName;
var methods = {};
var getMethod = function getMethod(methodName) {
return function (name, callback) {
// Check arguments
if (typeof name === 'function') {
callback = name;
name = 'sidr';
} else if (!name) {
name = 'sidr';
}
execute(methodName, name, callback);
};
};
for (i = 0; i < publicMethods.length; i++) {
methodName = publicMethods[i];
methods[methodName] = getMethod(methodName);
}
function sidr(method) {
if (method === 'status') {
return sidrStatus;
} else if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'function' || typeof method === 'string' || !method) {
return methods.toggle.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.sidr');
}
}
var $$3 = jQuery;
function fillContent($sideMenu, settings) {
// The menu content
if (typeof settings.source === 'function') {
var newContent = settings.source(name);
$sideMenu.html(newContent);
} else if (typeof settings.source === 'string' && helper.isUrl(settings.source)) {
$$3.get(settings.source, function (data) {
$sideMenu.html(data);
});
} else if (typeof settings.source === 'string') {
var htmlContent = '',
selectors = settings.source.split(',');
$$3.each(selectors, function (index, element) {
htmlContent += '<div class="sidr-inner">' + $$3(element).html() + '</div>';
});
// Renaming ids and classes
if (settings.renaming) {
var $htmlContent = $$3('<div />').html(htmlContent);
$htmlContent.find('*').each(function (index, element) {
var $element = $$3(element);
helper.addPrefixes($element);
});
htmlContent = $htmlContent.html();
}
$sideMenu.html(htmlContent);
} else if (settings.source !== null) {
$$3.error('Invalid Sidr Source');
}
return $sideMenu;
}
function fnSidr(options) {
var transitions = helper.transitions,
settings = $$3.extend({
name: 'sidr', // Name for the 'sidr'
speed: 200, // Accepts standard jQuery effects speeds (i.e. fast, normal or milliseconds)
side: 'left', // Accepts 'left' or 'right'
source: null, // Override the source of the content.
renaming: true, // The ids and classes will be prepended with a prefix when loading existent content
body: 'body', // Page container selector,
displace: true, // Displace the body content or not
timing: 'ease', // Timing function for CSS transitions
method: 'toggle', // The method to call when element is clicked
bind: 'touchstart click', // The event(s) to trigger the menu
onOpen: function onOpen() {},
// Callback when sidr start opening
onClose: function onClose() {},
// Callback when sidr start closing
onOpenEnd: function onOpenEnd() {},
// Callback when sidr end opening
onCloseEnd: function onCloseEnd() {} // Callback when sidr end closing
}, options),
name = settings.name,
$sideMenu = $$3('#' + name);
// If the side menu do not exist create it
if ($sideMenu.length === 0) {
$sideMenu = $$3('<div />').attr('id', name).insertAfter($$3('#site-header'));
}
// Add transition to menu if are supported
if (transitions.supported) {
$sideMenu.css(transitions.property, settings.side + ' ' + settings.speed / 1000 + 's ' + settings.timing);
}
// Adding styles and options
$sideMenu.addClass('sidr').addClass(settings.side).data({
speed: settings.speed,
side: settings.side,
body: settings.body,
displace: settings.displace,
timing: settings.timing,
method: settings.method,
onOpen: settings.onOpen,
onClose: settings.onClose,
onOpenEnd: settings.onOpenEnd,
onCloseEnd: settings.onCloseEnd
});
$sideMenu = fillContent($sideMenu, settings);
return this.each(function () {
var $this = $$3(this),
data = $this.data('sidr'),
flag = false;
// If the plugin hasn't been initialized yet
if (!data) {
sidrStatus.moving = false;
sidrStatus.opened = false;
$this.data('sidr', name);
$this.bind(settings.bind, function (event) {
event.preventDefault();
if (!flag) {
flag = true;
sidr(settings.method, name);
setTimeout(function () {
flag = false;
}, 100);
}
});
}
});
}
jQuery.sidr = sidr;
jQuery.fn.sidr = fnSidr;
}());
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,788 @@
//
// SmoothScroll for websites v1.4.9 (Balazs Galambosi)
// http://www.smoothscroll.net/
//
// Licensed under the terms of the MIT license.
//
// You may use it in your theme if you credit me.
// It is also free to use on any individual website.
//
// Exception:
// The only restriction is to not publish any
// extension for browsers or native application
// without getting a written permission first.
//
(function () {
// Scroll Variables (tweakable)
var defaultOptions = {
// Scrolling Core
frameRate : 150, // [Hz]
animationTime : 400, // [ms]
stepSize : 100, // [px]
// Pulse (less tweakable)
// ratio of "tail" to "acceleration"
pulseAlgorithm : true,
pulseScale : 4,
pulseNormalize : 1,
// Acceleration
accelerationDelta : 50, // 50
accelerationMax : 3, // 3
// Keyboard Settings
keyboardSupport : true, // option
arrowScroll : 50, // [px]
// Other
fixedBackground : true,
excluded : ''
};
var options = defaultOptions;
// Other Variables
var isExcluded = false;
var isFrame = false;
var direction = { x: 0, y: 0 };
var initDone = false;
var root = document.documentElement;
var activeElement;
var observer;
var refreshSize;
var deltaBuffer = [];
var deltaBufferTimer;
var isMac = /^Mac/.test(navigator.platform);
var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
pageup: 33, pagedown: 34, end: 35, home: 36 };
var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 };
/***********************************************
* INITIALIZE
***********************************************/
/**
* Tests if smooth scrolling is allowed. Shuts down everything if not.
*/
function initTest() {
if (options.keyboardSupport) {
addEvent('keydown', keydown);
}
}
/**
* Sets up scrolls array, determines if frames are involved.
*/
function init() {
if (initDone || !document.body) return;
initDone = true;
var body = document.body;
var html = document.documentElement;
var windowHeight = window.innerHeight;
var scrollHeight = body.scrollHeight;
// check compat mode for root element
root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
activeElement = body;
initTest();
// Checks if this script is running in a frame
if (top != self) {
isFrame = true;
}
/**
* Safari 10 fixed it, Chrome fixed it in v45:
* This fixes a bug where the areas left and right to
* the content does not trigger the onmousewheel event
* on some pages. e.g.: html, body { height: 100% }
*/
else if (isOldSafari &&
scrollHeight > windowHeight &&
(body.offsetHeight <= windowHeight ||
html.offsetHeight <= windowHeight)) {
var fullPageElem = document.createElement('div');
fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +
'top:0; left:0; right:0; height:' +
root.scrollHeight + 'px';
document.body.appendChild(fullPageElem);
// DOM changed (throttled) to fix height
var pendingRefresh;
refreshSize = function () {
if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);
pendingRefresh = setTimeout(function () {
if (isExcluded) return; // could be running after cleanup
fullPageElem.style.height = '0';
fullPageElem.style.height = root.scrollHeight + 'px';
pendingRefresh = null;
}, 500); // act rarely to stay fast
};
setTimeout(refreshSize, 10);
addEvent('resize', refreshSize);
// TODO: attributeFilter?
var config = {
attributes: true,
childList: true,
characterData: false
// subtree: true
};
observer = new MutationObserver(refreshSize);
observer.observe(body, config);
if (root.offsetHeight <= windowHeight) {
var clearfix = document.createElement('div');
clearfix.style.clear = 'both';
body.appendChild(clearfix);
}
}
// disable fixed background
if (!options.fixedBackground && !isExcluded) {
body.style.backgroundAttachment = 'scroll';
html.style.backgroundAttachment = 'scroll';
}
}
/**
* Removes event listeners and other traces left on the page.
*/
function cleanup() {
observer && observer.disconnect();
removeEvent(wheelEvent, wheel);
removeEvent('mousedown', mousedown);
removeEvent('keydown', keydown);
removeEvent('resize', refreshSize);
removeEvent('load', init);
}
/************************************************
* SCROLLING
************************************************/
var que = [];
var pending = false;
var lastScroll = Date.now();
/**
* Pushes scroll actions to the scrolling queue.
*/
function scrollArray(elem, left, top) {
directionCheck(left, top);
if (options.accelerationMax != 1) {
var now = Date.now();
var elapsed = now - lastScroll;
if (elapsed < options.accelerationDelta) {
var factor = (1 + (50 / elapsed)) / 2;
if (factor > 1) {
factor = Math.min(factor, options.accelerationMax);
left *= factor;
top *= factor;
}
}
lastScroll = Date.now();
}
// push a scroll command
que.push({
x: left,
y: top,
lastX: (left < 0) ? 0.99 : -0.99,
lastY: (top < 0) ? 0.99 : -0.99,
start: Date.now()
});
// don't act if there's a pending queue
if (pending) {
return;
}
var scrollRoot = getScrollRoot();
var isWindowScroll = (elem === scrollRoot || elem === document.body);
// if we haven't already fixed the behavior,
// and it needs fixing for this sesh
if (elem.$scrollBehavior == null && isScrollBehaviorSmooth(elem)) {
elem.$scrollBehavior = elem.style.scrollBehavior;
elem.style.scrollBehavior = 'auto';
}
var step = function (time) {
var now = Date.now();
var scrollX = 0;
var scrollY = 0;
for (var i = 0; i < que.length; i++) {
var item = que[i];
var elapsed = now - item.start;
var finished = (elapsed >= options.animationTime);
// scroll position: [0, 1]
var position = (finished) ? 1 : elapsed / options.animationTime;
// easing [optional]
if (options.pulseAlgorithm) {
position = pulse(position);
}
// only need the difference
var x = (item.x * position - item.lastX) >> 0;
var y = (item.y * position - item.lastY) >> 0;
// add this to the total scrolling
scrollX += x;
scrollY += y;
// update last values
item.lastX += x;
item.lastY += y;
// delete and step back if it's over
if (finished) {
que.splice(i, 1); i--;
}
}
// scroll left and top
if (isWindowScroll) {
window.scrollBy(scrollX, scrollY);
}
else {
if (scrollX) elem.scrollLeft += scrollX;
if (scrollY) elem.scrollTop += scrollY;
}
// clean up if there's nothing left to do
if (!left && !top) {
que = [];
}
if (que.length) {
requestFrame(step, elem, (1000 / options.frameRate + 1));
} else {
pending = false;
// restore default behavior at the end of scrolling sesh
if (elem.$scrollBehavior != null) {
elem.style.scrollBehavior = elem.$scrollBehavior;
elem.$scrollBehavior = null;
}
}
};
// start a new queue of actions
requestFrame(step, elem, 0);
pending = true;
}
/***********************************************
* EVENTS
***********************************************/
/**
* Mouse wheel handler.
* @param {Object} event
*/
function wheel(event) {
if (!initDone) {
init();
}
var target = event.target;
// leave early if default action is prevented
// or it's a zooming event with CTRL
if (event.defaultPrevented || event.ctrlKey) {
return true;
}
// leave embedded content alone (flash & pdf)
if (isNodeName(activeElement, 'embed') ||
(isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) ||
isNodeName(activeElement, 'object') ||
target.shadowRoot) {
return true;
}
var deltaX = -event.wheelDeltaX || event.deltaX || 0;
var deltaY = -event.wheelDeltaY || event.deltaY || 0;
if (isMac) {
if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) {
deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX));
}
if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) {
deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY));
}
}
// use wheelDelta if deltaX/Y is not available
if (!deltaX && !deltaY) {
deltaY = -event.wheelDelta || 0;
}
// line based scrolling (Firefox mostly)
if (event.deltaMode === 1) {
deltaX *= 40;
deltaY *= 40;
}
var overflowing = overflowingAncestor(target);
// nothing to do if there's no element that's scrollable
if (!overflowing) {
// except Chrome iframes seem to eat wheel events, which we need to
// propagate up, if the iframe has nothing overflowing to scroll
if (isFrame && isChrome) {
// change target to iframe element itself for the parent frame
Object.defineProperty(event, "target", {value: window.frameElement});
return parent.wheel(event);
}
return true;
}
// check if it's a touchpad scroll that should be ignored
if (isTouchpad(deltaY)) {
return true;
}
// scale by step size
// delta is 120 most of the time
// synaptics seems to send 1 sometimes
if (Math.abs(deltaX) > 1.2) {
deltaX *= options.stepSize / 120;
}
if (Math.abs(deltaY) > 1.2) {
deltaY *= options.stepSize / 120;
}
scrollArray(overflowing, deltaX, deltaY);
event.preventDefault();
scheduleClearCache();
}
/**
* Keydown event handler.
* @param {Object} event
*/
function keydown(event) {
var target = event.target;
var modifier = event.ctrlKey || event.altKey || event.metaKey ||
(event.shiftKey && event.keyCode !== key.spacebar);
// our own tracked active element could've been removed from the DOM
if (!document.body.contains(activeElement)) {
activeElement = document.activeElement;
}
// do nothing if user is editing text
// or using a modifier key (except shift)
// or in a dropdown
// or inside interactive elements
var inputNodeNames = /^(textarea|select|embed|object)$/i;
var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i;
if ( event.defaultPrevented ||
inputNodeNames.test(target.nodeName) ||
isNodeName(target, 'input') && !buttonTypes.test(target.type) ||
isNodeName(activeElement, 'video') ||
isInsideYoutubeVideo(event) ||
target.isContentEditable ||
modifier ) {
return true;
}
// [spacebar] should trigger button press, leave it alone
if ((isNodeName(target, 'button') ||
isNodeName(target, 'input') && buttonTypes.test(target.type)) &&
event.keyCode === key.spacebar) {
return true;
}
// [arrwow keys] on radio buttons should be left alone
if (isNodeName(target, 'input') && target.type == 'radio' &&
arrowKeys[event.keyCode]) {
return true;
}
var shift, x = 0, y = 0;
var overflowing = overflowingAncestor(activeElement);
if (!overflowing) {
// Chrome iframes seem to eat key events, which we need to
// propagate up, if the iframe has nothing overflowing to scroll
return (isFrame && isChrome) ? parent.keydown(event) : true;
}
var clientHeight = overflowing.clientHeight;
if (overflowing == document.body) {
clientHeight = window.innerHeight;
}
switch (event.keyCode) {
case key.up:
y = -options.arrowScroll;
break;
case key.down:
y = options.arrowScroll;
break;
case key.spacebar: // (+ shift)
shift = event.shiftKey ? 1 : -1;
y = -shift * clientHeight * 0.9;
break;
case key.pageup:
y = -clientHeight * 0.9;
break;
case key.pagedown:
y = clientHeight * 0.9;
break;
case key.home:
if (overflowing == document.body && document.scrollingElement)
overflowing = document.scrollingElement;
y = -overflowing.scrollTop;
break;
case key.end:
var scroll = overflowing.scrollHeight - overflowing.scrollTop;
var scrollRemaining = scroll - clientHeight;
y = (scrollRemaining > 0) ? scrollRemaining + 10 : 0;
break;
case key.left:
x = -options.arrowScroll;
break;
case key.right:
x = options.arrowScroll;
break;
default:
return true; // a key we don't care about
}
scrollArray(overflowing, x, y);
event.preventDefault();
scheduleClearCache();
}
/**
* Mousedown event only for updating activeElement
*/
function mousedown(event) {
activeElement = event.target;
}
/***********************************************
* OVERFLOW
***********************************************/
var uniqueID = (function () {
var i = 0;
return function (el) {
return el.uniqueID || (el.uniqueID = i++);
};
})();
var cacheX = {}; // cleared out after a scrolling session
var cacheY = {}; // cleared out after a scrolling session
var clearCacheTimer;
var smoothBehaviorForElement = {};
//setInterval(function () { cache = {}; }, 10 * 1000);
function scheduleClearCache() {
clearTimeout(clearCacheTimer);
clearCacheTimer = setInterval(function () {
cacheX = cacheY = smoothBehaviorForElement = {};
}, 1*1000);
}
function setCache(elems, overflowing, x) {
var cache = x ? cacheX : cacheY;
for (var i = elems.length; i--;)
cache[uniqueID(elems[i])] = overflowing;
return overflowing;
}
function getCache(el, x) {
return (x ? cacheX : cacheY)[uniqueID(el)];
}
// (body) (root)
// | hidden | visible | scroll | auto |
// hidden | no | no | YES | YES |
// visible | no | YES | YES | YES |
// scroll | no | YES | YES | YES |
// auto | no | YES | YES | YES |
function overflowingAncestor(el) {
var elems = [];
var body = document.body;
var rootScrollHeight = root.scrollHeight;
do {
var cached = getCache(el, false);
if (cached) {
return setCache(elems, cached);
}
elems.push(el);
if (rootScrollHeight === el.scrollHeight) {
var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body);
var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root);
if (isFrame && isContentOverflowing(root) ||
!isFrame && isOverflowCSS) {
return setCache(elems, getScrollRoot());
}
} else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) {
return setCache(elems, el);
}
} while ((el = el.parentElement));
}
function isContentOverflowing(el) {
return (el.clientHeight + 10 < el.scrollHeight);
}
// typically for <body> and <html>
function overflowNotHidden(el) {
var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
return (overflow !== 'hidden');
}
// for all other elements
function overflowAutoOrScroll(el) {
var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
return (overflow === 'scroll' || overflow === 'auto');
}
// for all other elements
function isScrollBehaviorSmooth(el) {
var id = uniqueID(el);
if (smoothBehaviorForElement[id] == null) {
var scrollBehavior = getComputedStyle(el, '')['scroll-behavior'];
smoothBehaviorForElement[id] = ('smooth' == scrollBehavior);
}
return smoothBehaviorForElement[id];
}
/***********************************************
* HELPERS
***********************************************/
function addEvent(type, fn, arg) {
window.addEventListener(type, fn, arg || false);
}
function removeEvent(type, fn, arg) {
window.removeEventListener(type, fn, arg || false);
}
function isNodeName(el, tag) {
return el && (el.nodeName||'').toLowerCase() === tag.toLowerCase();
}
function directionCheck(x, y) {
x = (x > 0) ? 1 : -1;
y = (y > 0) ? 1 : -1;
if (direction.x !== x || direction.y !== y) {
direction.x = x;
direction.y = y;
que = [];
lastScroll = 0;
}
}
if (window.localStorage && localStorage.SS_deltaBuffer) {
try { // #46 Safari throws in private browsing for localStorage
deltaBuffer = localStorage.SS_deltaBuffer.split(',');
} catch (e) { }
}
function isTouchpad(deltaY) {
if (!deltaY) return;
if (!deltaBuffer.length) {
deltaBuffer = [deltaY, deltaY, deltaY];
}
deltaY = Math.abs(deltaY);
deltaBuffer.push(deltaY);
deltaBuffer.shift();
clearTimeout(deltaBufferTimer);
deltaBufferTimer = setTimeout(function () {
try { // #46 Safari throws in private browsing for localStorage
localStorage.SS_deltaBuffer = deltaBuffer.join(',');
} catch (e) { }
}, 1000);
var dpiScaledWheelDelta = deltaY > 120 && allDeltasDivisableBy(deltaY); // win64
return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100) && !dpiScaledWheelDelta;
}
function isDivisible(n, divisor) {
return (Math.floor(n / divisor) == n / divisor);
}
function allDeltasDivisableBy(divisor) {
return (isDivisible(deltaBuffer[0], divisor) &&
isDivisible(deltaBuffer[1], divisor) &&
isDivisible(deltaBuffer[2], divisor));
}
function isInsideYoutubeVideo(event) {
var elem = event.target;
var isControl = false;
if (document.URL.indexOf ('www.youtube.com/watch') != -1) {
do {
isControl = (elem.classList &&
elem.classList.contains('html5-video-controls'));
if (isControl) break;
} while ((elem = elem.parentNode));
}
return isControl;
}
var requestFrame = (function () {
return (window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function (callback, element, delay) {
window.setTimeout(callback, delay || (1000/60));
});
})();
var MutationObserver = (window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver);
var getScrollRoot = (function() {
var SCROLL_ROOT = document.scrollingElement;
return function() {
if (!SCROLL_ROOT) {
var dummy = document.createElement('div');
dummy.style.cssText = 'height:10000px;width:1px;';
document.body.appendChild(dummy);
var bodyScrollTop = document.body.scrollTop;
var docElScrollTop = document.documentElement.scrollTop;
window.scrollBy(0, 3);
if (document.body.scrollTop != bodyScrollTop)
(SCROLL_ROOT = document.body);
else
(SCROLL_ROOT = document.documentElement);
window.scrollBy(0, -3);
document.body.removeChild(dummy);
}
return SCROLL_ROOT;
};
})();
/***********************************************
* PULSE (by Michael Herf)
***********************************************/
/**
* Viscous fluid with a pulse for part and decay for the rest.
* - Applies a fixed force over an interval (a damped acceleration), and
* - Lets the exponential bleed away the velocity over a longer interval
* - Michael Herf, http://stereopsis.com/stopping/
*/
function pulse_(x) {
var val, start, expx;
// test
x = x * options.pulseScale;
if (x < 1) { // acceleartion
val = x - (1 - Math.exp(-x));
} else { // tail
// the previous animation ended here:
start = Math.exp(-1);
// simple viscous drag
x -= 1;
expx = 1 - Math.exp(-x);
val = start + (expx * (1 - start));
}
return val * options.pulseNormalize;
}
function pulse(x) {
if (x >= 1) return 1;
if (x <= 0) return 0;
if (options.pulseNormalize == 1) {
options.pulseNormalize /= pulse_(1);
}
return pulse_(x);
}
/***********************************************
* FIRST RUN
***********************************************/
var userAgent = window.navigator.userAgent;
var isEdge = /Edge/.test(userAgent); // thank you MS
var isChrome = /chrome/i.test(userAgent) && !isEdge;
var isSafari = /safari/i.test(userAgent) && !isEdge;
var isMobile = /mobile/i.test(userAgent);
var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
var isOldSafari = isSafari && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent));
var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile;
var supportsPassive = false;
try {
window.addEventListener("test", null, Object.defineProperty({}, 'passive', {
get: function () {
supportsPassive = true;
}
}));
} catch(e) {}
var wheelOpt = supportsPassive ? { passive: false } : false;
var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel';
if (wheelEvent && isEnabledForBrowser) {
addEvent(wheelEvent, wheel, wheelOpt);
addEvent('mousedown', mousedown);
addEvent('load', init);
}
/***********************************************
* PUBLIC INTERFACE
***********************************************/
function SmoothScroll(optionsToSet) {
for (var key in optionsToSet)
if (defaultOptions.hasOwnProperty(key))
options[key] = optionsToSet[key];
}
SmoothScroll.destroy = cleanup;
if (window.SmoothScrollOptions) // async API
SmoothScroll(window.SmoothScrollOptions);
if (typeof define === 'function' && define.amd)
define(function() {
return SmoothScroll;
});
else if ('object' == typeof exports)
module.exports = SmoothScroll;
else
window.SmoothScroll = SmoothScroll;
})();
@@ -0,0 +1,276 @@
/*
* jQuery Superfish Menu Plugin
* Copyright (c) 2013 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function ($, w) {
"use strict";
var methods = (function () {
// private properties and methods go here
var c = {
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
anchorClass: 'sf-with-ul',
menuArrowClass: 'sf-arrows'
},
ios = (function () {
var ios = /^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);
if (ios) {
// tap anywhere on iOS to unfocus a submenu
$('html').css('cursor', 'pointer').on('click', $.noop);
}
return ios;
})(),
wp7 = (function () {
var style = document.documentElement.style;
return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
})(),
unprefixedPointerEvents = (function () {
return (!!w.PointerEvent);
})(),
toggleMenuClasses = function ($menu, o, add) {
var classes = c.menuClass,
method;
if (o.cssArrows) {
classes += ' ' + c.menuArrowClass;
}
method = (add) ? 'addClass' : 'removeClass';
$menu[method](classes);
},
setPathToCurrent = function ($menu, o) {
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
.addClass(o.hoverClass + ' ' + c.bcClass)
.filter(function () {
return ($(this).children(o.popUpSelector).hide().show().length);
}).removeClass(o.pathClass);
},
toggleAnchorClass = function ($li, add) {
var method = (add) ? 'addClass' : 'removeClass';
$li.children('a')[method](c.anchorClass);
},
toggleTouchAction = function ($menu) {
var msTouchAction = $menu.css('ms-touch-action');
var touchAction = $menu.css('touch-action');
touchAction = touchAction || msTouchAction;
touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
$menu.css({
'ms-touch-action': touchAction,
'touch-action': touchAction
});
},
getMenu = function ($el) {
return $el.closest('.' + c.menuClass);
},
getOptions = function ($el) {
return getMenu($el).data('sfOptions');
},
over = function () {
var $this = $(this),
o = getOptions($this);
clearTimeout(o.sfTimer);
$this.siblings().superfish('hide').end().superfish('show');
},
close = function (o) {
o.retainPath = ($.inArray(this[0], o.$path) > -1);
this.superfish('hide');
if (!this.parents('.' + o.hoverClass).length) {
o.onIdle.call(getMenu(this));
if (o.$path.length) {
$.proxy(over, o.$path)();
}
}
},
out = function () {
var $this = $(this),
o = getOptions($this);
if (ios) {
$.proxy(close, $this, o)();
}
else {
clearTimeout(o.sfTimer);
o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
}
},
touchHandler = function (e) {
var $this = $(this),
o = getOptions($this),
$ul = $this.siblings(e.data.popUpSelector);
if (o.onHandleTouch.call($ul) === false) {
return this;
}
if ($ul.length > 0 && $ul.is(':hidden')) {
$this.one('click.superfish', false);
if (e.type === 'MSPointerDown' || e.type === 'pointerdown') {
$this.trigger('focus');
} else {
$.proxy(over, $this.parent('li'))();
}
}
},
applyHandlers = function ($menu, o) {
var targets = 'li:has(' + o.popUpSelector + ')';
if ($.fn.hoverIntent && !o.disableHI) {
$menu.hoverIntent(over, out, targets);
}
else {
$menu
.on('mouseenter.superfish', targets, over)
.on('mouseleave.superfish', targets, out);
}
var touchevent = 'MSPointerDown.superfish';
if (unprefixedPointerEvents) {
touchevent = 'pointerdown.superfish';
}
if (!ios) {
touchevent += ' touchend.superfish';
}
if (wp7) {
touchevent += ' mousedown.superfish';
}
$menu
.on('focusin.superfish', 'li', over)
.on('focusout.superfish', 'li', out)
.on(touchevent, 'a', o, touchHandler);
};
return {
// public methods
hide: function (instant) {
if (this.length) {
var $this = this,
o = getOptions($this);
if (!o) {
return this;
}
var not = (o.retainPath === true) ? o.$path : '',
$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
speed = o.speedOut;
if (instant) {
$ul.show();
speed = 0;
}
o.retainPath = false;
if (o.onBeforeHide.call($ul) === false) {
return this;
}
$ul.stop(true, true).animate(o.animationOut, speed, function () {
var $this = $(this);
o.onHide.call($this);
});
}
return this;
},
show: function () {
var o = getOptions(this);
if (!o) {
return this;
}
var $this = this.addClass(o.hoverClass),
$ul = $this.children(o.popUpSelector);
if (o.onBeforeShow.call($ul) === false) {
return this;
}
$ul.stop(true, true).animate(o.animation, o.speed, function () {
o.onShow.call($ul);
});
return this;
},
destroy: function () {
return this.each(function () {
var $this = $(this),
o = $this.data('sfOptions'),
$hasPopUp;
if (!o) {
return false;
}
$hasPopUp = $this.find(o.popUpSelector).parent('li');
clearTimeout(o.sfTimer);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
// remove event handlers
$this.off('.superfish').off('.hoverIntent');
// clear animation's inline display style
$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
return style.replace(/display[^;]+;?/g, '');
});
// reset 'current' path classes
o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
o.onDestroy.call($this);
$this.removeData('sfOptions');
});
},
init: function (op) {
return this.each(function () {
var $this = $(this);
if ($this.data('sfOptions')) {
return false;
}
var o = $.extend({}, $.fn.superfish.defaults, op),
$hasPopUp = $this.find(o.popUpSelector).parent('li');
o.$path = setPathToCurrent($this, o);
$this.data('sfOptions', o);
toggleMenuClasses($this, o, true);
toggleAnchorClass($hasPopUp, true);
toggleTouchAction($this);
applyHandlers($this, o);
$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
o.onInit.call(this);
});
}
};
})();
$.fn.superfish = function (method, args) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
}
else {
return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish');
}
};
$.fn.superfish.defaults = {
popUpSelector: 'ul,.sf-mega', // within menu context
hoverClass: 'sfHover',
pathClass: 'overrideThisToUse',
pathLevels: 1,
delay: 800,
animation: {opacity: 'show'},
animationOut: {opacity: 'hide'},
speed: 'normal',
speedOut: 'fast',
cssArrows: true,
disableHI: false,
onInit: $.noop,
onBeforeShow: $.noop,
onShow: $.noop,
onBeforeHide: $.noop,
onHide: $.noop,
onIdle: $.noop,
onDestroy: $.noop,
onHandleTouch: $.noop
};
})(jQuery, window);