");
var $shareLink = this._createShareLink(share).appendTo($result);
if(this._showCount) {
var isInsideCount = (this._showCount === "inside");
var $countContainer = isInsideCount ? $shareLink : $("
").addClass(this.shareCountBoxClass).appendTo($result);
$countContainer.addClass(isInsideCount ? this.shareLinkCountClass : this.shareCountBoxClass);
this._renderShareCount(share, $countContainer);
}
return $result;
},
_createShareLink: function(share) {
var shareStrategy = this._getShareStrategy(share);
var $result = shareStrategy.call(share, {
shareUrl: this._getShareUrl(share)
});
$result.addClass(this.shareLinkClass)
.append(this._createShareLogo(share));
if(this._showLabel) {
$result.append(this._createShareLabel(share));
}
$.each(this.on || {}, function(event, handler) {
if(isFunction(handler)) {
$result.on(event, proxy(handler, share));
}
});
return $result;
},
_getShareStrategy: function(share) {
var result = shareStrategies[share.shareIn || this.shareIn];
if(!result)
throw Error("Share strategy '" + this.shareIn + "' not found");
return result;
},
_getShareUrl: function(share) {
var shareUrl = getOrApply(share.shareUrl, share);
return this._formatShareUrl(shareUrl, share);
},
_createShareLogo: function(share) {
var logo = share.logo;
var $result = IMG_SRC_REGEX.test(logo) ?
$("
![]()
").attr("src", share.logo) :
$("
").addClass(logo);
$result.addClass(this.shareLogoClass);
return $result;
},
_createShareLabel: function(share) {
return $("").addClass(this.shareLabelClass)
.text(share.label);
},
_renderShareCount: function(share, $container) {
var $count = $("").addClass(this.shareCountClass);
$container.addClass(this.shareZeroCountClass)
.append($count);
this._loadCount(share).done(proxy(function(count) {
if(count) {
$container.removeClass(this.shareZeroCountClass);
$count.text(count);
}
}, this));
},
_loadCount: function(share) {
var deferred = $.Deferred();
var countUrl = this._getCountUrl(share);
if(!countUrl) {
return deferred.resolve(0).promise();
}
var handleSuccess = proxy(function(response) {
deferred.resolve(this._getCountValue(response, share));
}, this);
$.getJSON(countUrl).done(handleSuccess)
.fail(function() {
$.get(countUrl).done(handleSuccess)
.fail(function() {
deferred.resolve(0);
});
});
return deferred.promise();
},
_getCountUrl: function(share) {
var countUrl = getOrApply(share.countUrl, share);
return this._formatShareUrl(countUrl, share);
},
_getCountValue: function(response, share) {
var count = (isFunction(share.getCount) ? share.getCount(response) : response) || 0;
return (typeof count === "string") ? count : this._formatNumber(count);
},
_formatNumber: function(number) {
$.each(MEASURES, function(letter, value) {
if(number >= value) {
number = parseFloat((number / value).toFixed(2)) + letter;
return false;
}
});
return number;
},
_formatShareUrl: function(url, share) {
return url.replace(URL_PARAMS_REGEX, function(match, key, field) {
var value = share[field] || "";
return value ? (key || "") + window.encodeURIComponent(value) : "";
});
},
_clear: function() {
window.clearTimeout(this._resizeTimer);
this._$element.empty();
},
_passOptionToShares: function(key, value) {
var shares = this.shares;
$.each(["url", "text"], function(_, optionName) {
if(optionName !== key)
return;
$.each(shares, function(_, share) {
share[key] = value;
});
});
},
_normalizeShare: function(share) {
if($.isNumeric(share)) {
return this.shares[share];
}
if(typeof share === "string") {
return $.grep(this.shares, function(s) {
return s.share === share;
})[0];
}
return share;
},
refresh: function() {
this._render();
},
destroy: function() {
this._clear();
this._detachWindowResizeCallback();
this._$element
.removeClass(this.elementClass)
.removeData(JSSOCIALS_DATA_KEY);
},
option: function(key, value) {
if(arguments.length === 1) {
return this[key];
}
this[key] = value;
this._passOptionToShares(key, value);
this.refresh();
},
shareOption: function(share, key, value) {
share = this._normalizeShare(share);
if(arguments.length === 2) {
return share[key];
}
share[key] = value;
this.refresh();
}
};
$.fn.jsSocials = function(config) {
var args = $.makeArray(arguments),
methodArgs = args.slice(1),
result = this;
this.each(function() {
var $element = $(this),
instance = $element.data(JSSOCIALS_DATA_KEY),
methodResult;
if(instance) {
if(typeof config === "string") {
methodResult = instance[config].apply(instance, methodArgs);
if(methodResult !== undefined && methodResult !== instance) {
result = methodResult;
return false;
}
} else {
instance._detachWindowResizeCallback();
instance._init(config);
instance._render();
}
} else {
new Socials($element, config);
}
});
return result;
};
var setDefaults = function(config) {
var component;
if($.isPlainObject(config)) {
component = Socials.prototype;
} else {
component = shares[config];
config = arguments[1] || {};
}
$.extend(component, config);
};
var shareStrategies = {
popup: function(args) {
return $("").attr("href", "#")
.on("click", function() {
window.open(args.shareUrl, null, "width=600, height=400, location=0, menubar=0, resizeable=0, scrollbars=0, status=0, titlebar=0, toolbar=0");
return false;
});
},
blank: function(args) {
return $("").attr({ target: "_blank", href: args.shareUrl });
},
self: function(args) {
return $("").attr({ target: "_self", href: args.shareUrl });
}
};
window.jsSocials = {
Socials: Socials,
shares: shares,
shareStrategies: shareStrategies,
setDefaults: setDefaults
};
}(window, jQuery));
(function(window, $, jsSocials, undefined) {
$.extend(jsSocials.shares, {
email: {
label: "E-mail",
logo: "fa fa-at",
shareUrl: "mailto:{to}?subject={text}&body={url}",
countUrl: "",
shareIn: "self"
},
twitter: {
label: "Tweet",
logo: "fa fa-twitter",
shareUrl: "https://twitter.com/share?url={url}&text={text}&via={via}&hashtags={hashtags}",
countUrl: ""
},
facebook: {
label: "Like",
logo: "fa fa-facebook",
shareUrl: "https://facebook.com/sharer/sharer.php?u={url}",
countUrl: "https://graph.facebook.com/?id={url}",
getCount: function(data) {
return data.share && data.share.share_count || 0;
}
},
vkontakte: {
label: "Like",
logo: "fa fa-vk",
shareUrl: "https://vk.com/share.php?url={url}&title={title}&description={text}",
countUrl: "https://vk.com/share.php?act=count&index=1&url={url}",
getCount: function(data) {
return parseInt(data.slice(15, -2).split(', ')[1]);
}
},
googleplus: {
label: "+1",
logo: "fa fa-google",
shareUrl: "https://plus.google.com/share?url={url}",
countUrl: ""
},
linkedin: {
label: "Share",
logo: "fa fa-linkedin",
shareUrl: "https://www.linkedin.com/shareArticle?mini=true&url={url}",
countUrl: "https://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",
getCount: function(data) {
return data.count;
}
},
pinterest: {
label: "Pin it",
logo: "fa fa-pinterest",
shareUrl: "https://pinterest.com/pin/create/bookmarklet/?media={media}&url={url}&description={text}",
countUrl: "https://api.pinterest.com/v1/urls/count.json?&url={url}&callback=?",
getCount: function(data) {
return data.count;
}
},
stumbleupon: {
label: "Share",
logo: "fa fa-stumbleupon",
shareUrl: "http://www.stumbleupon.com/submit?url={url}&title={title}",
countUrl: "https://cors-anywhere.herokuapp.com/https://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}",
getCount: function(data) {
return data.result && data.result.views;
}
},
telegram: {
label: "Telegram",
logo: "fa fa-telegram",
shareUrl: "tg://msg?text={url} {text}",
countUrl: "",
shareIn: "self"
},
whatsapp: {
label: "WhatsApp",
logo: "fa fa-whatsapp",
shareUrl: "whatsapp://send?text={url} {text}",
countUrl: "",
shareIn: "self"
},
line: {
label: "LINE",
logo: "fa fa-comment",
shareUrl: "http://line.me/R/msg/text/?{text} {url}",
countUrl: ""
},
viber: {
label: "Viber",
logo: "fa fa-volume-control-phone",
shareUrl: "viber://forward?text={url} {text}",
countUrl: "",
shareIn: "self"
},
pocket: {
label: "Pocket",
logo: "fa fa-get-pocket",
shareUrl: "https://getpocket.com/save?url={url}&title={title}",
countUrl: ""
},
messenger: {
label: "Share",
logo: "fa fa-commenting",
shareUrl: "fb-messenger://share?link={url}",
countUrl: "",
shareIn: "self"
},
rss: {
label: "RSS",
logo: "fa fa-rss",
shareUrl: "/feeds/",
countUrl: "",
shareIn: "blank"
}
});
}(window, jQuery, window.jsSocials));
/*!
*
* ================== js/libs/plugins/jquery.twentytwenty.js ===================
**/
(function($){
$.fn.twentytwenty = function(options) {
var options = $.extend({
default_offset_pct: 0.5,
orientation: 'horizontal',
before_label: 'Before',
after_label: 'After',
no_overlay: false,
move_slider_on_hover: false,
move_with_handle_only: true,
click_to_move: false
}, options);
return this.each(function() {
var sliderPct = options.default_offset_pct;
var container = $(this);
var sliderOrientation = options.orientation;
var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
container.wrap("");
if(!options.no_overlay) {
container.append("");
var overlay = container.find(".twentytwenty-overlay");
overlay.append("");
overlay.append("");
}
var beforeImg = container.find("img:first");
var afterImg = container.find("img:last");
container.append("");
var slider = container.find(".twentytwenty-handle");
slider.append("");
slider.append("");
container.addClass("twentytwenty-container");
beforeImg.addClass("twentytwenty-before");
afterImg.addClass("twentytwenty-after");
var calcOffset = function(dimensionPct) {
var w = beforeImg.width();
var h = beforeImg.height();
return {
w: w+"px",
h: h+"px",
cw: (dimensionPct*w)+"px",
ch: (dimensionPct*h)+"px"
};
};
var adjustContainer = function(offset) {
if (sliderOrientation === 'vertical') {
beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
}
else {
beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
}
container.css("height", offset.h);
};
var adjustSlider = function(pct) {
var offset = calcOffset(pct);
slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
adjustContainer(offset);
};
// Return the number specified or the min/max number if it outside the range given.
var minMaxNumber = function(num, min, max) {
return Math.max(min, Math.min(max, num));
};
// Calculate the slider percentage based on the position.
var getSliderPercentage = function(positionX, positionY) {
var sliderPercentage = (sliderOrientation === 'vertical') ?
(positionY-offsetY)/imgHeight :
(positionX-offsetX)/imgWidth;
return minMaxNumber(sliderPercentage, 0, 1);
};
$(window).on("resize.twentytwenty", function(e) {
adjustSlider(sliderPct);
});
var offsetX = 0;
var offsetY = 0;
var imgWidth = 0;
var imgHeight = 0;
var onMoveStart = function(e) {
if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
e.preventDefault();
}
else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
e.preventDefault();
}
container.addClass("active");
offsetX = container.offset().left;
offsetY = container.offset().top;
imgWidth = beforeImg.width();
imgHeight = beforeImg.height();
};
var onMove = function(e) {
if (container.hasClass("active")) {
sliderPct = getSliderPercentage(e.pageX, e.pageY);
adjustSlider(sliderPct);
}
};
var onMoveEnd = function() {
container.removeClass("active");
};
var moveTarget = options.move_with_handle_only ? slider : container;
moveTarget.on("movestart",onMoveStart);
moveTarget.on("move",onMove);
moveTarget.on("moveend",onMoveEnd);
if (options.move_slider_on_hover) {
container.on("mouseenter", onMoveStart);
container.on("mousemove", onMove);
container.on("mouseleave", onMoveEnd);
}
slider.on("touchmove", function(e) {
e.preventDefault();
});
container.find("img").on("mousedown", function(event) {
event.preventDefault();
});
if (options.click_to_move) {
container.on('click', function(e) {
offsetX = container.offset().left;
offsetY = container.offset().top;
imgWidth = beforeImg.width();
imgHeight = beforeImg.height();
sliderPct = getSliderPercentage(e.pageX, e.pageY);
adjustSlider(sliderPct);
});
}
$(window).trigger("resize.twentytwenty");
});
};
})(jQuery);
/*!
*
* ================== js/libs/plugins/averta/averta-js-tools.js ===================
**/
/*!
* Averta JavaScript Tools - v1.0.1 (2021-08-24)
*
* A collection of JavaScript files that used in multiple projects
*
* Copyright (c) 2010-2021 Averta (www.averta.net)
* License:
*/
/* -------------------- src/averta-js-normalize.js -------------------- */
/**
* UAParser.js v0.7.9
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2015 Faisal Salman
* Dual licensed under GPLv2 & MIT
*/
(function (window, undefined) {
'use strict';
//////////////
// Constants
/////////////
var LIBVERSION = '0.7.9',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
STR_TYPE = 'string',
MAJOR = 'major', // deprecated
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet',
SMARTTV = 'smarttv',
WEARABLE = 'wearable',
EMBEDDED = 'embedded';
///////////
// Helper
//////////
var util = {
extend : function (regexes, extensions) {
for (var i in extensions) {
if ("browser cpu device engine os".indexOf(i) !== -1 && extensions[i].length % 2 === 0) {
regexes[i] = extensions[i].concat(regexes[i]);
}
}
return regexes;
},
has : function (str1, str2) {
if (typeof str1 === "string") {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
} else {
return false;
}
},
lowerize : function (str) {
return str.toLowerCase();
},
major : function (version) {
return typeof(version) === STR_TYPE ? version.split(".")[0] : undefined;
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
var result, i = 0, j, k, p, q, matches, match, args = arguments;
// loop through all regexes maps
while (i < args.length && !matches) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof result === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof q === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
j = k = 0;
while (j < regex.length && !matches) {
matches = regex[j++].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof q === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof q[1] == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
}
}
i += 2;
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
amazon : {
model : {
'Fire Phone' : ['SD', 'KF']
}
},
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'10' : ['NT 6.4', 'NT 10.0'],
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/([\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/([\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80
], [NAME, VERSION], [
/\s(opr)\/([\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION], [
// Mixed
/(kindle)\/([\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)\/([\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium)\/([\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium
], [NAME, VERSION], [
/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION], [
/(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge
], [NAME, VERSION], [
/(yabrowser)\/([\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION], [
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,
// Chrome/OmniWeb/Arora/Tizen/Nokia
/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i
// UCBrowser/QQBrowser
], [NAME, VERSION], [
/(dolfin)\/([\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION], [
/((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION], [
/XiaoMi\/MiuiBrowser\/([\w\.]+)/i // MIUI Browser
], [VERSION, [NAME, 'MIUI Browser']], [
/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i // Android Browser
], [VERSION, [NAME, 'Android Browser']], [
/FBAV\/([\w\.]+);/i // Facebook App for iOS
], [VERSION, [NAME, 'Facebook']], [
/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, [NAME, 'Mobile Safari']], [
/version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, NAME], [
/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/([\w\.]+)/i, // Konqueror
/(webkit|khtml)\/([\w\.]+)/i
], [NAME, VERSION], [
// Gecko based
/(navigator|netscape)\/([\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION], [
/fxios\/([\w\.-]+)/i // Firefox for iOS
], [VERSION, [NAME, 'Firefox']], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf
/(links)\s\(([\w\.]+)/i, // Links
/(gobrowser)\/?([\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]([\w\.]+)/i // Mosaic
], [NAME, VERSION]
/* /////////////////////
// Media players BEGIN
////////////////////////
, [
/(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia
/(coremedia) v((\d+)[\w\._]+)/i
], [NAME, VERSION], [
/(aqualung|lyssna|bsplayer)\/((\d+)?[\w\.-]+)/i // Aqualung/Lyssna/BSPlayer
], [NAME, VERSION], [
/(ares|ossproxy)\s((\d+)[\w\.-]+)/i // Ares/OSSProxy
], [NAME, VERSION], [
/(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/((\d+)[\w\.-]+)/i,
// Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC
// NSPlayer/PSP-InternetRadioPlayer/Videos
/(clementine|music player daemon)\s((\d+)[\w\.-]+)/i, // Clementine/MPD
/(lg player|nexplayer)\s((\d+)[\d\.]+)/i,
/player\/(nexplayer|lg player)\s((\d+)[\w\.-]+)/i // NexPlayer/LG Player
], [NAME, VERSION], [
/(nexplayer)\s((\d+)[\w\.-]+)/i // Nexplayer
], [NAME, VERSION], [
/(flrp)\/((\d+)[\w\.-]+)/i // Flip Player
], [[NAME, 'Flip Player'], VERSION], [
/(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i
// FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit
], [NAME], [
/(gstreamer) souphttpsrc (?:\([^\)]+\)){0,1} libsoup\/((\d+)[\w\.-]+)/i
// Gstreamer
], [NAME, VERSION], [
/(htc streaming player)\s[\w_]+\s\/\s((\d+)[\d\.]+)/i, // HTC Streaming Player
/(java|python-urllib|python-requests|wget|libcurl)\/((\d+)[\w\.-_]+)/i,
// Java/urllib/requests/wget/cURL
/(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG)
], [NAME, VERSION], [
/(htc_one_s)\/((\d+)[\d\.]+)/i // HTC One S
], [[NAME, /_/g, ' '], VERSION], [
/(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i
// MPlayer SVN
], [NAME, VERSION], [
/(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i // MPlayer
], [NAME, VERSION], [
/(mplayer)/i, // MPlayer (no other info)
/(yourmuze)/i, // YourMuze
/(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime
], [NAME], [
/(nero (?:home|scout))\/((\d+)[\w\.-]+)/i // Nero Home/Nero Scout
], [NAME, VERSION], [
/(nokia\d+)\/((\d+)[\w\.-]+)/i // Nokia
], [NAME, VERSION], [
/\s(songbird)\/((\d+)[\w\.-]+)/i // Songbird/Philips-Songbird
], [NAME, VERSION], [
/(winamp)3 version ((\d+)[\w\.-]+)/i, // Winamp
/(winamp)\s((\d+)[\w\.-]+)/i,
/(winamp)mpeg\/((\d+)[\w\.-]+)/i
], [NAME, VERSION], [
/(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info)
// inlight radio
], [NAME], [
/(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/((\d+)[\w\.-]+)/i
// QuickTime/RealMedia/RadioApp/RadioClientApplication/
// SoundTap/Totem/Stagefright/Streamium
], [NAME, VERSION], [
/(smp)((\d+)[\d\.]+)/i // SMP
], [NAME, VERSION], [
/(vlc) media player - version ((\d+)[\w\.]+)/i, // VLC Videolan
/(vlc)\/((\d+)[\w\.-]+)/i,
/(xbmc|gvfs|xine|xmms|irapp)\/((\d+)[\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp
/(foobar2000)\/((\d+)[\d\.]+)/i, // Foobar2000
/(itunes)\/((\d+)[\d\.]+)/i // iTunes
], [NAME, VERSION], [
/(wmplayer)\/((\d+)[\w\.-]+)/i, // Windows Media Player
/(windows-media-player)\/((\d+)[\w\.-]+)/i
], [[NAME, /-/g, ' '], VERSION], [
/windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i
// Windows Media Server
], [VERSION, [NAME, 'Windows']], [
/(com\.riseupradioalarm)\/((\d+)[\d\.]*)/i // RiseUP Radio Alarm
], [NAME, VERSION], [
/(rad.io)\s((\d+)[\d\.]+)/i, // Rad.io
/(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i
], [[NAME, 'rad.io'], VERSION]
//////////////////////
// Media players END
////////////////////*/
],
cpu : [[
/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64
], [[ARCHITECTURE, 'amd64']], [
/(ia32(?=;))/i // IA32 (quicktime)
], [[ARCHITECTURE, util.lowerize]], [
/((?:i[346]|x)86)[;\)]/i // IA32
], [[ARCHITECTURE, 'ia32']], [
// PocketPC mistakenly identified as PowerPC
/windows\s(ce|mobile);\sppc;/i
], [[ARCHITECTURE, 'arm']], [
/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC
], [[ARCHITECTURE, /ower/, '', util.lowerize]], [
/(sun4\w)[;\)]/i // SPARC
], [[ARCHITECTURE, 'sparc']], [
/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
], [[ARCHITECTURE, util.lowerize]]
],
device : [[
/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook
], [MODEL, VENDOR, [TYPE, TABLET]], [
/applecoremedia\/[\w\.]+ \((ipad)/ // iPad
], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [
/(apple\s{0,1}tv)/i // Apple TV
], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [
/(archos)\s(gamepad2?)/i, // Archos
/(hp).+(touchpad)/i, // HP TouchPad
/(kindle)\/([\w\.]+)/i, // Kindle
/\s(nook)[\w\s]+build\/(\w+)/i, // Nook
/(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak
], [VENDOR, MODEL, [TYPE, TABLET]], [
/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i // Kindle Fire HD
], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [
/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i // Fire Phone
], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [
/\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone
], [MODEL, VENDOR, [TYPE, MOBILE]], [
/\((ip[honed|\s\w*]+);/i // iPod/iPhone
], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [
/(blackberry)[\s-]?(\w+)/i, // BlackBerry
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola/Polytron
/(hp)\s([\w\s]+\w)/i, // HP iPAQ
/(asus)-?(\w+)/i // Asus
], [VENDOR, MODEL, [TYPE, MOBILE]], [
/\(bb10;\s(\w+)/i // BlackBerry 10
], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [
// Asus Tablets
/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i
], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [
/(sony)\s(tablet\s[ps])\sbuild\//i, // Sony
/(sony)?(?:sgp.+)\sbuild\//i
], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [
/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i
], [[VENDOR, 'Sony'], [MODEL, 'Xperia Phone'], [TYPE, MOBILE]], [
/\s(ouya)\s/i, // Ouya
/(nintendo)\s([wids3u]+)/i // Nintendo
], [VENDOR, MODEL, [TYPE, CONSOLE]], [
/android.+;\s(shield)\sbuild/i // Nvidia
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
/(playstation\s[3portablevi]+)/i // Playstation
], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [
/(sprint\s(\w+))/i // Sprint Phones
], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [
/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets
], [VENDOR, MODEL, [TYPE, TABLET]], [
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC
/(zte)-(\w+)*/i, // ZTE
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
/(nexus\s9)/i // HTC Nexus 9
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
/[\s\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox
], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [
/(kin\.[onetw]{3})/i // Microsoft Kin
], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [
// Motorola
/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,
/mot[\s-]?(\w+)*/i,
/(XT\d{3,4}) build\//i
], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [
/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i
], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [
/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i,
/((SM-T\w+))/i
], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung
/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i,
/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,
/sec-((sgh\w+))/i
], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [
/(samsung);smarttv/i
], [VENDOR, MODEL, [TYPE, SMARTTV]], [
/\(dtv[\);].+(aquos)/i // Sharp
], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
/sie-(\w+)*/i // Siemens
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
/(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia
/(nokia)[\s_-]?([\w-]+)*/i
], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [
/android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer
], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
/(lg) netcast\.tv/i // LG SmartTV
], [VENDOR, MODEL, [TYPE, SMARTTV]], [
/(nexus\s[45])/i, // LG
/lg[e;\s\/-]+(\w+)*/i
], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [
/android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo
], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [
/linux;.+((jolla));/i // Jolla
], [VENDOR, MODEL, [TYPE, MOBILE]], [
/((pebble))app\/[\d\.]+\s/i // Pebble
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
/android.+;\s(glass)\s\d/i // Google Glass
], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [
/android.+(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi
/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi
], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable
], [[TYPE, util.lowerize], VENDOR, MODEL]
/*//////////////////////////
// TODO: move to string map
////////////////////////////
/(C6603)/i // Sony Xperia Z C6603
], [[MODEL, 'Xperia Z C6603'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [
/(C6903)/i // Sony Xperia Z 1
], [[MODEL, 'Xperia Z 1'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [
/(SM-G900[F|H])/i // Samsung Galaxy S5
], [[MODEL, 'Galaxy S5'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [
/(SM-G7102)/i // Samsung Galaxy Grand 2
], [[MODEL, 'Galaxy Grand 2'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [
/(SM-G530H)/i // Samsung Galaxy Grand Prime
], [[MODEL, 'Galaxy Grand Prime'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [
/(SM-G313HZ)/i // Samsung Galaxy V
], [[MODEL, 'Galaxy V'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [
/(SM-T805)/i // Samsung Galaxy Tab S 10.5
], [[MODEL, 'Galaxy Tab S 10.5'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [
/(SM-G800F)/i // Samsung Galaxy S5 Mini
], [[MODEL, 'Galaxy S5 Mini'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [
/(SM-T311)/i // Samsung Galaxy Tab 3 8.0
], [[MODEL, 'Galaxy Tab 3 8.0'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [
/(R1001)/i // Oppo R1001
], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [
/(X9006)/i // Oppo Find 7a
], [[MODEL, 'Find 7a'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [
/(R2001)/i // Oppo YOYO R2001
], [[MODEL, 'Yoyo R2001'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [
/(R815)/i // Oppo Clover R815
], [[MODEL, 'Clover R815'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [
/(U707)/i // Oppo Find Way S
], [[MODEL, 'Find Way S'], [VENDOR, 'Oppo'], [TYPE, MOBILE]], [
/(T3C)/i // Advan Vandroid T3C
], [MODEL, [VENDOR, 'Advan'], [TYPE, TABLET]], [
/(ADVAN T1J\+)/i // Advan Vandroid T1J+
], [[MODEL, 'Vandroid T1J+'], [VENDOR, 'Advan'], [TYPE, TABLET]], [
/(ADVAN S4A)/i // Advan Vandroid S4A
], [[MODEL, 'Vandroid S4A'], [VENDOR, 'Advan'], [TYPE, MOBILE]], [
/(V972M)/i // ZTE V972M
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
/(i-mobile)\s(IQ\s[\d\.]+)/i // i-mobile IQ
], [VENDOR, MODEL, [TYPE, MOBILE]], [
/(IQ6.3)/i // i-mobile IQ IQ 6.3
], [[MODEL, 'IQ 6.3'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [
/(i-mobile)\s(i-style\s[\d\.]+)/i // i-mobile i-STYLE
], [VENDOR, MODEL, [TYPE, MOBILE]], [
/(i-STYLE2.1)/i // i-mobile i-STYLE 2.1
], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [
/(mobiistar touch LAI 512)/i // mobiistar touch LAI 512
], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [
/////////////
// END TODO
///////////*/
],
engine : [[
/windows.+\sedge\/([\w\.]+)/i // EdgeHTML
], [VERSION, [NAME, 'EdgeHTML']], [
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes)
], [NAME, VERSION], [
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)[\/\s]([\w\.]+)/i, // Tizen
/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki
/linux;.+(sailfish);/i // Sailfish OS
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION], [
/\((series40);/i // Series 40
], [NAME], [
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,
/(macintosh|mac(?=_powerpc)\s)/i // Mac OS
], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
// Other
/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring, extensions) {
if (!(this instanceof UAParser)) {
return new UAParser(uastring, extensions).getResult();
}
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
this.getBrowser = function () {
var browser = mapper.rgx.apply(this, rgxmap.browser);
browser.major = util.major(browser.version);
return browser;
};
this.getCPU = function () {
return mapper.rgx.apply(this, rgxmap.cpu);
};
this.getDevice = function () {
return mapper.rgx.apply(this, rgxmap.device);
};
this.getEngine = function () {
return mapper.rgx.apply(this, rgxmap.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, rgxmap.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS(),
device : this.getDevice(),
cpu : this.getCPU()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
return this;
};
UAParser.VERSION = LIBVERSION;
UAParser.BROWSER = {
NAME : NAME,
MAJOR : MAJOR, // deprecated
VERSION : VERSION
};
UAParser.CPU = {
ARCHITECTURE : ARCHITECTURE
};
UAParser.DEVICE = {
MODEL : MODEL,
VENDOR : VENDOR,
TYPE : TYPE,
CONSOLE : CONSOLE,
MOBILE : MOBILE,
SMARTTV : SMARTTV,
TABLET : TABLET,
WEARABLE: WEARABLE,
EMBEDDED: EMBEDDED
};
UAParser.ENGINE = {
NAME : NAME,
VERSION : VERSION
};
UAParser.OS = {
NAME : NAME,
VERSION : VERSION
};
///////////
// Export
//////////
// check js environment
if (typeof(exports) !== UNDEF_TYPE) {
// nodejs env
if (typeof module !== UNDEF_TYPE && module.exports) {
exports = module.exports = UAParser;
}
exports.UAParser = UAParser;
} else {
// requirejs env (optional)
if (typeof(define) === FUNC_TYPE && define.amd) {
define(function () {
return UAParser;
});
} else {
// browser env
window.UAParser = UAParser;
}
}
// jQuery/Zepto specific (optional)
// Note:
// In AMD env the global scope should be kept clean, but jQuery is an exception.
// jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
// and we should catch that.
var $ = window.jQuery || window.Zepto;
if (typeof $ !== UNDEF_TYPE) {
var parser = new UAParser();
$.ua = parser.getResult();
$.ua.get = function() {
return parser.getUA();
};
$.ua.set = function (uastring) {
parser.setUA(uastring);
var result = parser.getResult();
for (var prop in result) {
$.ua[prop] = result[prop];
}
};
}
})(typeof window === 'object' ? window : this);
window.averta = {};
;(function($){
//"use strict";
window.package = function(name){
if(!window[name]) window[name] = {};
};
var extend = function(target , object){
for(var key in object) target[key] = object[key];
};
Function.prototype.extend = function(superclass){
if(typeof superclass.prototype.constructor === "function"){
extend(this.prototype , superclass.prototype);
this.prototype.constructor = this;
}else{
this.prototype.extend(superclass);
this.prototype.constructor = this;
}
};
// Converts JS prefix to CSS prefix
var trans = {
'Moz' : '-moz-',
'Webkit' : '-webkit-',
'Khtml' : '-khtml-' ,
'O' : '-o-',
'ms' : '-ms-',
'Icab' : '-icab-'
};
window._mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
window._touch = 'ontouchstart' in document;
// Thanks to LEA VEROU
// http://lea.verou.me/2009/02/find-the-vendor-prefix-of-the-current-browser/
function getVendorPrefix() {
if('result' in arguments.callee) return arguments.callee.result;
var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;
var someScript = document.getElementsByTagName('script')[0];
for(var prop in someScript.style){
if(regex.test(prop)){
return arguments.callee.result = prop.match(regex)[0];
}
}
if('WebkitOpacity' in someScript.style) return arguments.callee.result = 'Webkit';
if('KhtmlOpacity' in someScript.style) return arguments.callee.result = 'Khtml';
return arguments.callee.result = '';
}
// Thanks to Steven Benner.
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
window.parseQueryString = function(url){
var queryString = {};
url.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
return queryString;
};
function checkStyleValue(prop){
var b = document.body || document.documentElement;
var s = b.style;
var p = prop;
if(typeof s[p] == 'string') {return true; }
// Tests for vendor specific prop
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'],
p = p.charAt(0).toUpperCase() + p.substr(1);
for(var i=0; i 0 && has3d !== "none");
}
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x ) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = function ( callback, element ) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
if ( !window.cancelAnimationFrame ) {
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}
if (!window.getComputedStyle) {
window.getComputedStyle = function(el, pseudo) {
this.el = el;
this.getPropertyValue = function(prop) {
var re = /(\-([a-z]){1})/g;
if (prop == 'float') prop = 'styleFloat';
if (re.test(prop)) {
prop = prop.replace(re, function () {
return arguments[2].toUpperCase();
});
}
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
};
return el.currentStyle;
};
}
// IE8 Array indexOf fix
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(elt /*, from*/) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
$.removeDataAttrs = function($target, exclude) {
var i,
attrName,
dataAttrsToDelete = [],
dataAttrs = $target[0].attributes,
dataAttrsLen = dataAttrs.length;
exclude = exclude || [];
// loop through attributes and make a list of those
// that begin with 'data-'
for (i=0; i') !== -1) {
return eval( ieVer + version );
} else {
return eval( version + '==' + ieVer );
}
} else {
return version == ieVer;
}
}
browser.webkit = AuxUserAgent.engine.name === 'WebKit';
browser.firefox = browser.name === 'Firefox';
browser.opera = browser.name === 'Opera';
browser.chrome = browser.name === 'Chrome';
browser.safari = browser.name === 'Safari';
browser.msie = browser.name === 'IE';
averta.browser = browser;
window.AuxBrowser = browser;
})();
/* ----------------------------------------------------------------------------------- */
if ( $ ) {
$.fn.preloadImg = function(src , _event){
this.each(function(){
var $this = $(this);
var self = this;
var img = new Image();
img.onload = function(event){
if(event == null) event = {}; // IE8
$this.attr('src' , src);
event.width = img.width;
event.height = img.height;
$this.data('width', img.width);
$this.data('height', img.height);
setTimeout(function(){_event.call(self , event);},50);
img = null;
};
img.src = src;
});
return this;
};
$(document).ready(function(){
window._jcsspfx = getVendorPrefix(); // JS CSS VendorPrefix
window._csspfx = trans[window._jcsspfx]; // CSS VendorPrefix
window._cssanim = supportsTransitions();
window._css3d = supports3DTransforms();
window._css2d = supportsTransforms();
});
}
/* ------------------------------------------------------------------------------ */
/*\
|*|
|*| Polyfill which enables the passage of arbitrary arguments to the
|*| callback functions of JavaScript timers (HTML5 standard syntax).
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/window.setInterval
|*|
|*| Syntax:
|*| var timeoutID = window.setTimeout(func, delay, [param1, param2, ...]);
|*| var timeoutID = window.setTimeout(code, delay);
|*| var intervalID = window.setInterval(func, delay[, param1, param2, ...]);
|*| var intervalID = window.setInterval(code, delay);
|*|
\*/
(function() {
setTimeout(function(arg1) {
if (arg1 === 'test') {
// feature test is passed, no need for polyfill
return;
}
var __nativeST__ = window.setTimeout;
window.setTimeout = function(vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */ ) {
var aArgs = Array.prototype.slice.call(arguments, 2);
return __nativeST__(vCallback instanceof Function ? function() {
vCallback.apply(null, aArgs);
} : vCallback, nDelay);
};
}, 0, 'test');
var interval = setInterval(function(arg1) {
clearInterval(interval);
if (arg1 === 'test') {
// feature test is passed, no need for polyfill
return;
}
var __nativeSI__ = window.setInterval;
window.setInterval = function(vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */ ) {
var aArgs = Array.prototype.slice.call(arguments, 2);
return __nativeSI__(vCallback instanceof Function ? function() {
vCallback.apply(null, aArgs);
} : vCallback, nDelay);
};
}, 0, 'test');
}());
})(jQuery);
/* -------------------- src/averta-js-timer.js -------------------- */
/**
* Ticker Class
* Author: Averta Ltd
*/
;(function(){
"use strict";
averta.Ticker = function(){};
var st = averta.Ticker,
list = [],
len = 0,
__stopped = true;
st.add = function (listener , ref){
list.push([listener , ref]);
if(list.length === 1) st.start();
len = list.length;
return len;
};
st.remove = function (listener , ref) {
for(var i = 0 , l = list.length ; i Math.abs(new_y - this.start_y))
return new_x <= this.start_x ? 'left' : 'right';
else
return new_y <= this.start_y ? 'up' : 'down';
break;
}
};
p._priventDefultEvent = function(new_x , new_y){
//if(this.priventEvt != null) return this.priventEvt;
var dx = Math.abs(new_x - this.start_x);
var dy = Math.abs(new_y - this.start_y);
var horiz = dx > dy;
return (this.swipeType === 'horizontal' && horiz) ||
(this.swipeType === 'vertical' && !horiz);
//return this.priventEvt;
};
p._createStatusObject = function(evt){
var status_data = {} , temp_x , temp_y;
temp_x = this.lastStatus.distanceX || 0;
temp_y = this.lastStatus.distanceY || 0;
status_data.distanceX = evt.pageX - this.start_x;
status_data.distanceY = evt.pageY - this.start_y;
status_data.moveX = status_data.distanceX - temp_x;
status_data.moveY = status_data.distanceY - temp_y;
status_data.distance = parseInt( Math.sqrt(Math.pow(status_data.distanceX , 2) + Math.pow(status_data.distanceY , 2)) );
status_data.duration = new Date().getTime() - this.start_time;
status_data.direction = this._getDirection(evt.pageX , evt.pageY);
return status_data;
};
/* ------------------------------------------------------------------------------ */
p._reset = function( event ) {
this.reset = false;
this.lastStatus = {};
this.start_time = new Date().getTime();
this.start_x = isTouch ? event.touches[0].pageX : event.pageX;
this.start_y = isTouch ? event.touches[0].pageY : event.pageY;
};
p._touchStart = function( event ) {
if ( !this.enabled ) {
return;
}
if ( event.target.closest(this.noSwipeSelector, this.$element) ) {
return;
}
if ( usePointer ) {
this.element.style.msTouchAction = this.swipeType === 'horizontal' ? 'pan-y' : 'pan-x';
}
if ( !this.onSwipe ) {
console.log( 'Swipe listener is undefined' );
return;
}
if ( this.touchStarted ) {
return;
}
var swipeEvent = isTouch ? event.touches[0] : event;
this.start_x = swipeEvent.pageX;
this.start_y = swipeEvent.pageY;
this.start_time = new Date().getTime();
this._bindEvents( document, ev_end, this._touchEnd );
this._bindEvents( document, ev_move, this._touchMove );
this._bindEvents( document, ev_cancel, this._touchCancel );
var status = this._createStatusObject( swipeEvent );
status.phase = 'start';
this.onSwipe.call( null , status );
if( !isTouch ) {
event.preventDefault();
}
this.lastStatus = status;
this.touchStarted = true;
};
p._touchMove = function( event ) {
if ( !this.touchStarted ) return;
clearTimeout(this.timo);
this.timo = setTimeout( function() {
this._reset(event);
}, 60);
var swipeEvent = isTouch ? event.touches[0] : event;
var status = this._createStatusObject( swipeEvent );
if ( this._priventDefultEvent( swipeEvent.pageX , swipeEvent.pageY ) ) {
event.preventDefault();
}
status.phase = 'move';
//if(this.lastStatus.direction !== status.direction) this._reset(event , jqevt);
this.lastStatus = status;
this.onSwipe.call( null , status );
};
p._touchEnd = function( event ) {
if ( !this.touchStarted ) {
return
}
clearTimeout(this.timo);
var swipeEvent = isTouch ? event.touches[0] : event;
var status = this.lastStatus;
if ( !isTouch ){
event.preventDefault();
}
status.phase = 'end';
this.touchStarted = false;
this.priventEvt = null;
this._unbindEvents( document ,ev_end , this._touchEnd);
this._unbindEvents( document ,ev_move , this._touchMove);
this._unbindEvents( document ,ev_cancel , this._touchCancel);
status.speed = status.distance / status.duration;
this.onSwipe.call( null, status );
};
p._touchCancel = function( event ) {
this._touchEnd( event );
};
p.enable = function(){
this.enabled = true;
};
p.disable = function(){
this.enabled = false;
};
})( window, document );
/* ------------------------------------------------------------------------------ */
// Element.closest polyfill
// From https://github.com/jonathantneal/closest
(function (ElementProto) {
if (typeof ElementProto.matches !== 'function') {
ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
var element = this;
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
var index = 0;
while (elements[index] && elements[index] !== element) {
++index;
}
return Boolean(elements[index]);
};
}
if (typeof ElementProto.closest !== 'function') {
ElementProto.closest = function closest(selector) {
var element = this;
while (element && element.nodeType === 1) {
if (element.matches(selector)) {
return element;
}
element = element.parentNode;
}
return null;
};
}
})(window.Element.prototype);
/* ------------------------------------------------------------------------------ */
;
/* -------------------- src/averta-js-aligner.js -------------------- */
;(function(){
"use strict";
window.AVTAligner = function(type , $container , $img, options ){
this.$container = $container;
this.$img = $img;
this.img = $img[0];
this.options = options || {};
this.type = type || 'stretch'; // fill , fit , stretch , tile , center
this.widthOnly = false;
this.heightOnly = false;
};
var p = AVTAligner.prototype;
/*-------------- METHODS --------------*/
p.init = function(w , h){
w = w || this.img.naturalWidth;
h = h || this.img.naturalHeight;
this.baseWidth = w;
this.baseHeight = h;
this.imgRatio = w / h;
this.imgRatio2 = h / w;
switch(this.type){
case 'tile':
this.$container.css('background-image' , 'url('+ this.$img.attr('src') +')');
this.$img.hide();
break;
case 'center':
this.$container.css('background-image' , 'url('+ this.$img.attr('src') +')');
this.$container.css({
backgroundPosition : 'center center',
backgroundRepeat : 'no-repeat'
});
this.$img.hide();
break;
case 'stretch':
this.$img.css({
width : '100%',
height : '100%'
});
break;
case 'fill':
case 'fit' :
this.needAlign = true;
this.align();
break;
}
if ( this.options.srcset ) {
this.$img.on('load', function( e ){
// update aspects and realign image
var img = e.target,
w = img.naturalWidth || this.$img.width(),
h = img.naturalHeight || this.$image.height();
this.baseWidth = w;
this.baseHeight = h;
this.imgRatio = w / h;
this.imgRatio2 = h / w;
this.align();
}.bind(this));
}
};
p.align = function(){
if(!this.needAlign) return;
this.cont_w = this.options.containerWidth ? this.options.containerWidth() : this.$container.width();
this.cont_h = this.options.containerHeight ? this.options.containerHeight() : this.$container.height();
var contRatio = this.cont_w / this.cont_h;
if(this.type == 'fill'){
if(this.imgRatio < contRatio ){
this.$img.width(this.cont_w);
this.$img.height(this.cont_w * this.imgRatio2);
}else{
this.$img.height(this.cont_h);
this.$img.width(this.cont_h * this.imgRatio);
}
}else if(this.type == 'fit'){
if(this.imgRatio < contRatio){
this.$img.height(this.cont_h);
this.$img.width(this.cont_h * this.imgRatio);
}else{
this.$img.width(this.cont_w);
this.$img.height(this.cont_w * this.imgRatio2);
}
}
this.setMargin();
};
p.setMargin = function(){
var position = this.options.position || 'cm',
img = this.$img[0];
switch( position.charAt(0) ) {
case 'l':
img.style.marginLeft = 0;
break;
case 'r':
img.style.marginLeft = this.cont_w - img.offsetWidth + 'px';
break;
case 'c':
default:
img.style.marginLeft = (this.cont_w - img.offsetWidth ) / 2 + 'px';
}
switch( position.charAt(1) ) {
case 't':
img.style.marginTop = 0;
break;
case 'b':
img.style.marginTop = this.cont_h - img.offsetHeight + 'px';
break;
case 'm':
default:
img.style.marginTop = (this.cont_h - img.offsetHeight ) / 2 + 'px';
}
};
})();
/* -------------------- src/averta-js-csstweener.js -------------------- */
;(function(){
"use strict";
var evt = null;
window.CSSTween = function(element , duration , delay , ease){
if ( element.jquery ) {
if ( !element.length ) {
return;
}
element = element[0];
}
this.element = element;
this.duration = duration || 1000;
this.delay = delay || 0;
this.ease = ease || 'linear';
/*if(!evt){
if(window._jcsspfx === 'O')
evt = 'otransitionend';
else if(window._jcsspfx == 'Webkit')
evt = 'webkitTransitionEnd';
else
evt = 'transitionend' ;
}*/
};
var p = CSSTween.prototype;
/*-------------- METHODS --------------*/
p.to = function(callback , target){
this.to_cb = callback;
this.to_cb_target = target;
return this;
};
p.from = function(callback , target ){
this.fr_cb = callback;
this.fr_cb_target = target;
return this;
};
p.onComplete = function(callback ,target){
this.oc_fb = callback;
this.oc_fb_target = target;
return this;
};
p.chain = function(csstween){
this.chained_tween = csstween;
return this;
};
p.reset = function(){
//element.removeEventListener(evt , this.onTransComplete , true);
clearTimeout(this.start_to);
clearTimeout(this.end_to);
};
p.start = function(){
var element = this.element;
clearTimeout(this.start_to);
clearTimeout(this.end_to);
this.fresh = true;
if(this.fr_cb){
element.style[window._jcsspfx + 'TransitionDuration'] = '0ms';
this.fr_cb.call(this.fr_cb_target);
}
var that = this;
this.onTransComplete = function(event){
if(!that.fresh) return;
//that.$element[0].removeEventListener(evt , this.onTransComplete, true);
//event.stopPropagation();
that.reset();
element.style[window._jcsspfx + 'TransitionDuration'] = '';
element.style[window._jcsspfx + 'TransitionProperty'] = '';
element.style[window._jcsspfx + 'TransitionTimingFunction'] = '';
element.style[window._jcsspfx + 'TransitionDelay'] = '';
that.fresh = false;
if(that.chained_tween) that.chained_tween.start();
if(that.oc_fb) that.oc_fb.call(that.oc_fb_target);
};
this.start_to = setTimeout(function(){
if ( !that.element ) return;
element.style[window._jcsspfx + 'TransitionDuration'] = that.duration + 'ms';
element.style[window._jcsspfx + 'TransitionProperty'] = that.transProperty || 'all';
if(that.delay > 0) element.style[window._jcsspfx + 'TransitionDelay'] = that.delay + 'ms';
else element.style[window._jcsspfx + 'TransitionDelay'] = '';
element.style[window._jcsspfx + 'TransitionTimingFunction'] = that.ease;
if(that.to_cb) that.to_cb.call(that.to_cb_target);
//that.$element[0].addEventListener(evt , that.onTransComplete , true );
that.end_to = setTimeout(function(){that.onTransComplete();} , that.duration + (that.delay || 0));
} , 10);
return this;
};
})();
/**
* Cross Tween Class
*/
;(function(){
"use strict";
var _cssanim = null;
window.CTween = {};
CTween.animate = function(element , duration , properties , options){
if(_cssanim == null) _cssanim = window._cssanim;
options = options || {};
if(_cssanim){
var tween = new CSSTween(element , duration , options.delay , EaseDic[options.ease]);
if ( options.transProperty ) {
tween.transProperty = options.transProperty;
}
tween.to(function(){ element.css(properties);});
if(options.complete) tween.onComplete(options.complete , options.target);
tween.start();
tween.stop = tween.reset;
return tween;
}
var onCl;
if(options.delay) element.delay(options.delay);
if(options.complete)
onCl = function(){
options.complete.call(options.target);
};
element.stop(true).animate(properties , duration , options.ease || 'linear' , onCl);
return element;
};
CTween.fadeOut = function(target , duration , remove) {
var options = {};
if(remove === true) {
options.complete = function(){target.remove();};
} else if ( remove === 2 ) {
options.complete = function(){target.css('display', 'none');};
}
CTween.animate(target , duration || 1000 , {opacity : 0} , options);
};
CTween.fadeIn = function(target , duration, reset){
if( reset !== false ) {
target.css('opacity' , 0).css('display', '');
}
CTween.animate(target , duration || 1000 , {opacity : 1});
};
})();
;(function(){
// Thanks to matthewlein
// https://github.com/matthewlein/Ceaser
window.EaseDic = {
'linear' : 'linear',
'ease' : 'ease',
'easeIn' : 'ease-in',
'easeOut' : 'ease-out',
'easeInOut' : 'ease-in-out',
'easeInCubic' : 'cubic-bezier(.55,.055,.675,.19)',
'easeOutCubic' : 'cubic-bezier(.215,.61,.355,1)',
'easeInOutCubic' : 'cubic-bezier(.645,.045,.355,1)',
'easeInCirc' : 'cubic-bezier(.6,.04,.98,.335)',
'easeOutCirc' : 'cubic-bezier(.075,.82,.165,1)',
'easeInOutCirc' : 'cubic-bezier(.785,.135,.15,.86)',
'easeInExpo' : 'cubic-bezier(.95,.05,.795,.035)',
'easeOutExpo' : 'cubic-bezier(.19,1,.22,1)',
'easeInOutExpo' : 'cubic-bezier(1,0,0,1)',
'easeInQuad' : 'cubic-bezier(.55,.085,.68,.53)',
'easeOutQuad' : 'cubic-bezier(.25,.46,.45,.94)',
'easeInOutQuad' : 'cubic-bezier(.455,.03,.515,.955)',
'easeInQuart' : 'cubic-bezier(.895,.03,.685,.22)',
'easeOutQuart' : 'cubic-bezier(.165,.84,.44,1)',
'easeInOutQuart' : 'cubic-bezier(.77,0,.175,1)',
'easeInQuint' : 'cubic-bezier(.755,.05,.855,.06)',
'easeOutQuint' : 'cubic-bezier(.23,1,.32,1)',
'easeInOutQuint' : 'cubic-bezier(.86,0,.07,1)',
'easeInSine' : 'cubic-bezier(.47,0,.745,.715)',
'easeOutSine' : 'cubic-bezier(.39,.575,.565,1)',
'easeInOutSine' : 'cubic-bezier(.445,.05,.55,.95)',
'easeInBack' : 'cubic-bezier(.6,-.28,.735,.045)',
'easeOutBack' : 'cubic-bezier(.175, .885,.32,1.275)',
'easeInOutBack' : 'cubic-bezier(.68,-.55,.265,1.55)'
};
})();
/* -------------------- src/averta-js-slickcontroller.js -------------------- */
/**
* Slick controller
* version 1.1.2
*
* @author averta
*
* Copyright © 2015, Averta Ltd. All rights reserved.
*/
;(function(){
"use strict";
var _options = {
bouncing : true,
snapping : false,
snapsize : null,
friction : 0.05,
outFriction : 0.05,
outAcceleration : 0.09,
minValidDist : 0.3,
snappingMinSpeed : 2,
paging : false,
endless : false,
maxSpeed : 160
};
var SlickController = function(min , max , options){
if(max === null || min === null) {
throw new Error('Max and Min values are required.');
}
this.options = options || {};
for(var key in _options){
if(!(key in this.options))
this.options[key] = _options[key];
}
this._max_value = max;
this._min_value = min;
this.value = min;
this.end_loc = min;
this.current_snap = this.getSnapNum(min);
this.__extrStep = 0;
this.__extraMove = 0;
this.__animID = -1;
};
var p = SlickController.prototype;
/*
---------------------------------------------------
PUBLIC METHODS
----------------------------------------------------
*/
p.changeTo = function(value , animate , speed , snap_num , dispatch) {
this.stopped = false;
this._internalStop();
value = this._checkLimits(value);
speed = Math.abs(speed || 0);
if(this.options.snapping){
snap_num = snap_num || this.getSnapNum(value);
if( dispatch !== false )this._callsnapChange(snap_num);
this.current_snap = snap_num;
}
if(animate){
this.animating = true;
var self = this,
active_id = ++self.__animID,
amplitude = value - self.value,
timeStep = 0,
targetPosition = value,
animFrict = 1 - self.options.friction,
timeconst = animFrict + (speed - 20) * animFrict * 1.3 / self.options.maxSpeed;
var tick = function(){
if(active_id !== self.__animID) return;
var dis = value - self.value;
if( Math.abs(dis) > self.options.minValidDist && self.animating ){
window.requestAnimationFrame(tick);
} else {
if( self.animating ){
self.value = value;
self._callrenderer();
}
self.animating = false;
if( active_id !== self.__animID ){
self.__animID = -1;
}
self._callonComplete('anim');
return;
}
//self.value += dis * timeconst
self.value = targetPosition - amplitude * Math.exp(-++timeStep * timeconst);
self._callrenderer();
};
tick();
return;
}
this.value = value;
this._callrenderer();
};
p.drag = function(move){
if(this.start_drag){
this.drag_start_loc = this.value;
this.start_drag = false;
}
this.animating = false;
this._deceleration = false;
this.value -= move;
if ( !this.options.endless && (this.value > this._max_value || this.value < 0)) {
if (this.options.bouncing) {
this.__isout = true;
this.value += move * 0.6;
} else if (this.value > this._max_value) {
this.value = this._max_value;
} else {
this.value = 0;
}
}else if(!this.options.endless && this.options.bouncing){
this.__isout = false;
}
this._callrenderer();
};
p.push = function(speed){
this.stopped = false;
if(this.options.snapping && Math.abs(speed) <= this.options.snappingMinSpeed){
this.cancel();
return;
}
this.__speed = speed;
this.__startSpeed = speed;
this.end_loc = this._calculateEnd();
if(this.options.snapping){
var snap_loc = this.getSnapNum(this.value),
end_snap = this.getSnapNum(this.end_loc);
if(this.options.paging){
snap_loc = this.getSnapNum(this.drag_start_loc);
this.__isout = false;
if(speed > 0){
this.gotoSnap(snap_loc + 1 , true , speed);
}else{
this.gotoSnap(snap_loc - 1 , true , speed);
}
return;
}else if(snap_loc === end_snap){
this.cancel();
return;
}
this._callsnapChange(end_snap);
this.current_snap = end_snap;
}
this.animating = false;
this.__needsSnap = this.options.endless || (this.end_loc > this._min_value && this.end_loc < this._max_value) ;
if(this.options.snapping && this.__needsSnap)
this.__extraMove = this._calculateExtraMove(this.end_loc);
this._startDecelaration();
};
p.bounce = function(speed){
if(this.animating) return;
this.stopped = false;
this.animating = false;
this.__speed = speed;
this.__startSpeed = speed;
this.end_loc = this._calculateEnd();
//if(this.options.paging){}
this._startDecelaration();
};
p.stop = function(){
this.stopped = true;
this._internalStop();
};
p.cancel = function(){
this.start_drag = true; // reset flag for next drag
if(this.__isout){
this.__speed = 0.0004;
this._startDecelaration();
}else if(this.options.snapping){
this.gotoSnap(this.getSnapNum(this.value) , true);
}
};
p.renderCallback = function(listener , ref){
this.__renderHook = {fun:listener , ref:ref};
};
p.snappingCallback = function(listener , ref){
this.__snapHook = {fun:listener , ref:ref};
};
p.snapCompleteCallback = function(listener , ref){
this.__compHook = {fun:listener , ref:ref};
};
p.getSnapNum = function(value){
return Math.floor(( value + this.options.snapsize / 2 ) / this.options.snapsize);
};
p.nextSnap = function(animate, speed){
this._internalStop();
var curr_snap = this.getSnapNum(this.value),
snapsize = this.options.snapsize;
if(!this.options.endless && (curr_snap + 1) * snapsize > this._max_value){
// if distance is larger than 10% of snap size, it moves to the end location without bounce.
if ( this._max_value - this.value > snapsize * 0.1 ) {
this.changeTo(this._max_value, true);
return;
}
this.__speed = 8;
this.__needsSnap = false;
this._startDecelaration();
}else{
this.gotoSnap(curr_snap + 1 , true);
}
};
p.prevSnap = function(animate, speed){
this._internalStop();
var curr_snap = this.getSnapNum(this.value),
snapsize = this.options.snapsize;
if(!this.options.endless && (curr_snap - 1) * snapsize < this._min_value){
// if distance is larger than 10% of snap size, it moves to the start location without bounce.
if ( this.value - this._min_value > snapsize * 0.1 ) {
this.changeTo(this._min_value, true);
return;
}
this.__speed = -8;
this.__needsSnap = false;
this._startDecelaration();
}else{
this.gotoSnap(curr_snap - 1 , true);
}
};
p.gotoSnap = function(snap_num , animate , speed){
this.changeTo(snap_num * this.options.snapsize , animate , speed , snap_num);
};
p.destroy = function(){
this._internalStop();
this.__renderHook = null;
this.__snapHook = null;
this.__compHook = null;
};
/*
---------------------------------------------------
PRIVATE METHODS
----------------------------------------------------
*/
p._internalStop = function(){
this.start_drag = true; // reset flag for next drag
this.animating = false;
this._deceleration = false;
this.__extrStep = 0;
};
p._calculateExtraMove = function(value){
var m = value % this.options.snapsize;
return m < this.options.snapsize / 2 ? -m : this.options.snapsize - m;
};
p._calculateEnd = function(step){
var temp_speed = this.__speed;
var temp_value = this.value;
var i = 0;
while(Math.abs(temp_speed) > this.options.minValidDist){
temp_value += temp_speed;
temp_speed *= this.options.friction;
i++;
}
if(step) return i;
return temp_value;
};
p._checkLimits = function(value){
if(this.options.endless) return value;
if(value < this._min_value) return this._min_value;
if(value > this._max_value) return this._max_value;
return value;
};
p._callrenderer = function(){
if(this.__renderHook) this.__renderHook.fun.call(this.__renderHook.ref , this , this.value);
};
p._callsnapChange = function(targetSnap){
if(!this.__snapHook || targetSnap === this.current_snap) return;
this.__snapHook.fun.call(this.__snapHook.ref , this , targetSnap , targetSnap - this.current_snap);
};
p._callonComplete = function(type){
if(this.__compHook && !this.stopped){
this.__compHook.fun.call(this.__compHook.ref , this , this.current_snap , type);
}
};
p._computeDeceleration = function(){
if(this.options.snapping && this.__needsSnap){
var xtr_move = (this.__startSpeed - this.__speed) / this.__startSpeed * this.__extraMove;
this.value += this.__speed + xtr_move - this.__extrStep;
this.__extrStep = xtr_move;
}else{
this.value += this.__speed;
}
this.__speed *= this.options.friction; //* 10;
if(!this.options.endless && !this.options.bouncing){
if(this.value <= this._min_value){
this.value = this._min_value;
this.__speed = 0;
}else if(this.value >= this._max_value){
this.value = this._max_value;
this.__speed = 0;
}
}
this._callrenderer();
if(!this.options.endless && this.options.bouncing){
var out_value = 0;
if(this.value < this._min_value){
out_value = this._min_value - this.value;
}else if(this.value > this._max_value){
out_value = this._max_value - this.value;
}
this.__isout = Math.abs(out_value) >= this.options.minValidDist;
if(this.__isout){
if(this.__speed * out_value <= 0){
this.__speed += out_value * this.options.outFriction;
}else {
this.__speed = out_value * this.options.outAcceleration;
}
}
}
};
p._startDecelaration = function(){
if(this._deceleration) return;
this._deceleration = true;
var self = this;
var tick = function (){
if(!self._deceleration) return;
self._computeDeceleration();
if(Math.abs(self.__speed) > self.options.minValidDist || self.__isout){
window.requestAnimationFrame(tick);
}else{
self._deceleration = false;
self.__isout = false;
if(self.__needsSnap && self.options.snapping && !self.options.paging){
self.value = self._checkLimits(self.end_loc + self.__extraMove);
}else{
self.value = Math.round(self.value);
}
self._callrenderer();
self._callonComplete('decel');
}
};
tick();
};
window.SlickController = SlickController;
})();
/*!
*
* ================== js/libs/modules/highlight.pack.js ===================
**/
/*! highlight.js v9.3.0 | BSD3 License | git.io/hljslicense */
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(//gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return w(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(w(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset"}function u(e){f+=""+t(e)+">"}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,f="",l=[];e.length||r.length;){var g=i();if(f+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){l.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);l.reverse().forEach(o)}else"start"==g[0].event?l.push(g[0].node):l.pop(),c(g.splice(0,1)[0])}return f+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var f=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=f.length?t(f.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){for(var t=0;t";return i+=e+'">',i+n+o}function h(){if(!k.k)return n(M);var e="",t=0;k.lR.lastIndex=0;for(var r=k.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(k,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=k.lR.lastIndex,r=k.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof k.sL;if(e&&!R[k.sL])return n(M);var t=e?f(k.sL,M,!0,y[k.sL]):l(M,k.sL.length?k.sL:void 0);return k.r>0&&(B+=t.r),e&&(y[k.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=void 0!==k.sL?d():h(),M=""}function v(e,n){L+=e.cN?p(e.cN,"",!0):"",k=Object.create(e,{parent:{value:k}})}function m(e,n){if(M+=e,void 0===n)return b(),0;var t=o(n,k);if(t)return t.skip?M+=n:(t.eB&&(M+=n),b(),t.rB||t.eB||(M=n)),v(t,n),t.rB?0:n.length;var r=u(k,n);if(r){var a=k;a.skip?M+=n:(a.rE||a.eE||(M+=n),b(),a.eE&&(M=n));do k.cN&&(L+=""),k.skip||(B+=k.r),k=k.parent;while(k!=r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,k))throw new Error('Illegal lexeme "'+n+'" for mode "'+(k.cN||"")+'"');return M+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var x,k=i||N,y={},L="";for(x=k;x!=N;x=x.parent)x.cN&&(L=p(x.cN,"",!0)+L);var M="",B=0;try{for(var C,j,I=0;;){if(k.t.lastIndex=I,C=k.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),x=k;x.parent;x=x.parent)x.cN&&(L+="");return{r:B,value:L,language:e,top:k}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function l(e,t){t=t||E.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function g(e){return E.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,E.tabReplace)})),E.useBR&&(e=e.replace(/\n/g,"
")),e}function p(e,n,t){var r=n?x[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n=i(e);if(!a(n)){var t;E.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/
/g,"\n")):t=e;var r=t.textContent,o=n?f(n,r,!0):l(r),s=u(t);if(s.length){var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");h.innerHTML=o.value,o.value=c(s,u(h),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=p(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){E=o(E,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,h)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){x[e]=n})}function N(){return Object.keys(R)}function w(e){return e=(e||"").toLowerCase(),R[e]||R[x[e]]}var E={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},x={};return e.highlight=f,e.highlightAuto=l,e.fixMarkup=g,e.highlightBlock=h,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/,r:0,c:[{cN:"attr",b:e,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("java",function(e){var t=e.UIR+"(<"+e.UIR+"(\\s*,\\s*"+e.UIR+")*>)?",a="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports",r="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",s={cN:"number",b:r,r:0};return{aliases:["jsp"],k:a,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:a,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},s,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("ruby",function(e){var r="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",b={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},c={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[c]}),e.C("^\\=begin","^\\=end",{c:[c],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:b},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:b},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:r}),i].concat(s)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[t,{b:r}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:b},{b:"("+e.RSR+")\\s*",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d,i.c=d;var l="[>?]>",o="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",w=[{b:/^\s*=>/,starts:{e:"$",c:d}},{cN:"meta",b:"^("+l+"|"+o+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:b,i:/\/\*/,c:s.concat(w).concat(d)}});hljs.registerLanguage("coffeescript",function(e){var c={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",r={cN:"subst",b:/#\{/,e:/}/,k:c},s=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+n},{b:"`",e:"`",eB:!0,eE:!0,sL:"javascript"}];r.c=s;var i=e.inherit(e.TM,{b:n}),t="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(s)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:s.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[i,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("cs",function(e){var r={keyword:"abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",literal:"null false true"},t=e.IR+"(<"+e.IR+">)?(\\[\\])?";return{aliases:["csharp"],k:r,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:"?",e:">"}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"symbol",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link",e:"$"}}]}]}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},a={cN:"meta",b:/<\?(php)?|\?>/},i={cN:"string",c:[e.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},t={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[a]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},a,c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,i,t]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},i,t]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("javascript",function(e){return{aliases:["js","jsx"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:["self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});
/*!
*
* ================== js/src/plugins/auxin-jquery.photoswipe.js ===================
**/
(function ($, window, document, undefined) {
"use strict";
/* ------------------------------------------------------------------------------ */
// insert photoswipe markup to the page
if (!window.photoswipe_l10n) {
window.photoswipe_l10n = {};
}
var $pswp = $(
'"
).appendTo("body");
// Youtube URL Regex;
var youtubeRegex =
/(?:https?:)?(?:\/\/)?(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube(?:-nocookie)?\.com\S*?[^\w\s-])([\w-]{11})(?=[^\w-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/;
// Vimeo URL Regex;
var vimeoRegex =
/(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^\\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/;
// Embed URL Regex
var embedURLRegex = /\.(3gp|m4v|mkv|mov|mp4|mpeg|mpg|ogg|webm|wmv)$/;
/* ------------------------------------------------------------------------------ */
var defaults = {
target: "a",
ui: PhotoSwipeUI_Default,
titleMap: false,
thumbnailMap: false,
autoplay: 0,
showHideOpacity: true,
getThumbBoundsFn: false,
},
_uid = 1;
function JQPhotoSwipe(element, options) {
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this.slides = [];
this.UID = _uid++;
this.element = element;
this.$element = $(element);
this.init();
}
$.extend(JQPhotoSwipe.prototype, {
init: function () {
this.$element
.find(this.settings.target)
.each(this._registerSlide.bind(this));
// Parse URL and open gallery if it contains #&pid=3&gid=1
var hashData = this._photoswipeParseHash();
if (hashData.pid && hashData.gid) {
// disable animation
var animDuration = this.settings.showAnimationDuration;
this.settings.showAnimationDuration = 0;
this._openPhotoSwipe(hashData.pid, true);
this.settings.showAnimationDuration = animDuration;
}
},
getSlides: function () {
return this.slides;
},
_registerSlide: function (index, item) {
var $item = $(item),
slide = {
src: $item.is("a")
? $item.attr("href")
: $item.data("original-src") || $item.attr("src"),
w: $item.data("original-width"),
h: $item.data("original-height"),
item: item,
};
if ($item.data("type") == "video" && $item.is("a")) {
var videoURLType = this._getVideoURLType($item.attr("href"));
if (!videoURLType) {
return;
}
slide = {
html: this._getVideoHtml($item.attr("href"), videoURLType),
};
}
// title
if (this.settings.titleMap) {
slide.title = this.settings.titleMap($item, index, this);
} else {
slide.title =
$item.data("caption") ||
$item.attr("title") ||
$item.attr("alt");
}
// thumbnail
if (this.settings.thumbnailMap) {
var thumb = this.settings.thumbnailMap($item, index, this);
slide.el = thumb.element;
slide.msrc = thumb.src;
} else if ($item.is("img")) {
slide.el = item;
slide.msrc = $item.attr("src");
} else {
var img = $item.find("img");
if (img.length) {
slide.el = img[0];
slide.msrc = img.attr("src");
}
}
$item.data("index", index);
$item.on("click.photoswipe", this._onItemClick.bind(this));
this.slides.push(slide);
},
_getVideoURLType: function (url) {
if (url.match(youtubeRegex)) {
return "youtube";
} else if (url.match(vimeoRegex)) {
return "vimeo";
} else if (url.match(embedURLRegex)) {
return "embed";
} else {
return false;
}
},
// get clean html video data
_getVideoHtml: function (url, type) {
var videoEmbedLink = url;
if (type === "youtube") {
var id = url.match(youtubeRegex)[1];
videoEmbedLink = "//www.youtube.com/embed/" + id;
}
if (type === "vimeo") {
var id = url.match(vimeoRegex)[4];
videoEmbedLink = "//player.vimeo.com/video/" + id;
}
return (
''
);
},
_onItemClick: function (e) {
e.preventDefault();
this._openPhotoSwipe($(e.currentTarget).data("index"));
},
_thumbnailBounds: function (index) {
var thumbnail = this.slides[index].el,
pageYScroll =
window.pageYOffset || document.documentElement.scrollTop;
if (thumbnail) {
var rect = thumbnail.getBoundingClientRect();
return {
x: rect.left,
y: rect.top + pageYScroll,
w: rect.width,
};
} else {
return null;
}
},
// parse picture index and gallery index from URL (#&pid=1&gid=2)
_photoswipeParseHash: function () {
var hash = window.location.hash.substring(1),
params = {};
if (hash.length < 5) {
return params;
}
var vars = hash.split("&");
for (var i = 0; i < vars.length; i++) {
if (!vars[i]) {
continue;
}
var pair = vars[i].split("=");
if (pair.length < 2) {
continue;
}
params[pair[0]] = pair[1];
}
if (params.gid) {
params.gid = parseInt(params.gid, 10);
}
return params;
},
_openPhotoSwipe: function (index, fromURL) {
var gallery,
options = this.settings;
$.extend(options, {
galleryUID: this.UID,
getThumbBoundsFn: this._thumbnailBounds.bind(this),
});
// PhotoSwipe opened from URL
if (fromURL) {
// in URL indexes start from 1
options.index = parseInt(index, 10) - 1;
} else {
options.index = parseInt(index, 10);
}
// exit if index not found
if (isNaN(options.index)) {
return;
}
// Pass data to PhotoSwipe and initialize it
gallery = new PhotoSwipe(
$pswp[0],
options.ui,
this.slides,
options
);
gallery.init();
this._photoswipeListen(gallery);
},
_photoswipeListen: function (gallery) {
gallery.listen("beforeChange", function () {
var $allItems = $(this.container).find(".pswp__video");
// Remove active class from all items
$allItems.removeClass("active");
// Add active class too current open item
$(this.currItem.container)
.find(".pswp__video")
.addClass("active");
// Check all items
$allItems.each(function () {
if (!$(this).hasClass("active")) {
$(this).attr("src", $(this).attr("src"));
}
});
});
gallery.listen("close", function () {
$(this.currItem.container)
.find(".pswp__video")
.each(function () {
$(this).attr("src", "about:blank");
});
});
},
});
// $.fn.photoSwipe = function ( options ) {
// return this.each(function() {
// if ( !$.data( this, 'averta_photoswipe' ) ) {
// $.data( this, 'averta_photoswipe', new JQPhotoSwipe( this, options ) );
// }
// });
// };
$.fn.photoSwipe = function (options) {
var args = arguments,
plugin = "averta_photoswipe";
if (options === undefined || typeof options === "object") {
return this.each(function () {
if (!$.data(this, plugin)) {
$.data(this, plugin, new JQPhotoSwipe(this, options));
}
});
} else if (
typeof options === "string" &&
options[0] !== "_" &&
options !== "init"
) {
var returns;
this.each(function () {
var instance = $.data(this, plugin);
if (
instance instanceof JQPhotoSwipe &&
typeof instance[options] === "function"
) {
returns = instance[options].apply(
instance,
Array.prototype.slice.call(args, 1)
);
}
// Allow instances to be destroyed via the 'destroy' method
if (options === "destroy") {
$.data(this, plugin, null);
}
});
return returns !== undefined ? returns : this;
}
};
})(jQuery, window, document);
/*!
*
* ================== js/src/plugins/auxin-jquery.floatLayout.js ===================
**/
/**
* Auxin Float Layout
* @author Averta [www.averta.net]
*
* Auto locating attributes:
* @example
* `
`
* `
`
* `
`
*
* possible methods:
* append, preprend, after, before
*/
;(function ( $, window, document, undefined ) {
"use strict";
var $window = $(window);
// Create the defaults once
var pluginName = "AuxinFloatLayout",
defaults = {
autoLocate : true, // enables auto locating elements in defferent screen sizes
placeholder : 'aux-placehoder', // placeholder element classname
dynamicSelector : '.aux-auto-locate', // it finds all elements in the and watchs for relocating them on page resize.
checkMiddle : true,
phoneClassName : 'aux-phone',
tabletClassName : 'aux-tablet',
desktopClassName : 'aux-desktop',
breakpoints : { // relocating breakpoints
1025: 'tablet',
767: 'phone'
}
};
/* ------------------------------------------------------------------------------ */
// The actual plugin constructor
function Plugin( element, options ) {
this.element = element;
this.$element = $( element );
// future instances of the plugin
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function() {
// catch the watch elements list
var dynamicElements = this.$element.find( this.settings.dynamicSelector );
this.dynamicElements = dynamicElements;
if ( this.settings.autoLocate && dynamicElements.length ) {
// init watch elements
for ( var i = 0, l = dynamicElements.length; i !== l; i++ ) {
var element = $( dynamicElements[i] );
dynamicElements[i] = element.data( 'placeholder', $( '' ) )
.data( 'layout', 'default' );
}
}
$window.on( 'resize', this._onResize.bind( this ) );
this._onResize();
},
/**
* updates the element
* it checks watch
*/
update: function () {
this._onResize();
if ( this.$containerPlaceHolder ) {
this._onScroll();
}
},
/**
* destroys the plugin
*/
destroy: function () {
$window.off( 'resize', this._onResize )
.off( 'scroll', this._onScroll );
if ( this.dynamicElements ) {
for ( var i = 0, l = this.dynamicElements.length; i !== l; i++ ) {
var dynamicElement = this.dynamicElements[i];
dynamicElement.data( 'placeholder' ).remove(); // remove watch element place holder
dynamicElement.data( 'placeholder', null );
}
this.dynamicElements = null;
}
// remove placeholder
if ( this.$containerPlaceHolder ) {
this.$containerPlaceHolder.remove();
}
},
/**
* on resize listener
*/
_onResize: function() {
var width = window.innerWidth,
layout = 'default',
lastPoint = null;
// find breakpoint
for ( var point in this.settings.breakpoints ) {
if ( width < point && ( lastPoint === null || point < lastPoint ) ) {
layout = this.settings.breakpoints[point];
lastPoint = point;
}
}
if ( layout === this.lastLayout ) {
return;
}
// remove device class names
this.$element.removeClass( this.settings.desktopClassName )
.removeClass( this.settings.phoneClassName )
.removeClass( this.settings.tabletClassName );
// update device classnames
if ( layout === 'default' ) {
this.$element.addClass( this.settings.desktopClassName );
} else {
this.$element.addClass( this.settings[layout + 'ClassName'] );
}
// check for middle align.
// this checks height size of element for being odd value, and changes it to even. It causes the element appears sharp
if ( this.settings.checkMiddle ) {
this.$element.find( '[class*="-middle"]' ).each( function( index, element ) {
var _height = $(element).height();
if ( _height % 2 !== 0 ) { // even
element.style.paddingBottom = '1px';
}
}.bind(this) );
}
this.lastLayout = layout;
if ( this.settings.autoLocate ) {
// update all dynamic elements based on new layout
for ( var i = 0, l = this.dynamicElements.length; i !== l; i++ ) {
this._checkElement( this.dynamicElements[i], layout );
}
}
},
/**
* check the dynamic element for the new layout
* @param {jQuery} $dynamicElement
* @param {String} layout
*/
_checkElement: function( $dynamicElement, layout ) {
if ( $dynamicElement.data( 'layout' ) === layout ) {
return;
}
if ( layout === 'phone' || layout === 'tablet' ) {
if ( $dynamicElement.data( 'layout' ) === 'default' ) {
// insert placeholder
$dynamicElement.after( $dynamicElement.data( 'placeholder' ) );
}
// read target $dynamicElement
var target = $dynamicElement.data( layout );
if ( target === undefined ) {
target = $dynamicElement.data( 'locate' );
$( target ).eq(0)[ $dynamicElement.data( 'locate-method' ) || 'append' ] ( $dynamicElement );
} else {
$( target ).eq(0)[ $dynamicElement.data( layout + '-method' ) || 'append' ] ( $dynamicElement );
}
} else {
// move back to placeholder
$dynamicElement.data( 'placeholder' ).after( $dynamicElement ).detach();
}
$dynamicElement.data( 'layout', layout );
}
});
/* ------------------------------------------------------------------------------ */
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function( options ) {
var _arguments = arguments;
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
} else if ( typeof options === 'string' && options.indexOf(0) !== '_' ) {
// access to public methods method
var plugin = $.data( this, "plugin_" + pluginName);
plugin[options].apply( plugin, Array.prototype.slice.call( _arguments, 1 ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.stickyPosition.js ===================
**/
/**
* Auxin Sticky Position
* @author Averta [www.averta.net]
*
*
* Rearrangement:
* This plugin support moving elements on sticky position in side the target block.
* Each element that required to move need to have data-sticky-move attribute which specifies the target location on sticky.
* In addition, data-sticky-move-method is supported for changing the jQuery's move method, default is "append".
*
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinStickyPosition",
$window = $(window),
defaults = {
className : 'aux-sticky',
placeholder : 'aux-sticky-placeholder',
schemePrefix : 'aux-header-',
stickyMargin : 0, // specifies the space between element and top of the page to trigger sticky position
disablePoint : 0, // responsive disable point
checkBoundaries : false, // check element boundaries while scrolling to prevent overlapping
boundryTarget : '', // boundry target selector
rearrange : true, // check for rearrangement of elements in the block on sticky
useTransform : false // whether to use transform instead of fixed position or not.
},
attributesMap = {
'sticky-margin' : 'stickyMargin',
'sticky-off' : 'disablePoint',
'rearrange' : 'rearrange',
'boundaries' : 'checkBoundaries',
'boundry-target': 'boundryTarget',
'use-transform' : 'useTransform'
};
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this._scheme = this.$element.data("color-scheme") || false;
this._stickyScheme = this.$element.data("sticky-scheme") || false;
this._stickyDisableFlag = false;
// read attributes
for ( var attrName in attributesMap ) {
var value = this.$element.data( attrName );
if ( value !== undefined ) {
this.settings[attributesMap[attrName]] = value;
}
}
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
//this.containerHeight = this.$element.data('sticky-height') || this.$element.outerHeight();
this.containerHeight = this.$element.outerHeight();
// create sticky placeholder
this.$containerPlaceHolder = $('').addClass( this.settings.placeholder );
this.$element.before( this.$containerPlaceHolder );
// is there wp admin bar?
this._wpadminbarHeight = $('#wpadminbar').outerHeight() || 0;
this.isOverlay = window.getComputedStyle(this.element).position === 'absolute';
$window.on( 'scroll resize', this._update.bind( this ) );
this._update();
},
_disable: function(){
if ( this.settings.useTransform ) {
this.element.style[_jcsspfx + 'Transform'] = '';
} else {
this.element.style.top = '';
}
this._stickyDisableFlag = true;
this.$containerPlaceHolder.css( 'display', 'none' );
// trigger proper event
this.$element.trigger( 'unsticky' );
},
_update: function() {
var wst = $window.scrollTop(),
etp = Math.round(this.$containerPlaceHolder.offset().top - this.settings.stickyMargin - this._wpadminbarHeight);
if ( this.settings.disablePoint >= window.innerWidth ) {
this._disable();
return;
} else if( this._stickyDisableFlag ) {
this.$containerPlaceHolder.css( 'display', 'initial' );
}
if ( wst > etp && !this.stickyEnabled ) {
this.$element.addClass( this.settings.className );
this.stickyEnabled = true;
if( this._scheme !== this._stickyScheme ) {
if( this._scheme ){
this.$element.removeClass( this.settings.schemePrefix + this._scheme );
}
if( this._stickyScheme ){
this.$element.addClass( this.settings.schemePrefix + this._stickyScheme );
}
}
if ( !this.settings.useTransform && !this.isOverlay ) {
this.$containerPlaceHolder.height( this.containerHeight );
}
if ( this.settings.rearrange ) {
this._checkForRearrange( true );
}
if ( !this.useTransform && (this.settings.stickyMargin || this.settings.stickyMargin === 0) ) {
this.element.style.top = this.settings.stickyMargin + this._wpadminbarHeight + 'px';
}
// trigger on sticky event
this.$element.trigger( 'sticky' );
} else if ( this.stickyEnabled && wst <= etp ) {
this.stickyEnabled = false;
this.$containerPlaceHolder.height( 0 );
this.$element.removeClass( this.settings.className );
// update height value
//this.containerHeight = this.$element.data('sticky-height') || this.$element.outerHeight();
//this.containerHeight = this.$element.outerHeight();
if( this._scheme !== this._stickyScheme ) {
if( this._scheme ){
this.$element.addClass( this.settings.schemePrefix + this._scheme );
}
if( this._stickyScheme ){
this.$element.removeClass( this.settings.schemePrefix + this._stickyScheme );
}
}
if ( this.settings.rearrange ) {
this._checkForRearrange( false );
}
if ( !this.useTransform && (this.settings.stickyMargin || this.settings.stickyMargin === 0) ) {
this.element.style.top = '';
}
// trigger proper event
this.$element.trigger( 'unsticky' );
}
if ( this.settings.useTransform ) {
if ( this.stickyEnabled ) {
var calc = wst - etp;
if ( this.settings.checkBoundaries ) {
this._checkElementBoundaries( etp, wst, calc );
} else {
this.element.style[_jcsspfx + 'Transform'] = 'translateY(' + calc + 'px)';
}
} else {
this.element.style[_jcsspfx + 'Transform'] = '';
}
} else if ( this.settings.checkBoundaries ) {
this._checkElementBoundaries( etp, wst );
}
},
_checkElementBoundaries: function( etp, wst, calc ) {
etp = etp || this.$containerPlaceHolder.offset().top;
wst = wst || $window.scrollTop();
calc = calc || 0;
this.$boundryTarget = this.settings.boundryTarget.length ? $( this.settings.boundryTarget ) : this.$element.parent().eq(0);
var boundryTargetOffTop = this.$boundryTarget.offset().top - this._wpadminbarHeight;
var diff = boundryTargetOffTop + this.$boundryTarget.outerHeight(true) - ( etp + this.$element.outerHeight(true));
if ( calc >= 0 && calc <= diff ) {
this.element.style[_jcsspfx + 'Transform'] = 'translateY(' + ( calc ) + 'px)';
} else if ( calc > diff ){
this.element.style[_jcsspfx + 'Transform'] = 'translateY(' + ( diff ) + 'px)';
} else {
this.element.style[_jcsspfx + 'Transform'] = '';
}
},
/**
* this method moves elements that have sticky move attribute to the target location upon sticky activate
*/
_checkForRearrange: function( attach ) {
var self = this;
if ( attach ) {
this.$element.find( '[data-sticky-move]' ).each( function(){
var $this = $(this),
$target = self.$element.find( $this.data( 'sticky-move' ) );
if ( $target.length == 0 ) {
return;
}
if ( !$this.data( 'placeholder' ) ) {
$this.data( 'placeholder', $('') );
}
$this.after( $this.data( 'placeholder' ) );
$target[$this.data( 'sticky-move-method') || 'append']( $this );
});
} else {
this.$element.find( '[data-sticky-move]' ).each( function(){
var $this = $(this);
if ( $this.data( 'placeholder' ) ) {
$this.data( 'placeholder').after( $this ).detach();
}
});
}
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.hovers.js ===================
**/
/**
* This file contains requred jq plugins to create intractive hover effects
*/
/* ------------------------------------------------------------------------------ */
// CUBE
;(function ( $, window, document, undefined ) {
"use strict";
var pluginName = "AuxinCubeHover",
defaults = {
hitArea: '.aux-hover-active'
};
function Plugin ( element, options ) {
this.element = element;
this.$element = $( element );
this.settings = $.extend( {}, defaults, options );
this._name = pluginName;
this.init();
}
$.extend(Plugin.prototype, {
init: function() {
if ( this.settings.hitArea ) {
var target = this.$element.parents( this.settings.hitArea ).eq(0);
target.on( 'mouseenter', this._movein.bind(this) );
target.on( 'mouseleave', this._moveout.bind(this) );
} else {
this.$element.on( 'mouseenter', this._movein.bind(this) );
this.$element.on( 'mouseleave', this._moveout.bind(this) );
}
this._fixOrigin();
},
_fixOrigin: function() {
var shift = -this.$element.outerHeight() / 2,
dir = -1,
axis = 'X';
if ( this.$element.hasClass( 'aux-rotate-down') ) {
dir = 1;
} else if ( this.$element.hasClass( 'aux-rotate-left') ) {
shift = -this.$element.outerWidth() / 2;
axis = 'Y';
dir = 1;
} else if ( this.$element.hasClass( 'aux-rotate-right') ) {
shift = -this.$element.outerWidth() / 2;
axis = 'Y';
}
this._outTransform = 'perspective(1000px) translateZ(' + shift + 'px)';
this._inTransform = this._outTransform + ' rotate' + axis + '( ' + (90 * dir) + 'deg )';
this.element.style[ _jcsspfx + 'TransitionDuration' ] = '0ms';
this.element.style[ _jcsspfx + 'Transform' ] = this._outTransform;
this.element.style[ _jcsspfx + 'TransformOrigin' ] = 'center center ' + shift + 'px';
setTimeout( function() {
this.element.style[ _jcsspfx + 'TransitionDuration' ] = '';
}.bind(this), 5);
},
_movein: function() {
this._fixOrigin();
clearTimeout( this._hoverdelay );
this._hoverdelay = setTimeout( function(){
this.element.style[ _jcsspfx + 'Transform' ] = this._inTransform;
}.bind(this), 10 );
},
_moveout: function() {
clearTimeout( this._hoverdelay );
this.element.style[ _jcsspfx + 'Transform' ] = this._outTransform;
},
destroy: function(){
}
});
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/* ------------------------------------------------------------------------------ */
// Two ways hover
;(function ( $, window, document, undefined ) {
"use strict";
var pluginName = "AuxTwoWayHover",
defaults = {
in : 'aux-hover-in',
out : 'aux-hover-out',
reset : 'aux-hover-reset'
};
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
$.extend(Plugin.prototype, {
init: function () {
var $element = $(this.element),
st = this.settings;
$element.on('mouseenter', function() {
$element.removeClass( st.out )
.addClass( st.reset );
clearTimeout( this._hoverTimeout );
this._hoverTimeout = setTimeout( function(){
$element.addClass( st.in ).removeClass( st.reset );
}, 30 );
}.bind( this ) ).on('mouseleave', function(event) {
clearTimeout( this._hoverTimeout );
$element.addClass( st.out );
$element.removeClass( st.in );
}.bind( this ) );
}
});
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/* ------------------------------------------------------------------------------ */
;
/*!
*
* ================== js/src/plugins/auxin-jquery.isoxin.js ===================
**/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxIsotope",
defaults = {
space : -1,
layoutMode : 'masonry',
lazyload : false,
paginationLoc : null,
loadingHeight : 500,
searchFilter : false,
grouping : null,
deeplink : true,
isOriginLeft : true,
slug : 'recent',
filters : '.aux-isotope-filters',
// isoxin animation timing options
revealTransitionDelay : 50,
revealTransitionDuration : 50,
revealBetweenDelay : 200,
hideTransitionDuration : null,
hideTransitionDelay : 0,
hideBetweenDelay : 200,
loadingTransitionDuration : 600,
imgSizes : true,
resizeTransition : false,
paginationClass : 'aux-pagination aux-round aux-page-no-border aux-iso-pagination',
loadingClass : 'aux-loading',
afterInitClass : 'aux-isotope-ready',
groupingPrefix : '.aux-grouping-',
searchClass : '.aux-isotope-search',
updateUponResize : false,
isInitLayout : false, // prevent auto initialization in isotope
transitionDuration : 0, // isotope animation duration ( 0 recommended )
itemsLoading : '.aux-items-loading',
loadingVisible : 'aux-loading-visible',
loadingHide : 'aux-loading-hide',
// transition helper class names
transitionHelpers : {
hiding : 'aux-iso-hiding',
hidden : 'aux-iso-hidden',
revealing : 'aux-iso-revealing',
visible : 'aux-iso-visible'
}
}, attributeOptionsMap = {
'pagination' : 'pagination',
'perpage' : 'inPage',
'layout' : 'layoutMode',
'lazyload' : 'lazyload',
'space' : 'space',
'loading-height' : 'loadingHeight',
'search-filter' : 'searchFilter',
'grouping' : 'grouping',
'deeplink' : 'deeplink',
'slug' : 'slug',
'filters' : 'filters',
'pagination-class' : 'paginationClass'
};
// The actual plugin constructor
function Plugin ( element, options ) {
if ( !window.Isotope && !$.fn.isotope ) {
// isotope is not available in this page.
$.error( 'isotope is not available in this page.' );
return;
}
this.element = element;
this.$element = $( element );
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
// read options from the element
/* ------------------------------------------------------------------------------ */
for ( var attr in attributeOptionsMap ) {
var value = this.$element.data( attr );
if ( value !== undefined ) {
this.settings[ attributeOptionsMap[attr] ] = value;
}
}
// check layout
if ( this.settings.layoutMode === 'grid' ) {
this.settings.layoutMode = 'masonry';
}
/* ------------------------------------------------------------------------------ */
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend( Plugin.prototype, {
init: function() {
this.$element.addClass( this.settings.afterInitClass );
if ( this.settings.lazyload ) {
this.$element.height( this.settings.loadingHeight );
}
if ( this.$element.parents('.rtl').length ) {
this.settings.isOriginLeft = false;
}
this._isoElement = this.$element[0];
if ( this.settings.space >= 0 ) {
this.$element.children( this.settings.itemSelector ).css({
'margin-bottom': this.settings.space + 'px',
'padding-right': this.settings.space + 'px'
});
this.$element.css( 'margin-right', -this.settings.space + 'px' );
}
// Retrieve custom transition settings
this.settings.revealTransitionDuration = this.$element.data("reveal-transition-duration") || this.settings.revealTransitionDuration;
this.settings.revealBetweenDelay = this.$element.data("reveal-between-delay" ) || this.settings.revealBetweenDelay;
this.settings.revealTransitionDelay = this.$element.data("reveal-transition-delay" ) || this.settings.revealTransitionDelay;
this.settings.hideTransitionDuration = this.$element.data("hide-transition-duration" ) || this.settings.hideTransitionDuration;
this.settings.hideBetweenDelay = this.$element.data("hide-between-delay" ) || this.settings.hideBetweenDelay;
this.settings.hideTransitionDelay = this.$element.data("hide-transition-delay" ) || this.settings.hideTransitionDelay;
// initialize isotope
this._isotope = new Isotope( this._isoElement, this.settings );
// disable default transitions in isotope
this._isotope.options.hiddenStyle = {};
this._isotope.options.visibleStyle = {};
// store isotope on element
this.$element.data( 'isotope', this._isotope );
var self = this;
this._isotope.options.filter = function() {
return self._filtering( this );
};
this._groupValue = null;
this._filterValue = null;
this._searchValue = null;
this._currentFilter = null;
this._currentSearch = null;
this._currentGroup = null;
if( this.settings.grouping ){
this._setGroupValue();
}
if ( this.settings.deeplink ) {
this._initDeeplink();
}
if ( this.settings.pagination ) {
// create pagination markup
this._isotope.options.pagination = true;
this._initPagination();
}
if ( this.settings.lazyload && window.imagesLoaded ) {
this._isotope.on( 'itemLoading', this._setLazyload.bind(this) );
} else if ( window.imagesLoaded ) {
this.$element.imagesLoaded().always( function( instance, image ) {
this._arrangeIsotope();
}.bind( this ) );
}
// arrange items
this._isotope.arrange();
this._currentPage = this._isotope.options.page;
this._isotope.items.forEach( function( item ){
// define $element in item
if ( !item.$element ) {
item.$element = $(item.element);
}
}, this );
if ( this.settings.lazyload ){
// generate the loading
this.$loading = this.$element.find( this.settings.itemsLoading )
.addClass( this.settings.loadingHide )
.appendTo( this.$element );
this._instantlyHideItems();
this._revealItems();
}
// update upon resize
if ( this.settings.updateUponResize ) {
$(window).on( 'resize', this._arrangeIsotope.bind( this ) );
}
this.ـinitFilters();
},
arrange: function( method, options ) {
var io = this._isotope.options;
// check filter and page
if ( this._currentFilter === this._filterValue && ( !this.settings.grouping || this._currentGroup === this._groupValue ) && ( !this.settings.searchFilter || this._currentSearch === this._searchValue ) && ( !this.settings.pagination || this._currentPage === io.page ) ) {
return;
} else {
this._currentPage = io.page;
this._currentFilter = this._filterValue;
this._currentSearch = this._searchValue;
this._currentGroup = this._groupValue;
}
var items = this._isotope.filteredItems,
totalHideDuration = this.settings.transitionDelay,
totalRevealDuration = 0,
helpers = this.settings.transitionHelpers,
i = 0,
st = this.settings,
self = this;
items.forEach ( function( item ){
self._hideItem( item, self.settings.hideBetweenDelay * (++i) + st.hideTransitionDelay, st.hideTransitionDuration );
});
totalHideDuration = st.hideBetweenDelay * i + st.hideTransitionDelay + st.hideTransitionDuration;
clearTimeout( this._hidingTimeout );
clearTimeout( this._revealingTimeout );
this._hidingTimeout = setTimeout( function(){
self._instantlyHideItems();
if ( !method || method === 'arrange' ) {
self._isotope._noTransition( self._isotope.arrange );
} else {
self._isotope[method].apply( self._isotope, options );
}
self._revealItems();
}, totalHideDuration );
if ( st.deeplink ) {
self._updateHash();
}
this.$element.trigger( 'auxinIsotopeArrange' );
},
insert: function( $item ) {
if ( this.settings.space >= 0 ) {
$item.css({
'margin-bottom': this.settings.space + 'px',
'padding-right': this.settings.space + 'px'
});
}
this._isotope.insert($item);
this._isotope.items.forEach( function( item ){
// define $element in item
if ( !item.$element ) {
item.$element = $(item.element);
}
}, this );
// Unnessecery Hide and Reveal on adding items
// this._instantlyHideItems();
// this._revealItems();
},
remove: function( items ) {
if ( !Array.isArray( items ) ) {
items = [items];
}
this._isotope.remove( items.map( function( item ) { return item.element; } ) );
this._isotope.arrange();
},
removeAll: function() {
this._isotope.remove( this._isotope.items.map( function( item ) { return item.element; } ) );
this.updateIsotope();
this._isotope.options.page = 1;
},
updateIsotope: function(){
this._arrangeIsotope();
},
/**
* destroys the plugin
* @public
*/
destroy: function() {
if ( this.settings.pagination ) {
this.$pagination.remove();
}
if ( this.settings.updateUponResize ) {
$(window).off( 'resize', this._arrangeIsotope.bind( this ) );
}
this.$element.data( 'isotope', null );
this._isotope.destroy();
this.$element.remove();
},
changeGroup: function( groupName ){
// Keep old group name
this._oldGroup = this._groupValue;
// Update group value
this._groupValue = groupName;
// Set localStorage
localStorage.setItem( 'auxinIsotopeGroup', this._groupValue );
// Change Filter List View
this.$filters.find( this.settings.groupingPrefix + this._groupValue ).removeClass( this.settings.transitionHelpers.hidden );
this.$filters.find( this.settings.groupingPrefix + this._oldGroup ).addClass( this.settings.transitionHelpers.hidden );
// Arrange isotope
if ( !this._internalFilterChange ) {
this.arrange( 'arrange' );
} else {
this._internalFilterChange = false;
}
},
/* ------------------------------------------------------------------------------ */
// loading
showLoading: function(){
if ( this._loadingIsVisible ) {
return;
}
this.$element.height( this.settings.loadingHeight );
this._loadingIsVisible = true;
clearTimeout( this._loadingTimeout );
this.$loading.show()
setTimeout(function(){
this.$loading.addClass( this.settings.loadingVisible )
.removeClass( this.settings.loadingHide );
}.bind(this), 1);
},
hideLoading: function(){
if ( !this._loadingIsVisible ) {
return;
}
this._loadingIsVisible = false;
this.$loading.removeClass( this.settings.loadingVisible )
.addClass( this.settings.loadingHide );
clearTimeout( this._loadingTimeout );
this._loadingTimeout = setTimeout( function(){
this.$loading.hide();
}.bind(this), this.settings.loadingTransitionDuration );
},
/* ------------------------------------------------------------------------------ */
// Private methods
_instantlyHideItems: function() {
this._isotope.items.forEach( function( item ){
item.element.style[window._jcsspfx + 'TransitionDelay'] = '0';
item.element.style[window._jcsspfx + 'TransitionDuration'] = '0';
this._removeHelpers( item.$element );
item.$element.addClass( this.settings.transitionHelpers.hidden );
}, this);
},
_isFilteredItemsLoaded: function() {
var items = this._isotope.filteredItems;
for ( var i = 0, l = items.length; i !== l; i++ ) {
if( !items[i].loaded ) {
return false;
}
}
return true;
},
_revealItems: function() {
var items = this._isotope.filteredItems,
st = this.settings,
i = 0;
if ( !st.lazyload || this._isFilteredItemsLoaded() ) {
if ( st.lazyload ) {
this.hideLoading();
this._isotope._noTransition(this._isotope.layout);
this._waitForLoad = false;
}
this._revealingTimeout = setTimeout( function() {
items.forEach( function( item ){
this._removeHelpers( item.$element );
item.$element.addClass( st.transitionHelpers.hidden );
this._revealItem( item, st.revealBetweenDelay * (++i) , st.revealTransitionDuration );
}, this);
}.bind(this), Math.max(st.revealTransitionDelay, 10) );
this.$element.trigger( 'auxinIsotopeReveal', [items] );
} else {
this.showLoading();
this._waitForLoad = true;
}
},
_revealItem: function( item, delay, duration ) {
item.element.style[window._jcsspfx + 'TransitionDelay'] = delay + 'ms';
item.element.style[window._jcsspfx + 'TransitionDuration'] = duration + 'ms';
this._removeHelpers( item.$element );
item.$element.addClass( this.settings.transitionHelpers.revealing );
clearTimeout( item._animTimeout );
item._animTimeout = setTimeout( function(){
this._removeHelpers( item.$element );
item.element.style[window._jcsspfx + 'TransitionDelay'] = '';
item.element.style[window._jcsspfx + 'TransitionDuration'] = '';
item.$element.addClass( this.settings.transitionHelpers.visible );
}.bind(this), delay + duration );
},
_hideItem: function( item, delay, duration ) {
item.element.style[window._jcsspfx + 'TransitionDelay'] = delay + 'ms';
item.element.style[window._jcsspfx + 'TransitionDuration'] = duration + 'ms';
this._removeHelpers( item.$element );
item.$element.addClass( this.settings.transitionHelpers.hiding );
clearTimeout( item._animTimeout );
item._animTimeout = setTimeout( function(){
this._removeHelpers( item.$element );
item.element.style[window._jcsspfx + 'TransitionDelay'] = '';
item.element.style[window._jcsspfx + 'TransitionDuration'] = '';
item.$element.addClass( this.settings.transitionHelpers.hidden );
}.bind(this), delay + duration );
},
_arrangeIsotope: function(){
this._isotope.layout();
},
/**
* removes transition helpers class name from item.
* @return {[type]} [description]
*/
_removeHelpers: function( $item ) {
var helpers = this.settings.transitionHelpers;
// remove old classNames
for ( var classKey in helpers ) {
$item.removeClass( helpers[classKey] );
}
},
_setLazyload: function( item, imagesloaded ) {
var iso = this._isotope,
that = this;
imagesloaded.on( 'always', function(e) {
item.loaded = true;
// We need to reset isotope item width and height to make sure it calculates the items size correctly
item.element.style.height = '';
item.element.style.width = '';
setTimeout( function() {
this.elements.forEach( function( element ) {
$(element).removeClass( this.settings.loadingClass );
}, that );
that._revealItems();
}.bind( this ) );
});
},
/* ------------------------------------------------------------------------------ */
// filters
_filtering: function( itemElement ){
var $item = $(itemElement);
// Item list filter
if( this._filterValue && this._filterValue !== 'all' && !$item.is( this._filterValue ) ){
return false;
}
// Serach value filter
if( this._searchValue && !( $item.text().match( this._searchValue ) || itemElement.className.match( this._searchValue ) ) ) {
return false;
}
// Grouping filter
if( this._groupValue && !$item.is( this.settings.groupingPrefix + this._groupValue ) ) {
return false;
}
return true;
},
ـinitFilters: function() {
if ( this.settings.filters ) {
this.$filters = this.$element.siblings( this.settings.filters ).eq(0);
if ( !this.$filters ) {
return;
}
var self = this;
// List Filters
this.$filters.find( 'li' ).on( 'click', function( e ) {
var $this = $(this),
filter = $this.data( 'filter' );
if ( filter.length ) {
if ( filter === 'all' ) {
self._filterValue = false;
} else {
self._filterValue = '.' + filter;
}
} else {
self._filterValue = false;
}
if ( !self._internalFilterChange && e.originalEvent ) {
self.arrange( 'arrange' );
} else {
self._internalFilterChange = false;
}
e.preventDefault();
});
// Search Filter
this.$filters.find( self.settings.searchClass ).on('keyup', this._debounce( function( e ) {
var $this = $(this),
filter = $this.val();
if( filter.length > 2 ) {
self._searchValue = new RegExp( filter, 'gi' );
} else {
self._searchValue = false;
}
if ( !self._internalFilterChange && e.originalEvent ) {
self.arrange( 'arrange' );
} else {
self._internalFilterChange = false;
}
}, 200 ) );
setTimeout( this._updateSelectedFilter.bind(this), 300 );
}
},
_setGroupValue: function(){
this._localGroupValue = localStorage.getItem("auxinIsotopeGroup");
this._groupValue = this._localGroupValue ? this._localGroupValue : this.settings.grouping;
},
_updateSelectedFilter: function() {
this._internalFilterChange = true;
this.$filters.find( '[data-filter="' + (this._filterValue || 'all').replace('.' ,'') + '"] a' ).trigger( 'click' );
},
_debounce: function( fn, threshold ) {
var timeout;
threshold = threshold || 100;
return function debounced() {
clearTimeout( timeout );
var args = arguments;
var _this = this;
function delayed() {
fn.apply( _this, args );
}
timeout = setTimeout( delayed, threshold );
};
},
/* ------------------------------------------------------------------------------ */
// pagination
/**
* initialize the pagination control
*/
_initPagination: function() {
this.$pagination = $('').addClass( this.settings.paginationClass );
if ( this.settings.paginationLoc ) {
this.$pagination.appendTo( this.settings.paginationLoc );
} else {
this.$pagination.insertAfter( this.$element );
}
this.$pagination.on( 'click', this._updatePage.bind(this) );
// update pagination buttons
this._isotope.on( 'paginationUpdate', this._updatePagination.bind(this) );
},
/**
* updates the pagination control
* @param {Number} currentPage
* @param {Number} totalPage
* @param {Array} items
*/
_updatePagination: function( currentPage, totalPage, items ) {
if ( this._internalPaginate ) {
this._internalPaginate = false;
return;
}
// generate pagination markup
var html = '';
this.$pagination.html( html );
},
/**
* pagination click listener
*/
_updatePage: function( event ) {
var $btn = $( event.target ),
page;
if ( $btn.data( 'page' ) !== undefined ) {
page = $btn.data( 'page' );
} else if ( $btn.data( 'next' ) ) {
page = Math.min( this._isotope.currentPage() + 1 , this._isotope.totalPages() );
} else if ( $btn.data( 'prev' ) ) {
page = Math.max( this._isotope.currentPage() - 1 , 1 );
} else {
return;
}
this._isotope.options.page = page;
this.$pagination.find('.page').removeClass('active')
.eq( page - 1 )
.addClass('active');
this._internalPaginate = true;
this.arrange('arrange');
event.preventDefault();
},
/* ------------------------------------------------------------------------------ */
// deeplink
_initDeeplink: function() {
this._readHash( false );
$(window).on( 'hashchange', this._readHash.bind(this) );
//this._isotope.on( 'arrangeComplete', this._updateHash.bind(this) );
},
_findHashData: function() {
var hash = window.location.hash.slice(1).split(','),
result
for ( var i = 0, l = hash.length; i !== l; i++ ) {
result = hash[i].split( '/' );
if ( result.indexOf( this.settings.slug ) !== -1 ) {
return result;
}
}
return false;
},
_readHash: function( arrange ) {
if ( this._internalHashUpdate ) {
this._internalHashUpdate = false;
return;
}
// #/slug/filter/page
// #/recent/all/1
var result = this._findHashData();
if ( !result ) {
return;
}
var io = this._isotope.options,
oldFilter = this._filterValue,
oldPage = io.page;
this._filterValue = this._parseFilter( result[2] );
if ( this.settings.pagination ){
io.page = this._checkPagePolicy( parseInt( result[3] ) );
}
if ( !arrange || ( this._filterValue === oldFilter && ( !this.settings.pagination || io.page === oldPage ) ) ) {
return;
}
if ( this.$filters ) {
this._updateSelectedFilter();
}
this._internalHashRead = true;
this.arrange('arrange');
},
_updateHash: function() {
if ( this._internalHashRead ) {
this._internalHashRead = false;
return;
}
var hashStr = '/' + this.settings.slug + '/' + this._sanitizeFilter(this._filterValue),
currentHash = window.location.hash.slice(1);
if ( this.settings.pagination ) {
hashStr += '/' + this._isotope.options.page;
}
var inHash = this._findHashData();
this._internalHashUpdate = true;
if ( inHash ) {
var hash = currentHash.split(',');
for ( var i = 0, l = hash.length; i !== l; i++ ) {
if ( hash[i].split( '/' ).indexOf( this.settings.slug ) !== -1 ) {
hash[i] = hashStr;
break;
}
}
window.location.hash = hash.join(',');
} else if ( currentHash.length ) {
window.location.hash = currentHash + ',' + hashStr;
} else {
window.location.hash = hashStr;
}
},
_checkPagePolicy: function( page ) {
if ( !this._isotope.options.pagination ) {
return undefined;
}
if ( page <= 0 ) {
return 1;
}
if ( page > this._isotope.totalPages() ) {
return this._isotope.totalPages();
}
if ( isNaN(page) ) {
return 1;
}
return page;
},
_sanitizeFilter: function( filter ) {
if ( !filter ) {
return 'all';
}
return filter.replace(/\s/g, '&').replace('.', '');
},
_parseFilter: function( filter ) {
if ( filter === 'all' || filter === undefined ) {
return undefined;
}
return '.' + filter.replace('&', ' .').trim();
}
});
$.fn[pluginName] = function (options) {
var args = arguments,
plugin = 'plugin_' + pluginName;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if (!$.data(this, plugin)) {
$.data(this, plugin, new Plugin( this, options ));
}
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
var returns;
this.each(function () {
var instance = $.data(this, plugin);
if (instance instanceof Plugin && typeof instance[options] === 'function') {
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.loadmore.js ===================
**/
/**
* Auxin Ajax Load
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxLoadMore",
$window = $(window),
defaults = {
elementID: ''
},
attributesMap = {
'element-id': 'elementID'
};
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this._isotopeLayout = this.$element.find('.aux-isotope-ready').length;
this.ajaxView = this.$element.find('.aux-ajax-view');
// read attributes
for ( var attrName in attributesMap ) {
var value = this.ajaxView.data( attrName );
if ( value !== undefined ) {
this.settings[attributesMap[attrName]] = value;
}
}
this.content = auxin.content.loadmore[this.settings.elementID];
this.args = this.content.args;
this.nonce = this.content.nonce;
this.handler = this.content.handler;
this.postPerPage = parseInt(this.args.loadmore_per_page);
this.offset = parseInt(this.args.offset) || 0;
this.defaultOffset = this.offset;
// main element controller
this.ajaxController = this.$element.find('.aux-ajax-controller');
// next-prev element
this.loadNextPrev = this.ajaxController.find('.aux-load-next-prev');
// load more button element
this.loadMoreBtn = this.ajaxController.find('.aux-load-more');
// Check ajax status (Especially for scroll loads)
this.ajaxLoaded = true;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
if ( this.$element.is('.aux-ajax-type-next-prev') ) {
//call _loadNextPrev function on click button
this.loadNextPrev.on('click', this._loadNextPrev.bind(this) );
} else if ( this.$element.is('.aux-ajax-type-scroll') ) {
//call _loadScroll function on scroll changes
$window.scroll( this._loadScroll.bind(this) );
} else if ( this.$element.is('.aux-ajax-type-next') ) {
//call _loadNext function on click button
this.loadMoreBtn.on('click', this._loadNext.bind(this) );
}
},
_callAjax: function( type, offset ) {
//set post offset
this.args.offset= offset;
// This value will fix synchronous conflicts
this.ajaxLoaded = false;
//run AJAX functionality
$.ajax({
type :'POST',
dataType : 'json',
url : auxin.ajax_url,
data : {
action : "load_more_element",
handler : this.handler,
nonce : this.nonce,
args : this.args
},
success: function(response) {
// Set post counter variable
var postCounter, allpostCounter;
//check results status
if( response.success ) {
switch( type ){
case 'next-prev':
if ( this._isotopeLayout) {
this.ajaxView.AuxIsotope( 'removeAll' );
} else {
$(this.ajaxView).empty();
}
if( offset === this.defaultOffset ) {
this.ajaxController.find('.np-prev-section').addClass('hidden');
} else {
this.ajaxController.find('.np-prev-section').removeClass('hidden');
}
break;
default:
this.loadMoreBtn.removeClass( 'aux-active-loading' );
}
// Remove widget container progress class
this.$element.removeClass('aux-in-progress');
var $newContent = $(response.data);
// Get post count DOM data from response.data
postCounter = $newContent.filter('.aux-post-count').text();
allpostCounter = $newContent.filter('.aux-all-posts-count').text();
// Remove aux-post-count block from response.data
$newContent = $newContent.filter('.aux-ajax-item, .aux-date-label, style');
// append new data by isotope insert | append method
if( this._isotopeLayout ) {
$newContent.each(function( index, element ) {
var $item = $(element);
if ( $item.is( 'style' ) ) {
this.ajaxView.append( $item );
return;
}
this.ajaxView.AuxIsotope( 'insert', $item );
$item.imagesLoaded({}, function () {
this.ajaxView.AuxIsotope('arrange').AuxIsotope('updateIsotope');
}.bind(this));
this._afterAppend( $item );
}.bind(this));
} else {
$newContent.each(function( index, element ) {
var $item = $(element);
this.ajaxView.append( $item );
if ( $item.is( 'style' ) ) {
return;
}
this._afterAppend( $item );
}.bind(this));
}
// display next page button
this.ajaxController.find('.np-next-section').removeClass('hidden');
}// end if
if ( postCounter < this.postPerPage || !response.success || ( parseInt( offset ) + parseInt( postCounter ) ) == parseInt( allpostCounter ) ) {
switch( type ){
case 'next-prev':
this.ajaxController.find('.np-next-section').addClass('hidden');
break;
default:
this.ajaxController.remove();
}
}// end if
// Fix matchHeight on DOM insert
if( $newContent && this.ajaxView.hasClass('aux-match-height') ) {
$.fn.matchHeight._maintainScroll = true;
$newContent.imagesLoaded( {}, function() {
this.ajaxView.find('.aux-col').matchHeight();
setTimeout($.fn.matchHeight._update, 100);
}.bind( this ));
}
// Hooray! Ajax is loaded :)
this.ajaxLoaded = true;
// End success status
}.bind(this)
});
},
_afterAppend: function( $content ) {
// $(window).trigger('resize');
$content.setOnAppear(true, 100).addClass('aux-ajax-anim');
if( $content.hasClass( 'aux-image-box' ) ) {
// update image alignment inside the tiles upon loadmore
$content.AuxinImagebox();
}
$content.AuxinCarouselInit();
$content.find('.aux-frame-cube').AuxinCubeHover();
$content.find('.aux-hover-twoway').AuxTwoWayHover();
if( $content.find( '.aux-media-video, .aux-media-audio' ).length ) {
if( $content.find( 'iframe' ).length ) {
// Creating intrinsic ratios for videos
$content.fitVids({ customSelector: 'iframe[src^="http://w.soundcloud.com"], iframe[src^="https://w.soundcloud.com"]'});
} else {
// Call mediaelement player
$content.find('video,audio').mediaelementplayer();
}
}
$content.find('.aux-lightbox-frame').photoSwipe({
target: '.aux-lightbox-btn',
bgOpacity: 0.8,
shareEl: true
}
);
},
_loadNext: function() {
// Returns when AJAX is not loaded yet
if( !this.ajaxLoaded ) {
return;
}
// Update offset value
this.offset += this.postPerPage;
this.loadMoreBtn.addClass( 'aux-active-loading' );
this.$element.addClass('aux-in-progress');
this._callAjax( 'next', this.offset );
},
_loadScroll: function( event ) {
// Returns when AJAX is not loaded yet
if( !this.ajaxLoaded ) {
return;
}
// get current load more container position
var elementPosition = this.ajaxController[0].getBoundingClientRect().bottom;
// check elementPosition with windows height
if ( elementPosition <= $window.height() ) {
// Update offset value
this.offset += this.postPerPage;
this.$element.addClass('aux-in-progress');
this.loadMoreBtn.addClass( 'aux-active-loading' );
this._callAjax( 'scroll', this.offset );
}
// no page reload
event.preventDefault();
},
_loadNextPrev: function( event ) {
// Returns when AJAX is not loaded yet
if( !this.ajaxLoaded ) {
return;
}
// Check offset value
if( $(event.currentTarget).hasClass('np-next-section') ){
this.offset += this.postPerPage;
} else {
this.offset = this.offset <= this.defaultOffset ? this.defaultOffset : this.offset - this.postPerPage;
}
this.$element.addClass('aux-in-progress');
this._callAjax( 'next-prev', this.offset );
// no page reload
event.preventDefault();
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.carousel.js ===================
**/
/**
* Auxin Carousel Plugin.
*
* @package Auxin
* @author Averta
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinCarousel",
$window = $(window),
defaults = {
viewClass : 'aux-mc-view',
containerClass : 'aux-mc-container',
itemClass : 'aux-mc-item',
arrowsClass : 'aux-mc-arrows',
bulletsClass : 'aux-bullets',
bulletClass : 'aux-bullet',
selectedBulletClass : 'aux-selected',
arrows : true,
matchHeight : false,
startItem : 0,
bullets : false,
wrapControls : false,
arrowNextMarkup : '.aux-next-arrow',
arrowPrevMarkup : '.aux-prev-arrow',
controlsClass : 'aux-mc-controls',
noJS : 'aux-no-js',
initClass : 'aux-mc-init',
beforeInit : 'aux-mc-before-init',
initCb : null
},
attributeOptionsMap = {
'loop' : 'loop',
'space' : 'space',
'dir' : 'dir',
'center' : 'center',
'speed' : 'speed',
'swipe' : 'swipe',
'mouse-swipe' : 'mouseSwipe',
'start' : 'startItem',
'rtl' : 'rtl',
'arrows' : 'arrows',
'bullets' : 'bullets',
'bullet-class' : 'bulletsClass',
'auto-height' : 'autoHeight',
'autoplay' : 'autoplay',
'delay' : 'autoplayDelay',
'columns' : 'columns',
'same-height' : 'matchHeight',
// responsive value example: 150:5, 220:2
'responsive' : 'responsive',
'auto-pause' : 'pauseOnHover',
'navigation' : 'navigation',
'lazyload' : 'preload',
'empty-height' : 'emptyHeight',
'wrap-controls' : 'wrapControls',
'element-id' : 'elementID'
}
// The actual plugin constructor
function Plugin ( element, options ) {
// Global Object to hold carousels instance
if ( !window.AuxinCarousel ) {
window.AuxinCarousel = {};
}
this.element = element;
// future instances of the plugin
this.settings = $.extend( {}, defaults, options );
this.$element = $(element);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
// check for Master Carousel
if ( !window.MasterCarousel ) {
$.error( 'Master Carousel does not found in the page.' );
return;
}
// read attributes
for ( var attrName in attributeOptionsMap ) {
var value = this.$element.data( attrName );
if ( value !== undefined ) {
this.settings[attributeOptionsMap[attrName]] = value;
}
}
// parse responsive options
if ( this.$element.data( 'responsive' ) ) {
var resp = {};
$.each(this.settings.responsive.replace( /\s+/g, '' ).split(','), function( index, value ) {
value = value.split(':');
resp[value[0]] = { columns: value[1] };
});
this.settings.responsive = resp;
}
// match height items
if ( this.settings.matchHeight ) {
$window.on( 'resize', this._updateItemsHeight.bind(this) );
}
// carousel instance
this.mc = new MasterCarousel( this.$element[0] , this.settings );
this.mc.addEventListener( MCEvents.INIT, this._onCarouselInit, this );
this.mc.setup();
// remove no-js class
this.$element.removeClass( this.settings.noJS );
// Create Instance
AuxinCarousel[this.settings.elementID] = this;
},
_onCarouselInit: function() {
var st = this.settings;
// add js active class name to the carousel
this.$element.addClass( this.settings.initClass )
.removeClass( this.settings.beforeInit );
if ( st.arrows || st.bullets && st.wrapControls ) {
this.$controlsWrap = $('').addClass( st.controlsClass ).insertAfter( this.$element );
}
// insert arrows
if ( st.arrows ) {
this.$prevArrow = $('').addClass( st.arrowsClass + ' aux-prev' )
.on('click', { action: 'prev' }, this._controlCarousel.bind( this ) );
if ( st.wrapControls ) {
this.$prevArrow.appendTo( this.$controlsWrap );
} else {
this.$prevArrow.insertAfter( this.$element );
}
if ( st.arrowPrevMarkup ) {
this.$element.find( st.arrowPrevMarkup ).appendTo( this.$prevArrow );
}
this.$nextArrow = $('').addClass( st.arrowsClass + ' aux-next' )
.on('click', { action: 'next' }, this._controlCarousel.bind( this ) );
if ( st.wrapControls ) {
this.$nextArrow.appendTo( this.$controlsWrap );
} else {
this.$nextArrow.insertAfter( this.$element );
}
if ( st.arrowNextMarkup ) {
this.$element.find( st.arrowNextMarkup ).appendTo( this.$nextArrow );
}
}
// bullets container
if ( st.bullets ) {
this.$bullets = $('').addClass( st.bulletsClass );
this._generateBullets();
this.mc.view.addEventListener( MCEvents.SCROLL, this._updateCurrentBullet, this );
$window.on( 'resize', this._updateBullets.bind(this) );
}
// match height items
if ( st.matchHeight ) {
this.matchHeightTo = setTimeout( this._updateItemsHeight.bind( this ), 150, true );
}
if ( st.initCb ) {
st.initCb( this );
}
this.$element.trigger( 'auxinCarouselInit' );
},
_updateCarouselSize : function() {
setTimeout( this.mc.view._resize.bind( this.mc.view ) , 0 );
},
_generateBullets: function() {
this.$bullets.children().remove();
this._bullets = [];
if ( this.settings.wrapControls ) {
this.$bullets.appendTo( this.$controlsWrap );
} else {
this.insertAfter( this.$element );
}
//insert bullets
if ( this.mc.count() <= 1 ) {
this._updateCurrentBullet();
return;
} else {
for ( var i = 0, l = this.mc.count(); i !== l; i++ ) {
this._bullets.push ( $('').addClass( this.settings.bulletClass ).appendTo( this.$bullets ).on('click', { action: 'bullet', index: i }, this._controlCarousel.bind( this ) ) );
}
}
this._updateCurrentBullet();
},
_updateBullets: function() {
if ( this._bullets.length === this.mc.count() ) {
return;
}
this._generateBullets();
},
_updateItemsHeight: function( withDelay ) {
if ( !this.mc.items ) {
return;
}
if ( withDelay !== true ) {
clearTimeout( this.matchHeightTo )
this.matchHeightTo = setTimeout( this._updateItemsHeight.bind( this ), 20, true );
return;
}
var maxHeight = 0;
this.mc.items.forEach( function( item ){
item.$element[0].style.height = '';
maxHeight = Math.max( item.$element.height(), maxHeight );
}.bind( this ) );
this.mc.items.forEach( function( item ){
item.$element.height( maxHeight );
}.bind( this ) );
},
/**
* controls
*/
_controlCarousel: function( event ) {
var target = event.target,
action = event.data.action;
switch ( action ) {
case 'next':
this.mc.next();
break;
case 'prev':
this.mc.previous();
break;
case 'bullet':
this.mc.goto( event.data.index + 1, true );
break;
}
},
/**
* updates the current class name on bullets
*/
_updateCurrentBullet: function() {
var target = this.mc.current() - 1;
if ( this._currentPosition === target ) {
return;
}
this._currentPosition = target;
this.$bullets.find( '.' + this.settings.bulletClass ).removeClass( this.settings.selectedBulletClass ).eq(target).addClass( this.settings.selectedBulletClass );
},
/**
* removes all
* @return {[type]} [description]
*/
destroy: function() {
// remove listeners
this.mc.removeEventListener( MCEvents.INIT, this._onCarouselInit, this );
this.mc.view.removeEventListener( MCEvents.SCROLL, this._updateCurrentBullet, this );
if ( this.settings.matchHeight ) {
$window.off( 'resize', this._updateItemsHeight.bind(this) );
}
$window.off( 'resize.master-carousel' );
if ( this.settings.arrows ) {
this.$nextArrow.remove();
this.$prevArrow.remove();
}
if ( this.settings.bullets ) {
$window.off( 'resize', this._updateBullets.bind(this) );
this.$bullets.remove();
}
// destory master carousel
this.mc.destroy();
this.$element.remove();
}
});
$.fn[pluginName] = function (options) {
var args = arguments,
plugin = 'plugin_' + pluginName;
// Is the first parameter an object (options), or was omitted,
// instantiate a new instance of the plugin.
if (options === undefined || typeof options === 'object') {
return this.each(function () {
// Only allow the plugin to be instantiated once,
// so we check that the element has no plugin instantiation yet
if (!$.data(this, plugin)) {
$.data(this, plugin, new Plugin( this, options ));
}
});
// If the first parameter is a string and it doesn't start
// with an underscore or "contains" the `init`-function,
// treat this as a call to a public method.
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
// Cache the method call
// to make it possible
// to return a value
var returns;
this.each(function () {
var instance = $.data(this, plugin);
// Tests that there's already a plugin-instance
// and checks that the requested public method exists
if (instance instanceof Plugin && typeof instance[options] === 'function') {
// Call the method of our plugin instance,
// and pass it the supplied arguments.
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
// Allow instances to be destroyed via the 'destroy' method
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
// If the earlier cached method
// gives a value back return the value,
// otherwise return this to preserve chainability.
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.toggleSelected.js ===================
**/
;(function ( $, window, document, undefined ) {
"use strict";
var pluginName = "AuxinToggleSelected",
defaults = {
isotope : null, // isotope element
overlayClass : 'aux-overlay',
overlay : 'aux-select-overlay',
event : 'click',
target : 'li>a',
selected : 'aux-selected',
resizeOverlay : true
};
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function() {
this.$targets = this.$element.find( this.settings.target );
this.$targets.on( this.settings.event, this._toggleSelected.bind(this) );
if ( this.$element.hasClass( this.settings.overlayClass ) ) {
this.overlay = this.$element.find( '.' + this.settings.overlay )[0];
$(window).on('resize', this._locateOverlay.bind( this ) );
}
// select first if nothing selected
if ( this.$element.find( '.' + this.settings.selected ).length === 0 ) {
this.$current = this.$targets.eq(0);
this._toggleSelected( { currentTarget: this.$current[0] } );
}
this._locateOverlay();
},
_toggleSelected: function( event ) {
this.$targets.removeClass( this.settings.selected );
var $this = $(event.currentTarget);
$this.addClass( this.settings.selected );
// update isotope, applies data-filter to isotope instance
if ( this.settings.isotope ) {
this.settings.isotope.arrange( { filter: $this.data('filter') } );
}
this.$current = $this;
this._locateOverlay();
},
_locateOverlay: function() {
if ( !this.overlay || !this.$current ) {
return;
}
this.overlay.style[window._jcsspfx + 'Transform'] = 'translate(' +
( this.$current.offset().left - this.$element.offset().left ) + 'px, ' +
( this.$current.offset().top - this.$element.offset().top ) + 'px )';
if ( this.settings.resizeOverlay ) {
this.overlay.style.width = ( this.$current.outerWidth() - 1 ) + 'px';
this.overlay.style.height = ( this.$current.outerHeight() - 1 ) + 'px';
}
},
destroy: function() {
$(window).off( 'resize', this._locateOverlay );
this.$overlay = null;
this.$element.remove();
}
});
$.fn[pluginName] = function (options) {
var args = arguments,
plugin = 'plugin_' + pluginName;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if (!$.data(this, plugin)) {
$.data(this, plugin, new Plugin( this, options ));
}
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
var returns;
this.each(function () {
var instance = $.data(this, plugin);
if (instance instanceof Plugin && typeof instance[options] === 'function') {
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
// Allow instances to be destroyed via the 'destroy' method
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.videobox.js ===================
**/
/**
* Auxin video box html element
*
* Example markup:
*
*
*
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinVideobox";
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $( element );
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function() {
this.$video = this.$element.find( '>video' );
if ( this.$video.length === 0 ) {
return;
}
this.video = this.$video[0];
this.video.addEventListener( 'loadedmetadata', this._initVideo.bind( this ) );
if ( !AVTAligner ){
$.error( "AVTAligner is not defined in this page, Auxin video box requires this library to perform correctly." );
} else {
this.aligner = new AVTAligner( this.$element.data( 'fill' ) || 'fill' , this.$element, this.$video );
$(window).on( 'resize', this._alignVideo.bind( this ) );
}
},
_initVideo: function() {
if ( this._videoInit ) {
return;
}
this._videoInit = true;
this.aligner.init( this.video.videoWidth , this.video.videoHeight );
this.aligner.align();
this.video.play();
},
_alignVideo: function() {
this.aligner.align();
},
destroy: function(){
$(window).off( 'resize', this._alignVideo );
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function ( options ) {
var args = arguments,
plugin = 'plugin_' + pluginName;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if (!$.data(this, plugin)) {
$.data(this, plugin, new Plugin( this, options ));
}
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
var returns;
this.each(function () {
var instance = $.data(this, plugin);
if (instance instanceof Plugin && typeof instance[options] === 'function') {
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
// Allow instances to be destroyed via the 'destroy' method
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.imagebox.js ===================
**/
/**
* Auxin Image Box
*
* This plugin aligns and sizes image element inside it's frame element
*
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinImagebox",
defaults = {
target : 'img',
frame : null,
fill : 'fill'
},
attributeOptionsMap = {
'fill' : 'fill',
'target' : 'target',
'frame' : 'frame'
}
function Plugin ( element, options ) {
this.element = element;
this.$element = $( element );
this.settings = $.extend( {}, defaults, options );
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function() {
if ( !AVTAligner ){
$.error( "AVTAligner is not defined in this page, Auxin image box requires this library to perform correctly." );
return;
}
// read attributes
for ( var attrName in attributeOptionsMap ) {
var value = this.$element.data( attrName );
if ( value !== undefined ) {
this.settings[attributeOptionsMap[attrName]] = value;
}
}
this.$image = this.$element.find( this.settings.target );
if ( !this.$image.length ) {
return;
}
this.$image.preloadImg( this.$image.attr('src'), this._initAligner.bind(this) );
this.$frame = this.settings.frame ? this.$element.find( this.settings.frame ) : this.$element;
this.aligner = new AVTAligner( this.settings.fill , this.$parent, this.$image, {
containerWidth: this.$frame.innerWidth.bind( this.$frame ),
containerHeight: this.$frame.innerHeight.bind( this.$frame ),
srcset: !!this.$image.attr( 'srcset' )
});
$(window).on( 'resize', this._alignImage.bind( this ) );
},
_initAligner: function() {
if ( this._aligenrInit ) {
return;
}
this._aligenrInit = true;
var img = this.$image[0],
w = img.naturalWidth || this.$image.data('width'),
h = img.naturalHeight || this.$image.data('height');
this.aligner.init( w, h);
this.aligner.align();
},
_alignImage: function() {
this.aligner.align();
},
update: function(){
this._alignImage();
},
destroy: function(){
$(window).off( 'resize', this._alignImage );
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function ( options ) {
var args = arguments,
plugin = 'plugin_' + pluginName;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if (!$.data(this, plugin)) {
$.data(this, plugin, new Plugin( this, options ));
}
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
var returns;
this.each(function () {
var instance = $.data(this, plugin);
if (instance instanceof Plugin && typeof instance[options] === 'function') {
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
// Allow instances to be destroyed via the 'destroy' method
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.fullscreenHero.js ===================
**/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinFullscreenHero";
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this._name = pluginName;
this.init();
}
$.extend(Plugin.prototype, {
init: function () {
$(window).on( 'resize', this.update.bind( this ) );
this.update();
},
update: function(){
this.$element.height( Math.max(0, window.innerHeight - this.$element.offset().top) + 'px' );
}
});
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.animateAndRedirect.js ===================
**/
/**
* A jQuery plugin for adding custom effect on changing pages
*
* @author Averta
* @package Auxin Framework
*/
;(function ( $, window, document, undefined ) {
"use strict";
var pluginName = "AuxinAnimateAndRedirect",
defaults = {
target : 'body', // The container which needs to animating before and after loading page
scrollFixTarget : 'body', // The container that checks for scroll top value on animation
checkLinkTarget : true, // Check the anchor target attribute and only work on _self
checkTargetEvents : true, // Don't work if the target has other click events
skipRelativeLinks : true, // Skips those are relatively linked
noAnimate : '.aux-no-page-animate, .aux-lightbox-btn, [data-elementor-open-lightbox="yes"], [bdt-lightbox] a', // Targets by this class don't animate the page
animateIn : 'aux-show-page', // The animation class name of page
animateOut : 'aux-hide-page', // Hide animation class name of page
beforeAnimateOut : 'aux-before-hide-page', // It adds this class name before starting the hide animation
disableOn : null, // Do not work if the link is a child of it
delay : 800, // The delay between opening links, it recommended to be set same as animation duration
fixScroll : true, // Fix scroll position on hiding the page
linkClicked : null, // Callback for when link clicked
startToHide : null, // Callback for when it starts to hide
startToShow : null // Callback for when it starts to show
};
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
var st = this.settings,
evts = $._data( this.element, 'events' ) || {},
$target = $( st.target ),
$scrollTarget = $( st.scrollFixTarget ),
linkHref = this.element.href;
if ( st.animateIn && !$target.data( 'isAnimated' ) ) {
$target.addClass( st.animateIn ).data( 'isAnimated', true );
if ( st.startToShow ) {
st.startToShow();
}
}
// Is it required to animate page?
/* ------------------------------------------------------------------------------ */
// no animation class name
if ( st.noAnimate && this.$element.is( st.noAnimate ) ) { return; }
// skip relative links
if ( st.skipRelativeLinks && !(/http(s?):\/\//).test(this.$element.attr('href')) ) { return; }
// target is blank
if ( this.$element.attr( 'target' ) === '_blank' ) { return; }
// link has click event
if ( st.checkTargetEvents && ( 'click' in evts || this.element.onclick ) ) { return; }
// link location is to current page
if ( this.element.hash !== '' && this.element.origin + this.element.pathname + this.element.search === location.origin + location.pathname + location.search ) { return; }
// check parents
if ( st.disableOn && this.$element.parents( st.disableOn ).length ) { return; }
/* ------------------------------------------------------------------------------ */
this.$element.on('click', function( e ) {
// check keys
if ( e.ctrlKey || e.metaKey || e.which !== 1 ) {
return;
}
e.preventDefault();
var scrollTop = document.documentElement.scrollTop;
$target.addClass( st.beforeAnimateOut ).removeClass( st.animateIn );
setTimeout( function(){
$target.addClass( st.animateOut );
}, 1 );
if ( st.fixScroll ) {
$scrollTarget.scrollTop( scrollTop );
}
if ( st.linkClicked ) {
st.linkClicked();
}
clearTimeout( this.timeout );
this.timeout = setTimeout( function(){
window.location.href = this.element.href;
if ( st.startToHide ) {
st.startToHide();
}
}.bind(this), st.delay );
}.bind(this));
}
});
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/averta-jquery.parallaxBox.js ===================
**/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AvertaParallaxBox",
defaults = {
targets : 'aux-parallax', // target elements classname to move in parallax
defaultDepth : 0.5, // default target parallax depth
defaultOrigin : 'top', // defalut target parallax origin, possible values: 'top', 'bottom', 'middle'
forceHR : false // force use hardware accelerated
},
$window = $(window);
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
this.$targets = this.$element.find( '.' + this.settings.targets );
this._targetsNum = this.$targets.length;
this._prefix = window._jcsspfx || '';
if ( this._targetsNum === 0 ) {
return;
}
$window.on( 'scroll resize', this.update.bind( this ) );
this.update();
},
/**
* Updates the position of parallax element in box
* @param {Element} $target
* @param {Number} scrollValue
*/
_setPosition: function( $target, scrollValue ) {
var origin = $target.data( 'parallax-origin' ) || this.settings.defaultOrigin,
depth = $target.data( 'parallax-depth' ) || this.settings.defaultDepth,
disablePoint = $target.data( 'parallax-off' ),
absDepth = Math.abs(depth),
dir = depth < 0 ? 1 : -1,
type = $target.data( 'parallax-type' ) || 'position',
value;
if ( disablePoint >= window.innerWidth ) {
if ( $target.data( 'disabled' ) ) {
return;
}
$target.data( 'disabled', true );
if ( type === 'background' ) {
$target[0].style.backgroundPosition = '';
} else {
$target[0].style[this._prefix + 'Transform'] = '';
}
return;
} else {
$target.data( 'disabled', false );
}
switch( origin ) {
case 'top':
value = Math.min( 0, this._spaceFromTop * absDepth );
break;
case 'bottom':
value = Math.max( 0, this._spaceFromBot * absDepth );
break;
case 'middle':
value = this._spaceFromMid * absDepth;
break;
}
if ( value < 0 ) {
value = Math.max( value, -window.innerHeight );
} else {
value = Math.min( value, window.innerHeight );
}
if ( type === 'background' ) {
$target[0].style.backgroundPosition = '50% ' + value * dir + 'px';
} else {
$target[0].style[this._prefix + 'Transform'] = 'translateY(' + value * dir + 'px)' + ( this.settings.forceHR ? ' translateZ(1px)' : '' );
}
},
/* ------------------------------------------------------------------------------ */
// public methods
/**
* update the parallax
*/
update: function() {
this._boxHeight = this.$element.height();
this._spaceFromTop = this.$element[0].getBoundingClientRect().top;
this._spaceFromBot = window.innerHeight - this._boxHeight - this._spaceFromTop;
this._spaceFromMid = window.innerHeight / 2 - this._boxHeight / 2 - this._spaceFromTop;
for( var i = 0; i !== this._targetsNum; i++ ) {
this._setPosition( this.$targets.eq(i), $window.scrollTop() );
}
},
/**
* Enables the parallax effect in box
*/
enable: function() {
$window.on( 'resize scroll', this.update );
this.update();
},
/**
* Disables the parallax effect in box
*/
disable: function() {
$window.off( 'resize scroll', this.update );
},
destroy: function() {
this.disable();
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function( options ) {
var _arguments = arguments;
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
} else if ( typeof options === 'string' && options.indexOf(0) !== '_' ) {
// access to public methods method
var plugin = $.data( this, "plugin_" + pluginName);
plugin[options].apply( plugin, Array.prototype.slice.call( _arguments, 1 ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.masonry.Animation.js ===================
**/
/**
* A jQuery plugin for Adding Animation To Masonry
*
* @author Averta
* @package Auxin Framework
*/
;( function( $, window, document, undefined ) {
"use strict";
var pluginName = "AuxinMasonryAnimate",
defaults = {
columns : 3,
tabletColumns: 2,
mobileColumns: 1,
columnClass : 'aux-parallax-column',
numItems : 8,
offset : 0.2,
minHeight : 500,
insetOffset : 0.3
},
attributeDataMap = {
'd-columns' : 'columns',
't-columns' : 'tabletColumns',
'm-columns' : 'mobileColumns',
'length' : 'numItems',
'offset' : 'offset',
'inset-offset': 'insetOffset',
},
$window = $(window)
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
// create element attribute options object
var elementData = {},
tempData;
for ( var attribute in attributeDataMap ) {
tempData = this.$element.data(attribute);
if ( tempData !== undefined ) {
elementData[attributeDataMap[attribute]] = tempData;
}
}
this.settings = $.extend( {}, defaults, options, elementData );
this._defaults = defaults;
this._name = pluginName;
this.items = this.$element.find('.aux-parallax-item');
this.oldBreakPoint = null,
this.loading = false;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend( Plugin.prototype, {
/**
* Init Function
*/
init: function() {
this.showLoading();
$window.on('load resize', this.initializeLayout.bind( this ) );
setTimeout( function(){
this.hideLoading();
}.bind(this), 1000);
},
/**
* a function for transform the columns based on short column on scroll
*/
update: function() {
if ( this.items.length <= this.columns.length || this.items.length % this.columns.length === 0 ) {
this.columns.css( window._jcsspfx + 'Transform', 'none' );
this.element.style.marginBottom = 0;
return;
};
var shortCol = this.shortCol,
shortColRect = shortCol.getBoundingClientRect(),
refDelta = window.innerHeight - ( window.innerHeight * this.settings.offset ) - ( shortColRect.top ) ,
refDeltaNormal = refDelta / ( shortColRect.height ) ;
this.element.style.marginBottom = ( shortCol.offsetHeight * this.settings.insetOffset - this.element.offsetHeight ) + 'px';
if ( refDeltaNormal >= 1 ) {
refDeltaNormal = 1;
} else if ( refDeltaNormal <= 0 ) {
refDeltaNormal = 0;
}
this.columns.each( function( index, column ) {
var colTransform = 0;
var columnOffBot = column.offsetHeight + column.offsetTop,
shortColOffBot = ( shortColRect.height * this.settings.insetOffset ) + shortCol.offsetTop;
colTransform = -1 * ( columnOffBot - shortColOffBot ) * refDeltaNormal;
column.style[window._jcsspfx + 'Transform'] = 'translateY(' + colTransform + 'px)';
}.bind( this ) );
},
/**
* a function for initialze the layout based on breakpoints
*/
initializeLayout: function(){
var columnsNum,
currentBreakPoint;
if ( $window.width() < 1024 && $window.width() > 768 ) {
columnsNum = this.settings.tabletColumns;
currentBreakPoint = 'tablet';
} else if ( $window.width() < 768 ) {
columnsNum = this.settings.mobileColumns;
currentBreakPoint = 'mobile';
} else {
columnsNum = this.settings.columns;
currentBreakPoint = 'desktop';
}
if ( this.oldBreakPoint === currentBreakPoint ) return;
this.oldBreakPoint = currentBreakPoint;
var colObject = this.initializeColumn( columnsNum ),
columns = [],
self = this,
shortCol;
if ( this.columns ) {
this.columns.remove();
}
Object.keys( colObject ).forEach( function ( key ) {
var columnNode = document.createElement('div');
columnNode.classList.add( self.settings.columnClass + '-' + key );
colObject[key]['posts'].forEach( function( item ) {
columnNode.appendChild( item );
})
self.element.appendChild( columnNode );
columns.push( columnNode );
if ( !shortCol || columnNode.offsetHeight < shortCol.offsetHeight ) {
shortCol = columnNode;
}
});
this.shortCol = shortCol;
this.columns = $(columns);
$window.on('scroll resize', this.update.bind( this ) );
},
/**
* a function for return an object of columns with their items
*/
initializeColumn: function( columnsNum ){
if ( this.settings.numItems !== this.items.length ) {
this.settings.numItems = this.items.length;
}
var colObj = {},
numExtraItems = this.settings.numItems < columnsNum ? 0 : this.settings.numItems % columnsNum,
orderdItems = 0 !== numExtraItems ? this.items.slice( 0, -1 * numExtraItems ): this.items,
extraItems = 0 !== numExtraItems ? this.items.slice( -1 * numExtraItems ) : null;
for( var i = 1; i <= columnsNum; i++ ) {
colObj[i] = {
posts : [],
}
}
orderdItems.each( function( index, item ) {
var currentIndex = index + 1,
columnIndex = currentIndex % columnsNum ;
columnIndex = 0 === columnIndex ? columnsNum : columnIndex ;
colObj[columnIndex].posts.push(item);
});
if ( extraItems ) {
switch( columnsNum ) {
case 5:
if ( 1 === 5 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item);
});
} else if ( 2 === 5 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = index * 2 + 1;
colObj[currentIndex].posts.push(item);
});
} else if ( 3 === 5 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = ( index + 1 ) * 2 ;
colObj[currentIndex].posts.push(item);
});
} else {
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item);
});
}
break;
case 4:
if ( 1 === 4 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item);
});
} else if ( 2 === 4 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = ( index + 1 ) * 2 ;
colObj[currentIndex].posts.push(item);
});
} else {
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item);
});
}
break;
case 3:
if ( 1 === 3 - numExtraItems ) {
extraItems.each( function( index, item ) {
var currentIndex = index * 2 + 1;
colObj[currentIndex].posts.push(item);
});
} else {
extraItems.each( function( index, item ) {
var currentIndex = ( index + 1 ) * 2 ;
colObj[currentIndex].posts.push(item);
});
}
break;
case 2:
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item)
});
break;
default:
extraItems.each( function( index, item ) {
var currentIndex = index + 1;
colObj[currentIndex].posts.push(item)
});
}
}
return colObj;
},
/**
* a function for showing the loading
*/
showLoading: function() {
this.$element.css({
'height' : this.settings.minHeight,
'overflow' : 'hidden'
});
this.$element.find('.aux-items-loading').addClass('aux-loading-hide');
},
/**
* a function for hiding the loading
*/
hideLoading: function() {
this.$element.css({
'height' : 'auto',
'overflow' : 'visible'
});
this.$element.find('.aux-items-loading').removeClass('aux-loading-hide');
},
/**
* a function for insert items
*/
insertItem: function( items ) {
this.oldBreakPoint = null;
this.columns.remove();
this.items = items;
this.initializeLayout();
}
} );
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function( options ) {
var _arguments = arguments;
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
} else if ( typeof options === 'string' && options.indexOf(0) !== '_' ) {
// access to public methods method
var plugin = $.data( this, "plugin_" + pluginName);
plugin[options].apply( plugin, Array.prototype.slice.call( _arguments, 1 ) );
}
});
};
} )( jQuery, window, document );
/*!
*
* ================== js/src/plugins/averta-jquery.scrollAnims.js ===================
**/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AvertaScrollAnims",
defaults = {
targets : 'aux-scroll-anim', // target elements classname to get styles in scroll,
elementOrigin : 0.2,
viewPortTopOrigin: 0.4,
viewPortBotOrigin: 0.6,
moveInEffect : 'fade', // fade
moveOutEffect : 'fade',
xAxis : 200,
yAxis : -200,
rotate : 90,
scale : 1,
containerTarget : '.elementor-widget-container',
disableScrollAnims: 1 // disable scroll animation under specified with (px)
},
attributeDataMap = {
'move-in' : 'moveInEffect',
'move-out': 'moveOutEffect',
'axis-x' : 'xAxis',
'axis-y' : 'yAxis',
'rotate' : 'rotate',
'scale' : 'scale',
'el-top' : 'elementOrigin',
'vp-bot' : 'viewPortBotOrigin',
'vp-top' : 'viewPortTopOrigin',
'scroll-animation-off' : 'disableScrollAnims',
},
$window = $(window);
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
// create element attribute options object
var elementData = {},
tempData;
for ( var attribute in attributeDataMap ) {
tempData = this.$element.data(attribute);
if ( tempData !== undefined ) {
elementData[attributeDataMap[attribute]] = tempData;
}
}
this.settings = $.extend( {}, defaults, options, elementData );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
this._prefix = window._jcsspfx || '';
this.settings.viewPortOrigin = [ this.settings.viewPortTopOrigin , this.settings.viewPortBotOrigin ];
this.oldEffect = this.settings.moveInEffect;
if ( this.$element.length === 0 ) {
return;
}
$window.on( 'scroll resize', this.update.bind( this ) );
this.update();
},
/**
* Updates the styles of scrollable element in box
* @param {Element} $target
* @param {Number} scrollValue
*/
_setStyles: function( $target, scrollValue ) {
var delta = this._getDelta( $target[0], this.settings.elementOrigin, this.settings.viewPortOrigin ),
styles = this._getStyle( delta ),
effect;
if ( delta < 0 ) {
effect = this.settings.moveOutEffect;
} else if ( delta > 0 ) {
effect = this.settings.moveInEffect;
} else {
effect = this.oldEffect;
}
if ( this.oldEffect !== effect ) {
this._generateEffect( this.oldEffect, this._getStyle( 0 ), $target.find( this.settings.containerTarget ) );
}
this._generateEffect( effect, styles, $target.find( this.settings.containerTarget ) );
this.oldEffect = effect;
},
/**
* Get the delta for scrollable target
* @param {Element} $target
*/
_getDelta: function( $target, elementOrigin, viewPortOrigin ) {
var dimensions = $target.getBoundingClientRect(),
isRange = Array.isArray( viewPortOrigin ),
lowerRange = isRange ? viewPortOrigin[0] : viewPortOrigin,
upperRange = isRange ? viewPortOrigin[1] : viewPortOrigin,
elementTop = ( dimensions.y + ( elementOrigin * dimensions.height ) ),
elementPosition = elementTop / window.innerHeight,
delta;
if ( elementPosition >= lowerRange && elementPosition <= upperRange ) {
delta = 0;
} else if ( elementPosition >= upperRange ) {
delta = Math.min( ( elementTop - window.innerHeight * upperRange ) / ( window.innerHeight - ( window.innerHeight * upperRange ) ) , 1 );
} else {
delta = Math.max( ( elementTop - window.innerHeight * lowerRange ) / ( window.innerHeight * lowerRange ) , -1 );
}
return delta;
},
_getStyle: function( delta ) {
var style = {};
style.opacity = 1 - Math.abs( delta ) ;
style.xAxis = this.settings.xAxis * delta;
style.yAxis = this.settings.yAxis * delta;
style.slide = Math.abs( 100 * delta );
style.mask = Math.abs( 100 * delta );;
style.rotate = this.settings.rotate * delta;
style.scale = ( ( this.settings.scale - 1 ) * Math.abs( delta ) ) + 1 ;
return style;
},
_generateEffect: function( effect , styles, $target ) {
switch( effect ) {
case 'moveVertical':
$target[0].style[this._prefix + 'Transform'] = 'translateY(' + styles.yAxis + 'px)';
break;
case 'moveHorizontal':
$target[0].style[this._prefix + 'Transform'] = 'translateX(' + styles.xAxis + 'px)';
break;
case 'fade':
$target[0].style.opacity = styles.opacity;
break;
case 'fadeTop':
$target[0].style.opacity = styles.opacity;
$target[0].style[this._prefix + 'Transform'] = 'translateY(' + -1 * styles.yAxis + 'px)';
break;
case 'fadeBottom':
$target[0].style.opacity = styles.opacity;
$target[0].style[this._prefix + 'Transform'] = 'translateY(' + styles.yAxis + 'px)';
break;
case 'fadeRight':
$target[0].style.opacity = styles.opacity;
$target[0].style[this._prefix + 'Transform'] = 'translateX(' + styles.xAxis + 'px)';
break;
case 'fadeLeft':
$target[0].style.opacity = styles.opacity;
$target[0].style[this._prefix + 'Transform'] = 'translateX(' + -1 * styles.xAxis + 'px)';
break;
case 'slideRight':
$target.parent()[0].style.overflow = 'hidden';
$target [0].style[this._prefix + 'Transform'] = 'translateX(' + styles.slide + '%)';
break;
case 'slideLeft':
$target.parent()[0].style.overflow = 'hidden';
$target [0].style[this._prefix + 'Transform'] = 'translateX(' + -1 * styles.slide + '%)';
break;
case 'slideTop':
$target.parent()[0].style.overflow = 'hidden';
$target [0].style[this._prefix + 'Transform'] = 'translateY(' + -1 * styles.slide + '%)';
break;
case 'slideBottom':
$target.parent()[0].style.overflow = 'hidden';
$target [0].style[this._prefix + 'Transform'] = 'translateY(' + styles.slide + '%)';
break;
case 'maskTop':
$target[0].style[this._prefix + 'ClipPath'] = 'inset(0 0 '+ styles.mask + '% 0)'
break;
case 'maskBottom':
$target[0].style[this._prefix + 'ClipPath'] = 'inset('+ styles.mask + '% 0 0 0)';
break;
case 'maskRight':
$target[0].style[this._prefix + 'ClipPath'] = 'inset(0 0 0 ' + styles.mask + '%)';
break;
case 'maskLeft':
$target[0].style[this._prefix + 'ClipPath'] = 'inset(0 ' + styles.mask + '% 0 0)';
break;
case 'rotateIn':
$target[0].style[this._prefix + 'Transform'] = 'rotate(' + -1 * styles.rotate + 'deg)';
break;
case 'rotateOut':
$target[0].style[this._prefix + 'Transform'] = 'rotate(' + styles.rotate + 'deg)';
break;
case 'fadeScale':
$target[0].style.opacity = styles.opacity;
$target[0].style[this._prefix + 'Transform'] = 'scale(' + styles.scale + ')';
break;
case 'scale':
$target[0].style[this._prefix + 'Transform'] = 'scale(' + styles.scale + ')';
break;
default:
return;
}
},
/* ------------------------------------------------------------------------------ */
// public methods
/**
* update the styles
*/
update: function() {
if ( $window.width() <= this.settings.disableScrollAnims ) {
this.disable();
} else {
this._setStyles( this.$element, $window.scrollTop() );
}
},
/**
* Enables the scroll effect in box
*/
enable: function() {
$window.on( 'resize scroll', this.update );
this.update();
},
/**
* Disables the scroll effect in box
*/
disable: function() {
$window.off( 'resize scroll', this.update );
},
destroy: function() {
this.disable();
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function( options ) {
var _arguments = arguments;
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
} else if ( typeof options === 'string' && options.indexOf(0) !== '_' ) {
// access to public methods method
var plugin = $.data( this, "plugin_" + pluginName);
plugin[options].apply( plugin, Array.prototype.slice.call( _arguments, 1 ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/auxin-jquery.timeline.js ===================
**/
/*!
* Auxin Timeline Element
* @author Averta [www.averta.net]
*/
;(function ( $, window, document, undefined ) {
"use strict";
// Create the defaults once
var pluginName = "AuxinTimeline",
defaults = {
layout: 'center',
responsive: {
760: 'left'
},
layoutMap: {
'left' : 'aux-left',
'right': 'aux-right',
'middle': 'aux-middle',
'center': 'aux-center'
}
}, $window = $(window);
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
// future instances of the plugin
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend(Plugin.prototype, {
init: function () {
// read layout from attribute
if ( this.$element.data( 'layout' ) !== undefined ) {
this.settings.layout = this.$element.data( 'layout' );
}
$window.on( 'resize', this._onResize.bind( this ) );
this._onResize();
},
_onResize: function ( e ) {
var width = $window.width(),
layout = this.settings.layout;
for ( var bp in this.settings.responsive ) {
if ( width < bp ) {
layout = this.settings.responsive[bp];
}
}
this._update( layout );
},
_update: function ( newLayout ) {
if ( this._currentLayout !== newLayout ) {
this._currentLayout = newLayout;
// remove old class names
for ( var key in this.settings.layoutMap ) {
this.$element.removeClass( this.settings.layoutMap[key] );
}
this.$element.addClass( this.settings.layoutMap[newLayout] );
}
}
});
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[ pluginName ] = function ( options ) {
return this.each(function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
}
});
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/averta-jquery.accordion.js ===================
**/
/**
* Averta.Accordion v2.0
* An jQuery for Accordion and toggles
* Copyright (c) averta | http://averta.net | 2016
* licensed under the MIT license
**/
/**
* USAGE :
* -----------------------------------------------------------------------------------------------------
* HTML:
- -Nam ante quam, venenatis
- Lorem ipsum dolor isus. Ut neque.
- -Nam ante quam, venenatis
- Lorem ipsum dolor isus. Ut neque.
*
* JS:
$('#container').avertaAccordion({
items: 'section', // accordion item selector
itemActiveClass: 'active', // A Class that indicates active item
itemHeader: 'dt', // item header selector
itemContent: 'dd', // item content selector
transition: 'fade', // Animation type white swiching tabs
hideDuration : '300' , // Hiding duration in mili seconds
showDuration : '500' , // Showing duration in mili seconds
hideEase : 'linear' , // Ease for hiding transition
showEase : 'linear' , // Ease for showing transition
oneVisible: true , // Always just one item can be open or not
collapseOnInit: true // collapse all items on accordion init
onExpand: function(){},// callback that fires on expanding item - param: item
onCollapse: function(){} // callback that fires on collapsing item - param: item
});
*
* ---------------------------------------------------------------------------------------------------------
**/
if( typeof Object.create !== 'function' ){ Object.create = function (obj){ function F(){} F.prototype = obj; return new F();}; }
;( function($){
var Container = {
init : function(el, options){
//cache this
var self = this;
self.options = $.extend({} ,$.fn.avertaAccordion.defaultOptions, options || {} );
// Access to jQuery and DOM versions of element
self.$el = $(el);
self.el = el;
self.$items = self.$el.find(self.options.items);
// skip if no item found
if( ! self.$items.length ) {
return;
}
self.$items.find(self.options.itemContent).wrap( '' );
self.$headers = self.$items.find(self.options.itemHeader);
self.$contents = self.$items.find( '.' + self.options.contentWrapClass );
self.setup();
},
setup: function(){
var self = this;
// add click handler on each item's header'
self.$headers.on('click', {self:self}, self.onHeaderClicked);
// collapse all elements on start
if( self.options.collapseOnInit || self.options.oneVisible ) {
self._closeContent( self.$contents, 0 );
self.options.onCollapse(self.$items);
}
// if oneVisible is true, expand the active element
if( self.options.oneVisible ){
var $actives = self.$items.filter('.'+self.options.itemActiveClass).first();
// if active is not defined, get first element as active item
$actives = $actives.length?$actives:self.$items.first().addClass(self.options.itemActiveClass);
// expand active element
self._openContent( $actives.find( '.' + self.options.contentWrapClass ), 0 );
self.options.onExpand($actives);
}else if( self.options.collapseOnInit ){
// remove active class if active item is collapsed
self.$items.removeClass(self.options.itemActiveClass);
}
// get hash id and expand the item
if( window.location.hash && this.options.expandHashItem ){
self.expandHashItem();
}
if ( this.options.expandHashItem ){
$(window).on('hashchange', self.expandHashItem);
}
},
expandHashItem: function(){
var self = this;
var $hashHead = $(window.location.hash).find(self.options.itemHeader);
$hashHead.trigger('click', {self:self}, self.onHeaderClicked);
},
onHeaderClicked:function(event){
event.preventDefault();
var self = event.data.self;
var $header = $(this);
var $item = $header.closest(self.options.items);
// skip if the target is active item
if( $item.hasClass( self.options.itemActiveClass ) && self.options.oneVisible ) {
return;
}
var $content = $item.find( '.' + self.options.contentWrapClass );
if( self.options.oneVisible ){
// remove active class from all items and add to current item
self.$items.removeClass(self.options.itemActiveClass);
$item.addClass(self.options.itemActiveClass);
// collapse all items and expand current item
self._closeContent( self.$contents, self.options.hideDuration, $content );
self.options.onCollapse(self.$items);
self._openContent( $content, self.options.showDuration );
self.options.onExpand($item);
} else {
if ( $item.hasClass( self.options.itemActiveClass ) ) {
self._closeContent( $content, self.options.hideDuration );
$item.removeClass(self.options.itemActiveClass);
self.options.onCollapse($item);
} else {
self._openContent( $content, self.options.showDuration );
$item.addClass(self.options.itemActiveClass);
self.options.onExpand($item);
}
}
},
_openContent: function( $contents, duration, $exclude ) {
var self = this;
if ( !$contents.length ) {
$contents = [$contents];
}
$.each( $contents, function( index, content ){
var $content = $(content);
if ( $exclude && $content === $exclude ) {
return;
}
clearTimeout( $content.data( 'toggle-to' ) );
if ( duration === 0 ) {
$content.css( 'height', 'auto' );
} else {
$content.css( 'height', $content.find( self.options.itemContent ).outerHeight() + 'px' );
$content.data( 'toggle-to', setTimeout( function(){ $content.css( 'height', 'auto' ); }, duration ) );
}
} );
},
_closeContent: function( $contents, duration, $exclude ) {
var self = this;
if ( !$contents.length ) {
$contents = [$contents];
}
$.each( $contents, function( index, content ){
var $content = $(content);
if ( $exclude && $content === $exclude ) {
return;
}
clearTimeout( $content.data( 'toggle-to' ) );
if ( duration === 0 ) {
$content.css( 'height', '0' );
} else {
$content.css( 'height', $content.find( self.options.itemContent ).outerHeight() + 'px' );
$content.data( 'toggle-to', setTimeout( function(){ $content.css( 'height', '0' ); }, 1 ) );
}
} );
}
};
$.fn.avertaAccordion = function(options){
return this.each(function(){
var container = Object.create(Container);
container.init(this, options);
});
};
$.fn.avertaAccordion.defaultOptions = {
items: 'section', // accordion item selector
itemActiveClass: 'active', // A Class that indicates active item
contentWrapClass: 'acc-content-wrap', // content wrap element classname
itemHeader: 'dt', // item header selector
itemContent: 'dd', // item content selector
transition: 'fade', // Animation type white swiching tabs
hideDuration : '300' , // Hiding duration in mili seconds
showDuration : '500' , // Showing duration in mili seconds
hideEase : 'linear' , // Ease for hiding transition
showEase : 'linear' , // Ease for showing transition
oneVisible: true , // Always just one item can be open or not
collapseOnInit: true , // collapse all items on accordion init
expandHashItem: true, // expand the item by hash id
onExpand: function(){}, // callback that fires on expanding item - param: item
onCollapse: function(){} // callback that fires on collapsing item - param: item
};
})(jQuery);
/*!
*
* ================== js/src/plugins/averta-jquery.livetabs.js ===================
**/
/*
* Averta LiveTabs - v1.6.0 (2014-11-22)
* https://bitbucket.org/averta/averta-livetabs/
*
* A jQuery plugin for enabling tabs.
*
* Copyright (c) 2010-2014 <>
* License:
*/
/**
* USAGE :
* -----------------------------------------------------------------------------------------------------
* HTML:
*
* JS:
$('#container').avertaLiveTabs({
tabs: 'ul.tabs > li', // Tabs selector
tabsActiveClass: 'active', // A Class that indicates active tab
contents: 'ul.tabs-content > li', // Tabs content selector
contentsActiveClass: 'active', // A Class that indicates active tab-content
transition: 'fade', // Animation type white swiching tabs
duration : '500', // Animation duration in mili seconds
connectType: 'index', // connect tabs and contents by 'index' or 'id'
enableHash: false , // check to select initial tab based on hash address
updateHash: false , // update hash in browser while switching between tabs
hashSuffix: '-tab' // suffix to add at the end of hash url to prevent page scroll
});
* ---------------------------------------------------------------------------------------------------------
**/
if( typeof Object.create !== 'function' ){ Object.create = function (obj){ function F(){} F.prototype = obj; return new F();}; }
;(function($){
var Container = {
init : function(el, options){
//cache this
var self = this;
self.options = $.extend({} ,$.fn.avertaLiveTabs.defaultOptions, options || {} );
// Access to jQuery and DOM versions of element
self.$el = $(el);
self.el = el;
self.$tabs = self.$el.find(self.options.tabs);
self.$contents = self.$el.find(self.options.contents);
self.setup();
},
setup: function(){
var self = this,
$activeTab;
// click event when new tab selected
self.$tabs.on('click', {self:self}, self.onTabClicked);
// if hash is enabled in options get current hash and select related tab
if(self.options.enableHash && window.location.hash !== '') {
var id = self.trimID( window.location.hash );
$activeTab = self.getTabById(id);
} else {
// find the tab with tabsActiveClass
$activeTab = self.$tabs.filter('.'+self.options.tabsActiveClass);
}
// validate to select the active tab for start
$activeTab = ($activeTab.length)?$activeTab:self.$tabs.first();
$activeTab.trigger('click', true);
},
onTabClicked:function(event, fromSetup){
event.preventDefault();
var self = event.data.self,
$this = $(this),
$tabContent,
activeId;
if( !fromSetup && $this.hasClass('active') ){
return;
}
self.$tabs.removeClass(self.options.tabsActiveClass);
$this.addClass(self.options.tabsActiveClass);
self.$contents.hide();
if( self.options.connectType === 'id' ){
activeId = self.getIdByTab( $this );
$tabContent = self.getContentById( activeId );
} else {
$tabContent = self.$contents.eq( $this.index() );
}
$tabContent.fadeIn(self.options.duration);
// update hash in page address if updateHash is enabled
if( self.options.updateHash ){
activeId = self.getIdByTab( $this );
activeId = self.trimID( activeId );
activeId = activeId ? activeId + self.options.hashSuffix : '';
if( window.history && window.history.pushState )
window.history.pushState(null, null, window.location.href.split('#')[0]+'#'+activeId);
else
window.location.hash = activeId;
}
// trigger custom event
self.$el.trigger('avtTabChange', $tabContent.attr('id'));
},
getTabById:function(id){
// remove hashSuffix (if exist) from id hash to get real element id
id = id.split(this.options.hashSuffix)[0];
// search for hash in tabs markup - generaly should be direct children of tab
// check for href="#id" format
var $activeTab = this.$tabs.find('[href="#'+ id +'"]').eq(0);
// if no match found, check for href="id" format too
if(!$activeTab.length)
$activeTab = this.$tabs.find('[href="'+ id +'"]').eq(0);
// get the tab if hash found in it
return $activeTab.length ? $activeTab.parent() : $activeTab;
},
getContentById:function(id){
return this.$contents.filter( '#'+ this.trimID(id) );
},
trimID:function(id){
return id.replace( /^\s+|\s+$|#/g, '' );
},
getIdByTab:function($tab){
var $anchor = $tab.find('[href]').eq(0);
return $anchor.length?$anchor.attr('href'):false;
}
};
$.fn.avertaLiveTabs = function(options){
return this.each(function(){
var container = Object.create(Container);
container.init(this, options);
});
};
$.fn.avertaLiveTabs.defaultOptions = {
tabs: 'ul.tabs > li', // Tabs selector
tabsActiveClass: 'active', // A Class that indicates active tab
contents: 'ul.tabs-content > li', // Tabs content selector
contentsActiveClass: 'active', // A Class that indicates active tab-content
transition: 'fade', // Animation type white swiching tabs
duration : '500', // Animation duration in mili seconds
connectType: 'index', // connect tabs and contents by 'index' or 'id'
enableHash: false , // check to select initial tab based on hash address
updateHash: false , // update hash in browser while switching between tabs
hashSuffix: '-tab' // suffix to add at the end of hash url to prevent page scroll
};
})(jQuery);
/*!
*
* ================== js/src/plugins/averta-jquery.mastermenu.js ===================
**/
/*!
* MasterMenu - Averta's exclusive responsive menu and megamenu jQuery plugin
*
* @version 0.1.0
* @requires jQuery 1.9+
* @author Averta [averta.net]
* @package Auxin Framework
* @copyright Copyright © 2015 Averta, all rights reserved
*/
(function ( $, window, document ) {
"use strict";
var pluginName = "mastermenu",
id = 1,
isTouch = 'ontouchstart' in document,
//isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
defaults = {
menuItem : 'aux-menu-item', // Menu items class name
menuItemContent : 'aux-item-content', // Menu item text content element
submenu : 'aux-submenu', // Submenu container class name
subIndicator : 'aux-submenu-indicator', // Submenu indicator arrow
hover : 'aux-hover', // It adds or removes from menu item when mouse moves over it
open : 'aux-open', // Adds to opened menu items
noJS : 'aux-no-js', // No js class name, it removes by the menu after initialization
tabs : 'aux-menu-tabs', // Tabs element in megamenu
tab : 'aux-menu-tab', // Tab item
narrow : 'aux-narrow', // specifies the narrow menu layout, in default toggle and accordion menu appears as narrow menu
wide : 'aux-wide', // specifies the wide layout of the menu, in default horizontal and vertical menus has this class name
submenuHeader : 'aux-submenu-header', // Submenu header class name it only appears in cover menu
submenuBack : 'aux-submenu-back', // Submenu back menu item class name, it only appears in cover menu type.
type : 'horizontal', // Type of the menu 'horizontal', 'vertical', 'toggle', 'accordion', 'cover'
openOn : 'over', // Specifies the way of opening submenus "press" or "over"
openDelay : 100, // Specifies delay amount before opening submenu [ms]
closeDelay : 50, // Specifies delay amount before closing submenu [ms]
autoSwitch : 600, // Auto change menu type relative to window width it's useful for creating responsive layouts
autoSwitchType : 'accordion', // Specifies the type of auto-switching [usually toggle or accordion but other types are accepted]
autoSwitchParent : null, // Specifies the parent element of menu when it auto switches to another type.
addSubIndicator : true, // Inserts indicator element to each menu item that has submenu.
useSubIndicator : true, // Use sub indicator element for opening or closing submenus instead of menu item. It only affects with 'toggle' or 'accordion' type.
skipDelayForTabs : true, // Whether skip the opening menu delay for the tabs or not.
keepSubmenuInView : true, // Whether check the submenu position in browser window and always keeps it in view, it changes submenu alignment if it requires.
// cover menu options
insertHeaderInSubs : true, // Whether insert the parent menu name at top of the submenu.
backLabel : 'Back', // back menu item label in cover menu
// This map will be used to adding type class names to the main element of MasterMenu
typeMap : {
toggle : 'aux-toggle',
accordion : 'aux-toggle aux-accordion',
vertical : 'aux-vertical',
horizontal : 'aux-horizontal',
cover : 'aux-toggle aux-cover'
},
submenuAlignMap : {
left : 'aux-temp-left',
right : 'aux-temp-right',
bottom : 'aux-temp-bottom',
top : 'aux-temp-top',
pattern: /aux-temp-\w+/g
}
},
attributeDataMap = {
'type' : 'type',
'open-on' : 'openOn',
'open-delay' : 'openDelay',
'close-delay' : 'closeDelay',
'switch-width' : 'autoSwitch',
'switch-type' : 'autoSwitchType',
'switch-parent' : 'autoSwitchParent',
'indicator' : 'addSubIndicator'
};
function MasterMenuPlugin (element, options) {
this.element = element;
this.$element = $(element);
// create element attribute options object
var elementData = {},
tempData;
for ( var attribute in attributeDataMap ) {
tempData = this.$element.data(attribute);
if ( tempData !== undefined ) {
elementData[attributeDataMap[attribute]] = tempData;
}
}
this.settings = $.extend( {}, defaults, options, elementData );
this._defaults = defaults;
this._name = pluginName;
this._uniqueId = this._name + '_' + id++;
this.init();
}
$.extend(MasterMenuPlugin.prototype, {
/**
* MasterMenu initialization method
* @private
*/
init : function () {
var self = this,
st = this.settings;
self.$element.removeClass(st.noJS);
// store initial parent element and prev element
// it will be used to locating menu element in initial location in dom tree
self.lastLocation = 'defautlt';
self.defaultParent = self.$element.parent();
self.defaultPrev = self.$element.prev();
// cache menu items
self.$menuItems = self.$element.find('.' + st.menuItem);
self.pressEvent = 'click' + '.' + self._uniqueId;
// add submenu indicator if required
if ( st.addSubIndicator ) {
self.$menuItems.has('.' + st.submenu).find('>.' + st.menuItemContent).append('');
self.$subIndicators = self.$menuItems.find('.' + st.subIndicator);
}
// mouse interactions
self.handlerProxy = self._menuInteract.bind( self );
self.$menuItems.on('mouseenter' + '.' + self._uniqueId, self.handlerProxy)
.on('focusin' + '.' + self._uniqueId, self.handlerProxy)
.on('mouseleave' + '.' + self._uniqueId, self.handlerProxy)
.on('focusout' + '.' + self._uniqueId, self.handlerProxy);
// init slider type
self.changeType(st.type);
if ( st.autoSwitch > 0 ){
$(window).on('resize' + '.' + self._uniqueId, self._autoSwitch.bind( self ));
self._autoSwitch();
}
},
/**
* Prepare interaction events based on new menu type
* @private
*/
_onTypeChanged : function () {
if ( this.lastType === this.type ) {
return;
}
var self = this,
type = self.type,
st = self.settings;
// remove listeners
if ( self.lastType ) {
self.$menuItems.off(self.pressEvent, self.handlerProxy);
if ( st.useSubIndicator ) {
self.$subIndicators.off(self.pressEvent, self.handlerProxy);
}
if ( st.openOn === 'press' ) {
$(document).off(self.pressEvent, self.handlerProxy);
}
}
self._closeAll(false);
if ( type === 'horizontal' || type === 'vertical' ) {
self.$element.removeClass(st.narrow)
.addClass(st.wide);
self.isNarrow = false;
if ( st.openOn === 'over' ) {
self.openOnOver = true;
} else if ( st.openOn === 'press' ) {
$(document).on(self.pressEvent, self.handlerProxy);
self.$menuItems.on(self.pressEvent, self.handlerProxy);
}
// keep open tabs
self.keepTabs = true;
// open first tabs
self.$element.find('.' + st.tabs + '>.' + st.tab + ':first-child').addClass(st.open);
// if last type was cover, remove not requierd elements
if ( self.lastType === 'cover' ) {
self._removeCoverMenuElements();
}
} else { // 'accordion', 'toggle', 'cover'
self.openOnOver = false;
self.isNarrow = true;
self.$element.addClass(st.narrow)
.removeClass(st.wide);
if ( st.useSubIndicator && st.addSubIndicator ) {
self.$subIndicators.on(self.pressEvent, self.handlerProxy);
} else {
self.$menuItems.on(self.pressEvent, self.handlerProxy);
}
// disable tabbing function in toggle or accordion
self.keepTabs = false;
if ( type === 'cover' ) {
self._insertCoverMenuElements();
} else {
self._removeCoverMenuElements();
}
}
self.lastType = type;
self.$element.trigger( 'typeChanged' );
},
/**
* Controls all interactions over the menu
* @private
* @param {jQuery Evenr} event
* @since v1.0
*/
_menuInteract : function ( event ) {
var $this = $(event.currentTarget),
$menuItem = $this,
self = this,
st = self.settings,
etype = event.type;
// target is a submenu indicator
if ( $this.hasClass(st.subIndicator) ) {
$menuItem = $this.parents('.' + st.menuItem).eq(0);
} else if ( $this.hasClass(st.submenuBack) ) {
$menuItem = $this.parents('.' + st.menuItem).eq(0);
}
var hasSubmenu = $menuItem.find('>.' + st.submenu).length !== 0;
switch ( etype ) {
case 'mouseenter':
case 'focusin':
$menuItem.addClass(st.hover);
if ( hasSubmenu && self.openOnOver ) {
self._openMenu($menuItem, st.openDelay);
}
break;
case 'mouseleave':
case 'focusout':
$menuItem.removeClass(st.hover);
if ( hasSubmenu && self.openOnOver ) {
self._closeMenu($menuItem, st.closeDelay);
}
break;
case 'mouseup':
case 'click':
if ( $menuItem.is(document) ) {
self._closeAll();
} else if ( $menuItem.hasClass(st.open) ) {
// already opened? Ok close it
self._closeMenu($menuItem, 0);
// prevent clicking on menu item link
event.preventDefault();
// prevent bobbling
event.stopPropagation();
} else {
if ( self.type !== 'toggle' ) {
// close others
self._closeOthers($menuItem);
}
if ( hasSubmenu ) {
self._openMenu($menuItem, 0);
// prevent clicking on menu item link
event.preventDefault();
}
// prevent bobbling
event.stopPropagation();
}
}
},
/**
* Auto switch handler, it checks window width value and if it comes lower than
* options.autoSwitch value transform the menu to another type.
* @private
* @param {jQuery Event} event
*/
_autoSwitch : function (event) {
var autoSwitchType = this.settings.autoSwitchType;
if ( this.type !== autoSwitchType && window.innerWidth <= this.settings.autoSwitch ) {
this.changeType(autoSwitchType);
if ( this.settings.autoSwitchParent ) {
this.changeLocation(this.settings.autoSwitchParent);
}
} else if ( this.type !== this.settings.type && window.innerWidth > this.settings.autoSwitch ) { // is not default type
this.changeType('default');
if ( this.settings.autoSwitchParent ) {
this.changeLocation('default');
}
}
},
/**
* Adds required elements of cover menu to submenus.
* @private
*/
_insertCoverMenuElements : function () {
var self = this,
st = self.settings;
self.$element.find('.' + st.submenu).each(function () {
var $this = $(this),
// add back element
backItem = $('').html('')
.addClass(st.menuItem)
.addClass(st.submenuBack)
.prependTo($this)
.on(self.pressEvent, self.handlerProxy);
if ( st.insertHeaderInSubs ) {
var headerContent = $this.parent().find('>.' + st.menuItemContent).eq(0).clone();
headerContent.find('.' + st.subIndicator).remove();
$('').append(headerContent)
.prependTo($this)
.addClass(st.menuItem)
.addClass(st.submenuHeader);
}
});
},
/**
* Removes the added cover menu elements from markup.
* @private
*/
_removeCoverMenuElements : function () {
var st = this.settings;
// remove backElements
this.$element.find('.' + st.submenuBack).remove();
// remove submebu titles
if ( st.insertHeaderInSubs ) {
this.$element.find('.' + st.submenuHeader).remove();
}
},
/**
* Checkes the position of opening submenu and keeps it in view.
* @private
* @param {jQuery Object} $menuItem
*/
_checkSubmenuPosition: function ( $menuItem ) {
var st = this.settings,
submenu = $menuItem.find('>.' + st.submenu),
$window = $(window);
// it's not required for megamenu submenus
if ( $menuItem.parent().hasClass(st.megamenu) ) {
return;
}
// remove last added aligning classnames
submenu.attr('class', submenu.attr('class').replace(st.submenuAlignMap.pattern, ''));
// cache boundaries
var offset = submenu.offset(),
offsetTop = offset.top - $window.scrollTop(),
offsetLeft = offset.left - $window.scrollLeft(),
offsetRight = offsetLeft + submenu.width(),
offsetBottom = offsetTop + submenu.height();
// is it menu root item?
if ( $menuItem.parent().is( this.$element) ) {
if ( offsetRight > $window.width() ) {
var lastShift = submenu.data( 'menu-shift' ) || 0,
shift = $window.width() - offsetRight + lastShift;
if ( $( 'body' ).hasClass( 'rtl' ) ) {
submenu.css( 'right', Math.min( 0, shift ) );
} else {
submenu.css( 'left', Math.min( 0, shift ) );
}
submenu.data( 'menu-shift', shift );
return;
}
}
if ( offsetRight > $window.width() ) {
submenu.addClass(st.submenuAlignMap.left);
} else if ( offsetLeft < 0 ) {
submenu.addClass(st.submenuAlignMap.right);
}
// if ( offsetTop < 0 ) {
// submenu.addClass(st.submenuAlignMap.bottom);
// } else if ( offsetBottom > $window.height() ) {
// submenu.addClass(st.submenuAlignMap.top);
// }
},
/**
* Open submenu
* @private
* @param {jQuery Object} $menuItem
* @param {Number} delay
*/
_openMenu : function ($menuItem, delay){
var st = this.settings;
// Remove last timeout if exists
clearTimeout($menuItem.data('openTo'));
clearTimeout($menuItem.data('closeTo'));
// remove opening delay for the tabs
if ( st.skipDelayForTabs && $menuItem.hasClass(st.tab) ) {
delay = 0;
}
if ( delay === 0 ) {
this.$element.trigger( { type: 'beforeOpen', item: $menuItem } );
$menuItem.addClass(this.settings.open);
if ( !this.isNarrow && st.keepSubmenuInView ) {
this._checkSubmenuPosition($menuItem);
}
// close sibling tabs
if ( this.keepTabs && $menuItem.hasClass(st.tab) ) {
this._closeOthers($menuItem, false);
}
this.$element.trigger( { type: 'afterOpen', item: $menuItem } );
return;
}
var openTo = setTimeout(this._openMenu.bind( this ), delay, $menuItem, 0);
$menuItem.data('openTo', openTo);
},
/**
* close submenu
* @private
* @param {jQuery Object} $menuItem
* @param {Number} delay
* @param {Boolean} notTabs whether close tab items or not
*/
_closeMenu : function($menuItem, delay, notTabs) {
var st = this.settings;
if ( notTabs === undefined ) {
notTabs = this.keepTabs;
}
// Remove last timeout if exists
clearTimeout($menuItem.data('closeTo'));
clearTimeout($menuItem.data('openTo'));
if ( delay === 0 ) {
this.$element.trigger( { type: 'beforeClose', item: $menuItem } );
if ( !notTabs || !$menuItem.hasClass(st.tab) ){
$menuItem.removeClass(st.open);
}
// close children menus
$menuItem.find('.' + st.menuItem + '.' + st.open + (notTabs ? ':not(.' + st.tab + ')' : ''))
.removeClass(st.open);
this.$element.trigger( { type: 'afterClose', item: $menuItem } );
return;
}
var closeTo = setTimeout(this._closeMenu.bind( this ), delay, $menuItem, 0, notTabs);
$menuItem.data('closeTo', closeTo);
},
/**
* Close other opened menus
* @private
* @param {jQuery Object} $menuItem
* @param {Boolean} notTabs whether close tab items or not
*/
_closeOthers : function ($menuItem, notTabs) {
if ( notTabs === undefined ) {
notTabs = this.keepTabs;
}
this._closeMenu($menuItem.siblings(), 0, notTabs);
},
/**
* Close all opened menu items
* @param {Boolean} notTabs whether close tab items or not
* @private
*/
_closeAll : function (notTabs){
if ( notTabs === undefined ) {
notTabs = this.keepTabs;
}
this.$element.find('.' + this.settings.open + (notTabs ? ':not(.' + this.settings.tab + ')' : '')).removeClass(this.settings.open);
},
/*-----------------------------------------------------------*\
Public API
\*-----------------------------------------------------------*/
/**
* Transforms Menu to toggle menu, vertical menu, accordion menu and horizontal
* @public
* @param {string} type
* values: toggle
* horizontal
* vertical
* accordion
* cover
* default
*/
changeType: function (type) {
if ( this.type !== undefined ) {
this.$element.removeClass(this.settings.typeMap[this.type]);
} else {
// remove all probable type classnames
for ( var typeKey in this.settings.typeMap ) {
this.$element.removeClass( this.settings.typeMap[typeKey] );
}
}
// change type to initial value
if ( type === 'default' ) {
type = this.settings.type;
}
// update menu type
this.type = type;
this.$element.addClass(this.settings.typeMap[this.type]);
this._onTypeChanged();
},
/**
* Changes location of menu in dom tree it also restore the menu to the initial location if
* location with "default" value passed.
* @public
* @param {String} location jQuery selector or "default" value
*/
changeLocation: function (location) {
if ( this.lastLocation === location ) {
return;
}
if ( location === 'default' ) {
this.locationChanged = false;
if ( this.defaultPrev.length === 0 ) {
this.$element.prependTo(this.defaultParent[0]);
} else {
this.defaultPrev[0].after(this.$element);
}
} else {
this.locationChanged = true;
this.$element.appendTo(location);
}
this.lastLocation = location;
this.$element.trigger( 'locationChanged' );
}
});
// enable public access
window.MasterMenuPlugin = window.MasterMenuPlugin || MasterMenuPlugin;
$.fn[pluginName] = function (options) {
var args = arguments,
plugin = 'plugin_' + pluginName;
// Is the first parameter an object (options), or was omitted,
// instantiate a new instance of the plugin.
if (options === undefined || typeof options === 'object') {
return this.each(function () {
// Only allow the plugin to be instantiated once,
// so we check that the element has no plugin instantiation yet
if (!$.data(this, plugin)) {
$.data(this, plugin, new MasterMenuPlugin( this, options ));
}
});
// If the first parameter is a string and it doesn't start
// with an underscore or "contains" the `init`-function,
// treat this as a call to a public method.
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
// Cache the method call
// to make it possible
// to return a value
var returns;
this.each(function () {
var instance = $.data(this, plugin);
// Tests that there's already a plugin-instance
// and checks that the requested public method exists
if (instance instanceof MasterMenuPlugin && typeof instance[options] === 'function') {
// Call the method of our plugin instance,
// and pass it the supplied arguments.
returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
// Allow instances to be destroyed via the 'destroy' method
if (options === 'destroy') {
$.data(this, plugin, null);
}
});
// If the earlier cached method
// gives a value back return the value,
// otherwise return this to preserve chainability.
return returns !== undefined ? returns : this;
}
};
})( jQuery, window, document );
/*!
*
* ================== js/src/plugins/jquery.appearl.js ===================
**/
/**
* A super simple jQuery plugin checks if element is visible on scroll.
*
* @author Averta
*/
;( function( $, window, document, undefined ) {
"use strict";
var pluginName = "appearl",
defaults = {
offset: 0,
insetOffset: '50%'
},
attributesMap = {
'offset': 'offset',
'inset-offset': 'insetOffset'
},
$window = $(window);
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
// read attributes
for ( var key in attributesMap ) {
var value = attributesMap[ key ],
dataAttr = this.$element.data( key );
if ( dataAttr === undefined ) {
continue;
}
this.settings[ value ] = dataAttr;
}
this.init();
}
// Avoid Plugin.prototype conflicts
$.extend( Plugin.prototype, {
init: function() {
if ( typeof this.settings.offset === 'object' ) {
this._offsetTop = this.settings.offset.top;
this._offsetBottom = this.settings.offset.bottom;
} else {
this._offsetTop = this._offsetBottom = this.settings.offset;
}
// To check if the element is on viewport and set the offset 0 for them
if ( this._isOnViewPort( this.$element) ) {
this._offsetTop = this._offsetBottom = 0
}
this._appeared = false;
this._lastScroll = 0;
$window.on( 'scroll resize', this.update.bind( this ) );
setTimeout( this.update.bind(this) );
},
update: function( event ) {
var rect = this.element.getBoundingClientRect(),
insetOffset = this._parseOffset( this.settings.insetOffset, true );
var remainingPageScroll = document.documentElement.scrollHeight - (window.scrollY + window.innerHeight);
var passedPageScroll = window.scrollY;
var areaTop = Math.min(this._parseOffset( this._offsetTop ), passedPageScroll) ;
var areaBottom = window.innerHeight - Math.min(this._parseOffset( this._offsetBottom ), remainingPageScroll);
if ( rect.top + insetOffset <= areaBottom && rect.bottom - insetOffset >= areaTop ) {
!this._appeared && this.$element.trigger( 'appear', [{ from: ( this._lastScroll <= $window.scrollTop() ? 'bottom' : 'top' ) }] );
this._appeared = true;
} else if ( this._appeared ) {
this.$element.trigger( 'disappear', [{ from: ( rect.top < areaTop ? 'top' : 'bottom' ) }] );
this._appeared = false;
}
this._lastScroll = $window.scrollTop();
},
_parseOffset: function( value, inset ) {
var percentage = typeof value === 'string' && value.indexOf( '%' ) !== -1;
value = parseInt( value );
return !percentage ? value : ( inset ? this.element.offsetHeight : window.innerHeight ) * value / 100;
},
_isOnViewPort: function( element ) {
var bottomOffset = this.element.getBoundingClientRect().bottom;
return bottomOffset < window.innerHeight
},
} );
$.fn[ pluginName ] = function( options ) {
return this.each( function() {
if ( !$.data( this, "plugin_" + pluginName ) ) {
$.data( this, "plugin_" +
pluginName, new Plugin( this, options ) );
}
} );
};
} )( jQuery, window, document );
/*!
*
* ================== auxin/js/libs/perfect-scrollbar/perfect-scrollbar.js ===================
**/
/*!
* perfect-scrollbar v1.5.2
* Copyright 2021 Hyunje Jun, MDBootstrap and Contributors
* Licensed under MIT
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.PerfectScrollbar = factory());
}(this, (function () { 'use strict';
function get(element) {
return getComputedStyle(element);
}
function set(element, obj) {
for (var key in obj) {
var val = obj[key];
if (typeof val === 'number') {
val = val + "px";
}
element.style[key] = val;
}
return element;
}
function div(className) {
var div = document.createElement('div');
div.className = className;
return div;
}
var elMatches =
typeof Element !== 'undefined' &&
(Element.prototype.matches ||
Element.prototype.webkitMatchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector);
function matches(element, query) {
if (!elMatches) {
throw new Error('No element matching method supported');
}
return elMatches.call(element, query);
}
function remove(element) {
if (element.remove) {
element.remove();
} else {
if (element.parentNode) {
element.parentNode.removeChild(element);
}
}
}
function queryChildren(element, selector) {
return Array.prototype.filter.call(element.children, function (child) { return matches(child, selector); }
);
}
var cls = {
main: 'ps',
rtl: 'ps__rtl',
element: {
thumb: function (x) { return ("ps__thumb-" + x); },
rail: function (x) { return ("ps__rail-" + x); },
consuming: 'ps__child--consume',
},
state: {
focus: 'ps--focus',
clicking: 'ps--clicking',
active: function (x) { return ("ps--active-" + x); },
scrolling: function (x) { return ("ps--scrolling-" + x); },
},
};
/*
* Helper methods
*/
var scrollingClassTimeout = { x: null, y: null };
function addScrollingClass(i, x) {
var classList = i.element.classList;
var className = cls.state.scrolling(x);
if (classList.contains(className)) {
clearTimeout(scrollingClassTimeout[x]);
} else {
classList.add(className);
}
}
function removeScrollingClass(i, x) {
scrollingClassTimeout[x] = setTimeout(
function () { return i.isAlive && i.element.classList.remove(cls.state.scrolling(x)); },
i.settings.scrollingThreshold
);
}
function setScrollingClassInstantly(i, x) {
addScrollingClass(i, x);
removeScrollingClass(i, x);
}
var EventElement = function EventElement(element) {
this.element = element;
this.handlers = {};
};
var prototypeAccessors = { isEmpty: { configurable: true } };
EventElement.prototype.bind = function bind (eventName, handler) {
if (typeof this.handlers[eventName] === 'undefined') {
this.handlers[eventName] = [];
}
this.handlers[eventName].push(handler);
this.element.addEventListener(eventName, handler, false);
};
EventElement.prototype.unbind = function unbind (eventName, target) {
var this$1 = this;
this.handlers[eventName] = this.handlers[eventName].filter(function (handler) {
if (target && handler !== target) {
return true;
}
this$1.element.removeEventListener(eventName, handler, false);
return false;
});
};
EventElement.prototype.unbindAll = function unbindAll () {
for (var name in this.handlers) {
this.unbind(name);
}
};
prototypeAccessors.isEmpty.get = function () {
var this$1 = this;
return Object.keys(this.handlers).every(
function (key) { return this$1.handlers[key].length === 0; }
);
};
Object.defineProperties( EventElement.prototype, prototypeAccessors );
var EventManager = function EventManager() {
this.eventElements = [];
};
EventManager.prototype.eventElement = function eventElement (element) {
var ee = this.eventElements.filter(function (ee) { return ee.element === element; })[0];
if (!ee) {
ee = new EventElement(element);
this.eventElements.push(ee);
}
return ee;
};
EventManager.prototype.bind = function bind (element, eventName, handler) {
this.eventElement(element).bind(eventName, handler);
};
EventManager.prototype.unbind = function unbind (element, eventName, handler) {
var ee = this.eventElement(element);
ee.unbind(eventName, handler);
if (ee.isEmpty) {
// remove
this.eventElements.splice(this.eventElements.indexOf(ee), 1);
}
};
EventManager.prototype.unbindAll = function unbindAll () {
this.eventElements.forEach(function (e) { return e.unbindAll(); });
this.eventElements = [];
};
EventManager.prototype.once = function once (element, eventName, handler) {
var ee = this.eventElement(element);
var onceHandler = function (evt) {
ee.unbind(eventName, onceHandler);
handler(evt);
};
ee.bind(eventName, onceHandler);
};
function createEvent(name) {
if (typeof window.CustomEvent === 'function') {
return new CustomEvent(name);
} else {
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(name, false, false, undefined);
return evt;
}
}
function processScrollDiff(
i,
axis,
diff,
useScrollingClass,
forceFireReachEvent
) {
if ( useScrollingClass === void 0 ) useScrollingClass = true;
if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;
var fields;
if (axis === 'top') {
fields = [
'contentHeight',
'containerHeight',
'scrollTop',
'y',
'up',
'down' ];
} else if (axis === 'left') {
fields = [
'contentWidth',
'containerWidth',
'scrollLeft',
'x',
'left',
'right' ];
} else {
throw new Error('A proper axis should be provided');
}
processScrollDiff$1(i, diff, fields, useScrollingClass, forceFireReachEvent);
}
function processScrollDiff$1(
i,
diff,
ref,
useScrollingClass,
forceFireReachEvent
) {
var contentHeight = ref[0];
var containerHeight = ref[1];
var scrollTop = ref[2];
var y = ref[3];
var up = ref[4];
var down = ref[5];
if ( useScrollingClass === void 0 ) useScrollingClass = true;
if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;
var element = i.element;
// reset reach
i.reach[y] = null;
// 1 for subpixel rounding
if (element[scrollTop] < 1) {
i.reach[y] = 'start';
}
// 1 for subpixel rounding
if (element[scrollTop] > i[contentHeight] - i[containerHeight] - 1) {
i.reach[y] = 'end';
}
if (diff) {
element.dispatchEvent(createEvent(("ps-scroll-" + y)));
if (diff < 0) {
element.dispatchEvent(createEvent(("ps-scroll-" + up)));
} else if (diff > 0) {
element.dispatchEvent(createEvent(("ps-scroll-" + down)));
}
if (useScrollingClass) {
setScrollingClassInstantly(i, y);
}
}
if (i.reach[y] && (diff || forceFireReachEvent)) {
element.dispatchEvent(createEvent(("ps-" + y + "-reach-" + (i.reach[y]))));
}
}
function toInt(x) {
return parseInt(x, 10) || 0;
}
function isEditable(el) {
return (
matches(el, 'input,[contenteditable]') ||
matches(el, 'select,[contenteditable]') ||
matches(el, 'textarea,[contenteditable]') ||
matches(el, 'button,[contenteditable]')
);
}
function outerWidth(element) {
var styles = get(element);
return (
toInt(styles.width) +
toInt(styles.paddingLeft) +
toInt(styles.paddingRight) +
toInt(styles.borderLeftWidth) +
toInt(styles.borderRightWidth)
);
}
var env = {
isWebKit:
typeof document !== 'undefined' &&
'WebkitAppearance' in document.documentElement.style,
supportsTouch:
typeof window !== 'undefined' &&
('ontouchstart' in window ||
('maxTouchPoints' in window.navigator &&
window.navigator.maxTouchPoints > 0) ||
(window.DocumentTouch && document instanceof window.DocumentTouch)),
supportsIePointer:
typeof navigator !== 'undefined' && navigator.msMaxTouchPoints,
isChrome:
typeof navigator !== 'undefined' &&
/Chrome/i.test(navigator && navigator.userAgent),
};
function updateGeometry(i) {
var element = i.element;
var roundedScrollTop = Math.floor(element.scrollTop);
var rect = element.getBoundingClientRect();
i.containerWidth = Math.round(rect.width);
i.containerHeight = Math.round(rect.height);
i.contentWidth = element.scrollWidth;
i.contentHeight = element.scrollHeight;
if (!element.contains(i.scrollbarXRail)) {
// clean up and append
queryChildren(element, cls.element.rail('x')).forEach(function (el) { return remove(el); }
);
element.appendChild(i.scrollbarXRail);
}
if (!element.contains(i.scrollbarYRail)) {
// clean up and append
queryChildren(element, cls.element.rail('y')).forEach(function (el) { return remove(el); }
);
element.appendChild(i.scrollbarYRail);
}
if (
!i.settings.suppressScrollX &&
i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth
) {
i.scrollbarXActive = true;
i.railXWidth = i.containerWidth - i.railXMarginWidth;
i.railXRatio = i.containerWidth / i.railXWidth;
i.scrollbarXWidth = getThumbSize(
i,
toInt((i.railXWidth * i.containerWidth) / i.contentWidth)
);
i.scrollbarXLeft = toInt(
((i.negativeScrollAdjustment + element.scrollLeft) *
(i.railXWidth - i.scrollbarXWidth)) /
(i.contentWidth - i.containerWidth)
);
} else {
i.scrollbarXActive = false;
}
if (
!i.settings.suppressScrollY &&
i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight
) {
i.scrollbarYActive = true;
i.railYHeight = i.containerHeight - i.railYMarginHeight;
i.railYRatio = i.containerHeight / i.railYHeight;
i.scrollbarYHeight = getThumbSize(
i,
toInt((i.railYHeight * i.containerHeight) / i.contentHeight)
);
i.scrollbarYTop = toInt(
(roundedScrollTop * (i.railYHeight - i.scrollbarYHeight)) /
(i.contentHeight - i.containerHeight)
);
} else {
i.scrollbarYActive = false;
}
if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) {
i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth;
}
if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) {
i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight;
}
updateCss(element, i);
if (i.scrollbarXActive) {
element.classList.add(cls.state.active('x'));
} else {
element.classList.remove(cls.state.active('x'));
i.scrollbarXWidth = 0;
i.scrollbarXLeft = 0;
element.scrollLeft = i.isRtl === true ? i.contentWidth : 0;
}
if (i.scrollbarYActive) {
element.classList.add(cls.state.active('y'));
} else {
element.classList.remove(cls.state.active('y'));
i.scrollbarYHeight = 0;
i.scrollbarYTop = 0;
element.scrollTop = 0;
}
}
function getThumbSize(i, thumbSize) {
if (i.settings.minScrollbarLength) {
thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength);
}
if (i.settings.maxScrollbarLength) {
thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength);
}
return thumbSize;
}
function updateCss(element, i) {
var xRailOffset = { width: i.railXWidth };
var roundedScrollTop = Math.floor(element.scrollTop);
if (i.isRtl) {
xRailOffset.left =
i.negativeScrollAdjustment +
element.scrollLeft +
i.containerWidth -
i.contentWidth;
} else {
xRailOffset.left = element.scrollLeft;
}
if (i.isScrollbarXUsingBottom) {
xRailOffset.bottom = i.scrollbarXBottom - roundedScrollTop;
} else {
xRailOffset.top = i.scrollbarXTop + roundedScrollTop;
}
set(i.scrollbarXRail, xRailOffset);
var yRailOffset = { top: roundedScrollTop, height: i.railYHeight };
if (i.isScrollbarYUsingRight) {
if (i.isRtl) {
yRailOffset.right =
i.contentWidth -
(i.negativeScrollAdjustment + element.scrollLeft) -
i.scrollbarYRight -
i.scrollbarYOuterWidth -
9;
} else {
yRailOffset.right = i.scrollbarYRight - element.scrollLeft;
}
} else {
if (i.isRtl) {
yRailOffset.left =
i.negativeScrollAdjustment +
element.scrollLeft +
i.containerWidth * 2 -
i.contentWidth -
i.scrollbarYLeft -
i.scrollbarYOuterWidth;
} else {
yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;
}
}
set(i.scrollbarYRail, yRailOffset);
set(i.scrollbarX, {
left: i.scrollbarXLeft,
width: i.scrollbarXWidth - i.railBorderXWidth,
});
set(i.scrollbarY, {
top: i.scrollbarYTop,
height: i.scrollbarYHeight - i.railBorderYWidth,
});
}
function clickRail(i) {
var element = i.element;
i.event.bind(i.scrollbarY, 'mousedown', function (e) { return e.stopPropagation(); });
i.event.bind(i.scrollbarYRail, 'mousedown', function (e) {
var positionTop =
e.pageY -
window.pageYOffset -
i.scrollbarYRail.getBoundingClientRect().top;
var direction = positionTop > i.scrollbarYTop ? 1 : -1;
i.element.scrollTop += direction * i.containerHeight;
updateGeometry(i);
e.stopPropagation();
});
i.event.bind(i.scrollbarX, 'mousedown', function (e) { return e.stopPropagation(); });
i.event.bind(i.scrollbarXRail, 'mousedown', function (e) {
var positionLeft =
e.pageX -
window.pageXOffset -
i.scrollbarXRail.getBoundingClientRect().left;
var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;
i.element.scrollLeft += direction * i.containerWidth;
updateGeometry(i);
e.stopPropagation();
});
}
function dragThumb(i) {
bindMouseScrollHandler(i, [
'containerWidth',
'contentWidth',
'pageX',
'railXWidth',
'scrollbarX',
'scrollbarXWidth',
'scrollLeft',
'x',
'scrollbarXRail' ]);
bindMouseScrollHandler(i, [
'containerHeight',
'contentHeight',
'pageY',
'railYHeight',
'scrollbarY',
'scrollbarYHeight',
'scrollTop',
'y',
'scrollbarYRail' ]);
}
function bindMouseScrollHandler(
i,
ref
) {
var containerHeight = ref[0];
var contentHeight = ref[1];
var pageY = ref[2];
var railYHeight = ref[3];
var scrollbarY = ref[4];
var scrollbarYHeight = ref[5];
var scrollTop = ref[6];
var y = ref[7];
var scrollbarYRail = ref[8];
var element = i.element;
var startingScrollTop = null;
var startingMousePageY = null;
var scrollBy = null;
function mouseMoveHandler(e) {
if (e.touches && e.touches[0]) {
e[pageY] = e.touches[0].pageY;
}
element[scrollTop] =
startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);
addScrollingClass(i, y);
updateGeometry(i);
e.stopPropagation();
e.preventDefault();
}
function mouseUpHandler() {
removeScrollingClass(i, y);
i[scrollbarYRail].classList.remove(cls.state.clicking);
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
}
function bindMoves(e, touchMode) {
startingScrollTop = element[scrollTop];
if (touchMode && e.touches) {
e[pageY] = e.touches[0].pageY;
}
startingMousePageY = e[pageY];
scrollBy =
(i[contentHeight] - i[containerHeight]) /
(i[railYHeight] - i[scrollbarYHeight]);
if (!touchMode) {
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
e.preventDefault();
} else {
i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler);
}
i[scrollbarYRail].classList.add(cls.state.clicking);
e.stopPropagation();
}
i.event.bind(i[scrollbarY], 'mousedown', function (e) {
bindMoves(e);
});
i.event.bind(i[scrollbarY], 'touchstart', function (e) {
bindMoves(e, true);
});
}
function keyboard(i) {
var element = i.element;
var elementHovered = function () { return matches(element, ':hover'); };
var scrollbarFocused = function () { return matches(i.scrollbarX, ':focus') || matches(i.scrollbarY, ':focus'); };
function shouldPreventDefault(deltaX, deltaY) {
var scrollTop = Math.floor(element.scrollTop);
if (deltaX === 0) {
if (!i.scrollbarYActive) {
return false;
}
if (
(scrollTop === 0 && deltaY > 0) ||
(scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)
) {
return !i.settings.wheelPropagation;
}
}
var scrollLeft = element.scrollLeft;
if (deltaY === 0) {
if (!i.scrollbarXActive) {
return false;
}
if (
(scrollLeft === 0 && deltaX < 0) ||
(scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)
) {
return !i.settings.wheelPropagation;
}
}
return true;
}
i.event.bind(i.ownerDocument, 'keydown', function (e) {
if (
(e.isDefaultPrevented && e.isDefaultPrevented()) ||
e.defaultPrevented
) {
return;
}
if (!elementHovered() && !scrollbarFocused()) {
return;
}
var activeElement = document.activeElement
? document.activeElement
: i.ownerDocument.activeElement;
if (activeElement) {
if (activeElement.tagName === 'IFRAME') {
activeElement = activeElement.contentDocument.activeElement;
} else {
// go deeper if element is a webcomponent
while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
}
if (isEditable(activeElement)) {
return;
}
}
var deltaX = 0;
var deltaY = 0;
switch (e.which) {
case 37: // left
if (e.metaKey) {
deltaX = -i.contentWidth;
} else if (e.altKey) {
deltaX = -i.containerWidth;
} else {
deltaX = -30;
}
break;
case 38: // up
if (e.metaKey) {
deltaY = i.contentHeight;
} else if (e.altKey) {
deltaY = i.containerHeight;
} else {
deltaY = 30;
}
break;
case 39: // right
if (e.metaKey) {
deltaX = i.contentWidth;
} else if (e.altKey) {
deltaX = i.containerWidth;
} else {
deltaX = 30;
}
break;
case 40: // down
if (e.metaKey) {
deltaY = -i.contentHeight;
} else if (e.altKey) {
deltaY = -i.containerHeight;
} else {
deltaY = -30;
}
break;
case 32: // space bar
if (e.shiftKey) {
deltaY = i.containerHeight;
} else {
deltaY = -i.containerHeight;
}
break;
case 33: // page up
deltaY = i.containerHeight;
break;
case 34: // page down
deltaY = -i.containerHeight;
break;
case 36: // home
deltaY = i.contentHeight;
break;
case 35: // end
deltaY = -i.contentHeight;
break;
default:
return;
}
if (i.settings.suppressScrollX && deltaX !== 0) {
return;
}
if (i.settings.suppressScrollY && deltaY !== 0) {
return;
}
element.scrollTop -= deltaY;
element.scrollLeft += deltaX;
updateGeometry(i);
if (shouldPreventDefault(deltaX, deltaY)) {
e.preventDefault();
}
});
}
function wheel(i) {
var element = i.element;
function shouldPreventDefault(deltaX, deltaY) {
var roundedScrollTop = Math.floor(element.scrollTop);
var isTop = element.scrollTop === 0;
var isBottom =
roundedScrollTop + element.offsetHeight === element.scrollHeight;
var isLeft = element.scrollLeft === 0;
var isRight =
element.scrollLeft + element.offsetWidth === element.scrollWidth;
var hitsBound;
// pick axis with primary direction
if (Math.abs(deltaY) > Math.abs(deltaX)) {
hitsBound = isTop || isBottom;
} else {
hitsBound = isLeft || isRight;
}
return hitsBound ? !i.settings.wheelPropagation : true;
}
function getDeltaFromEvent(e) {
var deltaX = e.deltaX;
var deltaY = -1 * e.deltaY;
if (typeof deltaX === 'undefined' || typeof deltaY === 'undefined') {
// OS X Safari
deltaX = (-1 * e.wheelDeltaX) / 6;
deltaY = e.wheelDeltaY / 6;
}
if (e.deltaMode && e.deltaMode === 1) {
// Firefox in deltaMode 1: Line scrolling
deltaX *= 10;
deltaY *= 10;
}
if (deltaX !== deltaX && deltaY !== deltaY /* NaN checks */) {
// IE in some mouse drivers
deltaX = 0;
deltaY = e.wheelDelta;
}
if (e.shiftKey) {
// reverse axis with shift key
return [-deltaY, -deltaX];
}
return [deltaX, deltaY];
}
function shouldBeConsumedByChild(target, deltaX, deltaY) {
// FIXME: this is a workaround for