/*! UIkit 1.0.0 | http://www.getuikit.com | (c) 2014 - 2018 YOOtheme | MIT License */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define('uikit', factory) : (global.UIkit = factory()); }(this, (function () { 'use strict'; function bind(fn, context) { return function (a) { var l = arguments.length; return l ? l > 1 ? fn.apply(context, arguments) : fn.call(context, a) : fn.call(context); }; } var objPrototype = Object.prototype; var hasOwnProperty = objPrototype.hasOwnProperty; function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } var hyphenateCache = {}; var hyphenateRe = /([a-z\d])([A-Z])/g; function hyphenate(str) { if (!(str in hyphenateCache)) { hyphenateCache[str] = str .replace(hyphenateRe, '$1-$2') .toLowerCase(); } return hyphenateCache[str]; } var camelizeRe = /-(\w)/g; function camelize(str) { return str.replace(camelizeRe, toUpper); } function toUpper(_, c) { return c ? c.toUpperCase() : ''; } function ucfirst(str) { return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : ''; } var strPrototype = String.prototype; var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; }; function startsWith(str, search) { return startsWithFn.call(str, search); } var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-search.length) === search; }; function endsWith(str, search) { return endsWithFn.call(str, search); } var includesFn = function (search) { return ~this.indexOf(search); }; var includesStr = strPrototype.includes || includesFn; var includesArray = Array.prototype.includes || includesFn; function includes(obj, search) { return obj && (isString(obj) ? includesStr : includesArray).call(obj, search); } var isArray = Array.isArray; function isFunction(obj) { return typeof obj === 'function'; } function isObject(obj) { return obj !== null && typeof obj === 'object'; } function isPlainObject(obj) { return isObject(obj) && Object.getPrototypeOf(obj) === objPrototype; } function isWindow(obj) { return isObject(obj) && obj === obj.window; } function isDocument(obj) { return isObject(obj) && obj.nodeType === 9; } function isJQuery(obj) { return isObject(obj) && !!obj.jquery; } function isNode(obj) { return obj instanceof Node || isObject(obj) && obj.nodeType >= 1; } var toString = objPrototype.toString; function isNodeCollection(obj) { return toString.call(obj).match(/^\[object (NodeList|HTMLCollection)\]$/); } function isBoolean(value) { return typeof value === 'boolean'; } function isString(value) { return typeof value === 'string'; } function isNumber(value) { return typeof value === 'number'; } function isNumeric(value) { return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value)); } function isUndefined(value) { return value === void 0; } function toBoolean(value) { return isBoolean(value) ? value : value === 'true' || value === '1' || value === '' ? true : value === 'false' || value === '0' ? false : value; } function toNumber(value) { var number = Number(value); return !isNaN(number) ? number : false; } function toFloat(value) { return parseFloat(value) || 0; } function toNode(element) { return isNode(element) || isWindow(element) || isDocument(element) ? element : isNodeCollection(element) || isJQuery(element) ? element[0] : isArray(element) ? toNode(element[0]) : null; } var arrayProto = Array.prototype; function toNodes(element) { return isNode(element) ? [element] : isNodeCollection(element) ? arrayProto.slice.call(element) : isArray(element) ? element.map(toNode).filter(Boolean) : isJQuery(element) ? element.toArray() : []; } function toList(value) { return isArray(value) ? value : isString(value) ? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value) ? toNumber(value) : toBoolean(value.trim()); }) : [value]; } function toMs(time) { return !time ? 0 : endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000; } function swap(value, a, b) { return value.replace(new RegExp((a + "|" + b), 'mg'), function (match) { return match === a ? b : a; }); } var assign = Object.assign || function (target) { var args = [], len = arguments.length - 1; while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; target = Object(target); for (var i = 0; i < args.length; i++) { var source = args[i]; if (source !== null) { for (var key in source) { if (hasOwn(source, key)) { target[key] = source[key]; } } } } return target; }; function each(obj, cb) { for (var key in obj) { cb.call(obj[key], obj[key], key); } } function sortBy(collection, prop) { return collection.sort(function (ref, ref$1) { var propA = ref[prop]; if ( propA === void 0 ) propA = 0; var propB = ref$1[prop]; if ( propB === void 0 ) propB = 0; return propA > propB ? 1 : propB > propA ? -1 : 0; } ); } function clamp(number, min, max) { if ( min === void 0 ) min = 0; if ( max === void 0 ) max = 1; return Math.min(Math.max(toNumber(number) || 0, min), max); } function noop() {} function intersectRect(r1, r2) { return r1.left < r2.right && r1.right > r2.left && r1.top < r2.bottom && r1.bottom > r2.top; } function pointInRect(point, rect) { return point.x <= rect.right && point.x >= rect.left && point.y <= rect.bottom && point.y >= rect.top; } var Dimensions = { ratio: function(dimensions, prop, value) { var obj; var aProp = prop === 'width' ? 'height' : 'width'; return ( obj = {}, obj[aProp] = dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp], obj[prop] = value, obj ); }, contain: function(dimensions, maxDimensions) { var this$1 = this; dimensions = assign({}, dimensions); each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop] ? this$1.ratio(dimensions, prop, maxDimensions[prop]) : dimensions; } ); return dimensions; }, cover: function(dimensions, maxDimensions) { var this$1 = this; dimensions = this.contain(dimensions, maxDimensions); each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop] ? this$1.ratio(dimensions, prop, maxDimensions[prop]) : dimensions; } ); return dimensions; } }; function attr(element, name, value) { if (isObject(name)) { for (var key in name) { attr(element, key, name[key]); } return; } if (isUndefined(value)) { element = toNode(element); return element && element.getAttribute(name); } else { toNodes(element).forEach(function (element) { if (isFunction(value)) { value = value.call(element, attr(element, name)); } if (value === null) { removeAttr(element, name); } else { element.setAttribute(name, value); } }); } } function hasAttr(element, name) { return toNodes(element).some(function (element) { return element.hasAttribute(name); }); } function removeAttr(element, name) { element = toNodes(element); name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.removeAttribute(name); } ); } ); } function data(element, attribute) { for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) { if (hasAttr(element, attrs[i])) { return attr(element, attrs[i]); } } } function query(selector, context) { return toNode(selector) || find(selector, getContext(selector, context)); } function queryAll(selector, context) { var nodes = toNodes(selector); return nodes.length && nodes || findAll(selector, getContext(selector, context)); } function getContext(selector, context) { if ( context === void 0 ) context = document; return isContextSelector(selector) || isDocument(context) ? context : context.ownerDocument; } function find(selector, context) { return toNode(_query(selector, context, 'querySelector')); } function findAll(selector, context) { return toNodes(_query(selector, context, 'querySelectorAll')); } function _query(selector, context, queryFn) { if ( context === void 0 ) context = document; if (!selector || !isString(selector)) { return null; } selector = selector.replace(contextSanitizeRe, '$1 *'); var removes; if (isContextSelector(selector)) { removes = []; selector = selector.split(',').map(function (selector, i) { var ctx = context; selector = selector.trim(); if (selector[0] === '!') { var selectors = selector.substr(1).trim().split(' '); ctx = closest(context.parentNode, selectors[0]); selector = selectors.slice(1).join(' ').trim(); } if (selector[0] === '-') { var selectors$1 = selector.substr(1).trim().split(' '); var prev = (ctx || context).previousElementSibling; ctx = matches(prev, selector.substr(1)) ? prev : null; selector = selectors$1.slice(1).join(' '); } if (!ctx) { return null; } if (!ctx.id) { ctx.id = "uk-" + (Date.now()) + i; removes.push(function () { return removeAttr(ctx, 'id'); }); } return ("#" + (escape(ctx.id)) + " " + selector); }).filter(Boolean).join(','); context = document; } try { return context[queryFn](selector); } catch (e) { return null; } finally { removes && removes.forEach(function (remove) { return remove(); }); } } var contextSelectorRe = /(^|,)\s*[!>+~-]/; var contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g; function isContextSelector(selector) { return isString(selector) && selector.match(contextSelectorRe); } var elProto = Element.prototype; var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector; function matches(element, selector) { return toNodes(element).some(function (element) { return matchesFn.call(element, selector); }); } var closestFn = elProto.closest || function (selector) { var ancestor = this; do { if (matches(ancestor, selector)) { return ancestor; } ancestor = ancestor.parentNode; } while (ancestor && ancestor.nodeType === 1); }; function closest(element, selector) { if (startsWith(selector, '>')) { selector = selector.slice(1); } return isNode(element) ? element.parentNode && closestFn.call(element, selector) : toNodes(element).map(function (element) { return element.parentNode && closestFn.call(element, selector); }).filter(Boolean); } function parents(element, selector) { var elements = []; var parent = toNode(element).parentNode; while (parent && parent.nodeType === 1) { if (matches(parent, selector)) { elements.push(parent); } parent = parent.parentNode; } return elements; } var escapeFn = window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); }; function escape(css) { return isString(css) ? escapeFn.call(null, css) : ''; } var voidElements = { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, menuitem: true, meta: true, param: true, source: true, track: true, wbr: true }; function isVoidElement(element) { return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; }); } function isVisible(element) { return toNodes(element).some(function (element) { return element.offsetWidth || element.offsetHeight || element.getClientRects().length; }); } var selInput = 'input,select,textarea,button'; function isInput(element) { return toNodes(element).some(function (element) { return matches(element, selInput); }); } function filter(element, selector) { return toNodes(element).filter(function (element) { return matches(element, selector); }); } function within(element, selector) { return !isString(selector) ? element === selector || (isDocument(selector) ? selector.documentElement : toNode(selector)).contains(toNode(element)) // IE 11 document does not implement contains : matches(element, selector) || closest(element, selector); } function on() { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var ref = getArgs(args); var targets = ref[0]; var type = ref[1]; var selector = ref[2]; var listener = ref[3]; var useCapture = ref[4]; targets = toEventTargets(targets); if (selector) { listener = delegate(targets, selector, listener); } if (listener.length > 1) { listener = detail(listener); } type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.addEventListener(type, listener, useCapture); } ); } ); return function () { return off(targets, type, listener, useCapture); }; } function off(targets, type, listener, useCapture) { if ( useCapture === void 0 ) useCapture = false; targets = toEventTargets(targets); type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.removeEventListener(type, listener, useCapture); } ); } ); } function once() { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var ref = getArgs(args); var element = ref[0]; var type = ref[1]; var selector = ref[2]; var listener = ref[3]; var useCapture = ref[4]; var condition = ref[5]; var off = on(element, type, selector, function (e) { var result = !condition || condition(e); if (result) { off(); listener(e, result); } }, useCapture); return off; } function trigger(targets, event, detail) { return toEventTargets(targets).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); } , true); } function createEvent(e, bubbles, cancelable, detail) { if ( bubbles === void 0 ) bubbles = true; if ( cancelable === void 0 ) cancelable = false; if (isString(e)) { var event = document.createEvent('CustomEvent'); // IE 11 event.initCustomEvent(e, bubbles, cancelable, detail); e = event; } return e; } function getArgs(args) { if (isFunction(args[2])) { args.splice(2, 0, false); } return args; } function delegate(delegates, selector, listener) { var this$1 = this; return function (e) { delegates.forEach(function (delegate) { var current = selector[0] === '>' ? findAll(selector, delegate).reverse().filter(function (element) { return within(e.target, element); })[0] : closest(e.target, selector); if (current) { e.delegate = delegate; e.current = current; listener.call(this$1, e); } }); }; } function detail(listener) { return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); }; } function isEventTarget(target) { return target && 'addEventListener' in target; } function toEventTarget(target) { return isEventTarget(target) ? target : toNode(target); } function toEventTargets(target) { return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target); } function preventClick() { var timer = setTimeout(once(document, 'click', function (e) { e.preventDefault(); e.stopImmediatePropagation(); clearTimeout(timer); }, true)); trigger(document, 'touchcancel'); } /* global setImmediate */ var Promise = 'Promise' in window ? window.Promise : PromiseFn; var Deferred = function() { var this$1 = this; this.promise = new Promise(function (resolve, reject) { this$1.reject = reject; this$1.resolve = resolve; }); }; /** * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis) */ var RESOLVED = 0; var REJECTED = 1; var PENDING = 2; var async = 'setImmediate' in window ? setImmediate : setTimeout; function PromiseFn(executor) { this.state = PENDING; this.value = undefined; this.deferred = []; var promise = this; try { executor( function (x) { promise.resolve(x); }, function (r) { promise.reject(r); } ); } catch (e) { promise.reject(e); } } PromiseFn.reject = function (r) { return new PromiseFn(function (resolve, reject) { reject(r); }); }; PromiseFn.resolve = function (x) { return new PromiseFn(function (resolve, reject) { resolve(x); }); }; PromiseFn.all = function all(iterable) { return new PromiseFn(function (resolve, reject) { var result = []; var count = 0; if (iterable.length === 0) { resolve(result); } function resolver(i) { return function (x) { result[i] = x; count += 1; if (count === iterable.length) { resolve(result); } }; } for (var i = 0; i < iterable.length; i += 1) { PromiseFn.resolve(iterable[i]).then(resolver(i), reject); } }); }; PromiseFn.race = function race(iterable) { return new PromiseFn(function (resolve, reject) { for (var i = 0; i < iterable.length; i += 1) { PromiseFn.resolve(iterable[i]).then(resolve, reject); } }); }; var p = PromiseFn.prototype; p.resolve = function resolve(x) { var promise = this; if (promise.state === PENDING) { if (x === promise) { throw new TypeError('Promise settled with itself.'); } var called = false; try { var then = x && x.then; if (x !== null && isObject(x) && isFunction(then)) { then.call( x, function (x) { if (!called) { promise.resolve(x); } called = true; }, function (r) { if (!called) { promise.reject(r); } called = true; } ); return; } } catch (e) { if (!called) { promise.reject(e); } return; } promise.state = RESOLVED; promise.value = x; promise.notify(); } }; p.reject = function reject(reason) { var promise = this; if (promise.state === PENDING) { if (reason === promise) { throw new TypeError('Promise settled with itself.'); } promise.state = REJECTED; promise.value = reason; promise.notify(); } }; p.notify = function notify() { var this$1 = this; async(function () { if (this$1.state !== PENDING) { while (this$1.deferred.length) { var ref = this$1.deferred.shift(); var onResolved = ref[0]; var onRejected = ref[1]; var resolve = ref[2]; var reject = ref[3]; try { if (this$1.state === RESOLVED) { if (isFunction(onResolved)) { resolve(onResolved.call(undefined, this$1.value)); } else { resolve(this$1.value); } } else if (this$1.state === REJECTED) { if (isFunction(onRejected)) { resolve(onRejected.call(undefined, this$1.value)); } else { reject(this$1.value); } } } catch (e) { reject(e); } } } }); }; p.then = function then(onResolved, onRejected) { var this$1 = this; return new PromiseFn(function (resolve, reject) { this$1.deferred.push([onResolved, onRejected, resolve, reject]); this$1.notify(); }); }; p.catch = function (onRejected) { return this.then(undefined, onRejected); }; function ajax(url, options) { return new Promise(function (resolve, reject) { var env = assign({ data: null, method: 'GET', headers: {}, xhr: new XMLHttpRequest(), beforeSend: noop, responseType: '' }, options); env.beforeSend(env); var xhr = env.xhr; for (var prop in env) { if (prop in xhr) { try { xhr[prop] = env[prop]; } catch (e) {} } } xhr.open(env.method.toUpperCase(), url); for (var header in env.headers) { xhr.setRequestHeader(header, env.headers[header]); } on(xhr, 'load', function () { if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) { resolve(xhr); } else { reject(assign(Error(xhr.statusText), { xhr: xhr, status: xhr.status })); } }); on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); }); on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); }); xhr.send(env.data); }); } function getImage(src, srcset, sizes) { return new Promise(function (resolve, reject) { var img = new Image(); img.onerror = reject; img.onload = function () { return resolve(img); }; sizes && (img.sizes = sizes); srcset && (img.srcset = srcset); img.src = src; }); } /* global DocumentTouch */ var isIE = /msie|trident/i.test(window.navigator.userAgent); var isRtl = attr(document.documentElement, 'dir') === 'rtl'; var hasTouchEvents = 'ontouchstart' in window; var hasPointerEvents = window.PointerEvent; var hasTouch = hasTouchEvents || window.DocumentTouch && document instanceof DocumentTouch || navigator.maxTouchPoints; // IE >=11 var pointerDown = !hasTouch ? 'mousedown' : ("mousedown " + (hasTouchEvents ? 'touchstart' : 'pointerdown')); var pointerMove = !hasTouch ? 'mousemove' : ("mousemove " + (hasTouchEvents ? 'touchmove' : 'pointermove')); var pointerUp = !hasTouch ? 'mouseup' : ("mouseup " + (hasTouchEvents ? 'touchend' : 'pointerup')); var pointerEnter = hasTouch && hasPointerEvents ? 'pointerenter' : 'mouseenter'; var pointerLeave = hasTouch && hasPointerEvents ? 'pointerleave' : 'mouseleave'; function isReady() { return document.readyState === 'complete' || document.readyState !== 'loading' && !document.documentElement.doScroll; } function ready(fn) { if (isReady()) { fn(); return; } var handle = function () { unbind1(); unbind2(); fn(); }; var unbind1 = on(document, 'DOMContentLoaded', handle); var unbind2 = on(window, 'load', handle); } function index(element, ref) { return ref ? toNodes(element).indexOf(toNode(ref)) : toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element); } function getIndex(i, elements, current, finite) { if ( current === void 0 ) current = 0; if ( finite === void 0 ) finite = false; elements = toNodes(elements); var length = elements.length; i = isNumeric(i) ? toNumber(i) : i === 'next' ? current + 1 : i === 'previous' ? current - 1 : index(elements, i); if (finite) { return clamp(i, 0, length - 1); } i %= length; return i < 0 ? i + length : i; } function empty(element) { element = $(element); element.innerHTML = ''; return element; } function html(parent, html) { parent = $(parent); return isUndefined(html) ? parent.innerHTML : append(parent.hasChildNodes() ? empty(parent) : parent, html); } function prepend(parent, element) { parent = $(parent); if (!parent.hasChildNodes()) { return append(parent, element); } else { return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); }); } } function append(parent, element) { parent = $(parent); return insertNodes(element, function (element) { return parent.appendChild(element); }); } function before(ref, element) { ref = $(ref); return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); }); } function after(ref, element) { ref = $(ref); return insertNodes(element, function (element) { return ref.nextSibling ? before(ref.nextSibling, element) : append(ref.parentNode, element); } ); } function insertNodes(element, fn) { element = isString(element) ? fragment(element) : element; return element ? 'length' in element ? toNodes(element).map(fn) : fn(element) : null; } function remove(element) { toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); }); } function wrapAll(element, structure) { structure = toNode(before(element, structure)); while (structure.firstChild) { structure = structure.firstChild; } append(structure, element); return structure; } function wrapInner(element, structure) { return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); } )); } function unwrap(element) { toNodes(element) .map(function (element) { return element.parentNode; }) .filter(function (value, index, self) { return self.indexOf(value) === index; }) .forEach(function (parent) { before(parent, parent.childNodes); remove(parent); }); } var fragmentRe = /^\s*<(\w+|!)[^>]*>/; var singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/; function fragment(html) { var matches$$1 = singleTagRe.exec(html); if (matches$$1) { return document.createElement(matches$$1[1]); } var container = document.createElement('div'); if (fragmentRe.test(html)) { container.insertAdjacentHTML('beforeend', html.trim()); } else { container.textContent = html; } return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild; } function apply(node, fn) { if (!node || node.nodeType !== 1) { return; } fn(node); node = node.firstElementChild; while (node) { apply(node, fn); node = node.nextElementSibling; } } function $(selector, context) { return !isString(selector) ? toNode(selector) : isHtml(selector) ? toNode(fragment(selector)) : find(selector, context); } function $$(selector, context) { return !isString(selector) ? toNodes(selector) : isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context); } function isHtml(str) { return str[0] === '<' || str.match(/^\s* 0 ) args[ len ] = arguments[ len + 1 ]; apply$1(element, args, 'add'); } function removeClass(element) { var args = [], len = arguments.length - 1; while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; apply$1(element, args, 'remove'); } function removeClasses(element, cls) { attr(element, 'class', function (value) { return (value || '').replace(new RegExp(("\\b" + cls + "\\b"), 'g'), ''); }); } function replaceClass(element) { var args = [], len = arguments.length - 1; while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; args[0] && removeClass(element, args[0]); args[1] && addClass(element, args[1]); } function hasClass(element, cls) { return cls && toNodes(element).some(function (element) { return element.classList.contains(cls.split(' ')[0]); }); } function toggleClass(element) { var args = [], len = arguments.length - 1; while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; if (!args.length) { return; } args = getArgs$1(args); var force = !isString(args[args.length - 1]) ? args.pop() : []; // in iOS 9.3 force === undefined evaluates to false args = args.filter(Boolean); toNodes(element).forEach(function (ref) { var classList = ref.classList; for (var i = 0; i < args.length; i++) { supports.Force ? classList.toggle.apply(classList, [args[i]].concat(force)) : (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i])); } }); } function apply$1(element, args, fn) { args = getArgs$1(args).filter(Boolean); args.length && toNodes(element).forEach(function (ref) { var classList = ref.classList; supports.Multiple ? classList[fn].apply(classList, args) : args.forEach(function (cls) { return classList[fn](cls); }); }); } function getArgs$1(args) { return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); } , []); } var supports = {}; // IE 11 (function () { var list = document.createElement('_').classList; if (list) { list.add('a', 'b'); list.toggle('c', false); supports.Multiple = list.contains('b'); supports.Force = !list.contains('c'); } list = null; })(); var cssNumber = { 'animation-iteration-count': true, 'column-count': true, 'fill-opacity': true, 'flex-grow': true, 'flex-shrink': true, 'font-weight': true, 'line-height': true, 'opacity': true, 'order': true, 'orphans': true, 'widows': true, 'z-index': true, 'zoom': true }; function css(element, property, value) { return toNodes(element).map(function (element) { if (isString(property)) { property = propName(property); if (isUndefined(value)) { return getStyle(element, property); } else if (!value && value !== 0) { element.style.removeProperty(property); } else { element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value; } } else if (isArray(property)) { var styles = getStyles(element); return property.reduce(function (props, property) { props[property] = styles[propName(property)]; return props; }, {}); } else if (isObject(property)) { each(property, function (value, property) { return css(element, property, value); }); } return element; })[0]; } function getStyles(element, pseudoElt) { element = toNode(element); return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt); } function getStyle(element, property, pseudoElt) { return getStyles(element, pseudoElt)[property]; } var vars = {}; function getCssVar(name) { var docEl = document.documentElement; if (!isIE) { return getStyles(docEl).getPropertyValue(("--uk-" + name)); } if (!(name in vars)) { /* usage in css: .uk-name:before { content:"xyz" } */ var element = append(docEl, document.createElement('div')); addClass(element, ("uk-" + name)); vars[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1'); remove(element); } return vars[name]; } var cssProps = {}; function propName(name) { var ret = cssProps[name]; if (!ret) { ret = cssProps[name] = vendorPropName(name) || name; } return ret; } var cssPrefixes = ['webkit', 'moz', 'ms']; var ref = document.createElement('_'); var style = ref.style; function vendorPropName(name) { name = hyphenate(name); if (name in style) { return name; } var i = cssPrefixes.length, prefixedName; while (i--) { prefixedName = "-" + (cssPrefixes[i]) + "-" + name; if (prefixedName in style) { return prefixedName; } } } function transition(element, props, duration, timing) { if ( duration === void 0 ) duration = 400; if ( timing === void 0 ) timing = 'linear'; return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) { for (var name in props) { var value = css(element, name); if (value === '') { css(element, name, value); } } var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration); once(element, 'transitionend transitioncanceled', function (ref) { var type = ref.type; clearTimeout(timer); removeClass(element, 'uk-transition'); css(element, { 'transition-property': '', 'transition-duration': '', 'transition-timing-function': '' }); type === 'transitioncanceled' ? reject() : resolve(); }, false, function (ref) { var target = ref.target; return element === target; }); addClass(element, 'uk-transition'); css(element, assign({ 'transition-property': Object.keys(props).map(propName).join(','), 'transition-duration': (duration + "ms"), 'transition-timing-function': timing }, props)); }); } )); } var Transition = { start: transition, stop: function(element) { trigger(element, 'transitionend'); return Promise.resolve(); }, cancel: function(element) { trigger(element, 'transitioncanceled'); }, inProgress: function(element) { return hasClass(element, 'uk-transition'); } }; var animationPrefix = 'uk-animation-'; var clsCancelAnimation = 'uk-cancel-animation'; function animate(element, animation, duration, origin, out) { var arguments$1 = arguments; if ( duration === void 0 ) duration = 200; return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) { if (hasClass(element, clsCancelAnimation)) { requestAnimationFrame(function () { return Promise.resolve().then(function () { return animate.apply(void 0, arguments$1).then(resolve, reject); } ); } ); return; } var cls = animation + " " + animationPrefix + (out ? 'leave' : 'enter'); if (startsWith(animation, animationPrefix)) { if (origin) { cls += " uk-transform-origin-" + origin; } if (out) { cls += " " + animationPrefix + "reverse"; } } reset(); once(element, 'animationend animationcancel', function (ref) { var type = ref.type; var hasReset = false; if (type === 'animationcancel') { reject(); reset(); } else { resolve(); Promise.resolve().then(function () { hasReset = true; reset(); }); } requestAnimationFrame(function () { if (!hasReset) { addClass(element, clsCancelAnimation); requestAnimationFrame(function () { return removeClass(element, clsCancelAnimation); }); } }); }, false, function (ref) { var target = ref.target; return element === target; }); css(element, 'animationDuration', (duration + "ms")); addClass(element, cls); function reset() { css(element, 'animationDuration', ''); removeClasses(element, (animationPrefix + "\\S*")); } }); } )); } var inProgress = new RegExp((animationPrefix + "(enter|leave)")); var Animation = { in: function(element, animation, duration, origin) { return animate(element, animation, duration, origin, false); }, out: function(element, animation, duration, origin) { return animate(element, animation, duration, origin, true); }, inProgress: function(element) { return inProgress.test(attr(element, 'class')); }, cancel: function(element) { trigger(element, 'animationcancel'); } }; var dirs = { width: ['x', 'left', 'right'], height: ['y', 'top', 'bottom'] }; function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) { elAttach = getPos(elAttach); targetAttach = getPos(targetAttach); var flipped = {element: elAttach, target: targetAttach}; if (!element || !target) { return flipped; } var dim = getDimensions(element); var targetDim = getDimensions(target); var position = targetDim; moveTo(position, elAttach, dim, -1); moveTo(position, targetAttach, targetDim, 1); elOffset = getOffsets(elOffset, dim.width, dim.height); targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height); elOffset['x'] += targetOffset['x']; elOffset['y'] += targetOffset['y']; position.left += elOffset['x']; position.top += elOffset['y']; if (flip) { var boundaries = [getDimensions(window$1(element))]; if (boundary) { boundaries.unshift(getDimensions(boundary)); } each(dirs, function (ref, prop) { var dir = ref[0]; var align = ref[1]; var alignFlip = ref[2]; if (!(flip === true || includes(flip, dir))) { return; } boundaries.some(function (boundary) { var elemOffset = elAttach[dir] === align ? -dim[prop] : elAttach[dir] === alignFlip ? dim[prop] : 0; var targetOffset = targetAttach[dir] === align ? targetDim[prop] : targetAttach[dir] === alignFlip ? -targetDim[prop] : 0; if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) { var centerOffset = dim[prop] / 2; var centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0; return elAttach[dir] === 'center' && ( apply(centerOffset, centerTargetOffset) || apply(-centerOffset, -centerTargetOffset) ) || apply(elemOffset, targetOffset); } function apply(elemOffset, targetOffset) { var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2; if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) { position[align] = newVal; ['element', 'target'].forEach(function (el) { flipped[el][dir] = !elemOffset ? flipped[el][dir] : flipped[el][dir] === dirs[prop][1] ? dirs[prop][2] : dirs[prop][1]; }); return true; } } }); }); } offset(element, position); return flipped; } function offset(element, coordinates) { element = toNode(element); if (coordinates) { var currentOffset = offset(element); var pos = css(element, 'position'); ['left', 'top'].forEach(function (prop) { if (prop in coordinates) { var value = css(element, prop); css(element, prop, coordinates[prop] - currentOffset[prop] + toFloat(pos === 'absolute' && value === 'auto' ? position(element)[prop] : value) ); } }); return; } return getDimensions(element); } function getDimensions(element) { element = toNode(element); var ref = window$1(element); var top = ref.pageYOffset; var left = ref.pageXOffset; if (isWindow(element)) { var height = element.innerHeight; var width = element.innerWidth; return { top: top, left: left, height: height, width: width, bottom: top + height, right: left + width, }; } var style, hidden; if (!isVisible(element)) { style = attr(element, 'style'); hidden = attr(element, 'hidden'); attr(element, { style: ((style || '') + ";display:block !important;"), hidden: null }); } var rect = element.getBoundingClientRect(); if (!isUndefined(style)) { attr(element, {style: style, hidden: hidden}); } return { height: rect.height, width: rect.width, top: rect.top + top, left: rect.left + left, bottom: rect.bottom + top, right: rect.right + left, }; } function position(element) { element = toNode(element); var parent = element.offsetParent || docEl(element); var parentOffset = offset(parent); var ref = ['top', 'left'].reduce(function (props, prop) { var propName$$1 = ucfirst(prop); props[prop] -= parentOffset[prop] + toFloat(css(element, ("margin" + propName$$1))) + toFloat(css(parent, ("border" + propName$$1 + "Width"))); return props; }, offset(element)); var top = ref.top; var left = ref.left; return {top: top, left: left}; } var height = dimension('height'); var width = dimension('width'); function dimension(prop) { var propName$$1 = ucfirst(prop); return function (element, value) { element = toNode(element); if (isUndefined(value)) { if (isWindow(element)) { return element[("inner" + propName$$1)]; } if (isDocument(element)) { var doc = element.documentElement; return Math.max(doc[("offset" + propName$$1)], doc[("scroll" + propName$$1)]); } value = css(element, prop); value = value === 'auto' ? element[("offset" + propName$$1)] : toFloat(value) || 0; return value - boxModelAdjust(prop, element); } else { css(element, prop, !value && value !== 0 ? '' : +value + boxModelAdjust(prop, element) + 'px' ); } }; } function boxModelAdjust(prop, element, sizing) { if ( sizing === void 0 ) sizing = 'border-box'; return css(element, 'boxSizing') === sizing ? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value + toFloat(css(element, ("padding" + prop))) + toFloat(css(element, ("border" + prop + "Width"))); } , 0) : 0; } function moveTo(position, attach, dim, factor) { each(dirs, function (ref, prop) { var dir = ref[0]; var align = ref[1]; var alignFlip = ref[2]; if (attach[dir] === alignFlip) { position[align] += dim[prop] * factor; } else if (attach[dir] === 'center') { position[align] += dim[prop] * factor / 2; } }); } function getPos(pos) { var x = /left|center|right/; var y = /top|center|bottom/; pos = (pos || '').split(' '); if (pos.length === 1) { pos = x.test(pos[0]) ? pos.concat(['center']) : y.test(pos[0]) ? ['center'].concat(pos) : ['center', 'center']; } return { x: x.test(pos[0]) ? pos[0] : 'center', y: y.test(pos[1]) ? pos[1] : 'center' }; } function getOffsets(offsets, width, height) { var ref = (offsets || '').split(' '); var x = ref[0]; var y = ref[1]; return { x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0, y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0 }; } function flipPosition(pos) { switch (pos) { case 'left': return 'right'; case 'right': return 'left'; case 'top': return 'bottom'; case 'bottom': return 'top'; default: return pos; } } function isInView(element, topOffset, leftOffset, relativeToViewport) { if ( topOffset === void 0 ) topOffset = 0; if ( leftOffset === void 0 ) leftOffset = 0; if (!isVisible(element)) { return false; } element = toNode(element); var win = window$1(element); var client, bounding; if (relativeToViewport) { client = element.getBoundingClientRect(); bounding = { top: -topOffset, left: -leftOffset, bottom: topOffset + height(win), right: leftOffset + width(win) }; } else { var ref = offsetPosition(element); var elTop = ref[0]; var elLeft = ref[1]; var top = win.pageYOffset; var left = win.pageXOffset; client = { top: elTop, left: elLeft, bottom: elTop + element.offsetHeight, right: elTop + element.offsetWidth }; bounding = { top: top - topOffset, left: left - leftOffset, bottom: top + topOffset + height(win), right: left + leftOffset + width(win) }; } return intersectRect(client, bounding) || pointInRect({x: client.left, y: client.top}, bounding); } function scrolledOver(element, heightOffset) { if ( heightOffset === void 0 ) heightOffset = 0; if (!isVisible(element)) { return 0; } element = toNode(element); var win = window$1(element); var doc = document$1(element); var elHeight = element.offsetHeight + heightOffset; var ref = offsetPosition(element); var top = ref[0]; var vp = height(win); var vh = vp + Math.min(0, top - vp); var diff = Math.max(0, vp - (height(doc) + heightOffset - (top + elHeight))); return clamp(((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100)) / 100); } function scrollTop(element, top) { element = toNode(element); if (isWindow(element) || isDocument(element)) { var ref = window$1(element); var scrollTo = ref.scrollTo; var pageXOffset = ref.pageXOffset; scrollTo(pageXOffset, top); } else { element.scrollTop = top; } } function offsetPosition(element) { var offset = [0, 0]; do { offset[0] += element.offsetTop; offset[1] += element.offsetLeft; if (css(element, 'position') === 'fixed') { var win = window$1(element); offset[0] += win.pageYOffset; offset[1] += win.pageXOffset; return offset; } } while ((element = element.offsetParent)); return offset; } function window$1(element) { return isWindow(element) ? element : document$1(element).defaultView; } function document$1(element) { return toNode(element).ownerDocument; } function docEl(element) { return document$1(element).documentElement; } /* Based on: Copyright (c) 2016 Wilson Page wilsonpage@me.com https://github.com/wilsonpage/fastdom */ var fastdom = { reads: [], writes: [], read: function(task) { this.reads.push(task); scheduleFlush(); return task; }, write: function(task) { this.writes.push(task); scheduleFlush(); return task; }, clear: function(task) { return remove$1(this.reads, task) || remove$1(this.writes, task); }, flush: function() { runTasks(this.reads); runTasks(this.writes.splice(0, this.writes.length)); this.scheduled = false; if (this.reads.length || this.writes.length) { scheduleFlush(); } } }; function scheduleFlush() { if (!fastdom.scheduled) { fastdom.scheduled = true; requestAnimationFrame(fastdom.flush.bind(fastdom)); } } function runTasks(tasks) { var task; while ((task = tasks.shift())) { try { task(); } catch (e) { console && console.log('CMW caught and ignored ' + e.stack); } } } function remove$1(array, item) { var index = array.indexOf(item); return !!~index && !!array.splice(index, 1); } function MouseTracker() {} MouseTracker.prototype = { positions: [], position: null, init: function() { var this$1 = this; this.positions = []; this.position = null; var ticking = false; this.unbind = on(document, 'mousemove', function (e) { if (ticking) { return; } setTimeout(function () { var time = Date.now(); var ref = this$1.positions; var length = ref.length; if (length && (time - this$1.positions[length - 1].time > 100)) { this$1.positions.splice(0, length); } this$1.positions.push({time: time, x: e.pageX, y: e.pageY}); if (this$1.positions.length > 5) { this$1.positions.shift(); } ticking = false; }, 5); ticking = true; }); }, cancel: function() { if (this.unbind) { this.unbind(); } }, movesTo: function(target) { if (this.positions.length < 2) { return false; } var p = offset(target); var position$$1 = this.positions[this.positions.length - 1]; var ref = this.positions; var prevPos = ref[0]; if (p.left <= position$$1.x && position$$1.x <= p.right && p.top <= position$$1.y && position$$1.y <= p.bottom) { return false; } var points = [ [{x: p.left, y: p.top}, {x: p.right, y: p.bottom}], [{x: p.right, y: p.top}, {x: p.left, y: p.bottom}] ]; if (p.right <= position$$1.x) ; else if (p.left >= position$$1.x) { points[0].reverse(); points[1].reverse(); } else if (p.bottom <= position$$1.y) { points[0].reverse(); } else if (p.top >= position$$1.y) { points[1].reverse(); } return !!points.reduce(function (result, point) { return result + (slope(prevPos, point[0]) < slope(position$$1, point[0]) && slope(prevPos, point[1]) > slope(position$$1, point[1])); }, 0); } }; function slope(a, b) { return (b.y - a.y) / (b.x - a.x); } var strats = {}; strats.events = strats.created = strats.beforeConnect = strats.connected = strats.beforeDisconnect = strats.disconnected = strats.destroy = concatStrat; // args strategy strats.args = function (parentVal, childVal) { return concatStrat(childVal || parentVal); }; // update strategy strats.update = function (parentVal, childVal) { return sortBy(concatStrat(parentVal, isFunction(childVal) ? {read: childVal} : childVal), 'order'); }; // property strategy strats.props = function (parentVal, childVal) { if (isArray(childVal)) { childVal = childVal.reduce(function (value, key) { value[key] = String; return value; }, {}); } return strats.methods(parentVal, childVal); }; // extend strategy strats.computed = strats.methods = function (parentVal, childVal) { return childVal ? parentVal ? assign({}, parentVal, childVal) : childVal : parentVal; }; // data strategy strats.data = function (parentVal, childVal, vm) { if (!vm) { if (!childVal) { return parentVal; } if (!parentVal) { return childVal; } return function (vm) { return mergeFnData(parentVal, childVal, vm); }; } return mergeFnData(parentVal, childVal, vm); }; function mergeFnData(parentVal, childVal, vm) { return strats.computed( isFunction(parentVal) ? parentVal.call(vm, vm) : parentVal, isFunction(childVal) ? childVal.call(vm, vm) : childVal ); } // concat strategy function concatStrat(parentVal, childVal) { parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal; return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal; } // default strategy function defaultStrat(parentVal, childVal) { return isUndefined(childVal) ? parentVal : childVal; } function mergeOptions(parent, child, vm) { var options = {}; if (isFunction(child)) { child = child.options; } if (child.extends) { parent = mergeOptions(parent, child.extends, vm); } if (child.mixins) { for (var i = 0, l = child.mixins.length; i < l; i++) { parent = mergeOptions(parent, child.mixins[i], vm); } } for (var key in parent) { mergeKey(key); } for (var key$1 in child) { if (!hasOwn(parent, key$1)) { mergeKey(key$1); } } function mergeKey(key) { options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm); } return options; } function parseOptions(options, args) { var obj; if ( args === void 0 ) args = []; try { return !options ? {} : startsWith(options, '{') ? JSON.parse(options) : args.length && !includes(options, ':') ? (( obj = {}, obj[args[0]] = options, obj )) : options.split(';').reduce(function (options, option) { var ref = option.split(/:(.*)/); var key = ref[0]; var value = ref[1]; if (key && !isUndefined(value)) { options[key.trim()] = value.trim(); } return options; }, {}); } catch (e) { return {}; } } var id = 0; var Player = function(el) { this.id = ++id; this.el = toNode(el); }; Player.prototype.isVideo = function () { return this.isYoutube() || this.isVimeo() || this.isHTML5(); }; Player.prototype.isHTML5 = function () { return this.el.tagName === 'VIDEO'; }; Player.prototype.isIFrame = function () { return this.el.tagName === 'IFRAME'; }; Player.prototype.isYoutube = function () { return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/); }; Player.prototype.isVimeo = function () { return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/); }; Player.prototype.enableApi = function () { var this$1 = this; if (this.ready) { return this.ready; } var youtube = this.isYoutube(); var vimeo = this.isVimeo(); var poller; if (youtube || vimeo) { return this.ready = new Promise(function (resolve) { once(this$1.el, 'load', function () { if (youtube) { var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); }; poller = setInterval(listener, 100); listener(); } }); listen(function (data$$1) { return youtube && data$$1.id === this$1.id && data$$1.event === 'onReady' || vimeo && Number(data$$1.player_id) === this$1.id; }) .then(function () { resolve(); poller && clearInterval(poller); }); attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + (this$1.id))))); }); } return Promise.resolve(); }; Player.prototype.play = function () { var this$1 = this; if (!this.isVideo()) { return; } if (this.isIFrame()) { this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); }); } else if (this.isHTML5()) { try { var promise = this.el.play(); if (promise) { promise.catch(noop); } } catch (e) {} } }; Player.prototype.pause = function () { var this$1 = this; if (!this.isVideo()) { return; } if (this.isIFrame()) { this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); }); } else if (this.isHTML5()) { this.el.pause(); } }; Player.prototype.mute = function () { var this$1 = this; if (!this.isVideo()) { return; } if (this.isIFrame()) { this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); }); } else if (this.isHTML5()) { this.el.muted = true; attr(this.el, 'muted', ''); } }; function post(el, cmd) { try { el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*'); } catch (e) {} } function listen(cb) { return new Promise(function (resolve) { once(window, 'message', function (_, data$$1) { return resolve(data$$1); }, false, function (ref) { var data$$1 = ref.data; if (!data$$1 || !isString(data$$1)) { return; } try { data$$1 = JSON.parse(data$$1); } catch (e) { return; } return data$$1 && cb(data$$1); }); }); } /* Based on: Copyright (c) 2010-2016 Thomas Fuchs http://zeptojs.com/ */ var touch = {}, clickTimeout, swipeTimeout, tapTimeout, clicked; function swipeDirection(ref) { var x1 = ref.x1; var x2 = ref.x2; var y1 = ref.y1; var y2 = ref.y2; return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down'); } function cancelAll() { clickTimeout && clearTimeout(clickTimeout); swipeTimeout && clearTimeout(swipeTimeout); tapTimeout && clearTimeout(tapTimeout); clickTimeout = swipeTimeout = tapTimeout = null; touch = {}; } ready(function () { on(document, 'click', function () { return clicked = true; }, true); on(document, pointerDown, function (e) { var target = e.target; var ref = getPos$1(e); var x = ref.x; var y = ref.y; var now = Date.now(); var type = getType(e.type); if (touch.type && touch.type !== type) { return; } touch.el = 'tagName' in target ? target : target.parentNode; clickTimeout && clearTimeout(clickTimeout); touch.x1 = x; touch.y1 = y; if (touch.last && now - touch.last <= 250) { touch = {}; } touch.type = type; touch.last = now; clicked = e.button > 0; }); on(document, pointerMove, function (e) { if (e.defaultPrevented) { return; } var ref = getPos$1(e); var x = ref.x; var y = ref.y; touch.x2 = x; touch.y2 = y; }); on(document, pointerUp, function (ref) { var type = ref.type; var target = ref.target; if (touch.type !== getType(type)) { return; } // swipe if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 30 || touch.y2 && Math.abs(touch.y1 - touch.y2) > 30) { swipeTimeout = setTimeout(function () { if (touch.el) { trigger(touch.el, 'swipe'); trigger(touch.el, ("swipe" + (swipeDirection(touch)))); } touch = {}; }); // normal tap } else if ('last' in touch) { tapTimeout = setTimeout(function () { return trigger(touch.el, 'tap'); }); // trigger single click after 350ms of inactivity if (touch.el && type !== 'mouseup' && within(target, touch.el)) { clickTimeout = setTimeout(function () { clickTimeout = null; if (touch.el && !clicked) { trigger(touch.el, 'click'); } touch = {}; }, 350); } } else { touch = {}; } }); on(document, 'touchcancel', cancelAll); on(window, 'scroll', cancelAll); }); var touching = false; on(document, 'touchstart', function () { return touching = true; }, true); on(document, 'click', function () {touching = false;}); on(document, 'touchcancel', function () { return touching = false; }, true); function isTouch(e) { return touching || e.pointerType === 'touch'; } function getPos$1(e) { var touches = e.touches; var changedTouches = e.changedTouches; var ref = touches && touches[0] || changedTouches && changedTouches[0] || e; var x = ref.pageX; var y = ref.pageY; return {x: x, y: y}; } function getType(type) { return type.slice(0, 5); } var util = /*#__PURE__*/Object.freeze({ ajax: ajax, getImage: getImage, transition: transition, Transition: Transition, animate: animate, Animation: Animation, attr: attr, hasAttr: hasAttr, removeAttr: removeAttr, data: data, addClass: addClass, removeClass: removeClass, removeClasses: removeClasses, replaceClass: replaceClass, hasClass: hasClass, toggleClass: toggleClass, positionAt: positionAt, offset: offset, position: position, height: height, width: width, boxModelAdjust: boxModelAdjust, flipPosition: flipPosition, isInView: isInView, scrolledOver: scrolledOver, scrollTop: scrollTop, offsetPosition: offsetPosition, isReady: isReady, ready: ready, index: index, getIndex: getIndex, empty: empty, html: html, prepend: prepend, append: append, before: before, after: after, remove: remove, wrapAll: wrapAll, wrapInner: wrapInner, unwrap: unwrap, fragment: fragment, apply: apply, $: $, $$: $$, isIE: isIE, isRtl: isRtl, hasTouch: hasTouch, pointerDown: pointerDown, pointerMove: pointerMove, pointerUp: pointerUp, pointerEnter: pointerEnter, pointerLeave: pointerLeave, on: on, off: off, once: once, trigger: trigger, createEvent: createEvent, toEventTargets: toEventTargets, preventClick: preventClick, fastdom: fastdom, isVoidElement: isVoidElement, isVisible: isVisible, selInput: selInput, isInput: isInput, filter: filter, within: within, bind: bind, hasOwn: hasOwn, hyphenate: hyphenate, camelize: camelize, ucfirst: ucfirst, startsWith: startsWith, endsWith: endsWith, includes: includes, isArray: isArray, isFunction: isFunction, isObject: isObject, isPlainObject: isPlainObject, isWindow: isWindow, isDocument: isDocument, isJQuery: isJQuery, isNode: isNode, isNodeCollection: isNodeCollection, isBoolean: isBoolean, isString: isString, isNumber: isNumber, isNumeric: isNumeric, isUndefined: isUndefined, toBoolean: toBoolean, toNumber: toNumber, toFloat: toFloat, toNode: toNode, toNodes: toNodes, toList: toList, toMs: toMs, swap: swap, assign: assign, each: each, sortBy: sortBy, clamp: clamp, noop: noop, intersectRect: intersectRect, pointInRect: pointInRect, Dimensions: Dimensions, MouseTracker: MouseTracker, mergeOptions: mergeOptions, parseOptions: parseOptions, Player: Player, Promise: Promise, Deferred: Deferred, query: query, queryAll: queryAll, find: find, findAll: findAll, matches: matches, closest: closest, parents: parents, escape: escape, css: css, getStyles: getStyles, getStyle: getStyle, getCssVar: getCssVar, propName: propName, isTouch: isTouch, getPos: getPos$1 }); function componentAPI (UIkit) { var DATA = UIkit.data; var components = {}; UIkit.component = function (name, options) { if (!options) { if (isPlainObject(components[name])) { components[name] = UIkit.extend(components[name]); } return components[name]; } UIkit[name] = function (element, data$$1) { var i = arguments.length, argsArray = Array(i); while ( i-- ) argsArray[i] = arguments[i]; var component = UIkit.component(name); if (isPlainObject(element)) { return new component({data: element}); } if (component.options.functional) { return new component({data: [].concat( argsArray )}); } return element && element.nodeType ? init(element) : $$(element).map(init)[0]; function init(element) { var instance = UIkit.getComponent(element, name); if (instance) { if (!data$$1) { return instance; } else { instance.$destroy(); } } return new component({el: element, data: data$$1}); } }; var opt = isPlainObject(options) ? assign({}, options) : options.options; opt.name = name; if (opt.install) { opt.install(UIkit, opt, name); } if (UIkit._initialized && !opt.functional) { var id = hyphenate(name); fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); }); } return components[name] = isPlainObject(options) ? opt : options; }; UIkit.getComponents = function (element) { return element && element[DATA] || {}; }; UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; }; UIkit.connect = function (node) { if (node[DATA]) { for (var name in node[DATA]) { node[DATA][name]._callConnected(); } } for (var i = 0; i < node.attributes.length; i++) { var name$1 = getComponentName(node.attributes[i].name); if (name$1 && name$1 in components) { UIkit[name$1](node); } } }; UIkit.disconnect = function (node) { for (var name in node[DATA]) { node[DATA][name]._callDisconnected(); } }; } function getComponentName(attribute) { return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-') ? camelize(attribute.replace('data-uk-', '').replace('uk-', '')) : false; } function boot (UIkit) { var connect = UIkit.connect; var disconnect = UIkit.disconnect; if (!('MutationObserver' in window)) { return; } if (document.body) { init(); } else { (new MutationObserver(function () { if (document.body) { this.disconnect(); init(); } })).observe(document, {childList: true, subtree: true}); } function init() { apply$$1(document.body, connect); fastdom.flush(); (new MutationObserver(function (mutations) { return mutations.forEach(applyMutation); })).observe(document, { childList: true, subtree: true, characterData: true, attributes: true }); UIkit._initialized = true; } function applyMutation(mutation) { var target = mutation.target; var type = mutation.type; var update = type !== 'attributes' ? applyChildList(mutation) : applyAttribute(mutation); update && UIkit.update(target); } function applyAttribute(ref) { var target = ref.target; var attributeName = ref.attributeName; if (attributeName === 'href') { return true; } var name = getComponentName(attributeName); if (!name || !(name in UIkit)) { return; } if (hasAttr(target, attributeName)) { UIkit[name](target); return true; } var component = UIkit.getComponent(target, name); if (component) { component.$destroy(); return true; } } function applyChildList(ref) { var addedNodes = ref.addedNodes; var removedNodes = ref.removedNodes; for (var i = 0; i < addedNodes.length; i++) { apply$$1(addedNodes[i], connect); } for (var i$1 = 0; i$1 < removedNodes.length; i$1++) { apply$$1(removedNodes[i$1], disconnect); } return true; } function apply$$1(node, fn) { if (node.nodeType !== 1 || hasAttr(node, 'uk-no-boot')) { return; } fn(node); node = node.firstElementChild; while (node) { var next = node.nextElementSibling; apply$$1(node, fn); node = next; } } } function globalAPI (UIkit) { var DATA = UIkit.data; UIkit.use = function (plugin) { if (plugin.installed) { return; } plugin.call(null, this); plugin.installed = true; return this; }; UIkit.mixin = function (mixin, component) { component = (isString(component) ? UIkit.component(component) : component) || this; component.options = mergeOptions(component.options, mixin); }; UIkit.extend = function (options) { options = options || {}; var Super = this; var Sub = function UIkitComponent (options) { this._init(options); }; Sub.prototype = Object.create(Super.prototype); Sub.prototype.constructor = Sub; Sub.options = mergeOptions(Super.options, options); Sub.super = Super; Sub.extend = Super.extend; return Sub; }; UIkit.update = function (element, e) { e = createEvent(e || 'update'); element = element ? toNode(element) : document.body; path(element).map(function (element) { return update(element[DATA], e); }); apply(element, function (element) { return update(element[DATA], e); }); }; var container; Object.defineProperty(UIkit, 'container', { get: function() { return container || document.body; }, set: function(element) { container = $(element); } }); function update(data$$1, e) { if (!data$$1) { return; } for (var name in data$$1) { if (data$$1[name]._connected) { data$$1[name]._callUpdate(e); } } } function path(element) { var path = []; while (element && element !== document.body && element.parentNode) { element = element.parentNode; path.unshift(element); } return path; } } function hooksAPI (UIkit) { UIkit.prototype._callHook = function (hook) { var this$1 = this; var handlers = this.$options[hook]; if (handlers) { handlers.forEach(function (handler) { return handler.call(this$1); }); } }; UIkit.prototype._callConnected = function () { if (this._connected) { return; } this._data = {}; this._initProps(); this._callHook('beforeConnect'); this._connected = true; this._initEvents(); this._initObserver(); this._callHook('connected'); this._callUpdate(); }; UIkit.prototype._callDisconnected = function () { if (!this._connected) { return; } this._callHook('beforeDisconnect'); if (this._observer) { this._observer.disconnect(); this._observer = null; } this._unbindEvents(); this._callHook('disconnected'); this._connected = false; }; UIkit.prototype._callUpdate = function (e) { var this$1 = this; e = createEvent(e || 'update'); var type = e.type; if (includes(['update', 'load', 'resize'], type)) { this._resetComputeds(); } var updates = this.$options.update; var ref = this._frames; var reads = ref.reads; var writes = ref.writes; if (!updates) { return; } updates.forEach(function (ref, i) { var read = ref.read; var write = ref.write; var events = ref.events; if (type !== 'update' && !includes(events, type)) { return; } if (read && !includes(fastdom.reads, reads[i])) { reads[i] = fastdom.read(function () { var result = this$1._connected && read.call(this$1, this$1._data, e); if (result === false && write) { fastdom.clear(writes[i]); delete writes[i]; } else if (isPlainObject(result)) { assign(this$1._data, result); } delete reads[i]; }); } if (write && !includes(fastdom.writes, writes[i])) { writes[i] = fastdom.write(function () { this$1._connected && write.call(this$1, this$1._data, e); delete writes[i]; }); } }); }; } function stateAPI (UIkit) { var uid = 0; UIkit.prototype._init = function (options) { options = options || {}; options.data = normalizeData(options, this.constructor.options); this.$options = mergeOptions(this.constructor.options, options, this); this.$el = null; this.$props = {}; this._frames = {reads: {}, writes: {}}; this._events = []; this._uid = uid++; this._initData(); this._initMethods(); this._initComputeds(); this._callHook('created'); if (options.el) { this.$mount(options.el); } }; UIkit.prototype._initData = function () { var ref = this.$options; var data$$1 = ref.data; if ( data$$1 === void 0 ) data$$1 = {}; for (var key in data$$1) { this.$props[key] = this[key] = data$$1[key]; } }; UIkit.prototype._initMethods = function () { var ref = this.$options; var methods = ref.methods; if (methods) { for (var key in methods) { this[key] = bind(methods[key], this); } } }; UIkit.prototype._initComputeds = function () { var ref = this.$options; var computed = ref.computed; this._resetComputeds(); if (computed) { for (var key in computed) { registerComputed(this, key, computed[key]); } } }; UIkit.prototype._resetComputeds = function () { this._computeds = {}; }; UIkit.prototype._initProps = function (props) { var key; this._resetComputeds(); props = props || getProps(this.$options, this.$name); for (key in props) { if (!isUndefined(props[key])) { this.$props[key] = props[key]; } } var exclude = [this.$options.computed, this.$options.methods]; for (key in this.$props) { if (key in props && notIn(exclude, key)) { this[key] = this.$props[key]; } } }; UIkit.prototype._initEvents = function () { var this$1 = this; var ref = this.$options; var events = ref.events; if (events) { events.forEach(function (event) { if (!hasOwn(event, 'handler')) { for (var key in event) { registerEvent(this$1, event[key], key); } } else { registerEvent(this$1, event); } }); } }; UIkit.prototype._unbindEvents = function () { this._events.forEach(function (unbind) { return unbind(); }); this._events = []; }; UIkit.prototype._initObserver = function () { var this$1 = this; var ref = this.$options; var attrs = ref.attrs; var props = ref.props; var el = ref.el; if (this._observer || !props || attrs === false) { return; } attrs = isArray(attrs) ? attrs : Object.keys(props); this._observer = new MutationObserver(function () { var data$$1 = getProps(this$1.$options, this$1.$name); if (attrs.some(function (key) { return !isUndefined(data$$1[key]) && data$$1[key] !== this$1.$props[key]; })) { this$1.$reset(); } }); var filter$$1 = attrs.map(function (key) { return hyphenate(key); }).concat(this.$name); this._observer.observe(el, { attributes: true, attributeFilter: filter$$1.concat(filter$$1.map(function (key) { return ("data-" + key); })) }); }; function getProps(opts, name) { var data$$1 = {}; var args = opts.args; if ( args === void 0 ) args = []; var props = opts.props; if ( props === void 0 ) props = {}; var el = opts.el; if (!props) { return data$$1; } for (var key in props) { var prop = hyphenate(key); var value = data(el, prop); if (!isUndefined(value)) { value = props[key] === Boolean && value === '' ? true : coerce(props[key], value); if (prop === 'target' && (!value || startsWith(value, '_'))) { continue; } data$$1[key] = value; } } var options = parseOptions(data(el, name), args); for (var key$1 in options) { var prop$1 = camelize(key$1); if (props[prop$1] !== undefined) { data$$1[prop$1] = coerce(props[prop$1], options[key$1]); } } return data$$1; } function registerComputed(component, key, cb) { Object.defineProperty(component, key, { enumerable: true, get: function() { var _computeds = component._computeds; var $props = component.$props; var $el = component.$el; if (!hasOwn(_computeds, key)) { _computeds[key] = (cb.get || cb).call(component, $props, $el); } return _computeds[key]; }, set: function(value) { var _computeds = component._computeds; _computeds[key] = cb.set ? cb.set.call(component, value) : value; if (isUndefined(_computeds[key])) { delete _computeds[key]; } } }); } function registerEvent(component, event, key) { if (!isPlainObject(event)) { event = ({name: key, handler: event}); } var name = event.name; var el = event.el; var handler = event.handler; var capture = event.capture; var passive = event.passive; var delegate = event.delegate; var filter$$1 = event.filter; var self = event.self; el = isFunction(el) ? el.call(component) : el || component.$el; if (isArray(el)) { el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); }); return; } if (!el || filter$$1 && !filter$$1.call(component)) { return; } handler = detail(isString(handler) ? component[handler] : bind(handler, component)); if (self) { handler = selfFilter(handler); } component._events.push( on( el, name, !delegate ? null : isString(delegate) ? delegate : delegate.call(component), handler, isBoolean(passive) ? {passive: passive, capture: capture} : capture ) ); } function selfFilter(handler) { return function selfHandler(e) { if (e.target === e.currentTarget || e.target === e.current) { return handler.call(null, e); } }; } function notIn(options, key) { return options.every(function (arr) { return !arr || !hasOwn(arr, key); }); } function detail(listener) { return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); }; } function coerce(type, value) { if (type === Boolean) { return toBoolean(value); } else if (type === Number) { return toNumber(value); } else if (type === 'list') { return toList(value); } return type ? type(value) : value; } function normalizeData(ref, ref$1) { var data$$1 = ref.data; var el = ref.el; var args = ref$1.args; var props = ref$1.props; if ( props === void 0 ) props = {}; data$$1 = isArray(data$$1) ? args && args.length ? data$$1.slice(0, args.length).reduce(function (data$$1, value, index$$1) { if (isPlainObject(value)) { assign(data$$1, value); } else { data$$1[args[index$$1]] = value; } return data$$1; }, {}) : undefined : data$$1; if (data$$1) { for (var key in data$$1) { if (isUndefined(data$$1[key])) { delete data$$1[key]; } else { data$$1[key] = props[key] ? coerce(props[key], data$$1[key], el) : data$$1[key]; } } } return data$$1; } } function instanceAPI (UIkit) { var DATA = UIkit.data; UIkit.prototype.$mount = function (el) { var ref = this.$options; var name = ref.name; if (!el[DATA]) { el[DATA] = {}; } if (el[DATA][name]) { return; } el[DATA][name] = this; this.$el = this.$options.el = this.$options.el || el; if (within(el, document)) { this._callConnected(); } }; UIkit.prototype.$emit = function (e) { this._callUpdate(e); }; UIkit.prototype.$reset = function () { this._callDisconnected(); this._callConnected(); }; UIkit.prototype.$destroy = function (removeEl) { if ( removeEl === void 0 ) removeEl = false; var ref = this.$options; var el = ref.el; var name = ref.name; if (el) { this._callDisconnected(); } this._callHook('destroy'); if (!el || !el[DATA]) { return; } delete el[DATA][name]; if (!Object.keys(el[DATA]).length) { delete el[DATA]; } if (removeEl) { remove(this.$el); } }; UIkit.prototype.$create = function (component, element, data$$1) { return UIkit[component](element, data$$1); }; UIkit.prototype.$update = UIkit.update; UIkit.prototype.$getComponent = UIkit.getComponent; var names = {}; Object.defineProperties(UIkit.prototype, { $container: Object.getOwnPropertyDescriptor(UIkit, 'container'), $name: { get: function() { var ref = this.$options; var name = ref.name; if (!names[name]) { names[name] = UIkit.prefix + hyphenate(name); } return names[name]; } } }); } var UIkit = function (options) { this._init(options); }; UIkit.util = util; UIkit.data = '__uikit__'; UIkit.prefix = 'uk-'; UIkit.options = {}; globalAPI(UIkit); hooksAPI(UIkit); stateAPI(UIkit); componentAPI(UIkit); instanceAPI(UIkit); var Class = { connected: function() { !hasClass(this.$el, this.$name) && addClass(this.$el, this.$name); } }; var Togglable = { props: { cls: Boolean, animation: 'list', duration: Number, origin: String, transition: String, queued: Boolean }, data: { cls: false, animation: [false], duration: 200, origin: false, transition: 'linear', queued: false, initProps: { overflow: '', height: '', paddingTop: '', paddingBottom: '', marginTop: '', marginBottom: '' }, hideProps: { overflow: 'hidden', height: 0, paddingTop: 0, paddingBottom: 0, marginTop: 0, marginBottom: 0 } }, computed: { hasAnimation: function(ref) { var animation = ref.animation; return !!animation[0]; }, hasTransition: function(ref) { var animation = ref.animation; return this.hasAnimation && animation[0] === true; } }, methods: { toggleElement: function(targets, show, animate$$1) { var this$1 = this; return new Promise(function (resolve) { targets = toNodes(targets); var all = function (targets) { return Promise.all(targets.map(function (el) { return this$1._toggleElement(el, show, animate$$1); })); }; var toggled = targets.filter(function (el) { return this$1.isToggled(el); }); var untoggled = targets.filter(function (el) { return !includes(toggled, el); }); var p; if (!this$1.queued || !isUndefined(animate$$1) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) { p = all(untoggled.concat(toggled)); } else { var body = document.body; var scroll = body.scrollTop; var el = toggled[0]; var inProgress = Animation.inProgress(el) && hasClass(el, 'uk-animation-leave') || Transition.inProgress(el) && el.style.height === '0px'; p = all(toggled); if (!inProgress) { p = p.then(function () { var p = all(untoggled); body.scrollTop = scroll; return p; }); } } p.then(resolve, noop); }); }, toggleNow: function(targets, show) { var this$1 = this; return new Promise(function (resolve) { return Promise.all(toNodes(targets).map(function (el) { return this$1._toggleElement(el, show, false); })).then(resolve, noop); }); }, isToggled: function(el) { var nodes = toNodes(el || this.$el); return this.cls ? hasClass(nodes, this.cls.split(' ')[0]) : !hasAttr(nodes, 'hidden'); }, updateAria: function(el) { if (this.cls === false) { attr(el, 'aria-hidden', !this.isToggled(el)); } }, _toggleElement: function(el, show, animate$$1) { var this$1 = this; show = isBoolean(show) ? show : Animation.inProgress(el) ? hasClass(el, 'uk-animation-leave') : Transition.inProgress(el) ? el.style.height === '0px' : !this.isToggled(el); if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) { return Promise.reject(); } var promise = ( isFunction(animate$$1) ? animate$$1 : animate$$1 === false || !this.hasAnimation ? this._toggle : this.hasTransition ? toggleHeight(this) : toggleAnimation(this) )(el, show); trigger(el, show ? 'show' : 'hide', [this]); var final = function () { trigger(el, show ? 'shown' : 'hidden', [this$1]); this$1.$update(el); }; return promise ? promise.then(final) : Promise.resolve(final()); }, _toggle: function(el, toggled) { if (!el) { return; } var changed; if (this.cls) { changed = includes(this.cls, ' ') || Boolean(toggled) !== hasClass(el, this.cls); changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled); } else { changed = Boolean(toggled) === hasAttr(el, 'hidden'); changed && attr(el, 'hidden', !toggled ? '' : null); } $$('[autofocus]', el).some(function (el) { return isVisible(el) && (el.focus() || true); }); this.updateAria(el); changed && this.$update(el); } } }; function toggleHeight(ref) { var isToggled = ref.isToggled; var duration = ref.duration; var initProps = ref.initProps; var hideProps = ref.hideProps; var transition$$1 = ref.transition; var _toggle = ref._toggle; return function (el, show) { var inProgress = Transition.inProgress(el); var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0; var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0; Transition.cancel(el); if (!isToggled(el)) { _toggle(el, true); } height(el, ''); // Update child components first fastdom.flush(); var endHeight = height(el) + (inProgress ? 0 : inner); height(el, currentHeight); return (show ? Transition.start(el, assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition$$1) : Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition$$1).then(function () { return _toggle(el, false); }) ).then(function () { return css(el, initProps); }); }; } function toggleAnimation(ref) { var animation = ref.animation; var duration = ref.duration; var origin = ref.origin; var _toggle = ref._toggle; return function (el, show) { Animation.cancel(el); if (show) { _toggle(el, true); return Animation.in(el, animation[0], duration, origin); } return Animation.out(el, animation[1] || animation[0], duration, origin).then(function () { return _toggle(el, false); }); }; } var Accordion = { mixins: [Class, Togglable], props: { targets: String, active: null, collapsible: Boolean, multiple: Boolean, toggle: String, content: String, transition: String }, data: { targets: '> *', active: false, animation: [true], collapsible: true, multiple: false, clsOpen: 'uk-open', toggle: '> .uk-accordion-title', content: '> .uk-accordion-content', transition: 'ease' }, computed: { items: function(ref, $el) { var targets = ref.targets; return $$(targets, $el); } }, events: [ { name: 'click', delegate: function() { return ((this.targets) + " " + (this.$props.toggle)); }, handler: function(e) { e.preventDefault(); this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current)); } } ], connected: function() { if (this.active === false) { return; } var active = this.items[Number(this.active)]; if (active && !hasClass(active, this.clsOpen)) { this.toggle(active, false); } }, update: function() { var this$1 = this; this.items.forEach(function (el) { return this$1._toggle($(this$1.content, el), hasClass(el, this$1.clsOpen)); }); var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0]; if (active) { this.toggle(active, false); } }, methods: { toggle: function(item, animate$$1) { var this$1 = this; var index$$1 = getIndex(item, this.items); var active = filter(this.items, ("." + (this.clsOpen))); item = this.items[index$$1]; item && [item] .concat(!this.multiple && !includes(active, item) && active || []) .forEach(function (el) { var isItem = el === item; var state = isItem && !hasClass(el, this$1.clsOpen); if (!state && isItem && !this$1.collapsible && active.length < 2) { return; } toggleClass(el, this$1.clsOpen, state); var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el); if (!el._wrapper) { el._wrapper = wrapAll(content, '
'); attr(el._wrapper, 'hidden', state ? '' : null); } this$1._toggle(content, true); this$1.toggleElement(el._wrapper, state, animate$$1).then(function () { if (hasClass(el, this$1.clsOpen) !== state) { return; } if (!state) { this$1._toggle(content, false); } el._wrapper = null; unwrap(content); }); }); } } }; var Alert = { mixins: [Class, Togglable], args: 'animation', props: { close: String }, data: { animation: [true], selClose: '.uk-alert-close', duration: 150, hideProps: assign({opacity: 0}, Togglable.data.hideProps) }, events: [ { name: 'click', delegate: function() { return this.selClose; }, handler: function(e) { e.preventDefault(); this.close(); } } ], methods: { close: function() { var this$1 = this; this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); }); } } }; function Core (UIkit) { ready(function () { UIkit.update(); var scroll = 0; var started = 0; on(window, 'load resize', function (e) { return UIkit.update(null, e); }); on(window, 'scroll', function (e) { var target = e.target; e.dir = scroll <= window.pageYOffset ? 'down' : 'up'; e.pageYOffset = scroll = window.pageYOffset; UIkit.update(target.nodeType !== 1 ? document.body : target, e); }, {passive: true, capture: true}); on(document, 'loadedmetadata load', function (ref) { var target = ref.target; return UIkit.update(target, 'load'); }, true); on(document, 'animationstart', function (ref) { var target = ref.target; if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) { started++; css(document.body, 'overflowX', 'hidden'); setTimeout(function () { if (!--started) { css(document.body, 'overflowX', ''); } }, toMs(css(target, 'animationDuration')) + 100); } }, true); if (!hasTouch) { return; } var cls = 'uk-hover'; on(document, 'tap', function (ref) { var target = ref.target; return $$(("." + cls)).forEach(function (el) { return !within(target, el) && removeClass(el, cls); } ); } ); Object.defineProperty(UIkit, 'hoverSelector', { set: function(selector) { on(document, 'tap', selector, function (ref) { var current = ref.current; return addClass(current, cls); }); } }); UIkit.hoverSelector = '.uk-animation-toggle, .uk-transition-toggle, [uk-hover]'; }); } var Video = { args: 'autoplay', props: { automute: Boolean, autoplay: Boolean, }, data: { automute: false, autoplay: true }, computed: { inView: function(ref) { var autoplay = ref.autoplay; return autoplay === 'inview'; } }, connected: function() { if (this.inView && !hasAttr(this.$el, 'preload')) { this.$el.preload = 'none'; } this.player = new Player(this.$el); if (this.automute) { this.player.mute(); } }, update: { read: function(_, ref) { var type = ref.type; return !this.player || (type === 'scroll' || type === 'resize') && !this.inView ? false : { visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden', inView: this.inView && isInView(this.$el) }; }, write: function(ref) { var visible = ref.visible; var inView = ref.inView; if (!visible || this.inView && !inView) { this.player.pause(); } else if (this.autoplay === true || this.inView && inView) { this.player.play(); } }, events: ['load', 'resize', 'scroll'] } }; var Cover = { mixins: [Class, Video], props: { width: Number, height: Number }, data: { automute: true }, update: { read: function() { var el = this.$el; if (!isVisible(el)) { return false; } var ref = el.parentNode; var height$$1 = ref.offsetHeight; var width$$1 = ref.offsetWidth; return {height: height$$1, width: width$$1}; }, write: function(ref) { var height$$1 = ref.height; var width$$1 = ref.width; var el = this.$el; var elWidth = this.width || el.naturalWidth || el.videoWidth || el.clientWidth; var elHeight = this.height || el.naturalHeight || el.videoHeight || el.clientHeight; if (!elWidth || !elHeight) { return; } css(el, Dimensions.cover( { width: elWidth, height: elHeight }, { width: width$$1 + (width$$1 % 2 ? 1 : 0), height: height$$1 + (height$$1 % 2 ? 1 : 0) } )); }, events: ['load', 'resize'] } }; var Position = { props: { pos: String, offset: null, flip: Boolean, clsPos: String }, data: { pos: ("bottom-" + (!isRtl ? 'left' : 'right')), flip: true, offset: false, clsPos: '' }, computed: { pos: function(ref) { var pos = ref.pos; return (pos + (!includes(pos, '-') ? '-center' : '')).split('-'); }, dir: function() { return this.pos[0]; }, align: function() { return this.pos[1]; } }, methods: { positionAt: function(element, target, boundary) { removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?")); css(element, {top: '', left: ''}); var node; var ref = this; var offset$$1 = ref.offset; var axis = this.getAxis(); offset$$1 = isNumeric(offset$$1) ? offset$$1 : (node = $(offset$$1)) ? offset(node)[axis === 'x' ? 'left' : 'top'] - offset(target)[axis === 'x' ? 'right' : 'bottom'] : 0; var ref$1 = positionAt( element, target, axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))), axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)), axis === 'x' ? ("" + (this.dir === 'left' ? -offset$$1 : offset$$1)) : (" " + (this.dir === 'top' ? -offset$$1 : offset$$1)), null, this.flip, boundary ).target; var x = ref$1.x; var y = ref$1.y; this.dir = axis === 'x' ? x : y; this.align = axis === 'x' ? y : x; toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false); }, getAxis: function() { return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x'; } } }; var active; var Drop = { mixins: [Position, Togglable], args: 'pos', props: { mode: 'list', toggle: Boolean, boundary: Boolean, boundaryAlign: Boolean, delayShow: Number, delayHide: Number, clsDrop: String }, data: { mode: ['click', 'hover'], toggle: '- *', boundary: window, boundaryAlign: false, delayShow: 0, delayHide: 0, clsDrop: false, hoverIdle: 200, animation: ['uk-animation-fade'], cls: 'uk-open' }, computed: { boundary: function(ref, $el) { var boundary = ref.boundary; return query(boundary, $el); }, clsDrop: function(ref) { var clsDrop = ref.clsDrop; return clsDrop || ("uk-" + (this.$options.name)); }, clsPos: function() { return this.clsDrop; } }, created: function() { this.tracker = new MouseTracker(); }, connected: function() { addClass(this.$el, this.clsDrop); var ref = this.$props; var toggle = ref.toggle; this.toggle = toggle && this.$create('toggle', query(toggle, this.$el), { target: this.$el, mode: this.mode }); this.updateAria(this.$el); }, events: [ { name: 'click', delegate: function() { return ("." + (this.clsDrop) + "-close"); }, handler: function(e) { e.preventDefault(); this.hide(false); } }, { name: 'click', delegate: function() { return 'a[href^="#"]'; }, handler: function(e) { if (e.defaultPrevented) { return; } var id = e.target.hash; if (!id) { e.preventDefault(); } if (!id || !within(id, this.$el)) { this.hide(false); } } }, { name: 'beforescroll', handler: function() { this.hide(false); } }, { name: 'toggle', self: true, handler: function(e, toggle) { e.preventDefault(); if (this.isToggled()) { this.hide(false); } else { this.show(toggle, false); } } }, { name: pointerEnter, filter: function() { return includes(this.mode, 'hover'); }, handler: function(e) { if (isTouch(e)) { return; } if (active && active !== this && active.toggle && includes(active.toggle.mode, 'hover') && !within(e.target, active.toggle.$el) && !pointInRect({x: e.pageX, y: e.pageY}, offset(active.$el)) ) { active.hide(false); } e.preventDefault(); this.show(this.toggle); } }, { name: 'toggleshow', handler: function(e, toggle) { if (toggle && !includes(toggle.target, this.$el)) { return; } e.preventDefault(); this.show(toggle || this.toggle); } }, { name: ("togglehide " + pointerLeave), handler: function(e, toggle) { if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) { return; } e.preventDefault(); if (this.toggle && includes(this.toggle.mode, 'hover')) { this.hide(); } } }, { name: 'beforeshow', self: true, handler: function() { this.clearTimers(); Animation.cancel(this.$el); this.position(); } }, { name: 'show', self: true, handler: function() { this.tracker.init(); if (this.toggle) { addClass(this.toggle.$el, this.cls); attr(this.toggle.$el, 'aria-expanded', 'true'); } registerEvent(); } }, { name: 'beforehide', self: true, handler: function() { this.clearTimers(); } }, { name: 'hide', handler: function(ref) { var target = ref.target; if (this.$el !== target) { active = active === null && within(target, this.$el) && this.isToggled() ? this : active; return; } active = this.isActive() ? null : active; if (this.toggle) { removeClass(this.toggle.$el, this.cls); attr(this.toggle.$el, 'aria-expanded', 'false'); this.toggle.$el.blur(); $$('a, button', this.toggle.$el).forEach(function (el) { return el.blur(); }); } this.tracker.cancel(); } } ], update: { write: function() { if (this.isToggled() && !Animation.inProgress(this.$el)) { this.position(); } }, events: ['resize'] }, methods: { show: function(toggle, delay) { var this$1 = this; if ( delay === void 0 ) delay = true; var show = function () { return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); }; var tryShow = function () { this$1.toggle = toggle || this$1.toggle; this$1.clearTimers(); if (this$1.isActive()) { return; } else if (delay && active && active !== this$1 && active.isDelaying) { this$1.showTimer = setTimeout(this$1.show, 10); return; } else if (this$1.isParentOf(active)) { if (active.hideTimer) { active.hide(false); } else { return; } } else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) { var prev; while (active && active !== prev && !this$1.isChildOf(active)) { prev = active; active.hide(false); } } if (delay && this$1.delayShow) { this$1.showTimer = setTimeout(show, this$1.delayShow); } else { show(); } active = this$1; }; if (toggle && this.toggle && toggle.$el !== this.toggle.$el) { once(this.$el, 'hide', tryShow); this.hide(false); } else { tryShow(); } }, hide: function(delay) { var this$1 = this; if ( delay === void 0 ) delay = true; var hide = function () { return this$1.toggleNow(this$1.$el, false); }; this.clearTimers(); this.isDelaying = this.tracker.movesTo(this.$el); if (delay && this.isDelaying) { this.hideTimer = setTimeout(this.hide, this.hoverIdle); } else if (delay && this.delayHide) { this.hideTimer = setTimeout(hide, this.delayHide); } else { hide(); } }, clearTimers: function() { clearTimeout(this.showTimer); clearTimeout(this.hideTimer); this.showTimer = null; this.hideTimer = null; this.isDelaying = false; }, isActive: function() { return active === this; }, isChildOf: function(drop) { return drop && drop !== this && within(this.$el, drop.$el); }, isParentOf: function(drop) { return drop && drop !== this && within(drop.$el, this.$el); }, position: function() { removeClasses(this.$el, ((this.clsDrop) + "-(stack|boundary)")); css(this.$el, {top: '', left: '', display: 'block'}); toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign); var boundary = offset(this.boundary); var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el); if (this.align === 'justify') { var prop = this.getAxis() === 'y' ? 'width' : 'height'; css(this.$el, prop, alignTo[prop]); } else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) { addClass(this.$el, ((this.clsDrop) + "-stack")); } this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary); css(this.$el, 'display', ''); } } }; var registered; function registerEvent() { if (registered) { return; } registered = true; on(document, 'click', function (ref) { var target = ref.target; var defaultPrevented = ref.defaultPrevented; var prev; if (defaultPrevented) { return; } while (active && active !== prev && !within(target, active.$el) && !(active.toggle && within(target, active.toggle.$el))) { prev = active; active.hide(false); } }); } var Dropdown = { extends: Drop }; var FormCustom = { mixins: [Class], args: 'target', props: { target: Boolean }, data: { target: false }, computed: { input: function(_, $el) { return $(selInput, $el); }, state: function() { return this.input.nextElementSibling; }, target: function(ref, $el) { var target = ref.target; return target && (target === true && this.input.parentNode === $el && this.input.nextElementSibling || query(target, $el)); } }, update: function() { var ref = this; var target = ref.target; var input = ref.input; if (!target) { return; } var option; var prop = isInput(target) ? 'value' : 'textContent'; var prev = target[prop]; var value = input.files && input.files[0] ? input.files[0].name : matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0]) ? option.textContent : input.value; if (prev !== value) { target[prop] = value; } }, events: [ { name: 'focusin focusout mouseenter mouseleave', delegate: selInput, handler: function(ref) { var type = ref.type; var current = ref.current; if (current === this.input) { toggleClass( this.state, ("uk-" + (includes(type, 'focus') ? 'focus' : 'hover')), includes(['focusin', 'mouseenter'], type) ); } } }, { name: 'change', handler: function() { this.$emit(); } } ] }; // Deprecated var Gif = { update: { read: function(data$$1) { var inview = isInView(this.$el); if (!inview || data$$1.isInView === inview) { return false; } data$$1.isInView = inview; }, write: function() { this.$el.src = this.$el.src; }, events: ['scroll', 'load', 'resize'] } }; var Margin = { props: { margin: String, firstColumn: Boolean }, data: { margin: 'uk-margin-small-top', firstColumn: 'uk-first-column' }, update: { read: function(data$$1) { var items = this.$el.children; var rows = [[]]; if (!items.length || !isVisible(this.$el)) { return data$$1.rows = rows; } data$$1.rows = getRows(items); data$$1.stacks = !data$$1.rows.some(function (row) { return row.length > 1; }); }, write: function(ref) { var this$1 = this; var rows = ref.rows; rows.forEach(function (row, i) { return row.forEach(function (el, j) { toggleClass(el, this$1.margin, i !== 0); toggleClass(el, this$1.firstColumn, j === 0); }); } ); }, events: ['load', 'resize'] } }; function getRows(items) { var rows = [[]]; for (var i = 0; i < items.length; i++) { var el = items[i]; var dim = getOffset(el); if (!dim.height) { continue; } for (var j = rows.length - 1; j >= 0; j--) { var row = rows[j]; if (!row[0]) { row.push(el); break; } var leftDim = (void 0); if (row[0].offsetParent === el.offsetParent) { leftDim = getOffset(row[0]); } else { dim = getOffset(el, true); leftDim = getOffset(row[0], true); } if (dim.top >= leftDim.bottom - 1) { rows.push([el]); break; } if (dim.bottom > leftDim.top) { if (dim.left < leftDim.left && !isRtl) { row.unshift(el); break; } row.push(el); break; } if (j === 0) { rows.unshift([el]); break; } } } return rows; } function getOffset(element, offset$$1) { var assign$$1; if ( offset$$1 === void 0 ) offset$$1 = false; var offsetTop = element.offsetTop; var offsetLeft = element.offsetLeft; var offsetHeight = element.offsetHeight; if (offset$$1) { (assign$$1 = offsetPosition(element), offsetTop = assign$$1[0], offsetLeft = assign$$1[1]); } return { top: offsetTop, left: offsetLeft, height: offsetHeight, bottom: offsetTop + offsetHeight }; } var Grid = { extends: Margin, mixins: [Class], name: 'grid', props: { masonry: Boolean, parallax: Number }, data: { margin: 'uk-grid-margin', clsStack: 'uk-grid-stack', masonry: false, parallax: 0 }, computed: { length: function(_, $el) { return $el.children.length; }, parallax: function(ref) { var parallax = ref.parallax; return parallax && this.length ? Math.abs(parallax) : ''; } }, connected: function() { this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top'); }, update: [ { read: function(ref) { var rows = ref.rows; if (this.masonry || this.parallax) { rows = rows.map(function (elements) { return sortBy(elements, 'offsetLeft'); }); if (isRtl) { rows.map(function (row) { return row.reverse(); }); } } var transitionInProgress = rows.some(function (elements) { return elements.some(Transition.inProgress); }); var translates = false; var elHeight = ''; if (this.masonry && this.length) { var height$$1 = 0; translates = rows.reduce(function (translates, row, i) { translates[i] = row.map(function (_, j) { return i === 0 ? 0 : toFloat(translates[i - 1][j]) + (height$$1 - toFloat(rows[i - 1][j] && rows[i - 1][j].offsetHeight)); }); height$$1 = row.reduce(function (height$$1, el) { return Math.max(height$$1, el.offsetHeight); }, 0); return translates; }, []); elHeight = maxColumnHeight(rows) + getMarginTop(this.$el, this.margin) * (rows.length - 1); } return {rows: rows, translates: translates, height: !transitionInProgress ? elHeight : false}; }, write: function(ref) { var stacks = ref.stacks; var height$$1 = ref.height; toggleClass(this.$el, this.clsStack, stacks); css(this.$el, 'paddingBottom', this.parallax); height$$1 !== false && css(this.$el, 'height', height$$1); }, events: ['load', 'resize'] }, { read: function(ref) { var height$$1 = ref.height; return { scrolled: this.parallax ? scrolledOver(this.$el, height$$1 ? height$$1 - height(this.$el) : 0) * this.parallax : false }; }, write: function(ref) { var rows = ref.rows; var scrolled = ref.scrolled; var translates = ref.translates; if (scrolled === false && !translates) { return; } rows.forEach(function (row, i) { return row.forEach(function (el, j) { return css(el, 'transform', !scrolled && !translates ? '' : ("translateY(" + ((translates && -translates[i][j]) + (scrolled ? j % 2 ? scrolled : scrolled / 8 : 0)) + "px)")); } ); } ); }, events: ['scroll', 'load', 'resize'] } ] }; function getMarginTop(root, cls) { var nodes = toNodes(root.children); var ref = nodes.filter(function (el) { return hasClass(el, cls); }); var node = ref[0]; return toFloat(node ? css(node, 'marginTop') : css(nodes[0], 'paddingLeft')); } function maxColumnHeight(rows) { return Math.max.apply(Math, rows.reduce(function (sum, row) { row.forEach(function (el, i) { return sum[i] = (sum[i] || 0) + el.offsetHeight; }); return sum; }, [])); } // IE 11 fix (min-height on a flex container won't apply to its flex items) var FlexBug = isIE ? { data: { selMinHeight: false, forceHeight: false }, computed: { elements: function(ref, $el) { var selMinHeight = ref.selMinHeight; return selMinHeight ? $$(selMinHeight, $el) : [$el]; } }, update: [ { read: function() { css(this.elements, 'height', ''); }, order: -5, events: ['load', 'resize'] }, { write: function() { var this$1 = this; this.elements.forEach(function (el) { var height$$1 = toFloat(css(el, 'minHeight')); if (height$$1 && (this$1.forceHeight || Math.round(height$$1) >= height(el))) { css(el, 'height', height$$1); } }); }, order: 5, events: ['load', 'resize'] } ] } : {}; var HeightMatch = { mixins: [FlexBug], args: 'target', props: { target: String, row: Boolean }, data: { target: '> *', row: true, forceHeight: true }, computed: { elements: function(ref, $el) { var target = ref.target; return $$(target, $el); } }, update: { read: function() { return { rows: (this.row ? getRows(this.elements) : [this.elements]).map(match) }; }, write: function(ref) { var rows = ref.rows; rows.forEach(function (ref) { var heights = ref.heights; var elements = ref.elements; return elements.forEach(function (el, i) { return css(el, 'minHeight', heights[i]); } ); } ); }, events: ['load', 'resize'] } }; function match(elements) { var assign$$1; if (elements.length < 2) { return {heights: [''], elements: elements}; } var ref = getHeights(elements); var heights = ref.heights; var max = ref.max; var hasMinHeight = elements.some(function (el) { return el.style.minHeight; }); var hasShrunk = elements.some(function (el, i) { return !el.style.minHeight && heights[i] < max; }); if (hasMinHeight && hasShrunk) { css(elements, 'minHeight', ''); ((assign$$1 = getHeights(elements), heights = assign$$1.heights, max = assign$$1.max)); } heights = elements.map(function (el, i) { return heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max; } ); return {heights: heights, elements: elements}; } function getHeights(elements) { var heights = elements.map(function (el) { return offset(el).height - boxModelAdjust('height', el, 'content-box'); }); var max = Math.max.apply(null, heights); return {heights: heights, max: max}; } var HeightViewport = { mixins: [FlexBug], props: { expand: Boolean, offsetTop: Boolean, offsetBottom: Boolean, minHeight: Number }, data: { expand: false, offsetTop: false, offsetBottom: false, minHeight: 0 }, update: { read: function() { var minHeight = ''; var box = boxModelAdjust('height', this.$el, 'content-box'); if (this.expand) { minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) - box || ''; } else { // on mobile devices (iOS and Android) window.innerHeight !== 100vh minHeight = 'calc(100vh'; if (this.offsetTop) { var ref = offset(this.$el); var top = ref.top; minHeight += top < height(window) / 2 ? (" - " + top + "px") : ''; } if (this.offsetBottom === true) { minHeight += " - " + (offsetHeight(this.$el.nextElementSibling)) + "px"; } else if (isNumeric(this.offsetBottom)) { minHeight += " - " + (this.offsetBottom) + "vh"; } else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) { minHeight += " - " + (toFloat(this.offsetBottom)) + "px"; } else if (isString(this.offsetBottom)) { minHeight += " - " + (offsetHeight(query(this.offsetBottom, this.$el))) + "px"; } minHeight += (box ? (" - " + box + "px") : '') + ")"; } return {minHeight: minHeight}; }, write: function(ref) { var minHeight = ref.minHeight; css(this.$el, {minHeight: minHeight}); if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) { css(this.$el, 'minHeight', this.minHeight); } }, events: ['load', 'resize'] } }; function offsetHeight(el) { return el && el.offsetHeight || 0; } var svgs = {}; var SVG = { args: 'src', props: { id: String, icon: String, src: String, style: String, width: Number, height: Number, ratio: Number, 'class': String }, data: { ratio: 1, id: false, exclude: ['ratio', 'src', 'icon'], 'class': '' }, connected: function() { var this$1 = this; var assign$$1; this.class += ' uk-svg'; if (!this.icon && includes(this.src, '#')) { var parts = this.src.split('#'); if (parts.length > 1) { (assign$$1 = parts, this.src = assign$$1[0], this.icon = assign$$1[1]); } } this.svg = this.getSvg().then(function (svg) { var el; if (isString(svg)) { if (this$1.icon && includes(svg, '/g; var symbols = {}; function parseSymbols(svg, icon) { if (!symbols[svg]) { symbols[svg] = {}; var match; while ((match = symbolRe.exec(svg))) { symbols[svg][match[3]] = ""; } symbolRe.lastIndex = 0; } return symbols[svg][icon]; } var closeIcon = ""; var closeLarge = ""; var marker = ""; var navbarToggleIcon = ""; var overlayIcon = ""; var paginationNext = ""; var paginationPrevious = ""; var searchIcon = ""; var searchLarge = ""; var searchNavbar = ""; var slidenavNext = ""; var slidenavNextLarge = ""; var slidenavPrevious = ""; var slidenavPreviousLarge = ""; var spinner = ""; var totop = ""; var parsed = {}; var icons = { spinner: spinner, totop: totop, marker: marker, 'close-icon': closeIcon, 'close-large': closeLarge, 'navbar-toggle-icon': navbarToggleIcon, 'overlay-icon': overlayIcon, 'pagination-next': paginationNext, 'pagination-previous': paginationPrevious, 'search-icon': searchIcon, 'search-large': searchLarge, 'search-navbar': searchNavbar, 'slidenav-next': slidenavNext, 'slidenav-next-large': slidenavNextLarge, 'slidenav-previous': slidenavPrevious, 'slidenav-previous-large': slidenavPreviousLarge }; var Icon = { install: install, attrs: ['icon', 'ratio'], mixins: [Class, SVG], args: 'icon', props: ['icon'], data: {exclude: ['id', 'style', 'class', 'src', 'icon', 'ratio']}, isIcon: true, connected: function() { addClass(this.$el, 'uk-icon'); }, methods: { getSvg: function() { var icon = getIcon(applyRtl(this.icon)); if (!icon) { return Promise.reject('Icon not found.'); } return Promise.resolve(icon); } } }; var IconComponent = { extends: Icon, data: function (vm) { return ({ icon: hyphenate(vm.constructor.options.name) }); } }; var Slidenav = { extends: IconComponent, connected: function() { addClass(this.$el, 'uk-slidenav'); }, computed: { icon: function(ref, $el) { var icon = ref.icon; return hasClass($el, 'uk-slidenav-large') ? (icon + "-large") : icon; } } }; var Search = { extends: IconComponent, computed: { icon: function(ref, $el) { var icon = ref.icon; return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length ? 'search-large' : parents($el, '.uk-search-navbar').length ? 'search-navbar' : icon; } } }; var Close = { extends: IconComponent, computed: { icon: function() { return ("close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon')); } } }; var Spinner = { extends: IconComponent, connected: function() { var this$1 = this; this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this$1.ratio); }, noop); } }; function install(UIkit) { UIkit.icon.add = function (name, svg) { var obj; var added = isString(name) ? (( obj = {}, obj[name] = svg, obj )) : name; each(added, function (svg, name) { icons[name] = svg; delete parsed[name]; }); if (UIkit._initialized) { apply(document.body, function (el) { return each(UIkit.getComponents(el), function (cmp) { return cmp.$options.isIcon && cmp.icon in added && cmp.$reset(); } ); } ); } }; } function getIcon(icon) { if (!icons[icon]) { return null; } if (!parsed[icon]) { parsed[icon] = $(icons[icon].trim()); } return parsed[icon]; } function applyRtl(icon) { return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon; } var Img = { props: { dataSrc: String, dataSrcset: Boolean, sizes: String, width: Number, height: Number, offsetTop: String, offsetLeft: String, target: String }, data: { dataSrc: '', dataSrcset: false, sizes: false, width: false, height: false, offsetTop: '50vh', offsetLeft: 0, target: false }, computed: { cacheKey: function(ref) { var dataSrc = ref.dataSrc; return ((this.$name) + "." + dataSrc); }, width: function(ref) { var width$$1 = ref.width; var dataWidth = ref.dataWidth; return width$$1 || dataWidth; }, height: function(ref) { var height$$1 = ref.height; var dataHeight = ref.dataHeight; return height$$1 || dataHeight; }, sizes: function(ref) { var sizes = ref.sizes; var dataSizes = ref.dataSizes; return sizes || dataSizes; }, isImg: function(_, $el) { return isImg($el); }, target: function(ref) { var target = ref.target; return [this.$el].concat(queryAll(target, this.$el)); }, offsetTop: function(ref) { var offsetTop = ref.offsetTop; return toPx(offsetTop, 'height'); }, offsetLeft: function(ref) { var offsetLeft = ref.offsetLeft; return toPx(offsetLeft, 'width'); } }, connected: function() { if (storage[this.cacheKey]) { setSrcAttrs(this.$el, storage[this.cacheKey] || this.dataSrc, this.dataSrcset, this.sizes); } else if (this.isImg && this.width && this.height) { setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes)); } }, update: { read: function(ref) { var this$1 = this; var update = ref.update; var image = ref.image; if (!update) { return; } if (image || !this.target.some(function (el) { return isInView(el, this$1.offsetTop, this$1.offsetLeft, true); })) { if (!this.isImg && image) { image.then(function (img) { return img && setSrcAttrs(this$1.$el, currentSrc(img)); }); } return; } return { image: getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) { setSrcAttrs(this$1.$el, currentSrc(img), img.srcset, img.sizes); storage[this$1.cacheKey] = currentSrc(img); return img; }, noop) }; }, write: function(data$$1) { // Give placeholder images time to apply their dimensions if (!data$$1.update) { this.$emit(); return data$$1.update = true; } }, events: ['scroll', 'load', 'resize'] } }; function setSrcAttrs(el, src, srcset, sizes) { if (isImg(el)) { sizes && (el.sizes = sizes); srcset && (el.srcset = srcset); src && (el.src = src); } else if (src) { var change = !includes(el.style.backgroundImage, src); if (change) { css(el, 'backgroundImage', ("url(" + src + ")")); trigger(el, createEvent('load', false)); } } } var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g; function getPlaceholderImage(width$$1, height$$1, sizes) { var assign$$1; if (sizes) { var matches$$1; while ((matches$$1 = sizesRe.exec(sizes))) { if (!matches$$1[1] || window.matchMedia(matches$$1[1]).matches) { matches$$1 = evaluateSize(matches$$1[2]); break; } } sizesRe.lastIndex = 0; ((assign$$1 = Dimensions.ratio({width: width$$1, height: height$$1}, 'width', toPx(matches$$1 || '100vw')), width$$1 = assign$$1.width, height$$1 = assign$$1.height)); } return ("data:image/svg+xml;utf8,"); } var sizeRe = /\d+(?:\w+|%)/g; var additionRe = /[+-]?(\d+)/g; function evaluateSize(size) { return startsWith(size, 'calc') ? size .substring(5, size.length - 1) .replace(sizeRe, function (size) { return toPx(size); }) .replace(/ /g, '') .match(additionRe) .reduce(function (a, b) { return a + +b; }, 0) : size; } function toPx(value, property, element) { if ( property === void 0 ) property = 'width'; if ( element === void 0 ) element = window; return isNumeric(value) ? +value : endsWith(value, 'vw') ? percent(element, 'width', value) : endsWith(value, 'vh') ? percent(element, 'height', value) : endsWith(value, '%') ? percent(element, property, value) : toFloat(value); } var dimensions = {height: height, width: width}; function percent(element, property, value) { return dimensions[property](element) * toFloat(value) / 100; } function isImg(el) { return el.tagName === 'IMG'; } function currentSrc(el) { return el.currentSrc || el.src; } var key = '__test__'; var storage; // workaround for Safari's private browsing mode and accessing sessionStorage in Blink try { storage = window.sessionStorage || {}; storage[key] = 1; delete storage[key]; } catch (e) { storage = {}; } var Media = { props: { media: Boolean }, data: { media: false }, computed: { matchMedia: function() { var media = toMedia(this.media); return !media || window.matchMedia(media).matches; } } }; function toMedia(value) { if (isString(value)) { if (value[0] === '@') { var name = "breakpoint-" + (value.substr(1)); value = toFloat(getCssVar(name)); } else if (isNaN(value)) { return value; } } return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false; } var Leader = { mixins: [Class, Media], props: { fill: String }, data: { fill: '', clsWrapper: 'uk-leader-fill', clsHide: 'uk-leader-hide', attrFill: 'data-fill' }, computed: { fill: function(ref) { var fill = ref.fill; return fill || getCssVar('leader-fill-content'); } }, connected: function() { var assign$$1; (assign$$1 = wrapInner(this.$el, ("")), this.wrapper = assign$$1[0]); }, disconnected: function() { unwrap(this.wrapper.childNodes); }, update: { read: function(ref) { var changed = ref.changed; var width$$1 = ref.width; var prev = width$$1; width$$1 = Math.floor(this.$el.offsetWidth / 2); return { width: width$$1, changed: changed || prev !== width$$1, hide: !this.matchMedia }; }, write: function(data$$1) { toggleClass(this.wrapper, this.clsHide, data$$1.hide); if (data$$1.changed) { data$$1.changed = false; attr(this.wrapper, this.attrFill, new Array(data$$1.width).join(this.fill)); } }, events: ['load', 'resize'] } }; var Container = { props: { container: Boolean }, data: { container: true }, computed: { container: function(ref) { var container = ref.container; return container === true && this.$container || container && $(container); } } }; var active$1; var Modal = { mixins: [Class, Container, Togglable], props: { selPanel: String, selClose: String, escClose: Boolean, bgClose: Boolean, stack: Boolean }, data: { cls: 'uk-open', escClose: true, bgClose: true, overlay: true, stack: false }, computed: { panel: function(ref, $el) { var selPanel = ref.selPanel; return $(selPanel, $el); }, transitionElement: function() { return this.panel; }, bgClose: function(ref) { var bgClose = ref.bgClose; return bgClose && this.panel; } }, beforeDisconnect: function() { if (this.isToggled()) { this.toggleNow(this.$el, false); } }, events: [ { name: 'click', delegate: function() { return this.selClose; }, handler: function(e) { e.preventDefault(); this.hide(); } }, { name: 'toggle', self: true, handler: function(e) { if (e.defaultPrevented) { return; } e.preventDefault(); this.toggle(); } }, { name: 'beforeshow', self: true, handler: function(e) { var prev = active$1 && active$1 !== this && active$1; active$1 = this; if (prev) { if (this.stack) { this.prev = prev; } else { active$1 = prev; if (prev.isToggled()) { prev.hide().then(this.show); } else { once(prev.$el, 'beforeshow hidden', this.show, false, function (ref) { var target = ref.target; var type = ref.type; return type === 'hidden' && target === prev.$el; }); } e.preventDefault(); } return; } registerEvents(); } }, { name: 'show', self: true, handler: function() { if (!hasClass(document.documentElement, this.clsPage)) { this.scrollbarWidth = width(window) - width(document); css(document.body, 'overflowY', this.scrollbarWidth && this.overlay ? 'scroll' : ''); } addClass(document.documentElement, this.clsPage); } }, { name: 'hide', self: true, handler: function() { if (!active$1 || active$1 === this && !this.prev) { deregisterEvents(); } } }, { name: 'hidden', self: true, handler: function() { var found; var ref = this; var prev = ref.prev; active$1 = active$1 && active$1 !== this && active$1 || prev; if (!active$1) { css(document.body, 'overflowY', ''); } else { while (prev) { if (prev.clsPage === this.clsPage) { found = true; break; } prev = prev.prev; } } if (!found) { removeClass(document.documentElement, this.clsPage); } } } ], methods: { toggle: function() { return this.isToggled() ? this.hide() : this.show(); }, show: function() { var this$1 = this; if (this.isToggled()) { return Promise.resolve(); } if (this.container && this.$el.parentNode !== this.container) { append(this.container, this.$el); return new Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); } ); } ); } return this.toggleElement(this.$el, true, animate$1(this)); }, hide: function() { return this.isToggled() ? this.toggleElement(this.$el, false, animate$1(this)) : Promise.resolve(); }, getActive: function() { return active$1; } } }; var events; function registerEvents() { if (events) { return; } events = [ on(document, 'click', function (ref) { var target = ref.target; var defaultPrevented = ref.defaultPrevented; if (active$1 && active$1.bgClose && !defaultPrevented && (!active$1.overlay || within(target, active$1.$el)) && !within(target, active$1.panel)) { active$1.hide(); } }), on(document, 'keydown', function (e) { if (e.keyCode === 27 && active$1 && active$1.escClose) { e.preventDefault(); active$1.hide(); } }) ]; } function deregisterEvents() { events && events.forEach(function (unbind) { return unbind(); }); events = null; } function animate$1(ref) { var transitionElement = ref.transitionElement; var _toggle = ref._toggle; return function (el, show) { return new Promise(function (resolve, reject) { return once(el, 'show hide', function () { el._reject && el._reject(); el._reject = reject; _toggle(el, show); if (toMs(css(transitionElement, 'transitionDuration'))) { once(transitionElement, 'transitionend', resolve, false, function (e) { return e.target === transitionElement; }); } else { resolve(); } }); } ); }; } var Modal$1 = { install: install$1, mixins: [Modal], data: { clsPage: 'uk-modal-page', selPanel: '.uk-modal-dialog', selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full' }, events: [ { name: 'show', self: true, handler: function() { if (hasClass(this.panel, 'uk-margin-auto-vertical')) { addClass(this.$el, 'uk-flex'); } else { css(this.$el, 'display', 'block'); } height(this.$el); // force reflow } }, { name: 'hidden', self: true, handler: function() { css(this.$el, 'display', ''); removeClass(this.$el, 'uk-flex'); } } ] }; function install$1 (UIkit) { UIkit.modal.dialog = function (content, options) { var dialog = UIkit.modal(("
" + content + "
"), options); dialog.show(); on(dialog.$el, 'hidden', function (ref) { var target = ref.target; var currentTarget = ref.currentTarget; if (target === currentTarget) { Promise.resolve(function () { return dialog.$destroy(true); }); } }); return dialog; }; UIkit.modal.alert = function (message, options) { options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options); return new Promise( function (resolve) { return on(UIkit.modal.dialog(("
" + (isString(message) ? message : html(message)) + "
"), options).$el, 'hide', resolve); } ); }; UIkit.modal.confirm = function (message, options) { options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options); return new Promise(function (resolve, reject) { var confirm = UIkit.modal.dialog(("
" + (isString(message) ? message : html(message)) + "
"), options); var resolved = false; on(confirm.$el, 'submit', 'form', function (e) { e.preventDefault(); resolve(); resolved = true; confirm.hide(); }); on(confirm.$el, 'hide', function () { if (!resolved) { reject(); } }); }); }; UIkit.modal.prompt = function (message, value, options) { options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options); return new Promise(function (resolve) { var prompt = UIkit.modal.dialog(("
"), options), input = $('input', prompt.$el); input.value = value; var resolved = false; on(prompt.$el, 'submit', 'form', function (e) { e.preventDefault(); resolve(input.value); resolved = true; prompt.hide(); }); on(prompt.$el, 'hide', function () { if (!resolved) { resolve(null); } }); }); }; UIkit.modal.labels = { ok: 'Ok', cancel: 'Cancel' }; } var Nav = { extends: Accordion, data: { targets: '> .uk-parent', toggle: '> a', content: '> ul' } }; var Navbar = { mixins: [Class, FlexBug], props: { dropdown: String, mode: 'list', align: String, offset: Number, boundary: Boolean, boundaryAlign: Boolean, clsDrop: String, delayShow: Number, delayHide: Number, dropbar: Boolean, dropbarMode: String, dropbarAnchor: Boolean, duration: Number }, data: { dropdown: '.uk-navbar-nav > li', align: !isRtl ? 'left' : 'right', clsDrop: 'uk-navbar-dropdown', mode: undefined, offset: undefined, delayShow: undefined, delayHide: undefined, boundaryAlign: undefined, flip: 'x', boundary: true, dropbar: false, dropbarMode: 'slide', dropbarAnchor: false, duration: 200, forceHeight: true, selMinHeight: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle' }, computed: { boundary: function(ref, $el) { var boundary = ref.boundary; var boundaryAlign = ref.boundaryAlign; return (boundary === true || boundaryAlign) ? $el : boundary; }, dropbarAnchor: function(ref, $el) { var dropbarAnchor = ref.dropbarAnchor; return query(dropbarAnchor, $el); }, pos: function(ref) { var align = ref.align; return ("bottom-" + align); }, dropdowns: function(ref, $el) { var dropdown = ref.dropdown; var clsDrop = ref.clsDrop; return $$((dropdown + " ." + clsDrop), $el); } }, beforeConnect: function() { var ref = this.$props; var dropbar = ref.dropbar; this.dropbar = dropbar && (query(dropbar, this.$el) || $('+ .uk-navbar-dropbar', this.$el) || $('
')); if (this.dropbar) { addClass(this.dropbar, 'uk-navbar-dropbar'); if (this.dropbarMode === 'slide') { addClass(this.dropbar, 'uk-navbar-dropbar-slide'); } } }, disconnected: function() { this.dropbar && remove(this.dropbar); }, update: function() { var this$1 = this; this.$create( 'drop', this.dropdowns.filter(function (el) { return !this$1.getDropdown(el); }), assign({}, this.$props, {boundary: this.boundary, pos: this.pos, offset: this.dropbar || this.offset}) ); }, events: [ { name: 'mouseover', delegate: function() { return this.dropdown; }, handler: function(ref) { var current = ref.current; var active = this.getActive(); if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) { active.hide(false); } } }, { name: 'mouseleave', el: function() { return this.dropbar; }, handler: function() { var active = this.getActive(); if (active && !matches(this.dropbar, ':hover')) { active.hide(); } } }, { name: 'beforeshow', capture: true, filter: function() { return this.dropbar; }, handler: function() { if (!this.dropbar.parentNode) { after(this.dropbarAnchor || this.$el, this.dropbar); } } }, { name: 'show', capture: true, filter: function() { return this.dropbar; }, handler: function(_, drop) { var $el = drop.$el; var dir = drop.dir; this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar")); if (dir === 'bottom') { this.transitionTo($el.offsetHeight + toFloat(css($el, 'marginTop')) + toFloat(css($el, 'marginBottom')), $el); } } }, { name: 'beforehide', filter: function() { return this.dropbar; }, handler: function(e, ref) { var $el = ref.$el; var active = this.getActive(); if (matches(this.dropbar, ':hover') && active && active.$el === $el) { e.preventDefault(); } } }, { name: 'hide', filter: function() { return this.dropbar; }, handler: function(_, ref) { var $el = ref.$el; var active = this.getActive(); if (!active || active && active.$el === $el) { this.transitionTo(0); } } } ], methods: { getActive: function() { var ref = this.dropdowns.map(this.getDropdown).filter(function (drop) { return drop && drop.isActive(); }); var active = ref[0]; return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active; }, transitionTo: function(newHeight, el) { var this$1 = this; var ref = this; var dropbar = ref.dropbar; var oldHeight = isVisible(dropbar) ? height(dropbar) : 0; el = oldHeight < newHeight && el; css(el, 'clip', ("rect(0," + (el.offsetWidth) + "px," + oldHeight + "px,0)")); height(dropbar, oldHeight); Transition.cancel([el, dropbar]); return Promise.all([ Transition.start(dropbar, {height: newHeight}, this.duration), Transition.start(el, {clip: ("rect(0," + (el.offsetWidth) + "px," + newHeight + "px,0)")}, this.duration) ]) .catch(noop) .then(function () { css(el, {clip: ''}); this$1.$update(dropbar); }); }, getDropdown: function(el) { return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown'); } } }; var Offcanvas = { mixins: [Modal], args: 'mode', props: { mode: String, flip: Boolean, overlay: Boolean }, data: { mode: 'slide', flip: false, overlay: false, clsPage: 'uk-offcanvas-page', clsContainer: 'uk-offcanvas-container', selPanel: '.uk-offcanvas-bar', clsFlip: 'uk-offcanvas-flip', clsContainerAnimation: 'uk-offcanvas-container-animation', clsSidebarAnimation: 'uk-offcanvas-bar-animation', clsMode: 'uk-offcanvas', clsOverlay: 'uk-offcanvas-overlay', selClose: '.uk-offcanvas-close' }, computed: { clsFlip: function(ref) { var flip = ref.flip; var clsFlip = ref.clsFlip; return flip ? clsFlip : ''; }, clsOverlay: function(ref) { var overlay = ref.overlay; var clsOverlay = ref.clsOverlay; return overlay ? clsOverlay : ''; }, clsMode: function(ref) { var mode = ref.mode; var clsMode = ref.clsMode; return (clsMode + "-" + mode); }, clsSidebarAnimation: function(ref) { var mode = ref.mode; var clsSidebarAnimation = ref.clsSidebarAnimation; return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation; }, clsContainerAnimation: function(ref) { var mode = ref.mode; var clsContainerAnimation = ref.clsContainerAnimation; return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation; }, transitionElement: function(ref) { var mode = ref.mode; return mode === 'reveal' ? this.panel.parentNode : this.panel; } }, events: [ { name: 'click', delegate: function() { return 'a[href^="#"]'; }, handler: function(ref) { var current = ref.current; if (current.hash && $(current.hash, document.body)) { this.hide(); } } }, { name: 'touchstart', el: function() { return this.panel; }, handler: function(ref) { var targetTouches = ref.targetTouches; if (targetTouches.length === 1) { this.clientY = targetTouches[0].clientY; } } }, { name: 'touchmove', self: true, passive: false, filter: function() { return this.overlay; }, handler: function(e) { e.preventDefault(); } }, { name: 'touchmove', passive: false, el: function() { return this.panel; }, handler: function(e) { if (e.targetTouches.length !== 1) { return; } var clientY = event.targetTouches[0].clientY - this.clientY; var ref = this.panel; var scrollTop$$1 = ref.scrollTop; var scrollHeight = ref.scrollHeight; var clientHeight = ref.clientHeight; if (scrollTop$$1 === 0 && clientY > 0 || scrollHeight - scrollTop$$1 <= clientHeight && clientY < 0 ) { e.preventDefault(); } } }, { name: 'show', self: true, handler: function() { if (this.mode === 'reveal' && !hasClass(this.panel.parentNode, this.clsMode)) { wrapAll(this.panel, '
'); addClass(this.panel.parentNode, this.clsMode); } css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : ''); addClass(document.body, this.clsContainer, this.clsFlip); height(document.body); // force reflow addClass(document.body, this.clsContainerAnimation); addClass(this.panel, this.clsSidebarAnimation, this.mode !== 'reveal' ? this.clsMode : ''); addClass(this.$el, this.clsOverlay); css(this.$el, 'display', 'block'); height(this.$el); // force reflow this.clsContainerAnimation && suppressUserScale(); } }, { name: 'hide', self: true, handler: function() { removeClass(document.body, this.clsContainerAnimation); var active = this.getActive(); if (this.mode === 'none' || active && active !== this && active !== this.prev) { trigger(this.panel, 'transitionend'); } } }, { name: 'hidden', self: true, handler: function() { this.clsContainerAnimation && resumeUserScale(); if (this.mode === 'reveal') { unwrap(this.panel); } removeClass(this.panel, this.clsSidebarAnimation, this.clsMode); removeClass(this.$el, this.clsOverlay); css(this.$el, 'display', ''); removeClass(document.body, this.clsContainer, this.clsFlip); css(document.documentElement, 'overflowY', ''); } }, { name: 'swipeLeft swipeRight', handler: function(e) { if (this.isToggled() && isTouch(e) && e.type === 'swipeLeft' ^ this.flip) { this.hide(); } } } ] }; // Chrome in responsive mode zooms page upon opening offcanvas function suppressUserScale() { getViewport().content += ',user-scalable=0'; } function resumeUserScale() { var viewport = getViewport(); viewport.content = viewport.content.replace(/,user-scalable=0$/, ''); } function getViewport() { return $('meta[name="viewport"]', document.head) || append(document.head, ''); } var OverflowAuto = { mixins: [Class], props: { selContainer: String, selContent: String, }, data: { selContainer: '.uk-modal', selContent: '.uk-modal-dialog', }, computed: { container: function(ref, $el) { var selContainer = ref.selContainer; return closest($el, selContainer); }, content: function(ref, $el) { var selContent = ref.selContent; return closest($el, selContent); } }, connected: function() { css(this.$el, 'minHeight', 150); }, update: { read: function() { if (!this.content || !this.container) { return false; } return { current: toFloat(css(this.$el, 'maxHeight')), max: Math.max(150, height(this.container) - (offset(this.content).height - height(this.$el))) }; }, write: function(ref) { var current = ref.current; var max = ref.max; css(this.$el, 'maxHeight', max); if (Math.round(current) !== Math.round(max)) { trigger(this.$el, 'resize'); } }, events: ['load', 'resize'] } }; var Responsive = { props: ['width', 'height'], connected: function() { addClass(this.$el, 'uk-responsive-width'); }, update: { read: function() { return isVisible(this.$el) && this.width && this.height ? {width: width(this.$el.parentNode), height: this.height} : false; }, write: function(dim) { height(this.$el, Dimensions.contain({ height: this.height, width: this.width }, dim).height); }, events: ['load', 'resize'] } }; var Scroll = { props: { duration: Number, offset: Number }, data: { duration: 1000, offset: 0 }, methods: { scrollTo: function(el) { var this$1 = this; el = el && $(el) || document.body; var docHeight = height(document); var winHeight = height(window); var target = offset(el).top - this.offset; if (target + winHeight > docHeight) { target = docHeight - winHeight; } if (!trigger(this.$el, 'beforescroll', [this, el])) { return; } var start = Date.now(); var startY = window.pageYOffset; var step = function () { var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration)); scrollTop(window, currentY); // scroll more if we have not reached our destination if (currentY !== target) { requestAnimationFrame(step); } else { trigger(this$1.$el, 'scrolled', [this$1, el]); } }; step(); } }, events: { click: function(e) { if (e.defaultPrevented) { return; } e.preventDefault(); this.scrollTo(escape(decodeURIComponent(this.$el.hash)).substr(1)); } } }; function ease(k) { return 0.5 * (1 - Math.cos(Math.PI * k)); } var Scrollspy = { args: 'cls', props: { cls: 'list', target: String, hidden: Boolean, offsetTop: Number, offsetLeft: Number, repeat: Boolean, delay: Number }, data: function () { return ({ cls: [], target: false, hidden: true, offsetTop: 0, offsetLeft: 0, repeat: false, delay: 0, inViewClass: 'uk-scrollspy-inview' }); }, computed: { elements: function(ref, $el) { var target = ref.target; return target ? $$(target, $el) : [$el]; } }, update: [ { write: function() { if (this.hidden) { css(filter(this.elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden'); } } }, { read: function(els) { var this$1 = this; if (!els.update) { return; } this.elements.forEach(function (el, i) { var elData = els[i]; if (!elData || elData.el !== el) { var cls = data(el, 'uk-scrollspy-class'); elData = {el: el, toggles: cls && cls.split(',') || this$1.cls}; } elData.show = isInView(el, this$1.offsetTop, this$1.offsetLeft); els[i] = elData; }); }, write: function(els) { var this$1 = this; // Let child components be applied at least once first if (!els.update) { this.$emit(); return els.update = true; } this.elements.forEach(function (el, i) { var elData = els[i]; var cls = elData.toggles[i] || elData.toggles[0]; if (elData.show && !elData.inview && !elData.queued) { var show = function () { css(el, 'visibility', ''); addClass(el, this$1.inViewClass); toggleClass(el, cls); trigger(el, 'inview'); this$1.$update(el); elData.inview = true; elData.abort && elData.abort(); }; if (this$1.delay) { elData.queued = true; els.promise = (els.promise || Promise.resolve()).then(function () { return !elData.inview && new Promise(function (resolve) { var timer = setTimeout(function () { show(); resolve(); }, els.promise || this$1.elements.length === 1 ? this$1.delay : 0); elData.abort = function () { clearTimeout(timer); resolve(); elData.queued = false; }; }); }); } else { show(); } } else if (!elData.show && (elData.inview || elData.queued) && this$1.repeat) { elData.abort && elData.abort(); if (!elData.inview) { return; } css(el, 'visibility', this$1.hidden ? 'hidden' : ''); removeClass(el, this$1.inViewClass); toggleClass(el, cls); trigger(el, 'outview'); this$1.$update(el); elData.inview = false; } }); }, events: ['scroll', 'load', 'resize'] } ] }; var ScrollspyNav = { props: { cls: String, closest: String, scroll: Boolean, overflow: Boolean, offset: Number }, data: { cls: 'uk-active', closest: false, scroll: false, overflow: true, offset: 0 }, computed: { links: function(_, $el) { return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; }); }, elements: function() { return this.closest ? closest(this.links, this.closest) : this.links; }, targets: function() { return $$(this.links.map(function (el) { return el.hash; }).join(',')); } }, update: [ { read: function() { if (this.scroll) { this.$create('scroll', this.links, {offset: this.offset || 0}); } } }, { read: function(data$$1) { var this$1 = this; var scroll = window.pageYOffset + this.offset + 1; var max = height(document) - height(window) + this.offset; data$$1.active = false; this.targets.every(function (el, i) { var ref = offset(el); var top = ref.top; var last = i + 1 === this$1.targets.length; if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) { return false; } if (!last && offset(this$1.targets[i + 1]).top <= scroll) { return true; } if (scroll >= max) { for (var j = this$1.targets.length - 1; j > i; j--) { if (isInView(this$1.targets[j])) { el = this$1.targets[j]; break; } } } return !(data$$1.active = $(filter(this$1.links, ("[href=\"#" + (el.id) + "\"]")))); }); }, write: function(ref) { var active = ref.active; this.links.forEach(function (el) { return el.blur(); }); removeClass(this.elements, this.cls); if (active) { trigger(this.$el, 'active', [active, addClass(this.closest ? closest(active, this.closest) : active, this.cls)]); } }, events: ['scroll', 'load', 'resize'] } ] }; var Sticky = { mixins: [Class, Media], props: { top: null, bottom: Boolean, offset: Number, animation: String, clsActive: String, clsInactive: String, clsFixed: String, clsBelow: String, selTarget: String, widthElement: Boolean, showOnUp: Boolean, targetOffset: Number }, data: { top: 0, bottom: false, offset: 0, animation: '', clsActive: 'uk-active', clsInactive: '', clsFixed: 'uk-sticky-fixed', clsBelow: 'uk-sticky-below', selTarget: '', widthElement: false, showOnUp: false, targetOffset: false }, computed: { selTarget: function(ref, $el) { var selTarget = ref.selTarget; return selTarget && $(selTarget, $el) || $el; }, widthElement: function(ref, $el) { var widthElement = ref.widthElement; return query(widthElement, $el) || this.placeholder; }, isActive: { get: function() { return hasClass(this.selTarget, this.clsActive); }, set: function(value) { if (value && !this.isActive) { replaceClass(this.selTarget, this.clsInactive, this.clsActive); trigger(this.$el, 'active'); } else if (!value && !hasClass(this.selTarget, this.clsInactive)) { replaceClass(this.selTarget, this.clsActive, this.clsInactive); trigger(this.$el, 'inactive'); } } }, }, connected: function() { this.placeholder = $('+ .uk-sticky-placeholder', this.$el) || $('
'); this.isFixed = false; this.isActive = false; }, disconnected: function() { if (this.isFixed) { this.hide(); removeClass(this.selTarget, this.clsInactive); } remove(this.placeholder); this.placeholder = null; this.widthElement = null; }, events: [ { name: 'load hashchange popstate', el: window, handler: function() { var this$1 = this; if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) { return; } var target = $(location.hash); if (target) { fastdom.read(function () { var ref = offset(target); var top = ref.top; var elTop = offset(this$1.$el).top; var elHeight = this$1.$el.offsetHeight; if (this$1.isFixed && elTop + elHeight >= top && elTop <= top + target.offsetHeight) { scrollTop(window, top - elHeight - (isNumeric(this$1.targetOffset) ? this$1.targetOffset : 0) - this$1.offset); } }); } } } ], update: [ { read: function(ref, ref$1) { var height$$1 = ref.height; var type = ref$1.type; if (this.isActive && type !== 'update') { this.hide(); height$$1 = this.$el.offsetHeight; this.show(); } height$$1 = !this.isActive ? this.$el.offsetHeight : height$$1; this.topOffset = offset(this.isFixed ? this.placeholder : this.$el).top; this.bottomOffset = this.topOffset + height$$1; var bottom = parseProp('bottom', this); this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset; this.bottom = bottom && bottom - height$$1; this.inactive = !this.matchMedia; return { lastScroll: false, height: height$$1, margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight']) }; }, write: function(ref) { var height$$1 = ref.height; var margins = ref.margins; var ref$1 = this; var placeholder = ref$1.placeholder; css(placeholder, assign({height: height$$1}, margins)); if (!within(placeholder, document)) { after(this.$el, placeholder); attr(placeholder, 'hidden', ''); } // ensure active/inactive classes are applied this.isActive = this.isActive; }, events: ['load', 'resize'] }, { read: function(_, ref) { var scrollY = ref.scrollY; if ( scrollY === void 0 ) scrollY = window.pageYOffset; this.width = (isVisible(this.widthElement) ? this.widthElement : this.$el).offsetWidth; return { scroll: this.scroll = scrollY, visible: isVisible(this.$el), top: offsetPosition(this.placeholder)[0] }; }, write: function(data$$1, ref) { var this$1 = this; if ( ref === void 0 ) ref = {}; var dir = ref.dir; var initTimestamp = data$$1.initTimestamp; if ( initTimestamp === void 0 ) initTimestamp = 0; var lastDir = data$$1.lastDir; var lastScroll = data$$1.lastScroll; var scroll = data$$1.scroll; var top = data$$1.top; var visible = data$$1.visible; var now = performance.now(); data$$1.lastScroll = scroll; if (scroll < 0 || scroll === lastScroll || !visible || this.disabled || this.showOnUp && !dir) { return; } if (now - initTimestamp > 300 || dir !== lastDir) { data$$1.initScroll = scroll; data$$1.initTimestamp = now; } data$$1.lastDir = dir; if (this.showOnUp && Math.abs(data$$1.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) { return; } if (this.inactive || scroll < this.top || this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isFixed && scroll <= this.bottomOffset) ) { if (!this.isFixed) { if (Animation.inProgress(this.$el) && top > scroll) { Animation.cancel(this.$el); this.hide(); } return; } this.isFixed = false; if (this.animation && scroll > this.topOffset) { Animation.cancel(this.$el); Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop); } else { this.hide(); } } else if (this.isFixed) { this.update(); } else if (this.animation) { Animation.cancel(this.$el); this.show(); Animation.in(this.$el, this.animation).catch(noop); } else { this.show(); } }, events: ['load', 'resize', 'scroll'] } ], methods: { show: function() { this.isFixed = true; this.update(); attr(this.placeholder, 'hidden', null); }, hide: function() { this.isActive = false; removeClass(this.$el, this.clsFixed, this.clsBelow); css(this.$el, {position: '', top: '', width: ''}); attr(this.placeholder, 'hidden', ''); }, update: function() { var active = this.top !== 0 || this.scroll > this.top; var top = Math.max(0, this.offset); if (this.bottom && this.scroll > this.bottom - this.offset) { top = this.bottom - this.scroll; } css(this.$el, { position: 'fixed', top: (top + "px"), width: this.width }); this.isActive = active; toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset); addClass(this.$el, this.clsFixed); } } }; function parseProp(prop, ref) { var $props = ref.$props; var $el = ref.$el; var propOffset = ref[(prop + "Offset")]; var value = $props[prop]; if (!value) { return; } if (isNumeric(value)) { return propOffset + toFloat(value); } else if (isString(value) && value.match(/^-?\d+vh$/)) { return height(window) * toFloat(value) / 100; } else { var el = value === true ? $el.parentNode : query(value, $el); if (el) { return offset(el).top + el.offsetHeight; } } } var Switcher = { mixins: [Togglable], args: 'connect', props: { connect: String, toggle: String, active: Number, swiping: Boolean }, data: { connect: '~.uk-switcher', toggle: '> *', active: 0, swiping: true, cls: 'uk-active', clsContainer: 'uk-switcher', attrItem: 'uk-switcher-item', queued: true }, computed: { connects: function(ref, $el) { var connect = ref.connect; return queryAll(connect, $el); }, toggles: function(ref, $el) { var toggle = ref.toggle; return $$(toggle, $el); } }, events: [ { name: 'click', delegate: function() { return ((this.toggle) + ":not(.uk-disabled)"); }, handler: function(e) { e.preventDefault(); this.show(e.current); } }, { name: 'click', el: function() { return this.connects; }, delegate: function() { return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"); }, handler: function(e) { e.preventDefault(); this.show(data(e.current, this.attrItem)); } }, { name: 'swipeRight swipeLeft', filter: function() { return this.swiping; }, el: function() { return this.connects; }, handler: function(e) { if (!isTouch(e)) { return; } e.preventDefault(); if (!window.getSelection().toString()) { this.show(e.type === 'swipeLeft' ? 'next' : 'previous'); } } } ], update: function() { var this$1 = this; this.connects.forEach(function (list) { return this$1.updateAria(list.children); }); this.show(filter(this.toggles, ("." + (this.cls)))[0] || this.toggles[this.active] || this.toggles[0]); }, methods: { index: function() { return !!this.connects.length && index(filter(this.connects[0].children, ("." + (this.cls)))[0]); }, show: function(item) { var this$1 = this; var ref = this.toggles; var length = ref.length; var prev = this.index(); var hasPrev = prev >= 0; var dir = item === 'previous' ? -1 : 1; var toggle, next = getIndex(item, this.toggles, prev); for (var i = 0; i < length; i++, next = (next + dir + length) % length) { if (!matches(this.toggles[next], '.uk-disabled, [disabled]')) { toggle = this.toggles[next]; break; } } if (!toggle || prev >= 0 && hasClass(toggle, this.cls) || prev === next) { return; } removeClass(this.toggles, this.cls); attr(this.toggles, 'aria-expanded', false); addClass(toggle, this.cls); attr(toggle, 'aria-expanded', true); this.connects.forEach(function (list) { if (!hasPrev) { this$1.toggleNow(list.children[next]); } else { this$1.toggleElement([list.children[prev], list.children[next]]); } }); } } }; var Tab = { mixins: [Class], extends: Switcher, props: { media: Boolean }, data: { media: 960, attrItem: 'uk-tab-item' }, connected: function() { var cls = hasClass(this.$el, 'uk-tab-left') ? 'uk-tab-left' : hasClass(this.$el, 'uk-tab-right') ? 'uk-tab-right' : false; if (cls) { this.$create('toggle', this.$el, {cls: cls, mode: 'media', media: this.media}); } } }; var Toggle = { mixins: [Media, Togglable], args: 'target', props: { href: String, target: null, mode: 'list', }, data: { href: false, target: false, mode: 'click', queued: true, }, computed: { target: function(ref, $el) { var href = ref.href; var target = ref.target; target = queryAll(target || href, $el); return target.length && target || [$el]; } }, events: [ { name: (pointerEnter + " " + pointerLeave), filter: function() { return includes(this.mode, 'hover'); }, handler: function(e) { if (!isTouch(e)) { this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide'))); } } }, { name: 'click', filter: function() { return includes(this.mode, 'click') || hasTouch && includes(this.mode, 'hover'); }, handler: function(e) { if (!isTouch(e) && !includes(this.mode, 'click')) { return; } // TODO better isToggled handling var link; if (closest(e.target, 'a[href="#"], button') || (link = closest(e.target, 'a[href]')) && ( this.cls || !isVisible(this.target) || link.hash && matches(this.target, link.hash) ) ) { once(document, 'click', function (e) { return e.preventDefault(); }); } this.toggle(); } } ], update: { write: function() { if (!includes(this.mode, 'media') || !this.media) { return; } var toggled = this.isToggled(this.target); if (this.matchMedia ? !toggled : toggled) { this.toggle(); } }, events: ['load', 'resize'] }, methods: { toggle: function(type) { if (trigger(this.target, type || 'toggle', [this])) { this.toggleElement(this.target); } } } }; function core (UIkit) { // core components UIkit.component('accordion', Accordion); UIkit.component('alert', Alert); UIkit.component('cover', Cover); UIkit.component('drop', Drop); UIkit.component('dropdown', Dropdown); UIkit.component('formCustom', FormCustom); UIkit.component('gif', Gif); UIkit.component('grid', Grid); UIkit.component('heightMatch', HeightMatch); UIkit.component('heightViewport', HeightViewport); UIkit.component('icon', Icon); UIkit.component('img', Img); UIkit.component('leader', Leader); UIkit.component('margin', Margin); UIkit.component('modal', Modal$1); UIkit.component('nav', Nav); UIkit.component('navbar', Navbar); UIkit.component('offcanvas', Offcanvas); UIkit.component('overflowAuto', OverflowAuto); UIkit.component('responsive', Responsive); UIkit.component('scroll', Scroll); UIkit.component('scrollspy', Scrollspy); UIkit.component('scrollspyNav', ScrollspyNav); UIkit.component('sticky', Sticky); UIkit.component('svg', SVG); UIkit.component('switcher', Switcher); UIkit.component('tab', Tab); UIkit.component('toggle', Toggle); UIkit.component('video', Video); // Icon components UIkit.component('close', Close); UIkit.component('marker', IconComponent); UIkit.component('navbarToggleIcon', IconComponent); UIkit.component('overlayIcon', IconComponent); UIkit.component('paginationNext', IconComponent); UIkit.component('paginationPrevious', IconComponent); UIkit.component('searchIcon', Search); UIkit.component('slidenavNext', Slidenav); UIkit.component('slidenavPrevious', Slidenav); UIkit.component('spinner', Spinner); UIkit.component('totop', IconComponent); // core functionality UIkit.use(Core); } UIkit.version = '1.0.0'; core(UIkit); var Countdown = { mixins: [Class], props: { date: String, clsWrapper: String }, data: { date: '', clsWrapper: '.uk-countdown-%unit%' }, computed: { date: function(ref) { var date = ref.date; return Date.parse(date); }, days: function(ref, $el) { var clsWrapper = ref.clsWrapper; return $(clsWrapper.replace('%unit%', 'days'), $el); }, hours: function(ref, $el) { var clsWrapper = ref.clsWrapper; return $(clsWrapper.replace('%unit%', 'hours'), $el); }, minutes: function(ref, $el) { var clsWrapper = ref.clsWrapper; return $(clsWrapper.replace('%unit%', 'minutes'), $el); }, seconds: function(ref, $el) { var clsWrapper = ref.clsWrapper; return $(clsWrapper.replace('%unit%', 'seconds'), $el); }, units: function() { var this$1 = this; return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; }); } }, connected: function() { this.start(); }, disconnected: function() { var this$1 = this; this.stop(); this.units.forEach(function (unit) { return empty(this$1[unit]); }); }, events: [ { name: 'visibilitychange', el: document, handler: function() { if (document.hidden) { this.stop(); } else { this.start(); } } } ], update: { write: function() { var this$1 = this; var timespan = getTimeSpan(this.date); if (timespan.total <= 0) { this.stop(); timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0; } this.units.forEach(function (unit) { var digits = String(Math.floor(timespan[unit])); digits = digits.length < 2 ? ("0" + digits) : digits; var el = this$1[unit]; if (el.textContent !== digits) { digits = digits.split(''); if (digits.length !== el.children.length) { html(el, digits.map(function () { return ''; }).join('')); } digits.forEach(function (digit, i) { return el.children[i].textContent = digit; }); } }); } }, methods: { start: function() { var this$1 = this; this.stop(); if (this.date && this.units.length) { this.$emit(); this.timer = setInterval(function () { return this$1.$emit(); }, 1000); } }, stop: function() { if (this.timer) { clearInterval(this.timer); this.timer = null; } } } }; function getTimeSpan(date) { var total = date - Date.now(); return { total: total, seconds: total / 1000 % 60, minutes: total / 1000 / 60 % 60, hours: total / 1000 / 60 / 60 % 24, days: total / 1000 / 60 / 60 / 24 }; } var targetClass = 'uk-animation-target'; var Animate = { props: { animation: Number }, data: { animation: 150 }, computed: { target: function() { return this.$el; } }, methods: { animate: function(action) { var this$1 = this; addStyle(); var children = toNodes(this.target.children); var propsFrom = children.map(function (el) { return getProps(el, true); }); var oldHeight = height(this.target); var oldScrollY = window.pageYOffset; action(); Transition.cancel(this.target); children.forEach(Transition.cancel); reset(this.target); this.$update(this.target); fastdom.flush(); var newHeight = height(this.target); children = children.concat(toNodes(this.target.children).filter(function (el) { return !includes(children, el); })); var propsTo = children.map(function (el, i) { return el.parentNode && i in propsFrom ? propsFrom[i] ? isVisible(el) ? getPositionWithMargin(el) : {opacity: 0} : {opacity: isVisible(el) ? 1 : 0} : false; } ); propsFrom = propsTo.map(function (props, i) { var from = children[i].parentNode === this$1.target ? propsFrom[i] || getProps(children[i]) : false; if (from) { if (!props) { delete from.opacity; } else if (!('opacity' in props)) { var opacity = from.opacity; if (opacity % 1) { props.opacity = 1; } else { delete from.opacity; } } } return from; }); addClass(this.target, targetClass); children.forEach(function (el, i) { return propsFrom[i] && css(el, propsFrom[i]); }); css(this.target, 'height', oldHeight); scrollTop(window, oldScrollY); return Promise.all(children.map(function (el, i) { return propsFrom[i] && propsTo[i] ? Transition.start(el, propsTo[i], this$1.animation, 'ease') : Promise.resolve(); } ).concat(Transition.start(this.target, {height: newHeight}, this.animation, 'ease'))).then(function () { children.forEach(function (el, i) { return css(el, {display: propsTo[i].opacity === 0 ? 'none' : '', zIndex: ''}); }); reset(this$1.target); this$1.$update(this$1.target); fastdom.flush(); // needed for IE11 }, noop); } } }; function getProps(el, opacity) { var zIndex = css(el, 'zIndex'); return isVisible(el) ? assign({ display: '', opacity: opacity ? css(el, 'opacity') : '0', pointerEvents: 'none', position: 'absolute', zIndex: zIndex === 'auto' ? index(el) : zIndex }, getPositionWithMargin(el)) : false; } function reset(el) { css(el.children, { height: '', left: '', opacity: '', pointerEvents: '', position: '', top: '', width: '' }); removeClass(el, targetClass); css(el, 'height', ''); } function getPositionWithMargin(el) { var ref = el.getBoundingClientRect(); var height$$1 = ref.height; var width$$1 = ref.width; var ref$1 = position(el); var top = ref$1.top; var left = ref$1.left; top += toFloat(css(el, 'marginTop')); return {top: top, left: left, height: height$$1, width: width$$1}; } var style$1; function addStyle() { if (!style$1) { style$1 = append(document.head, '", "affordable-housing": " affordable ", "affordable-market-bleed": "", "affordable-market": " ", "Affordable": "", "Airports": "", "canada-color": " flag-canada-color ", "canada-flag": " ", "canada-gray": " flag-canada-gray ", "check-circle": " ", "checkmark-bold": " ", "commercial-market-bleed": "", "commercial-market": "", "Commercial-New": "", "commercial": " commercial ", "condo-market-bleed": "", "condo-market": " ", "Condo": "", "condos-hoa": " condos-hoa ", "Corporate": "", "Coworking": "", "custom-arrow-left": " ", "custom-arrow-right": " ", "data": " ", "EUROInvestmentManagement": "", "expenses": " ", "GBPInvestmentManagement": "", "Government": "", "insurance": " ", "InvestmentManagement": "", "location2": " ", "Logistics": "", "manufactured-housing": " manufactured-homes ", "manufactured-market": "", "Manufactured": "", "marketing-and-leasing": " ", "Military": "", "mixed-portfolios": " ", "numbers": " ", "Parks-Rec": "", "person": " ", "pha-market-bleed": "", "pha-market": " ", "PHA-New": "", "pie-graph": " ", "play-btn": " ", "Ports": "", "residential-market": "", "Residential-New": "", "residential": " residential ", "Retail": "", "self-storage": " self-storage ", "senior-housing-market": "", "senior-market-bleed": "", "senior-market": " ", "Senior": "", "Single Family": "", "Social": "", "storage-market-bleed": "", "storage-market": "", "Storage": "", "Student": "", "technology": " ", "test-icon": " ", "time": " ", "uk-color": " ", "uk-gray": " ", "us-flag": " ", "usa-color": " flag-usa-color ", "usa-gray": " flag-usa-gray " }); } if (typeof window !== 'undefined' && window.UIkit) { window.UIkit.use(plugin); } return plugin; }))); ; function cmwGetUTMParamsFromCookie() { // This function is declared globally for use in other files. var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); var cookiename = 'cmwUtmParams'; if (cookie.indexOf(cookiename + '=') === 0) { params = cookie.substring(cookiename.length + 1); return JSON.parse(params) } } return null; } window.addEventListener('load', function() { function sanitizeUtm(value) { /* Remove any non-alphanumeric characters except hyphens and underscores \p{L} matches any Unicode letter. \p{N} matches any Unicode number. g flag ensures that all occurrences of the pattern are replaced. u flag enables full Unicode matching. */ value = value.replace(/[^\p{L}\p{N}_-]/gu, ''); return value; } // Function to set a session cookie function setSessionCookie(name, value) { document.cookie = name + '=' + value + '; path=/'; } function setUTMParams(params) { setSessionCookie('cmwUtmParams', JSON.stringify(params)); } function storeUTMParameters() { var urlParams = new URLSearchParams(window.location.search); var utmParams = {}; // always start fresh so we don't contaminate urlParams.forEach(function(value, key) { if (key.startsWith('utm_')) { let sanitizedKey = sanitizeUtm(key); let sanitizedValue = sanitizeUtm(value); utmParams[sanitizedKey] = sanitizedValue; } }); if(Object.keys(utmParams).length !== 0){ // only overwrite if we've had utm in url setUTMParams(utmParams); } } function searchForUTMInputs(element) { var utmParams = cmwGetUTMParamsFromCookie(); if (utmParams) { // Loop through UTM parameters for (var key in utmParams) { if (utmParams.hasOwnProperty(key)) { var searchSpace = document; // Default search space is the whole document // If element argument is provided, set the search space to that element if (element instanceof HTMLElement) { searchSpace = element; } // Search for input elements by name within the search space var inputsByName = searchSpace.querySelectorAll('input[name="' + key + '"]'); // If inputs with the name exist, set their values if (inputsByName && inputsByName.length > 0) { for (var i = 0; i < inputsByName.length; i++) { // Check if the element is an input if (inputsByName[i].tagName.toLowerCase() === 'input') { inputsByName[i].value = utmParams[key]; /* NOTE: It doesn't matter if the form already has its own inserter of utm parameters on the same inputs It will just set the same values */ } } } } } } } storeUTMParameters(); // Store UTM parameters searchForUTMInputs(); // Non-embedded forms should be readily available and filled in window.addEventListener('message', event => { if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') { // the form is ready to manipulate! let form_id = "hsForm_" + event.data.id; let form = document.getElementById(form_id); if(form){ searchForUTMInputs(form); } } }); });; window.addEventListener('load', function() { var current_domain = window.location.hostname; function updateUTMParams(url, utmParams) { var urlObject = new URL(url); for (var key in utmParams) { if (key === 'utm_source') { // Adding current domain into source urlObject.searchParams.set(key, current_domain + '_' + utmParams[key]); } else { urlObject.searchParams.set(key, utmParams[key]); } } return urlObject.href; } // Not passing anything if it comes from the central site ( self ) if( ! current_domain.includes('www.yardi.') && !document.location.href.match(/https?:\/\/(stage|devel)\.yardi\.com\/yardi-.*/) ){ var utmParams = cmwGetUTMParamsFromCookie(); // only targeting sites that go to central sites var global_sites_links = document.querySelectorAll('a[href*="/www.yardi."]'); global_sites_links.forEach(link => { // Update each link's href attribute with the new UTM parameters if(!link.href.includes('utm_')){ // Only when not already with utm params var updatedHref = updateUTMParams(link.href, utmParams); link.href = updatedHref; } }); } }); ; jQuery(document).ready(function(){ scripts = jQuery("head script"); if(scripts.length > 0 && scripts[0].id !== 'cmw_inject_custom_head_js'){ console.log('CMW CUSTOM JS NOT FIRST'); } if(scripts.length === 0){ console.log('NO SCRIPTS IN HEAD!'); } });; /*! jQuery UI - v1.13.3 - 2024-04-26 * https://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3", /*! * jQuery UI :data 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}), /*! * jQuery UI Disable Selection 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}), /*! * jQuery UI Focusable 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)}, /*! * jQuery UI Form Reset Mixin 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), /*! * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license * */ x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}), /*! * jQuery UI Keycode 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}, /*! * jQuery UI Labels 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o
")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthW(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;e.collisionWidth>n?0o?0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});; /*! * jQuery UI Slider 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../keycode","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.slider",o.ui.mouse,{version:"1.13.3",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,t=this.options,i=this.element.find(".ui-slider-handle"),s=[],a=t.values&&t.values.length||1;for(i.length>a&&(i.slice(a).remove(),i=i.slice(0,a)),e=i.length;e
");this.handles=i.add(o(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){o(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=o("
").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==e.range&&"max"!==e.range||this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,a,n,t,h,l=this,u=this.options;return!u.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var t=Math.abs(i-l.values(e));(t=this._valueMax()?this._valueMax():(t=0=t&&(i+=0this.options.max&&(e-=i),this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return e=null!==this.options.min?Math.max(e,this._precisionOf(this.options.min)):e},_precisionOf:function(e){var e=e.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(e){"vertical"===e&&this.range.css({width:"",left:""}),"horizontal"===e&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var t,i,e,s,a,n=this.options.range,h=this.options,l=this,u=!this._animateOff&&h.animate,r={};this._hasMultipleValues()?this.handles.each(function(e){i=(l.values(e)-l._valueMin())/(l._valueMax()-l._valueMin())*100,r["horizontal"===l.orientation?"left":"bottom"]=i+"%",o(this).stop(1,1)[u?"animate":"css"](r,h.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===e&&l.range.stop(1,1)[u?"animate":"css"]({left:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:h.animate})):(0===e&&l.range.stop(1,1)[u?"animate":"css"]({bottom:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:h.animate}))),t=i}):(e=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(e-s)/(a-s)*100:0,r["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[u?"animate":"css"](r,h.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:i+"%"},h.animate),"max"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:100-i+"%"},h.animate),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:i+"%"},h.animate),"max"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:100-i+"%"},h.animate))},_handleEvents:{keydown:function(e){var t,i,s,a=o(e.target).data("ui-slider-handle-index");switch(e.keyCode){case o.ui.keyCode.HOME:case o.ui.keyCode.END:case o.ui.keyCode.PAGE_UP:case o.ui.keyCode.PAGE_DOWN:case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(e.preventDefault(),this._keySliding||(this._keySliding=!0,this._addClass(o(e.target),null,"ui-state-active"),!1!==this._start(e,a)))break;return}switch(s=this.options.step,t=i=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case o.ui.keyCode.HOME:i=this._valueMin();break;case o.ui.keyCode.END:i=this._valueMax();break;case o.ui.keyCode.PAGE_UP:i=this._trimAlignValue(t+(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(t-(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:if(t===this._valueMax())return;i=this._trimAlignValue(t+s);break;case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(t===this._valueMin())return;i=this._trimAlignValue(t-s)}this._slide(e,a,i)},keyup:function(e){var t=o(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,t),this._change(e,t),this._removeClass(o(e.target),null,"ui-state-active"))}}})});; jQuery( window ).on( 'load', function() { /* global authorsListAjaxSearch */ if ( typeof authorsListAjaxSearch !== 'undefined' ) { const buttonClick = jQuery( '.authors-list-search-filter-submit' ); const numberRange = buttonClick.closest( '.authors-list-ajax-filter' ).find( '.authors-list-number-range' ); jQuery.each( numberRange, function( index, value ) { const numberRangeHolder = jQuery( value ).find( '.authors-list-number-range-holder' ); const minRange = jQuery( numberRangeHolder ).data( 'min' ); const maxRange = jQuery( numberRangeHolder ).data( 'max' ); const numberSelectedElem = jQuery( value ).find( 'input[type="hidden"]' ); const rangeRender = jQuery( this ).find( '.authors-list-ranges' ); const rangeMinRender = rangeRender.find( '.authors-list-min-range' ); const rangeMaxRender = rangeRender.find( '.authors-list-max-range' ); // For the number slider range. numberRangeHolder.slider( { range: true, min: minRange, max: maxRange, values: [ minRange, maxRange ], slide: function( event, ui ) { // Update the HTMl to display the number ranges on slide change. jQuery( rangeMinRender ).html( ui.values[ 0 ] ); jQuery( rangeMaxRender ).html( ui.values[ 1 ] ); // Pass the value to the hidden type input for processing in Ajax request. numberSelectedElem.val( ui.values ); }, } ); } ); buttonClick.on( 'click', function( event ) { event.preventDefault(); const parentElem = jQuery( this ).closest( '.authors-list-ajax-filter' ); const loopElem = parentElem.next( '.authors-list-items' ); const ajaxSelectFilters = parentElem.find( '[class*="metadata"]' ); let className = ''; let inputType = ''; const checkboxexValues = []; const ajaxFiltersData = {}; // Add `authors-list-ajax-loading` class for button click event on main div. loopElem.addClass( 'authors-list-ajax-loading' ); jQuery.each( ajaxSelectFilters, function( index, value ) { className = jQuery( value ).attr( 'class' ); className = className.replace( 'authors-list-search-', '' ).replace( '-metadata', '' ); inputType = jQuery( value ).attr( 'type' ); if ( 'checkbox' === inputType ) { const checked = jQuery( value ).is( ':checked' ); if ( true === checked ) { checkboxexValues.push( jQuery( value ).val() ); checkboxexValues.join(); // Assign the output data to an object. ajaxFiltersData[ className ] = Object.assign( {}, checkboxexValues ); } } else if ( 'radio' === inputType ) { const checked = jQuery( value ).is( ':checked' ); if ( true === checked ) { // Assign the output data to an object. ajaxFiltersData[ className ] = jQuery( value ).val(); } } else { // Assign the output data to an object. ajaxFiltersData[ className ] = jQuery( value ).val(); } } ); jQuery.ajax( { type: 'post', dataType: 'json', url: authorsListAjaxSearch.ajaxurl, data: { action: 'update_authors_list_ajax', authorsListNonce: authorsListAjaxSearch.nonce, shortcode: parentElem.find( '.authors-list-search-shortcode' ).val(), searchParam: parentElem.find( '.authors-list-search-input' ).val(), searchColumn: parentElem.find( '.authors-list-search-column' ).val(), ajaxFiltersData, }, beforeSend: function() { loopElem.find( '.spinner' ).show(); }, success: function( response ) { if ( true === response.success ) { loopElem.html( response.data ); } }, complete: function( jqXHR, textStatus ) { if ( 'success' === textStatus ) { // Remove `authors-list-ajax-loading` class when the Ajax loading is successfully done from main div. loopElem.removeClass( 'authors-list-ajax-loading' ); loopElem.find( '.spinner' ).hide(); } }, } ); } ); } } ); ; /*! This file is auto-generated */ !function(n,r){var t,e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,t=n._,(e=n._=r()).noConflict=function(){return n._=t,e})}(this,function(){var n="1.13.6",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},e=Array.prototype,F=Object.prototype,V="undefined"!=typeof Symbol?Symbol.prototype:null,P=e.push,f=e.slice,s=F.toString,q=F.hasOwnProperty,t="undefined"!=typeof ArrayBuffer,u="undefined"!=typeof DataView,U=Array.isArray,W=Object.keys,z=Object.create,L=t&&ArrayBuffer.isView,$=isNaN,C=isFinite,K=!{toString:null}.propertyIsEnumerable("toString"),J=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],G=Math.pow(2,53)-1;function l(u,o){return o=null==o?u.length-1:+o,function(){for(var n=Math.max(arguments.length-o,0),r=Array(n),t=0;t":">",'"':""","'":"'","`":"`"},qn=Pn(t),t=Pn(An(t)),Un=m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Wn=/(.)^/,zn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Ln=/\\|'|\r|\n|\u2028|\u2029/g;function $n(n){return"\\"+zn[n]}var Cn=/^\s*(\w|\$)+\s*$/;var Kn=0;function Jn(n,r,t,e,u){return e instanceof r?(e=En(n.prototype),o(r=n.apply(e,u))?r:e):n.apply(t,u)}var M=l(function(u,o){function i(){for(var n=0,r=o.length,t=Array(r),e=0;ethis.length?this.length:n)<0&&(n+=this.length+1),[]),r=[],o=[],h=[],a={},l=e.add,c=e.merge,u=e.remove,d=!1,f=this.comparator&&null==n&&!1!==e.sort,p=b.isString(this.comparator)?this.comparator:null,g=0;g[\\d]+)/");return t<0?"":((e=(e=e.substr(0,t-1)).split("/")).pop(),e.pop())},wp.api.utils.decorateFromRoute=function(e,t){_.each(e,function(e){_.includes(e.methods,"POST")||_.includes(e.methods,"PUT")?_.isEmpty(e.args)||(_.isEmpty(t.prototype.args)?t.prototype.args=e.args:t.prototype.args=_.extend(t.prototype.args,e.args)):_.includes(e.methods,"GET")&&!_.isEmpty(e.args)&&(_.isEmpty(t.prototype.options)?t.prototype.options=e.args:t.prototype.options=_.extend(t.prototype.options,e.args))})},wp.api.utils.addMixinsAndHelpers=function(t,e,i){function n(e,t,i,n,o){var s,a=jQuery.Deferred(),e=e.get("_embedded")||{};return _.isNumber(t)&&0!==t?(s=(s=e[n]?_.findWhere(e[n],{id:t}):s)||{id:t},(e=new wp.api.models[i](s)).get(o)?a.resolve(e):e.fetch({success:function(e){a.resolve(e)},error:function(e,t){a.reject(t)}}),a.promise()):(a.reject(),a)}function p(e,t){_.each(e.models,function(e){e.set("parent_post",t)})}var o=!1,s=["date","modified","date_gmt","modified_gmt"],a={setDate:function(e,t){t=t||"date";if(_.indexOf(s,t)<0)return!1;this.set(t,e.toISOString())},getDate:function(e){var e=e||"date",t=this.get(e);return!(_.indexOf(s,e)<0||_.isNull(t))&&new Date(wp.api.utils.parseISO8601(t))}},r={getMeta:function(e){return this.get("meta")[e]},getMetas:function(){return this.get("meta")},setMetas:function(e){var t=this.get("meta");_.extend(t,e),this.set("meta",t)},setMeta:function(e,t){var i=this.get("meta");i[e]=t,this.set("meta",i)}},c={getRevisions:function(){return e=this,t="PostRevisions",s=o="",a=jQuery.Deferred(),r=e.get("id"),e=e.get("_embedded")||{},_.isNumber(r)&&0!==r?(_.isUndefined(i)||_.isUndefined(e[i])?o={parent:r}:s=_.isUndefined(n)?e[i]:e[i][n],e=new wp.api.collections[t](s,o),_.isUndefined(e.models[0])?e.fetch({success:function(e){p(e,r),a.resolve(e)},error:function(e,t){a.reject(t)}}):(p(e,r),a.resolve(e)),a.promise()):(a.reject(),a);var e,t,i,n,o,s,a,r}},d={getTags:function(){var e=this.get("tags"),t=new wp.api.collections.Tags;return _.isEmpty(e)?jQuery.Deferred().resolve([]):t.fetch({data:{include:e}})},setTags:function(e){var i,n=this,o=[];if(_.isString(e))return!1;_.isArray(e)?(new wp.api.collections.Tags).fetch({data:{per_page:100},success:function(t){_.each(e,function(e){(i=new wp.api.models.Tag(t.findWhere({slug:e}))).set("parent_post",n.get("id")),o.push(i)}),e=new wp.api.collections.Tags(o),n.setTagsWithCollection(e)}}):this.setTagsWithCollection(e)},setTagsWithCollection:function(e){return this.set("tags",e.pluck("id")),this.save()}},l={getCategories:function(){var e=this.get("categories"),t=new wp.api.collections.Categories;return _.isEmpty(e)?jQuery.Deferred().resolve([]):t.fetch({data:{include:e}})},setCategories:function(e){var i,n=this,o=[];if(_.isString(e))return!1;_.isArray(e)?(new wp.api.collections.Categories).fetch({data:{per_page:100},success:function(t){_.each(e,function(e){(i=new wp.api.models.Category(t.findWhere({slug:e}))).set("parent_post",n.get("id")),o.push(i)}),e=new wp.api.collections.Categories(o),n.setCategoriesWithCollection(e)}}):this.setCategoriesWithCollection(e)},setCategoriesWithCollection:function(e){return this.set("categories",e.pluck("id")),this.save()}},u={getAuthorUser:function(){return n(this,this.get("author"),"User","author","name")}},g={getFeaturedMedia:function(){return n(this,this.get("featured_media"),"Media","wp:featuredmedia","source_url")}};return t=_.isUndefined(t.prototype.args)||(_.each(s,function(e){_.isUndefined(t.prototype.args[e])||(o=!0)}),o&&(t=t.extend(a)),_.isUndefined(t.prototype.args.author)||(t=t.extend(u)),_.isUndefined(t.prototype.args.featured_media)||(t=t.extend(g)),_.isUndefined(t.prototype.args.categories)||(t=t.extend(l)),_.isUndefined(t.prototype.args.meta)||(t=t.extend(r)),_.isUndefined(t.prototype.args.tags)||(t=t.extend(d)),_.isUndefined(i.collections[e+"Revisions"]))?t:t.extend(c)}}(window),function(){"use strict";var i=window.wpApiSettings||{},e=["Comment","Media","Comment","Post","Page","Status","Taxonomy","Type"];wp.api.WPApiBaseModel=Backbone.Model.extend({initialize:function(){-1===_.indexOf(e,this.name)&&(this.requireForceForDelete=!0)},sync:function(e,t,i){var n;return i=i||{},_.isNull(t.get("date_gmt"))&&t.unset("date_gmt"),_.isEmpty(t.get("slug"))&&t.unset("slug"),_.isFunction(t.nonce)&&!_.isEmpty(t.nonce())&&(n=i.beforeSend,i.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",t.nonce()),n)return n.apply(this,arguments)},i.complete=function(e){e=e.getResponseHeader("X-WP-Nonce");e&&_.isFunction(t.nonce)&&t.nonce()!==e&&t.endpointModel.set("nonce",e)}),this.requireForceForDelete&&"delete"===e&&(t.url=t.url()+"?force=true"),Backbone.sync(e,t,i)},save:function(e,t){return!(!_.includes(this.methods,"PUT")&&!_.includes(this.methods,"POST"))&&Backbone.Model.prototype.save.call(this,e,t)},destroy:function(e){return!!_.includes(this.methods,"DELETE")&&Backbone.Model.prototype.destroy.call(this,e)}}),wp.api.models.Schema=wp.api.WPApiBaseModel.extend({defaults:{_links:{},namespace:null,routes:{}},initialize:function(e,t){t=t||{},wp.api.WPApiBaseModel.prototype.initialize.call(this,e,t),this.apiRoot=t.apiRoot||i.root,this.versionString=t.versionString||i.versionString},url:function(){return this.apiRoot+this.versionString}})}(),function(){"use strict";window.wpApiSettings;wp.api.WPApiBaseCollection=Backbone.Collection.extend({initialize:function(e,t){this.state={data:{},currentPage:null,totalPages:null,totalObjects:null},_.isUndefined(t)?this.parent="":this.parent=t.parent},sync:function(e,t,i){var n,o,s=this;return i=i||{},_.isFunction(t.nonce)&&!_.isEmpty(t.nonce())&&(n=i.beforeSend,i.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",t.nonce()),n)return n.apply(s,arguments)},i.complete=function(e){e=e.getResponseHeader("X-WP-Nonce");e&&_.isFunction(t.nonce)&&t.nonce()!==e&&t.endpointModel.set("nonce",e)}),"read"===e&&(i.data?(s.state.data=_.clone(i.data),delete s.state.data.page):s.state.data=i.data={},void 0===i.data.page?(s.state.currentPage=null,s.state.totalPages=null,s.state.totalObjects=null):s.state.currentPage=i.data.page-1,o=i.success,i.success=function(e,t,i){if(_.isUndefined(i)||(s.state.totalPages=parseInt(i.getResponseHeader("x-wp-totalpages"),10),s.state.totalObjects=parseInt(i.getResponseHeader("x-wp-total"),10)),null===s.state.currentPage?s.state.currentPage=1:s.state.currentPage++,o)return o.apply(this,arguments)}),Backbone.sync(e,t,i)},more:function(e){if((e=e||{}).data=e.data||{},_.extend(e.data,this.state.data),void 0===e.data.page){if(!this.hasMore())return!1;null===this.state.currentPage||this.state.currentPage<=1?e.data.page=2:e.data.page=this.state.currentPage+1}return this.fetch(e)},hasMore:function(){return null===this.state.totalPages||null===this.state.totalObjects||null===this.state.currentPage?null:this.state.currentPage",{type:"hidden",value:e,name:"g-recaptcha-response"})),o.trigger("submit")}))}))}));else{var a=grecaptcha.render(t,{sitekey:r,theme:$(t).attr("data-theme"),size:$(t).attr("data-size")});o.on("pp_form_submitted",(function(){grecaptcha.reset(a)})),$(document).on("ppress_process_checkout_success_callback ppress_process_checkout_error_callback",(function(){grecaptcha.reset(a)}))}}))},this.toggle_password_visibility=function(e){e.preventDefault();var s=$(this).parents(".pp-form-field-input-textarea-wrap").find(".pp-form-field");"password"===s.attr("type")?(s.attr("type","text"),$(this).text("visibility_off")):(s.attr("type","password"),$(this).text("visibility"))},this.submit_reload_form_on_billing_country_field_change=function(){$(document).on("change",".pp-edit-profile-form-wrap select[name=ppress_billing_country]",(function(e){$(document).on("pp_form_edit_profile_success",(function(){window.location.reload()})),$(this).closest("form").find("input.pp-submit-form").trigger("click")}))},this.ajax_edit_profile=function(s){if(void 0!==window.FormData&&window.FormData){s.preventDefault();var t=$('form[data-pp-form-submit="editprofile"]'),r=e.get_melange_id(t),o=new FormData(this);o.append("action","pp_ajax_editprofile"),o.append("nonce",pp_ajax_form.nonce),o.append("melange_id",r),$(".profilepress-edit-profile-status").remove(),$(".profilepress-edit-profile-success").remove(),""!==window.edit_profile_msg_class&&$("."+window.edit_profile_msg_class).remove(),e._add_processing_label(t),$.post({url:pp_ajax_form.ajaxurl,data:o,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){t.trigger("pp_form_submitted"),t.trigger("pp_form_edit_profile_success",[t]),"avatar_url"in s&&""!==s.avatar_url&&($("img[data-del='avatar'], img.pp-user-avatar").attr("src",s.avatar_url),$("input[name=eup_avatar]",t).val("")),"cover_image_url"in s&&""!==s.cover_image_url&&($("img[data-del='cover-image'], img.pp-user-cover-image").attr("src",s.cover_image_url),$("input[name=eup_cover_image]",t).val(""),$(".profilepress-myaccount-has-cover-image",t).show(),$(".profilepress-myaccount-cover-image-empty",t).hide()),"message"in s&&(window.edit_profile_msg_class=$(s.message).attr("class"),t.before(s.message)),"redirect"in s&&(t.trigger("pp_edit_profile_success_before_redirect"),window.location.assign(s.redirect)),e._remove_processing_label(t)}},"json")}},this.ajax_password_reset=function(s){s.preventDefault();var t=$(this),r=e.get_melange_id(t),o="true"===t.find('input[name="is-pp-tab-widget"]').val(),a={action:"pp_ajax_passwordreset",data:$(this).serialize()+"&melange_id="+r};e._remove_status_notice(),t.parents(".pp-tab-widget-form").prev(".pp-tab-status").remove(),e._add_processing_label(t),$.post(pp_ajax_form.ajaxurl,a,(function(s){if(t.trigger("pp_form_submitted"),"object"!=typeof s)return e._remove_processing_label(t);if("message"in s){if(t.trigger("pp_password_reset_status"),o){var r=s.message.replace("profilepress-reset-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);"status"in s&&!0===s.status&&t.hide(),$('input[name="user_login"]',t).val("")}e._remove_processing_label(t)}),"json")},this.ajax_registration=function(s){if(void 0!==window.FormData&&window.FormData){s.preventDefault();var t=$(this),r=e.get_melange_id(t),o=new FormData(this),a="true"===t.find('input[name="is-pp-tab-widget"]').val();o.append("action","pp_ajax_signup"),o.append("melange_id",r),e._remove_status_notice(),t.parents(".pp-tab-widget-form").prev(".pp-tab-status").remove(),e._add_processing_label(t),$.post({url:pp_ajax_form.ajaxurl,data:o,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){if(t.trigger("pp_form_submitted"),"object"!=typeof s)return e._remove_processing_label(t);if("message"in s)if(t.trigger("pp_registration_error",[s]),t.trigger("pp_registration_ajax_response",[s]),a){var r=s.message.replace("profilepress-reg-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);else"redirect"in s&&(t.trigger("pp_registration_success",[s]),window.location.assign(s.redirect));e._remove_processing_label(t)}})}},this.ajax_login=function(s){s.preventDefault();var t=$(this),r={action:"pp_ajax_login",data:$(this).serialize()},o="true"===t.find('input[name="is-pp-tab-widget"]').val();e._remove_status_notice(),e._add_processing_label(t),$.post(pp_ajax_form.ajaxurl,r,(function(s){if(t.trigger("pp_form_submitted"),null===s||"object"!=typeof s)return e._remove_processing_label(t);if("success"in s&&!0===s.success&&"redirect"in s)t.trigger("pp_login_form_success"),window.location.assign(s.redirect);else if(t.trigger("pp_login_form_error"),"code"in s&&"pp2fa_auth_code_invalid"==s.code&&t.find(".pp-2fa").show(),o){var r=s.message.replace("profilepress-login-status","pp-tab-status");t.parents(".pp-tab-widget-form").before(r)}else t.parents(".lucidContainer").length>0?t.parents(".lucidContainer").before(s.message):t.before(s.message);e._remove_processing_label(t)}),"json")},this.delete_avatar=function(e){e.preventDefault();var s=$(this).text(),t=$(this);e.preventDefault(),confirm(pp_ajax_form.confirm_delete)&&(t.is("button")&&t.text(pp_ajax_form.deleting_text),$.post(pp_ajax_form.ajaxurl,{action:"pp_del_avatar",nonce:pp_ajax_form.nonce}).done((function(e){"error"in e&&"nonce_failed"===e.error?(t.text(s),alert(pp_ajax_form.deleting_error)):"success"in e&&($("img[data-del='avatar']").attr("src",e.default),t.remove())})))},this.delete_profile_image_cover=function(e){e.preventDefault();var s=$(this).text(),t=$(this);e.preventDefault(),confirm(pp_ajax_form.confirm_delete)&&(t.is("button")&&t.text(pp_ajax_form.deleting_text),$.post(pp_ajax_form.ajaxurl,{action:"pp_del_cover_image",nonce:pp_ajax_form.nonce}).done((function(e){"error"in e&&"nonce_failed"===e.error&&(t.text(s),alert(pp_ajax_form.deleting_error)),"success"in e&&(""!==e.default?($("img[data-del='cover-image']").attr("src",e.default),t.parent().find(".profilepress-myaccount-has-cover-image").show(),t.parent().find(".profilepress-myaccount-cover-image-empty").hide()):(t.parent().find(".profilepress-myaccount-has-cover-image").hide(),t.parent().find(".profilepress-myaccount-cover-image-empty").show()),t.remove())})))},this.get_melange_id=function(e){var s=$("input.pp_melange_id",e).val();return void 0===s?"":s},this._add_processing_label=function(e){var s=e.find("input[data-pp-submit-label]");s.attr({value:s.data("pp-processing-label"),disabled:"disabled"}).css("opacity",".4")},this._remove_processing_label=function(e){var s=e.find("input[data-pp-submit-label]");s.attr("value",s.data("pp-submit-label")),s.attr({value:s.data("pp-submit-label"),disabled:null}).css("opacity","")},this._remove_status_notice=function(){$(".profilepress-login-status,.pp-tab-status,.profilepress-edit-profile-success,.profilepress-edit-profile-status,.pp-reset-success,.profilepress-reset-status,.profilepress-reg-status").remove()},this.defaultUserProfileResponsive=function(){$(".ppress-default-profile, .pp-member-directory, .ppress-checkout__form").each((function(){var e=$(this),s=e.width();s<=340?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui800"),e.removeClass("ppressui768"),e.removeClass("ppressui960"),e.addClass("ppressui340")):s<=500?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui500")):s<=768?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui768")):s<=800?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui800")):s<=960?(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960"),e.addClass("ppressui960")):s>960&&(e.removeClass("ppressui340"),e.removeClass("ppressui500"),e.removeClass("ppressui768"),e.removeClass("ppressui800"),e.removeClass("ppressui960")),e.css("opacity",1)})),$(".ppress-default-profile-cover, .ppress-default-profile-cover-e").each((function(){var e=$(this),s=Math.round(e.width()/e.data("ratio"))+"px";e.height(s),e.find(".ppress-dpf-cover-add").height(s)}))},this.myaccount_password_strength_meter=function(){$((function(){var e=$("input[name=password_new]"),s=$("input[name=password_confirm_new]"),t=$("input[name=submit-form]"),r=$("#pp-pass-strength-result");$("body").on("keyup","input[name=password_new], input[name=password_confirm_new]",(function(o){!function(e,s,t,r,o){var a=e.val(),p=s.val();r.attr("disabled","disabled"),t.removeClass("short bad good strong"),o=o.concat(wp.passwordStrength.userInputDisallowedList());var i=wp.passwordStrength.meter(a,o,p);switch(i){case 2:t.addClass("bad").html(pwsL10n.bad);break;case 3:t.addClass("good").html(pwsL10n.good);break;case 4:t.addClass("strong").html(pwsL10n.strong);break;case 5:t.addClass("short").html(pwsL10n.mismatch);break;default:t.addClass("short").html(pwsL10n.short)}"false"===myacPwsL10n.disable_enforcement&&4===i&&""!==p.trim()&&r.removeAttr("disabled")}(e,s,r,t,[])}))}))}}).init(),(new function(){let e=this;window.ppressCheckoutForm=this,this.init=function(){"0"!==pp_ajax_form.is_checkout&&0!==$("#ppress_checkout_main_form").length&&($(document).on("click",".ppress-checkout-show-login-form",this.toggle_login_form),$(document).on("click",'.ppress-login-submit-btn input[type="submit"]',this.process_login),$(document).on("click",".ppress-coupon-code-link",this.toggle_discount_code_reveal),$(document).on("click",".ppress-apply-discount-btn",this.apply_discount_code),$(document).on("click","#ppress-remove-applied-coupon",this.remove_applied_discount_code),$(document).on("submit","#ppress_mb_checkout_form",this.process_checkout),$(document).on("click",".ppress-terms-and-conditions-link",(function(e){var s=$(".ppress-checkout-form__terms_condition__content");s.length>0&&(e.preventDefault(),s.slideToggle())})),$(document).on("ppress_update_checkout",this.update_checkout),"1"===pp_ajax_form.is_checkout_tax_enabled?$(document).on("change","#ppress_mb_checkout_form .ppress_billing_country, #ppress_mb_checkout_form .ppress_billing_state, #ppress_mb_checkout_form .ppress_vat_number",e.debounce((function(){$(document.body).trigger("ppress_update_checkout")}),200)):$(document).on("change","#ppress_mb_checkout_form .ppress_billing_country",e.contextual_state_field),$(document.body).on("change","#ppress_checkout_payment_methods [name=ppress_payment_method]",(function(){$(document.body).trigger("ppress_update_checkout")})),$(document.body).on("change","#ppress_mb_checkout_form [name=group_selector]",(function(){e.update_checkout()})),$(document.body).trigger("ppress_update_checkout"),$(document).ajaxError((function(){e.remove_spinner()})))},this.debounce=function(e,s){let t;return s=s||600,function(){clearTimeout(t),t=setTimeout((function(){e()}),s)}},this.contextual_state_field=function(){let e=$(".ppress_billing_state"),s={action:"ppress_contextual_state_field",country:$(this).val(),name:e.prop("name"),id:e.prop("id"),class:e.prop("class"),csrf:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,s,(function(s){e.replaceWith(s.data)}))},this.scroll_to_notices=function(e){"true"===pp_ajax_form.is_checkout_autoscroll_enabled&&(e=e||$(".ppress-checkout-alert")).length&&$("html, body").animate({scrollTop:e.offset().top-100},1e3)},this.update_checkout=function(s){s=s||!1;let t=$("#ppress_mb_checkout_form [name=group_selector]").length>0;e.removeAllAlerts(),e.add_spinner();let r={action:"ppress_update_order_review",plan_id:$("#ppress-checkout-plan-id").val(),ppress_payment_method:$("#ppress_checkout_payment_methods [name=ppress_payment_method]:checked").val(),csrf:$("#ppress_checkout_nonce").val(),address:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_address").val(),city:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_city").val(),country:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_country").val(),state:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_state").val(),postcode:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_postcode").val(),phone:$(".ppress-checkout-form__payment_method.ppress-active .ppress_billing_phone").val(),vat_number:$("#ppress_checkout_main_form .ppress_vat_number").val(),post_data:$("#ppress_mb_checkout_form").serialize()};!0===t&&(r.isChangePlanUpdate="true"),$.post(pp_ajax_form.ajaxurl,r,(function(o){let a={};if($(".ppress-checkout-form__payment_method :input").each((function(){let e=$(this).attr("id");e&&(-1!==$.inArray($(this).attr("type"),["checkbox","radio"])?a[e]=$(this).prop("checked"):a[e]=$(this).val())})),"data"in o&&void 0!==o.data.fragments&&($.each(o.data.fragments,(function(s,t){e.fragments&&e.fragments[s]===t||$(s).replaceWith(t)})),e.fragments=r.fragments),$.isEmptyObject(a)||$(".ppress-checkout-form__payment_method :input").each((function(){let e=$(this).attr("id");e&&(-1!==$.inArray($(this).attr("type"),["checkbox","radio"])?$(this).prop("checked",a[e]):($.inArray($(this).attr("type"),["select"]),$(this).val(a[e])))})),"success"in o&&!1===o.success){let e=$("#ppress_checkout_main_form");o.data&&e.prepend(o.data),e.find(".input-text, select, input:checkbox").trigger("blur")}$(document.body).trigger("ppress_updated_checkout",[o]);let p,i=$(".ppress-checkout_order_summary__bottom_details");(p=$(".ppress-checkout-alert")).length>0&&(i=p),e.scroll_to_notices(i),e.remove_spinner(),!0===t&&!0!==s&&e.update_checkout(!0)}))},this.toggle_login_form=function(e){e.preventDefault(),$("#ppress_checkout_account_info .ppress-main-checkout-form__login_form_wrap").slideToggle()},this.toggle_discount_code_reveal=function(e){e.preventDefault(),$("#ppress-checkout-coupon-code-wrap").slideToggle()},this.apply_discount_code=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_checkout_apply_discount",plan_id:$("#ppress-checkout-plan-id").val(),coupon_code:$("#apply-discount").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&!0===s.success?$(document.body).trigger("ppress_update_checkout"):($(".ppress-checkout_order_summary-wrap").before(s.data),e.remove_spinner())}))},this.remove_applied_discount_code=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_checkout_remove_discount",plan_id:$("#ppress-checkout-plan-id").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&!0===s.success?$(document.body).trigger("ppress_update_checkout"):($(".ppress-checkout_order_summary-wrap").before(s.data),e.remove_spinner())}))},this.process_login=function(s){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();let t={action:"ppress_process_checkout_login",ppmb_user_login:$("#ppress_mb_checkout_form #ppmb_user_login").val(),ppmb_user_pass:$("#ppress_mb_checkout_form #ppmb_user_pass").val(),ppress_checkout_nonce:$("#ppress_checkout_nonce").val()};$.post(pp_ajax_form.ajaxurl,t,(function(s){"success"in s&&(!0===s.success?window.location.reload():"data"in s&&$("#ppress_mb_checkout_form .ppress-login-submit-btn").prepend(s.data)),e.remove_spinner()}))},this.process_checkout=function(s){if("function"!=typeof this.checkValidity||!1!==this.checkValidity()){s.preventDefault(),e.removeAllAlerts(),e.add_spinner();var t=$(this),r=e.get_payment_method();if(!1!==t.triggerHandler("ppress_checkout_place_order_"+r)){let s=new FormData(this);s.append("action","ppress_process_checkout"),s.append("ppress_checkout_nonce",$("#ppress_checkout_nonce").val()),$.post({url:pp_ajax_form.ajaxurl,data:s,cache:!1,contentType:!1,enctype:"multipart/form-data",processData:!1,dataType:"json",success:function(s){if($(document.body).trigger("ppress_process_checkout_success_callback",[s]),"success"in s)return!0===s.success?void(!1!==t.triggerHandler("ppress_process_checkout_"+r,[s,r])&&("redirect_url"in s&&void 0!==s.redirect_url&&s.redirect_url.length>0?window.location.assign(s.redirect_url):($(document.body).trigger("ppress_checkout_success",[s,r]),window.location.assign(s.order_success_url)))):"error_message"in s?e.createAlertMessage(s.error_message):"data"in s&&"string"==typeof s.data?e.createAlertMessage(s.data):void 0;e.remove_spinner()},error:function(s,t,r){$(document.body).trigger("ppress_process_checkout_error_callback",[s,t,r]),e.createAlertMessage(r)}},"json")}}},this.get_payment_method=function(){return $("#ppress_mb_checkout_form").find('input[name="ppress_payment_method"]:checked').val()},this.createAlertMessage=function(e,s){s=s||"error";var t=void 0!==e.indexOf&&-1!==e.indexOf("ppress-checkout-alert"),r="";t||(r='

'),r+=e,t||(r+="

"),$("#ppress_checkout_main_form").prepend(r),ppressCheckoutForm.scroll_to_notices(),ppressCheckoutForm.remove_spinner(),$(document.body).trigger("ppress_checkout_error",[e])},this.removeAllAlerts=function(){$(".ppress-checkout-alert").remove()},this.add_spinner=function(){e.remove_spinner(),$(".ppress-checkout__form").prepend('
')},this.remove_spinner=function(){$(".ppress-checkout__form .ppress-checkout__form__preloader").remove()},this.is_var_defined=function(e){return null!=e},this.get_obj_val=function(e,s){return this.is_var_defined(e)&&""!==e?e:s}}).init()}(jQuery);; /** * Process ads with cache busting 'On' */ var advanced_ads_layer_cache_busting; if ( ! advanced_ads_layer_cache_busting ) { advanced_ads_layer_cache_busting = { doc_loaded: false, bufferedAds: [], flush: function() { var _bufferedAds = this.bufferedAds; this.bufferedAds = []; for ( var i = 0; i < _bufferedAds.length; i++ ) { this._process_item( jQuery( _bufferedAds[i] ) ); } }, _process_item: function( banner ) { var banner_id = banner.attr('id'); advads_items.conditions[banner_id] = advads_items.conditions[banner_id] || {}; advads_layer_center_if_not_sticky ( banner ) if (banner.hasClass('advads-effect') ) { advads_layer_gather_effects(banner_id); } if ( ! banner.hasClass( 'use-fancybox' ) ) { advads_layer_gather_background( banner_id ); } advads_layer_gather_auto_close( banner ); // display onload ad right away if (banner.hasClass(advanced_ads_layer_settings.layer_class + '-onload')) { advads_items.conditions[banner_id].scrolloffset = true; advads_check_item_conditions(banner_id); // exit popup (if the user leaves the page) } else if (banner.hasClass(advanced_ads_layer_settings.layer_class + '-exit')) { ouibounce(banner[0], { // the modal will fire any time the page is reloaded, for the same user aggressive: true, // amount of time that firing is surpressed for timer: 0, callback: function() { // reset display to none after Ouibounce banner.css('display', 'none'); advads_items.conditions[banner_id].scrolloffset = true; advads_check_item_conditions(banner_id); } }); // display after delay of n seconds } else if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-delay' ) ) { var delay = ( parseInt( banner.attr( 'data-advads-layer-delay' ), 10 ) ) || 0; setTimeout( function() { advads_items.conditions[banner_id].delay_expired = true; advads_check_item_conditions(banner_id); }, delay ); // ad depends on scrolling } else { // calculate scroll length (document height - window height) var advads_scrollhalf = (jQuery(document).height() - jQuery(window).height()) / 2; var scroll_handler = function ( event ) { if ( jQuery.inArray( banner_id, advads_items.showed ) !== -1 ) { //console.log( 'off scroll event' ) jQuery( window ).off( 'scroll', scroll_handler ); return; } // display scroll ads right after scrolling stopped if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-stop' ) ) { advads_items.conditions[banner_id].scrolloffset = true; advads_check_item_conditions( banner_id ); } // display ads after half the page was scrolled if ( jQuery( document ).scrollTop() >= advads_scrollhalf) { if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-half' ) ) { advads_items.conditions[banner_id].scrolloffset = true; advads_check_item_conditions(banner_id); } } // display ads after custom scroll offset if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-offset' ) ) { var custom_offset = advads_extract_custom_offset_from_class( '#' + banner_id ); if ( jQuery( document ).scrollTop() >= custom_offset ) { advads_items.conditions[banner_id].scrolloffset = true; advads_check_item_conditions( banner_id ); } } } jQuery( window ).onEnd( 'scroll', scroll_handler, 100); } }, observe: function (event) { if ( event.event === 'postscribe_done' && event.ref && event.ad ) { var banner = jQuery( event.ref ).children( 'div' ); if ( ! banner.hasClass( advanced_ads_layer_settings.layer_class + '' ) ) { return; } if ( advanced_ads_layer_cache_busting.doc_loaded ) { advanced_ads_layer_cache_busting.bufferedAds.push( banner ); advanced_ads_layer_cache_busting.flush(); } } }, } } // Advanced Ads Pro is enabled if ( typeof advanced_ads_pro === 'object' && advanced_ads_pro !== null ) { // observe cache busting done event advanced_ads_pro.postscribeObservers.add( advanced_ads_layer_cache_busting.observe ); } /** * Process ads with cache busting 'Off' */ var layers = function() { advanced_ads_layer_cache_busting.doc_loaded = true; jQuery('.' + advanced_ads_layer_settings.layer_class).each(function () { advanced_ads_layer_cache_busting.bufferedAds.push(jQuery(this)); }); advanced_ads_layer_cache_busting.flush(); }; if (typeof advads !== 'undefined' && typeof advads.privacy.dispatch_event !== 'undefined') { document.addEventListener('advanced_ads_privacy', function (event) { if ( event.detail.previousState === 'unknown' && (event.detail.state === 'accepted' || event.detail.state === 'not_needed') && window.advanced_ads_layer_settings.placements !== null ) { window.advanced_ads_layer_settings.placements.forEach(function (value) { document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"][data-placement="' + value + '"]').forEach(advads.privacy.decode_ad); }); } layers(); }); } else { ( window.advanced_ads_ready || jQuery( document ).ready ).call( null, function() { layers(); }); } /** * adjust position for centered layer banner if not added by the sticky plugin * @param {string} $ad jQuery object (wrapped set) */ function advads_layer_center_if_not_sticky( $ad ) { if ($ad.hasClass('is-sticky')) { return; } /* var left = ( jQuery( window ).width() - ad.width() ) / 2; var top = ( jQuery( window ).height() - ad.height() ) / 2; ad.css('left', left); ad.css('top', top); ad.css('position', 'fixed'); */ var width = parseInt($ad.attr('data-width'), 10); var height = parseInt($ad.attr('data-height'), 10); var is_transform_supported = getSupportedTransform(); var transform_property = ''; if (!height) { if (is_transform_supported) { transform_property += 'translateY(50%) '; } else { jQuery($ad).css({'top': '0', 'bottom': 'auto'}); } } if (!width) { if (is_transform_supported) { transform_property += 'translateX(-50%) '; } else { jQuery($ad).css({'left': '0', 'right': 'auto'}); } } if (transform_property) { set_ad_transform($ad, transform_property); } } /** * gather information about display effects and duration * @param {string} id of the ad, without # */ function advads_layer_gather_effects(id) { var banner = jQuery('#' + id); // display effect duration advads_items.effect_durations[id] = advads_extract_duration_from_class(banner); // load display effects if (banner.hasClass('advads-effect-fadein')) { advads_items.display_effect_callbacks[id] = 'advads_display_effect_fadein'; }; if (banner.hasClass('advads-effect-show')) { advads_items.display_effect_callbacks[id] = 'advads_display_effect_show'; }; if (banner.hasClass('advads-effect-slide')) { advads_items.display_effect_callbacks[id] = 'advads_display_effect_slide'; }; } /** * gather information about background * @param {string} id of the ad, without # */ function advads_layer_gather_background(id) { var banner = jQuery('#' + id); // add display callback to the ads with background if (banner.hasClass('advads-has-background') && banner.is(':hidden')) { if (!advads_items.display_callbacks[id] != 'undefined') { advads_items.display_callbacks[id] = {}; var length = 0; } else { var length = advads_items.display_callbacks[id].length; } advads_items.display_callbacks[id][length] = 'advads_layer_display_background_callback'; } } /** * Gather auto close info and schedule auto close. * * @param {obj} $banner A jQuery object representing the banner wrapper. */ function advads_layer_gather_auto_close( $banner ) { var delay = parseInt( $banner.data( 'auto-close-delay'), 10 ); if ( ! delay ) { return; } var banner_id = $banner.attr('id'); advads_items.display_callbacks[ banner_id ] = advads_items.display_callbacks[ banner_id ] || {}; advads_items.display_callbacks[ banner_id ].auto_close = function( banner_id ) { setTimeout( function() { advads_layer_close_item( banner_id ); }, delay ); } } /** * check if background can be removed * * @param {string} id id of the ad, without # * @returns {bool} true, if background can be removed */ function can_remove_background(item) { advads_items.backgrounds[ item ] = false; var remove = true; jQuery.each( advads_items.backgrounds, function( i, val ) { if ( val == true ) { //if ( advads_items.conditions.hasOwnProperty(i) && advads_items.conditions[i].scrolloffset == true ) { remove = false; //break the loop return false; //} } }); return remove; } /** * check item conditions and display the ad if all conditions are true * * @param {string} id id of the ad, without # * @returns {bool} true, if item can be displayed */ function advads_check_item_conditions(id) { var item = jQuery('#' + id); if (item.length == 0) { return; } var display = true; jQuery.each(advads_items.conditions[id], function (method, flag) { if (flag === false) { // display the banner display = false; } }); if ( display ) { advads_items.showed.push(id); item.trigger( advanced_ads_layer_settings.layer_class + '-trigger' ); if ( item.hasClass('use-fancybox') ) { fancybox_display (id); } else { var ad = jQuery('#' + id); var position = jQuery(ad).attr('data-position'); var width = parseInt( ad.attr( 'data-width' ), 10 ); var height = parseInt( ad.attr( 'data-height' ), 10 ); var is_transform_supported = getSupportedTransform(); switch ( position ) { case 'topcenter': if ( ! width ) { if ( is_transform_supported ) { set_ad_transform(ad, 'translateX(-50%)'); } else { jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); } } break; case 'centerleft': if ( ! height ) { if ( is_transform_supported ) { set_ad_transform(ad, 'translateY(50%)'); } else { jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); } } break; case 'center': var transform_property = ''; if ( ! height ) { if ( is_transform_supported ) { transform_property += 'translateY(50%) '; } else { jQuery( ad ).css({ 'top':'0', 'bottom':'auto' }); } } if ( ! width ) { if ( is_transform_supported ) { transform_property += 'translateX(-50%) '; } else { jQuery( ad ).css({ 'left':'0', 'right':'auto' }); } } if (transform_property) { set_ad_transform(ad, transform_property); } break; case 'centerright': if ( ! height ) { if ( is_transform_supported ) { set_ad_transform(ad, 'translateY(50%)'); } else { jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); } } break; case 'bottomcenter': if ( ! width ) { if ( is_transform_supported ) { set_ad_transform(ad, 'translateX(-50%)'); } else { jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); } } break; } advads_layer_call_display_callbacks( id ); if (advads_items.display_effect_callbacks[id] == undefined) { ad.show(); } else { var callback = window[advads_items.display_effect_callbacks[id]]; callback(id); } } } } /** * shows the ad using fancybox plugin * * @param {string} id id of the ad, without # */ function fancybox_display(id) { var banner = jQuery('#' + id); var settings = { 'speedIn' : 0, 'speedOut' : 0, 'showCloseButton' : true, 'hideOnOverlayClick' : banner.hasClass( 'advads-background-click-close' ), 'centerOnScroll' : true, //'autoScale' : false, //'autoDimensions' : false, 'margin' : 20, 'padding' : 10, 'onClosed': function() { if ( typeof advads_items.close_functions[ id ] === 'function' ) { advads_items.close_functions[ id ](); } }, // Once the content is displayed. 'onComplete': function() { advads_layer_call_display_callbacks( id ); }, } if (advads_items.display_effect_callbacks[id] == undefined) { settings['transitionIn'] = 'none'; } else { var callback = advads_items.display_effect_callbacks[id]; switch ( callback ) { case 'advads_display_effect_fadein': settings['transitionIn'] = 'fade'; break; case 'advads_display_effect_show': settings['transitionIn'] = 'elastic'; break; default: settings['transitionIn'] = 'none'; } } if ( ! banner.hasClass('advads-has-background') ) { settings['overlayShow'] = false; } if ( ! banner.hasClass('advads-close') ) { settings['showCloseButton'] = false; } // extract duration of the transitionIn effect var speedIn = advads_extract_duration_from_class(banner); settings['speedIn'] = ( speedIn ) ? speedIn : 0; var position = jQuery(banner).attr('data-position'); // css for Fancybox var output_css = '#fancybox-close { right: -15px; }'; output_css += '#fancybox-loading, #fancybox-loading div, #fancybox-overlay, #fancybox-wrap, #fancybox-wrap div {'; output_css += '-webkit-box-sizing: content-box !important; -moz-box-sizing: content-box !important; box-sizing: content-box !important; }'; switch ( position ) { case 'topleft': output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; right: auto !important; left: 0px !important; }'; break; case 'topcenter': output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; }'; break; case 'topright': output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; right: 0px !important; left: auto !important; }'; break; case 'centerleft': output_css += '#fancybox-wrap { left: 0px !important; right: auto !important; }'; break; case 'center': break; case 'centerright': output_css += '#fancybox-wrap { right: 0px !important; left: auto !important; }'; break; case 'bottomleft': output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; right: auto !important; left: 0px !important; }'; break; case 'bottomcenter': output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; }'; break; case 'bottomright': output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; right: 0px !important; left: auto !important; }'; break; } jQuery('#' + advanced_ads_layer_settings.layer_class + '-custom-css').html(output_css); // show fancybox if ( typeof jQuery.fancybox == 'function' ) { banner.waitForImages( function() { settings['content'] = banner.show(); jQuery.fancybox( settings ); }); } } /** * Call display callbacks. * * @param {string} banner_id id of the banner, without # */ function advads_layer_call_display_callbacks( banner_id ) { // iterate through all callback function and call them advads_items.display_callbacks[ banner_id ] = advads_items.display_callbacks[ banner_id ] || {}; jQuery.each( advads_items.display_callbacks[ banner_id ], function ( key, func ) { if ( typeof func === 'string' ) { func = window[ func ]; } func( banner_id ); }); } /** * return a custom offset extracted from a class name * @param {str} field * @returns {int} offset */ function advads_extract_custom_offset_from_class(field) { var offset = 0; var classes = jQuery(field).attr('class'); if (classes !== undefined) { // create class array classes = classes.split(/\s+/); jQuery.each(classes, function (key, value) { if (value === '') return false; // get information about the solution from a class var pattern = new RegExp(advanced_ads_layer_settings.layer_class + '-offset-', 'gi'); if (value.match(pattern)) { infos = value.split('-'); offset = parseInt(infos[3]) return false; } }); } return offset; }; /** * return a duration extracted from a class name * @param {str} field * @returns {int} offset */ function advads_extract_duration_from_class(field) { var duration = 0; var classes = field.attr('class'); if (classes !== undefined) { // create class array classes = classes.split(/\s+/); jQuery.each(classes, function (key, value) { if (value === '') return false; // get information about the solution from a class if (value.match(/advads-duration-/gi)) { infos = value.split('-'); duration = parseInt(infos[2]) return false; } }); } return duration; }; /** * callback function in case a layer ad is displayed with a background * @param {type} ad object */ function advads_layer_display_background_callback(id) { // display overlay in case it is attached to an ad still not visible var banner = jQuery('#' + id); // only display background if there is an unvisible ad with a background AND no background visible yet if (banner.hasClass('advads-has-background') && banner.is(':hidden')) { //there is background for this ad advads_items.backgrounds[id] = true; if (jQuery('.advads-background').length === 0) { var args = { "class": "advads-background", "style": "position: fixed; bottom: 0; right: 0; display: block; width: 100%; height: 100%; background: #000; z-index: 9998; opacity:.5;", } if ( banner.hasClass( 'advads-background-click-close' ) ) { args.click = function() { jQuery( this ).remove(); advads_layer_close_items(); } } jQuery( '
', args ).appendTo( 'body' ); } } } /** * callback for display effect fadeIn * @param {obj} ad container */ function advads_display_effect_fadein(id) { var banner = jQuery('#' + id); var duration = parseInt(advads_items.effect_durations[id]); banner.fadeIn(duration); } /** * callback for display effect show * @param {obj} ad container */ function advads_display_effect_show(id) { var banner = jQuery('#' + id); var duration = parseInt(advads_items.effect_durations[id]); banner.show(duration); } /** * callback for display effect slideDown * @link http://api.jquery.com/slideDown/ * @param {obj} ad container */ function advads_display_effect_slide(id) { var banner = jQuery('#' + id); var duration = parseInt(advads_items.effect_durations[id]); banner.slideDown(duration); } /** * check, if css transform is supported by user's browser * * [http://stackoverflow.com/a/12625986] */ function getSupportedTransform() { var prefixes = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '); var div = document.createElement('div'); for(var i = 0; i < prefixes.length; i++) { if(div && div.style[prefixes[i]] !== undefined) { return prefixes[i]; } } return false; } /** * set css transform property for the ad * @param {string} jQuery object (wrapped set) * @param {string} values of property */ function set_ad_transform( ad, transform_properties ) { jQuery( ad ).css({ '-webkit-transform': transform_properties, '-moz-transform': transform_properties, 'transform': transform_properties }); } /** * Close item (when user clicks on the close button/background or automatically after n sec.). * * @param {string} item_id Id of the item. */ function advads_layer_close_item( item_id ) { if ( typeof advads_items.close_functions[ item_id ] === 'function' ) { advads_items.close_functions[ item_id ](); advads_items.close_functions[ item_id ] = null; // Close Fancybox window. if ( jQuery.fancybox && typeof jQuery.fancybox.close === 'function' ) { jQuery.fancybox.close(); } } } /** * Close all items. */ function advads_layer_close_items() { for ( var item_id in advads_items.close_functions ) { if ( advads_items.close_functions.hasOwnProperty( item_id ) ) { advads_layer_close_item( item_id ); } } } /** * Close an item if it contains a GAM ad that did not fill the space. */ document.addEventListener( 'aagam_empty_slot', function ( ev ) { const div = document.getElementById( ev.detail ); if ( ! div ) { return; } const layer = div.closest( '.' + document.body.classList.value.split( 'aa-prefix-' )[1].split( ' ' )[0] + 'layer' ); if ( ! layer ) { return; } if ( typeof advads_items.close_functions[layer.id] === 'function' ) { advads_layer_close_item( layer.id ); } else { let interval = setInterval( function () { if ( typeof advads_items.close_functions[layer.id] === 'function' ) { advads_layer_close_item( layer.id ); clearInterval( interval ); } }, 750 ); } } ); //https://github.com/tonai/jquery-onend !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.fn.onEnd=function(){var a,b=Array.prototype.slice.call(arguments),c=b.pop(),d=b.pop(),e=function(){var b=Array.prototype.slice.call(arguments);clearTimeout(a),a=setTimeout(function(){d.apply(this,b)}.bind(this),c)};e.guid=d.guid||(d.guid=jQuery.guid++),b.push(e),this.on.apply(this,b)}}); /*! * Ouibounce * https://github.com/carlsednaoui/ouibounce * * Copyright (c) 2014 Carl Sednaoui * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). **/ !function(e,n){"function"==typeof define&&define.amd?define(n):"object"==typeof exports?module.exports=n(require,exports,module):e.ouibounce=n()}(this,function(e,n,o){return function(e,n){"use strict";function o(e,n){return"undefined"==typeof e?n:e}function i(e){var n=24*e*60*60*1e3,o=new Date;return o.setTime(o.getTime()+n),"; expires="+o.toUTCString()}function t(){s()||(L.addEventListener("mouseleave",u),L.addEventListener("mouseenter",r),L.addEventListener("keydown",c))}function u(e){e.clientY>k||(D=setTimeout(m,y))}function r(){D&&(clearTimeout(D),D=null)}function c(e){g||e.metaKey&&76===e.keyCode&&(g=!0,D=setTimeout(m,y))}function d(e,n){return a()[e]===n}function a(){for(var e=document.cookie.split("; "),n={},o=e.length-1;o>=0;o--){var i=e[o].split("=");n[i[0]]=i[1]}return n}function s(){return d(T,"true")&&!v}function m(){s()||(e&&(e.style.display="block"),E(),f())}function f(e){var n=e||{};"undefined"!=typeof n.cookieExpire&&(b=i(n.cookieExpire)),n.sitewide===!0&&(w=";path=/"),"undefined"!=typeof n.cookieDomain&&(x=";domain="+n.cookieDomain),"undefined"!=typeof n.cookieName&&(T=n.cookieName),document.cookie=T+"=true"+b+x+w,L.removeEventListener("mouseleave",u),L.removeEventListener("mouseenter",r),L.removeEventListener("keydown",c)}var l=n||{},v=l.aggressive||!1,k=o(l.sensitivity,20),p=o(l.timer,1e3),y=o(l.delay,0),E=l.callback||function(){},b=i(l.cookieExpire)||"",x=l.cookieDomain?";domain="+l.cookieDomain:"",T=l.cookieName?l.cookieName:"viewedOuibounceModal",w=l.sitewide===!0?";path=/":"",D=null,L=document.documentElement;setTimeout(t,p);var g=!1;return{fire:m,disable:f,isDisabled:s}}}); /*! waitForImages jQuery Plugin 2015-06-02 */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b="waitForImages";a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"],hasImageAttributes:["srcset"]},a.expr[":"]["has-src"]=function(b){return a(b).is('img[src][src!=""]')},a.expr[":"].uncached=function(b){return a(b).is(":has-src")?!b.complete:!1},a.fn.waitForImages=function(){var c,d,e,f=0,g=0,h=a.Deferred();if(a.isPlainObject(arguments[0])?(e=arguments[0].waitForAll,d=arguments[0].each,c=arguments[0].finished):1===arguments.length&&"boolean"===a.type(arguments[0])?e=arguments[0]:(c=arguments[0],d=arguments[1],e=arguments[2]),c=c||a.noop,d=d||a.noop,e=!!e,!a.isFunction(c)||!a.isFunction(d))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var i=a(this),j=[],k=a.waitForImages.hasImageProperties||[],l=a.waitForImages.hasImageAttributes||[],m=/url\(\s*(['"]?)(.*?)\1\s*\)/g;e?i.find("*").addBack().each(function(){var b=a(this);b.is("img:has-src")&&j.push({src:b.attr("src"),element:b[0]}),a.each(k,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=m.exec(e);)j.push({src:d[2],element:b[0]})}),a.each(l,function(c,d){var e,f=b.attr(d);return f?(e=f.split(","),void a.each(e,function(c,d){d=a.trim(d).split(" ")[0],j.push({src:d,element:b[0]})})):!0})}):i.find("img:has-src").each(function(){j.push({src:this.src,element:this})}),f=j.length,g=0,0===f&&(c.call(i[0]),h.resolveWith(i[0])),a.each(j,function(e,j){var k=new Image,l="load."+b+" error."+b;a(k).one(l,function m(b){var e=[g,f,"load"==b.type];return g++,d.apply(j.element,e),h.notifyWith(j.element,e),a(this).off(l,m),g==f?(c.call(i[0]),h.resolveWith(i[0]),!1):void 0}),k.src=j.src})}),h.promise()}}); ; function advanced_ads_sticky_check_position_fixed() { var container = document.body; if (document.createElement && container && container.appendChild && container.removeChild) { var el = document.createElement( 'div' ); if ( ! el.getBoundingClientRect) { return null; } el.innerHTML = 'x'; el.style.cssText = 'position:fixed;top:100px;'; container.appendChild( el ); var originalHeight = container.style.height, originalScrollTop = container.scrollTop; // In IE<=7, the window's upper-left is at 2,2 (pixels) with respect to the true client. // surprisely, in IE8, the window's upper-left is at -2, -2 (pixels), but other elements // tested is just right, so we need adjust this. // https://groups.google.com/forum/?fromgroups#!topic/comp.lang.javascript/zWJaFM5gMIQ // https://bugzilla.mozilla.org/show_bug.cgi?id=174397 var extraTop = parseInt( document.documentElement.getBoundingClientRect().top, 10 ); extraTop = extraTop > 0 ? extraTop : 0; container.style.height = '3000px'; container.scrollTop = 500; var elementTop = parseInt( el.getBoundingClientRect().top, 10 ); container.style.height = originalHeight; var isSupported = (elementTop - extraTop) === 100; container.removeChild( el ); container.scrollTop = originalScrollTop; return isSupported; } return null; }; // decode sticky ads right after consent is given. document.addEventListener('advanced_ads_privacy', function (event) { if (event.detail.state !== 'accepted' && event.detail.state !== 'not_needed') { return; } window.advanced_ads_sticky_settings.placements.forEach(function (value) { document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"][data-placement="' + value + '"]').forEach(advads.privacy.decode_ad); }); }); // Close an ad if it contains a GAM ad that did not fill the space. document.addEventListener( 'aagam_empty_slot', function ( ev ) { const div = document.getElementById( ev.detail ); if ( ! div ) { return; } const wrapper = div.closest( '.' + document.body.classList.value.split( 'aa-prefix-' )[1].split( ' ' )[0] + 'sticky' ); if ( ! wrapper ) { return; } advads.close( '#' + wrapper.id ); } ); jQuery( document ).ready(function($) { var resize_timeout = null, $el, previous_width = $( window ).width(); // Update position when viewport size changes. function resize_handler() { if ( resize_timeout ) clearTimeout( resize_timeout ); resize_timeout = setTimeout( function() { var new_width = $( window ).width(); if ( previous_width === new_width ) { // Return if the viewport has not actually changed // Scroll event triggered this due to the position of the address bar. return; } previous_width = new_width; if ( typeof advanced_ads_sticky_items !== 'undefined' ) { $.each( advanced_ads_sticky_items, function( wrapper_id, data ) { $el = $( '#' + wrapper_id ); // Apply initial 'position: absolute' styles if 'position: absolute' was transformed to 'position: fixed' // using the 'advads.fix_element' function. $el.prop( 'style', data.initial_css ); // Fix to windows position and/or center vertically again. data.modifying_func(); } ); } }, 1000 ); } if ( 'undefined' === typeof advanced_ads_responsive || ! parseInt( advanced_ads_responsive.reload_on_resize, 10 ) ) { // If the "Reload ads on resize" feature of the Responsive add-on is not used. jQuery( window ).on( 'resize', resize_handler ); } //Remove 'position: fixed' if not supported, if the feature enabled in the settings. if ( typeof advanced_ads_sticky_settings === 'undefined' || ! advanced_ads_sticky_settings.check_position_fixed ) { return; } // story scroll enable value so it isn’t checked multiple times per page view var advanced_ads_sticky_position_fixed_supported = ''; var allowed_offset = $( document.body ).is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; /** * Remove all position related inline styles. * * @param {object=} $stickyads Optional jQuery object. */ function remove_css( $stickyads ) { // if position fixed is unsupported if ( advanced_ads_sticky_position_fixed_supported === false ) { $( window ).off( 'resize', resize_handler ); $stickyads = $stickyads || jQuery( '.' + advanced_ads_sticky_settings.sticky_class ); setTimeout( function() { $stickyads.each( function( key, value ) { var $stickyad = $( value ); if ( window.advanced_ads_sticky_items[ $stickyad.attr( 'id' ) ].can_convert_to_abs ) { $stickyad.css( 'position', 'absolute' ); } else { $stickyad.css( 'position', '' ).css( 'top', '' ).css( 'right', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'margin-left', '' ) .css( 'transform', 'none' ).css( '-webkit-transform', 'none' ).css( '-moz-transform', 'none' ).css( '-ms-transform', 'none' ); } }); } ); } } function scroll_handler() { clearTimeout( $.data( this, 'scrollTimer' ) ); // wait 100ms when scrolling before checking $.data(this, 'scrollTimer', setTimeout(function() { // don’t do anything if scroll position is 0 == top // or admin bar has not been scrolled. if($( document ).scrollTop() <= allowed_offset ) { return; } // check if position fixed is supported; story result in a variable so test runs only once if(advanced_ads_sticky_position_fixed_supported == ''){ advanced_ads_sticky_position_fixed_supported = advanced_ads_sticky_check_position_fixed(); clearTimeout( $.data( this, 'scrollTimer' ) ); $( window ).off( 'scroll', scroll_handler ); } // rewrite sticky ads remove_css(); }, 100)); } if ( navigator.userAgent.indexOf( 'Opera Mini' ) > -1 ) { //Opera mini does not support 'scroll' event. advanced_ads_sticky_position_fixed_supported = false; remove_css(); } else { $( window ).scroll( scroll_handler ); } // When cache-busting inserts new item. if ( typeof advanced_ads_pro === 'object' && advanced_ads_pro !== null ) { advanced_ads_pro.postscribeObservers.add( function (event) { if ( event.event === 'postscribe_done' && event.ref && event.ad ) { var $stickyad = jQuery( event.ref ).children( '.' + advanced_ads_sticky_settings.sticky_class ); if ( $stickyad.length ) { remove_css( $stickyad ); } } } ); } }); ; /*! * imagesLoaded PACKAGED v4.1.4 * JavaScript is all like "You images are done yet or what?" * MIT License */ !function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;oe){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);; !function(e){var t="advads_procfp",a="advanced_ads_ad_clicks",d=null,n=null;function o(e){try{return JSON.parse(e)}catch(e){return null}}e(document).on("advads-passive-cb-conditions",(function(e,t){t.conditions.ad_clicks="check_ad_clicks",t.check_ad_clicks=function(e,t){if(advads.cookie_exists(a+"_"+t.id)){var d=advads.get_cookie(a+"_"+t.id);d=o(d)}if(d){var n=parseInt((new Date).getTime()/1e3);for(var i in d)if("_"+e.expiration==i&&d[i].ttl>=n&&d[i].count>=parseInt(e.limit))return!1}return!0}}));var i=function(){this.$elements={},this.currentIFrame=!1,this.focusLost=!1,this.wrappers=[".google-auto-placed"],this.attributes={"data-anchor-status":"displayed","data-vignette-loaded":"true"},this.lastClick=0,this.init()};i.prototype={constructor:i,init:function(){const t=this;let a;e(document).on("click","a[data-cfpa]",(function(){t.onClick(parseInt(e(this).attr("data-cfpa")))})),e(window).on("blur",(function(e){setTimeout((function(){if(!t.currentIFrame)for(let e=document.activeElement;e&&e!==this&&e!==document&&(t.currentIFrame=t.checkWrappers(e),!t.currentIFrame);e=e.parentNode);t.currentIFrame&&(t.onClick(t.currentIFrame),t.focusLost=!0,top.focus())}),0)})),e(document).on("mouseenter","div[data-cfpa]",(function(){var a=parseInt(e(this).attr("data-cfpa"));t.addElement(a)})),document.addEventListener("touchmove",(function(){a=!0}),!1),document.addEventListener("touchstart",(function(){a=!1}),!1),["click","touchend"].forEach((function(e){document.addEventListener(e,(function(e){if(a||t.getTimestamp()-t.lastClick<1)return;let d=null;for(let a=e.target;a&&a!==this&&a!==document;a=a.parentNode){if(d=t.checkWrappers(a),d){t.onClick(d);break}if(a.hasAttribute("data-cfpa")&&a.hasAttribute("data-cfptl")){d=parseInt(a.getAttribute("data-cfpa"),10),t.onClick(d);break}}}))}))},getTimestamp:function(){return Math.floor(Date.now()/1e3)},checkWrappers:function(e){for(let t=0,a=this.wrappers.length,d=null;t=e&&c[f].count>=parseInt(t[f],10)&&(o.forEach((function(e){e.remove()})),r.removeEmptyWrappers()));var u=new Date,p=new Date(c.exp),v=parseInt((p.getTime()-u.getTime())/1e3);advads.set_cookie_sec(a+"_"+i,JSON.stringify(c,"false",!1),v,d,n)}else{var _={},l=0,m=new Date;u=new Date;for(var f in t)f=f.substring(1),parseFloat(f)>l&&(l=parseFloat(f)),_["_"+f]={count:1,ttl:parseInt(u.getTime()/1e3+3600*parseFloat(f),10)};m.setTime(m.getTime()+60*l*60*1e3);var w="expires="+m.toUTCString();v=parseInt((m.getTime()-u.getTime())/1e3);_.exp=w,advads.set_cookie_sec(a+"_"+i,JSON.stringify(_,"false",!1),v,d,n)}}if(advads.cookie_exists(t+"_"+i)&&(s=o(advads.get_cookie(t+"_"+i))),s){s.count=parseInt(s.count,10)+1;u=new Date,v=((p=new Date(s.exp)).getTime()-u.getTime())/1e3;advads.set_cookie_sec(t+"_"+i,JSON.stringify(s,"false",!1),v,d,n),advadsCfpInfo.cfpClickLimit<=s.count&&void 0!==advadsCfpInfo.cfpBan&&r._banVisitor()}else{m=new Date,u=new Date;m.setTime(m.getTime()+60*advadsCfpInfo.cfpExpHours*60*1e3);w="expires="+m.toUTCString(),v=(m.getTime()-u.getTime())/1e3;advads.set_cookie_sec(t+"_"+i,'{"count":1,"exp":"'+w+'"}',v,d,n),1===advadsCfpInfo.cfpClickLimit&&void 0!==advadsCfpInfo.cfpBan&&r._banVisitor()}}},e((function(){for(var t in window.advadsProCfp=new i,e(document).on("mouseenter","iframe[data-cfpa]",(function(t){var a=parseInt(e(this).attr("data-cfpa"));advadsProCfp.currentIFrame=a})).on("mouseenter",".google-auto-placed",(function(e){advadsProCfp.currentIFrame="google-auto-placed"})).on("mouseleave mouseout","[data-cfpa], .google-auto-placed",(function(){advadsProCfp.currentIFrame=!1,advadsProCfp.focusLost&&(advadsProCfp.focusLost=!1,e(window).trigger("focus"))})),advadsCfpQueue)advadsCfpQueue.hasOwnProperty(t)&&advadsProCfp.addElement(advadsCfpQueue[t]);advadsCfpQueue=[],void 0!==window.advadsCfpInfo.cfpPath&&(""!=advadsCfpInfo.cfpPath&&(d=advadsCfpInfo.cfpPath),""!=advadsCfpInfo.cfpDomain&&(n=advadsCfpInfo.cfpDomain))}))}(window.jQuery);var advanced_ads_resizetimeout=1e3,advanced_ads_cookieexpires=30,advanced_ads_browser_width=advanced_ads_get_browser_width();if(void 0!==window.advads){var cookieValue=advads.get_cookie("advanced_ads_visitor"),info=cookieValue?JSON.parse(cookieValue):{};info.browser_width&&info.browser_width===advanced_ads_browser_width||advanced_ads_save_width(advanced_ads_browser_width)}function advanced_ads_resize_window(){advads_resize_delay((function(){if(advanced_ads_browser_width!==(advanced_ads_browser_width=advanced_ads_get_browser_width())){advanced_ads_save_width(advanced_ads_browser_width);var e=window.advanced_ads_responsive||{};window.jQuery&&parseInt(e.reload_on_resize,10)&&jQuery(document).triggerHandler("advanced-ads-resize-window")}}),advanced_ads_resizetimeout)}function advanced_ads_save_width(e){if(window.advanced_ads_responsive&&void 0!==window.advads){var t=advads.get_cookie("advanced_ads_visitor"),a=t?JSON.parse(t):{};a.browser_width=e,advads.set_cookie("advanced_ads_visitor",JSON.stringify(a),advanced_ads_cookieexpires,advanced_ads_cookies.cookie_path,advanced_ads_cookies.cookie_domain)}}window.addEventListener?window.addEventListener("resize",advanced_ads_resize_window,!1):window.attachEvent&&window.attachEvent("onresize",advanced_ads_resize_window);var advads_resize_delay=function(){var e=0;return function(t,a){clearTimeout(e),e=setTimeout(t,a)}}();function advanced_ads_get_browser_width(){if(window.jQuery)return jQuery(window).width();var e=0;return"number"==typeof window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),e}; document.addEventListener('DOMContentLoaded', function() { const dropdownToggle = document.querySelector('.ap-dropdown-toggle.ap-filter-toggle'); if (dropdownToggle) { dropdownToggle.setAttribute('aria-expanded', 'false'); dropdownToggle.setAttribute('aria-live', 'polite'); dropdownToggle.setAttribute('role', 'combobox'); dropdownToggle.setAttribute('aria-haspopup', 'listbox'); dropdownToggle.setAttribute('aria-controls', 'dropdown-list'); dropdownToggle.setAttribute('aria-autocomplete', 'none'); } }); ; if (window.location.href.includes("subscriptions")) { document.addEventListener("DOMContentLoaded", () => { const ariaStatus = document.getElementById("recaptcha-accessible-status"); if (ariaStatus) { ariaStatus.removeAttribute("aria-hidden"); ariaStatus.setAttribute("aria-live", "assertive"); ariaStatus.setAttribute("role", "alert"); } }); } ; var AdvAdsTrackingUtils={hasAd:function(a){for(var e in a)if(Array.isArray(a[e])&&a[e].length)return!0;return!1},param:function(a){return Object.keys(a).map((function(e){return Array.isArray(a[e])?Object.keys(a[e]).map((function(t){return encodeURIComponent(e)+"[]="+encodeURIComponent(a[e][t])})).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(a[e])})).join("&").replace(/%20/g,"+")},concat:function(){var a=Array.prototype.slice.call(arguments),e={};for(var t in a)for(var d in a[t])void 0===e[d]?e[d]=a[t][d]:"function"==typeof e[d].concat&&(e[d]=e[d].concat(a[t][d]));return e},adsByBlog:function(a,e){var t={};return void 0!==a[e]&&(t[e]=a[e]),t},getPrefixedAttribute:function(a){return""+window.advadsTracking.frontendPrefix+a},getPrefixedDataSetAttribute:function(a){return this.getPrefixedAttribute(a).toLowerCase().replace("data-","").replace(/-([a-z]?)/g,((a,e)=>e.toUpperCase()))},extend:function(){var a={};for(var e in arguments){var t=arguments[e];for(var d in t)Object.prototype.hasOwnProperty.call(t,d)&&(a[d]=t[d])}return a},inArray:function(a,e){return e.indexOf(a)>-1},findParentByClassName:function(a,e){for(;(a=a.parentElement)&&!a.classList.contains(e););return a},getTimestamp:function(){return Date.now||(Date.now=function(){return(new Date).getTime()}),Math.floor(Date.now()/1e3)},arrayUnique:function(a,e,t){return t.indexOf(a)===e},blogUseGA:function(a){return("ga"===advads_tracking_methods[a]||advads_tracking_parallel[a])&&!!advads_gatracking_uids[a]},post:function(a,e,t){var d=new XMLHttpRequest;return d.timeout=5e3,new Promise((function(r,s){d.onreadystatechange=function(){d.readyState===XMLHttpRequest.DONE&&(0===d.status||d.status>=200&&d.status<300?r(d):s({status:d.status,statusText:d.statusText}))},d.open("POST",a,t||!0),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),d.send("string"==typeof e?e:AdvAdsTrackingUtils.param(e))}))}},AdvAdsImpressionTracker={ajaxAds:{},passiveAds:{},initialAds:{},removeDelayedAds:function(a){var e=document.querySelectorAll("[data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")+'][data-delayed="1"]'),t=e.length;if(!t)return a;for(var d=0;d-1&&a[s].splice(i,1)}}return a},track:function(a,e){if(e=e||"all",AdvAdsTrackingUtils.hasAd(a))for(var t in a){if(AdvAdsTrackingUtils.blogUseGA(t)&&(advadsGATracking.deferedAds=AdvAdsTrackingUtils.concat(advadsGATracking.deferedAds,AdvAdsTrackingUtils.adsByBlog(a,t)),"delayed"===e?this.triggerEvent("advadsGADelayedTrack"):this.triggerEvent("advadsGADeferedTrack"),"ajax"===e&&AdvAdsTrackingUtils.hasAd(AdvAdsTrackingUtils.adsByBlog(this.ajaxAds,t))))for(var d in this.ajaxAds[t]){a[t].indexOf(this.ajaxAds[t][d])>-1&&this.ajaxAds[t].splice(d,1)}"ajax"===e||"frontend"!==advads_tracking_methods[t]&&"onrequest"!==advads_tracking_methods[t]||this.sendTrack(t,a[t]),this.ajaxAds={}}},triggerEvent:function(a){var e=new CustomEvent(a);document.dispatchEvent(e)},sendTrack:function(a,e){e.length&&AdvAdsTrackingUtils.post(advads_tracking_urls[a],{ads:e,action:window.advadsTracking.impressionActionName,referrer:window.location.pathname+window.location.search,bid:a})}};!function(){var a=function(){if("undefined"!=typeof advads_tracking_ads&&(advads_tracking_ads=AdvAdsImpressionTracker.removeDelayedAds(advads_tracking_ads),AdvAdsTrackingUtils.hasAd(advads_tracking_ads)))for(var a in advads_tracking_ads)"frontend"===advads_tracking_methods[a]&&("undefined"!=typeof advads&&void 0!==advads.privacy.is_ad_decoded&&(advads_tracking_ads[a]=advads_tracking_ads[a].filter(advads.privacy.is_ad_decoded)),AdvAdsImpressionTracker.track(advads_tracking_ads),advads_tracking_ads={1:[]})};function e(a,e,t){return void 0===a[e]&&(a[e]=[]),a[e].push(t),a}function t(){return"undefined"!=typeof advads&&"unknown"===advads.privacy.get_state()}document.addEventListener("advads_track_async",(function(d){const r=d.detail.bid,s=d.detail.ad;switch(advads_tracking_methods[r]){case"frontend":"undefined"==typeof advads_tracking_ads&&(advads_tracking_ads={}),advads_tracking_ads=e(advads_tracking_ads,r,s),t()||a();break;case"ga":void 0===advadsGATracking.delayedAds&&(advadsGATracking.delayedAds={}),advadsGATracking.delayedAds=e(advadsGATracking.delayedAds,r,s),t()||AdvAdsImpressionTracker.triggerEvent("advadsGADelayedTrack")}})),t()?document.addEventListener("advanced_ads_privacy",(function(e){"unknown"===e.detail.previousState&&a()})):advanced_ads_ready(a,"interactive")}(),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);var AdvAdsClickTracker={wrappers:[],overTarget:!1,currentTarget:!1,lastClick:[],elements:["iframe","a.adv-link","button.adv-link"],targets:["aswift_0","aswift_1","aswift_3","aswift_4","aswift_5","aswift_6","aswift_7","aswift_8","aswift_9"],findTargets:function(){AdvAdsClickTracker.wrappers.forEach((function(a){document.querySelectorAll(a).forEach((function(a){null!==a&&AdvAdsClickTracker.elements.forEach((function(e){Array.prototype.push.apply(AdvAdsClickTracker.targets,Array.prototype.slice.call(a.querySelectorAll(e)))}))}))})),AdvAdsClickTracker.targets=AdvAdsClickTracker.targets.filter(AdvAdsTrackingUtils.arrayUnique),this.processTargets()},processTargets:function(){AdvAdsClickTracker.targets.forEach((function(a){AdvAdsClickTracker.registerTargetHandlers(a)}))},registerTargetHandlers:function(a){a.onmouseover=this.mouseOver,a.onmouseout=this.mouseOut,void 0!==window.attachEvent?top.attachEvent("onblur",this.adClick):void 0!==window.addEventListener&&top.addEventListener("blur",this.adClick,!1)},registerWrapperHandlers:function(){var a;["click","touchend","auxclick"].forEach((function(e){document.addEventListener(e,(function(e){if(!("auxclick"===e.type&&2!==e.which&&1!==e.which||a)){var t=!1;-1!==["a","iframe","button"].indexOf(e.target.localName)&&(t=!0);for(var d=e.target;d&&d!==this;d=d.parentNode){null===d.parentNode||t||-1===["a","iframe","button"].indexOf(d.parentNode.localName)||(t=!0);var r=!1;if(AdvAdsClickTracker.wrappers.forEach((function(a){(d.matches?d.matches(a):d.msMatchesSelector(a))&&(e.target.classList.contains("notrack")||!t&&null===d.querySelector("iframe")||(r=!0))})),r){if(this.currentTarget===e.target)return;AdvAdsClickTracker.ajaxSend(e.target);break}}}}),{capture:!0})})),document.addEventListener("touchmove",(function(e){a=!0}),!1),document.addEventListener("touchstart",(function(e){a=!1}),!1)},adClick:function(){AdvAdsClickTracker.overTarget&&(AdvAdsClickTracker.ajaxSend(AdvAdsClickTracker.currentTarget),top.focus())},mouseOver:function(){AdvAdsClickTracker.overTarget=!0,AdvAdsClickTracker.currentTarget=this},mouseOut:function(){AdvAdsClickTracker.overTarget=!1,AdvAdsClickTracker.currentTarget=!1,top.focus()},ajaxSend:function(a){var e=a.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")),t=a.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")),d=a.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("redirect"));if(null===e){var r=AdvAdsTrackingUtils.findParentByClassName(a,[advadsTracking.targetClass]);e=r.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")),t=r.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")),d=r.getAttribute("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("redirect"))}var s=advads_tracking_urls[t],i={action:window.advadsTracking.clickActionName,referrer:window.location.pathname+window.location.search,type:"ajax",ads:[e],bid:t};if(10>AdvAdsTrackingUtils.getTimestamp()-this.lastClick[e])return!1;if(AdvAdsTrackingUtils.blogUseGA(t)&&(advancedAdsGAInstances.getInstance(t).trackClick(e,!1,!1,!1),this.lastClick[e]=AdvAdsTrackingUtils.getTimestamp(),!advads_tracking_parallel[t]))return;if(!d){if(navigator.sendBeacon&&-1===s.indexOf("admin-ajax.php")){var n=JSON.parse(JSON.stringify(i));n.type="beacon",n=new Blob([JSON.stringify(n)],{type:"application/json; charset=UTF-8"}),navigator.sendBeacon(s,n)}else AdvAdsTrackingUtils.post(s,i,!1);this.lastClick[e]=AdvAdsTrackingUtils.getTimestamp()}}};advanced_ads_ready((function(){AdvAdsClickTracker.wrappers=null!==advadsTracking.targetClass&&""!==advadsTracking.targetClass?Array("."+advadsTracking.targetClass,".adsbygoogle"):Array(" ",".adsbygoogle"),window.onpageshow=function(a){a&&a.persisted&&window.location.reload()},setTimeout((function(){AdvAdsClickTracker.findTargets()}),1500),AdvAdsClickTracker.registerWrapperHandlers()}),"interactive"),"undefined"!=typeof advanced_ads_pro&&advanced_ads_pro.observers.add((function(a){if(-1!==["inject_passive_ads","inject_ajax_ads","advanced_ads_decode_inserted_ads","inject_placement"].indexOf(a.event)){Array.isArray(a.ad_ids)&&!a.ad_ids.length&&(a.ad_ids={});var e="all",t={};switch("complete"!==document.readyState?document.addEventListener("readystatechange",(function(a){"complete"===a.target.readyState&&AdvAdsClickTracker.findTargets()})):AdvAdsClickTracker.findTargets(),a.event){case"inject_passive_ads":for(var d in AdvAdsImpressionTracker.passiveAds=AdvAdsTrackingUtils.concat(AdvAdsImpressionTracker.passiveAds,a.ad_ids),a.ad_ids)if("frontend"===advads_tracking_methods[d]?(t=AdvAdsTrackingUtils.concat(advads_tracking_ads,a.ad_ids),advads_tracking_ads={1:[]}):(e="passive",t=a.ad_ids),"undefined"!=typeof advads&&void 0!==advads.privacy.is_ad_decoded)for(var d in t)t[d]=t[d].filter(advads.privacy.is_ad_decoded);break;case"inject_ajax_ads":var r="undefined"!=typeof advads&&window.advads_options.privacy.enabled&&"iab_tcf_20"===window.advads_options.privacy["consent-method"];for(var d in a.ad_ids)if(AdvAdsTrackingUtils.blogUseGA(d)||r)for(var s in a.ad_ids[d]){var i=document.querySelector("[data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")+'="'+a.ad_ids[d][s]+'"][data-'+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")+'="'+d+'"]');null!==i&&"undefined"!=typeof advads_items&&void 0!==advads_items.showed&&advads_items.showed.indexOf(i.id)>-1&&void 0!==i.dataset.delayed||(void 0===AdvAdsImpressionTracker.ajaxAds[d]&&(AdvAdsImpressionTracker.ajaxAds[d]=[]),AdvAdsImpressionTracker.ajaxAds[d].push(a.ad_ids[d][s]))}e=r&&"frontend"===advads_tracking_methods[d]?"all":"ajax",t=JSON.parse(JSON.stringify(AdvAdsImpressionTracker.ajaxAds));break;case"advanced_ads_decode_inserted_ads":t=a.ad_ids}advanced_ads_pro.busy?document.addEventListener("advanced_ads_pro.idle",(function(){AdvAdsImpressionTracker.track(AdvAdsImpressionTracker.removeDelayedAds(t),e)}),{once:!0}):AdvAdsImpressionTracker.track(AdvAdsImpressionTracker.removeDelayedAds(t),e)}}));; const advancedAdsGAInstances={instances:[],getInstance:function(a){return void 0===this.instances[a]&&(this.instances[a]=new AdvAdsGATracker(a,advads_gatracking_uids[a])),this.instances[a]}};function AdvAdsGATracker(a,d){this.blogId=a,this.propertyIds="string"==typeof d?[d]:d,this.normalTrackingDone=!1,this.clickTimer=null;const e=this;return this.getQueryString=function(a){var d=document.createElement("a");d.href=a;var e=d.search;if(e.length&&(e=(e=e.substr(1)).split("&")).length){var n={};for(var t in e){var s=e[t].split("=");n[s[0]]=s[1]}return n}return[]},this.appendQueryString=function(a,d){for(var e in d)-1!==a.indexOf("?")?a+="&"+e+"="+d[e]:a+="?"+e+"="+d[e];return a},this.trackImpressions=function(a){void 0===a&&(a=!1);var d=[];if(!this.normalTrackingDone&&AdvAdsTrackingUtils.hasAd(AdvAdsTrackingUtils.adsByBlog(advads_tracking_ads,e.blogId))&&(d=d.concat(advads_tracking_ads[e.blogId])),"frontend"===advads_tracking_methods[e.blogId]&&(d=[]),a?void 0!==advadsGATracking.delayedAds&&AdvAdsTrackingUtils.hasAd(AdvAdsTrackingUtils.adsByBlog(advadsGATracking.delayedAds,e.blogId))&&(d=d.concat(advadsGATracking.delayedAds[e.blogId]),advadsGATracking.delayedAds[e.blogId]=[]):void 0!==advadsGATracking.deferedAds&&AdvAdsTrackingUtils.hasAd(AdvAdsTrackingUtils.adsByBlog(advadsGATracking.deferedAds,e.blogId))&&(d=d.concat(advadsGATracking.deferedAds[e.blogId]),advadsGATracking.deferedAds[e.blogId]=[]),"undefined"!=typeof advads&&void 0!==advads.privacy.is_ad_decoded&&(d=d.filter(advads.privacy.is_ad_decoded)),d.length){for(var n in d)void 0!==advads_gatracking_allads[e.blogId][d[n]]&&advads_gatracking_allads[e.blogId][d[n]].impression&&e.sendEvent(window.advadsTrackingGAEvents.impression,{event_category:"Advanced Ads",event_label:"["+d[n]+"] "+advads_gatracking_allads[e.blogId][d[n]].title,non_interaction:!0});this.normalTrackingDone=!0}},this.trackClick=function(a,d,n,t){void 0===d&&(d=!0);var s={event_category:"Advanced Ads",event_label:"["+a+"] "+advads_gatracking_allads[e.blogId][a].title,non_interaction:!0};if(n||t){var i=advads_gatracking_allads[e.blogId][a].target;void 0===advadsGATracking.postContext&&(i=(i=(i=i.replace("[CAT_SLUG]",advadsGATracking.postContext.cats)).replace("[POST_ID]",advadsGATracking.postContext.postID)).replace("[POST_SLUG]",advadsGATracking.postContext.postSlug)),i=i.replace("[AD_ID]",a);var r=t.getAttribute("href");d?i=r:(i=e.appendQueryString(i,e.getQueryString(r)),void 0!==advads_gatracking_transmitpageqs[e.blogId]&&advads_gatracking_transmitpageqs[e.blogId][a]&&(i=e.appendQueryString(i,e.getQueryString(document.location.href))));var c=!!t.getAttribute("target");if(c)e.sendEvent(window.advadsTrackingGAEvents.click,s),d||t.setAttribute("href",i);else{function o(){null!==e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),window.location=i}n.preventDefault(),e.clickTimer=setTimeout((function(){o()}),1e3),s.event_callback=o,e.sendEvent(window.advadsTrackingGAEvents.click,s)}}else e.sendEvent(window.advadsTrackingGAEvents.click,s)},this.sendEvent=(a,d)=>{e.propertyIds.forEach((e=>{d.send_to=e,gtag("event",a,structuredClone(d))}))},function(){if("function"!=typeof gtag){var a=document.createElement("script");a.src="https://www.googletagmanager.com/gtag/js",a.async=!0,document.body.appendChild(a),window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},gtag("js",new Date)}var d={send_page_view:!1,transport_type:"beacon"};window.advads_gatracking_anonym&&(d.anonymize_ip=!0),e.propertyIds.forEach((a=>{gtag("config",a,d)})),document.addEventListener("advadsGADeferedTrack",(function(){e.trackImpressions(!1)})),document.addEventListener("advadsGADelayedTrack",(function(){e.trackImpressions(!0)})),e.trackImpressions()}(),this}document.addEventListener("DOMContentLoaded",(function(){for(let a in advads_tracking_methods)if(a=parseInt(a,10),!isNaN(a)&&AdvAdsTrackingUtils.blogUseGA(a)){if("undefined"!=typeof advads&&"unknown"===advads.privacy.get_state())return void document.addEventListener("advanced_ads_privacy",(function(d){"not_needed"!==d.detail.state&&"accepted"!==d.detail.state||advancedAdsGAInstances.getInstance(a)}));advancedAdsGAInstances.getInstance(a)}}));; !function(){var t="advads-sticky-trigger";"undefined"!=typeof advanced_ads_layer_settings&&(t+=" "+advanced_ads_layer_settings.layer_class+"-trigger"),jQuery(document).on(t,(function(t){var d=jQuery(t.target),a={},e=parseInt(d.attr("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")),10),r=parseInt(d.attr("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")),10),i=function(t,d){void 0===a[d]&&(a[d]=[]),a[d].push(t)};if(e){if(!d.data("delayed")||!d.data(AdvAdsTrackingUtils.getPrefixedAttribute("impression")))return;i(r,e)}else{if(!d.find("[data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")+"]").length)return;d.find("[data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")+"]").each((function(){var t=jQuery(this);t.data("delayed")&&t.data(AdvAdsTrackingUtils.getPrefixedAttribute("impression"))&&(e=parseInt(t.attr("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackbid")),10),r=parseInt(t.attr("data-"+AdvAdsTrackingUtils.getPrefixedAttribute("trackid")),10),i(r,e))}))}AdvAdsTrackingUtils.blogUseGA(e)&&(advadsGATracking.delayedAds=AdvAdsTrackingUtils.concat(advadsGATracking.delayedAds,a)),AdvAdsImpressionTracker.track(a,"delayed")}))}(jQuery);; !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t),t}:a(jQuery)}(function(O){"use strict";var d=/\r?\n/g,h={},X=(h.fileapi=void 0!==O('').get(0).files,h.formdata=void 0!==window.FormData,!!O.fn.prop);function o(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),O(e.target).closest("form").ajaxSubmit(t))}function i(e){var t=e.target,a=O(t);if(!a.is("[type=submit],[type=image]")){var r=a.closest("[type=submit]");if(0===r.length)return;t=r[0]}var n=t.form;"image"===(n.clk=t).type&&(void 0!==e.offsetX?(n.clk_x=e.offsetX,n.clk_y=e.offsetY):"function"==typeof O.fn.offset?(r=a.offset(),n.clk_x=e.pageX-r.left,n.clk_y=e.pageY-r.top):(n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function C(){var e;O.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}O.fn.attr2=function(){var e;return X&&((e=this.prop.apply(this,arguments))&&e.jquery||"string"==typeof e)?e:this.attr.apply(this,arguments)},O.fn.ajaxSubmit=function(F,e,t,a){if(this.length){var E,L=this,e=("function"==typeof F?F={success:F}:"string"==typeof F||!1===F&&0',c)).css({position:"absolute",top:"-1000px",left:"-1000px"}),d=f[0],m={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";C("aborting upload... "+t),this.aborted=1;try{d.contentWindow.document.execCommand&&d.contentWindow.document.execCommand("Stop")}catch(e){}f.attr("src",l.iframeSrc),m.error=t,l.error&&l.error.call(l.context,m,t,e),u&&O.event.trigger("ajaxError",[m,l,t]),l.complete&&l.complete.call(l.context,m,t)}},(u=l.global)&&0==O.active++&&O.event.trigger("ajaxStart"),u&&O.event.trigger("ajaxSend",[m,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,m,l)?(l.global&&O.active--,g.reject()):m.aborted?g.reject():((e=o.clk)&&(r=e.name)&&!e.disabled&&(l.extraData=l.extraData||{},l.extraData[r]=e.value,"image"===e.type)&&(l.extraData[r+".x"]=o.clk_x,l.extraData[r+".y"]=o.clk_y),v=1,x=2,e=O("meta[name=csrf-token]").attr("content"),(r=O("meta[name=csrf-param]").attr("content"))&&e&&(l.extraData=l.extraData||{},l.extraData[r]=e),l.forceSync?n():setTimeout(n,10),T=50,w=O.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},i=O.parseJSON||function(e){return window.eval("("+e+")")},S=function(e,t,a){var r=e.getResponseHeader("content-type")||"",n=("xml"===t||!t)&&0<=r.indexOf("xml"),e=n?e.responseXML:e.responseText;return n&&"parsererror"===e.documentElement.nodeName&&O.error&&O.error("parsererror"),"string"==typeof(e=a&&a.dataFilter?a.dataFilter(e,t):e)&&(("json"===t||!t)&&0<=r.indexOf("json")?e=i(e):("script"===t||!t)&&0<=r.indexOf("javascript")&&O.globalEval(e)),e}),g;function D(t){var a=null;try{t.contentWindow&&(a=t.contentWindow.document)}catch(e){C("cannot get iframe.contentWindow document: "+e)}if(!a)try{a=t.contentDocument||t.document}catch(e){C("cannot get iframe.contentDocument: "+e),a=t.document}return a}function n(){var e=L.attr2("target"),t=L.attr2("action"),a=L.attr("enctype")||L.attr("encoding")||"multipart/form-data";o.setAttribute("target",s),E&&!/post/i.test(E)||o.setAttribute("method","POST"),t!==l.url&&o.setAttribute("action",l.url),l.skipEncodingOverride||E&&!/post/i.test(E)||L.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(h=setTimeout(function(){p=!0,A(v)},l.timeout));var r=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(O.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?r.push(O('',c).val(l.extraData[n].value).appendTo(o)[0]):r.push(O('',c).val(l.extraData[n]).appendTo(o)[0]));l.iframeTarget||f.appendTo(k),d.attachEvent?d.attachEvent("onload",A):d.addEventListener("load",A,!1),setTimeout(function e(){try{var t=D(d).readyState;C("state = "+t),t&&"uninitialized"===t.toLowerCase()&&setTimeout(e,50)}catch(e){C("Server abort: ",e," (",e.name,")"),A(x),h&&clearTimeout(h),h=void 0}},15);try{o.submit()}catch(e){document.createElement("form").submit.apply(o)}}finally{o.setAttribute("action",t),o.setAttribute("enctype",a),e?o.setAttribute("target",e):L.removeAttr("target"),O(r).remove()}}function A(t){if(!m.aborted&&!j)if((b=D(d))||(C("cannot access response document"),t=x),t===v&&m)m.abort("timeout"),g.reject(m,"timeout");else if(t===x&&m)m.abort("server abort"),g.reject(m,"error","server abort");else if(b&&b.location.href!==l.iframeSrc||p){d.detachEvent?d.detachEvent("onload",A):d.removeEventListener("load",A,!1);var a,t="success";try{if(p)throw"timeout";var e="xml"===l.dataType||b.XMLDocument||O.isXMLDoc(b);if(C("isXml="+e),!e&&window.opera&&(null===b.body||!b.body.innerHTML)&&--T)return C("requeing onLoad callback, DOM not available"),void setTimeout(A,250);var r,n,o,i=b.body||b.documentElement,s=(m.responseText=i?i.innerHTML:null,m.responseXML=b.XMLDocument||b,e&&(l.dataType="xml"),m.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},i&&(m.status=Number(i.getAttribute("status"))||m.status,m.statusText=i.getAttribute("statusText")||m.statusText),(l.dataType||"").toLowerCase()),c=/(json|script|text)/.test(s);c||l.textarea?(r=b.getElementsByTagName("textarea")[0])?(m.responseText=r.value,m.status=Number(r.getAttribute("status"))||m.status,m.statusText=r.getAttribute("statusText")||m.statusText):c&&(n=b.getElementsByTagName("pre")[0],o=b.getElementsByTagName("body")[0],n?m.responseText=n.textContent||n.innerText:o&&(m.responseText=o.textContent||o.innerText)):"xml"===s&&!m.responseXML&&m.responseText&&(m.responseXML=w(m.responseText));try{y=S(m,s,l)}catch(e){t="parsererror",m.error=a=e||t}}catch(e){C("error caught: ",e),t="error",m.error=a=e||t}m.aborted&&(C("upload aborted"),t=null),"success"===(t=m.status?200<=m.status&&m.status<300||304===m.status?"success":"error":t)?(l.success&&l.success.call(l.context,y,"success",m),g.resolve(m.responseText,"success",m),u&&O.event.trigger("ajaxSuccess",[m,l])):t&&(void 0===a&&(a=m.statusText),l.error&&l.error.call(l.context,m,t,a),g.reject(m,"error",a),u)&&O.event.trigger("ajaxError",[m,l,a]),u&&O.event.trigger("ajaxComplete",[m,l]),u&&!--O.active&&O.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,m,t),j=!0,l.timeout&&clearTimeout(h),setTimeout(function(){l.iframeTarget?f.attr("src",l.iframeSrc):f.remove(),m.responseXML=null},100)}}}},O.fn.ajaxForm=function(e,t,a,r){var n;return("string"==typeof e||!1===e&&0 * @author Ris Adams */ (function (root, factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = factory(require('jquery')); } else { root.Selectize = factory(root.jQuery); } }(this, function ($) { 'use strict'; var highlight=function(t,e){var r,a;if("string"!=typeof e||e.length)return r="string"==typeof e?new RegExp(e,"i"):e,a=function(t){var e=0;if(3===t.nodeType){var n,i,o=t.data.search(r);0<=o&&0/g,">").replace(/"/g,""")},escape_replace=function(t){return(t+"").replace(/\$/g,"$$$$")},hook={before:function(t,e,n){var i=t[e];t[e]=function(){return n.apply(t,arguments),i.apply(t,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},once=function(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}},debounce=function(n,i){var o;return function(){var t=this,e=arguments;window.clearTimeout(o),o=window.setTimeout(function(){n.apply(t,e)},i)}},debounce_events=function(e,n,t){var i,o=e.trigger,s={};for(i in e.trigger=function(){var t=arguments[0];if(-1===n.indexOf(t))return o.apply(e,arguments);s[t]=arguments},t.apply(e,[]),e.trigger=o,s)s.hasOwnProperty(i)&&o.apply(e,s[i])},watchChildEvent=function(n,t,e,i){n.on(t,e,function(t){for(var e=t.target;e&&e.parentNode!==n[0];)e=e.parentNode;return t.currentTarget=e,i.apply(this,[t])})},getInputSelection=function(t){var e,n,i={};return void 0===t?console.warn("WARN getInputSelection cannot locate input control"):"selectionStart"in t?(i.start=t.selectionStart,i.length=t.selectionEnd-i.start):document.selection&&(t.focus(),e=document.selection.createRange(),n=document.selection.createRange().text.length,e.moveStart("character",-t.value.length),i.start=e.text.length-n,i.length=n),i},transferStyles=function(t,e,n){var i,o,s={};if(n)for(i=0,o=n.length;i").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),$("
").css({position:"absolute",width:0,height:0,overflow:"hidden"}).append(Selectize.$testInput).appendTo("body")),Selectize.$testInput.text(t),transferStyles(e,Selectize.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),Selectize.$testInput.width()):0},autoGrow=function(s){function t(t,e){var n,i,o;e=e||{},(t=t||window.event||{}).metaKey||t.altKey||!e.force&&!1===s.data("grow")||(e=s.val(),t.type&&"keydown"===t.type.toLowerCase()&&(n=48<=(i=t.keyCode)&&i<=57||65<=i&&i<=90||96<=i&&i<=111||186<=i&&i<=222||32===i,i===KEY_DELETE||i===KEY_BACKSPACE?(o=getInputSelection(s[0])).length?e=e.substring(0,o.start)+e.substring(o.start+o.length):i===KEY_BACKSPACE&&o.start?e=e.substring(0,o.start-1)+e.substring(o.start+1):i===KEY_DELETE&&void 0!==o.start&&(e=e.substring(0,o.start)+e.substring(o.start+1)):n&&(i=t.shiftKey,o=String.fromCharCode(t.keyCode),e+=o=i?o.toUpperCase():o.toLowerCase())),t=(n=s.attr("placeholder"))?measureString(n,s)+4:0,(i=Math.max(measureString(e,s),t)+4)===r)||(r=i,s.width(i),s.triggerHandler("resize"))}var r=null;s.on("keydown keyup update blur",t),t()},domToString=function(t){var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML},logError=function(t,e){e=e||{};console.error("Selectize: "+t),e.explanation&&(console.group&&console.group(),console.error(e.explanation),console.group)&&console.groupEnd()},isJSON=function(t){try{JSON.parse(str)}catch(t){return!1}return!0},Selectize=function(t,e){var n,i,o=this,s=t[0],r=(s.selectize=o,window.getComputedStyle&&window.getComputedStyle(s,null));if(r=(r?r.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(o,{order:0,settings:e,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?TAG_SELECT:TAG_INPUT,rtl:/rtl/i.test(r),eventNS:".selectize"+ ++Selectize.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",lastOpenTarget:!1,caretPos:0,loading:0,loadedSearches:{},isDropdownClosing:!1,$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===e.loadThrottle?o.onSearchChange:debounce(o.onSearchChange,e.loadThrottle)}),o.sifter=new Sifter(this.options,{diacritics:e.diacritics}),o.settings.options){for(n=0,i=o.settings.options.length;n").addClass(t.wrapperClass).addClass(a+" selectize-control").addClass(r),p=$("
").addClass(t.inputClass+" selectize-input items").appendTo(l),c=$('').appendTo(p).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),u=$(t.dropdownParent||l),r=$("
").addClass(t.dropdownClass).addClass(r+" selectize-dropdown").hide().appendTo(u),u=$("
").addClass(t.dropdownContentClass+" selectize-dropdown-content").attr("tabindex","-1").appendTo(r),d=((d=s.attr("id"))&&(c.attr("id",d+"-selectized"),$("label[for='"+d+"']").attr("for",d+"-selectized")),e.settings.copyClassesToDropdown&&r.addClass(a),l.css({width:s[0].style.width}),e.plugins.names.length&&(d="plugin-"+e.plugins.names.join(" plugin-"),l.addClass(d),r.addClass(d)),(null===t.maxItems||1[data-selectable]",function(t){t.stopImmediatePropagation()}),r.on("mouseenter","[data-selectable]",function(){return e.onOptionHover.apply(e,arguments)}),r.on("mouseup click","[data-selectable]",function(){return e.onOptionSelect.apply(e,arguments)}),watchChildEvent(p,"mouseup","*:not(input)",function(){return e.onItemSelect.apply(e,arguments)}),autoGrow(c),p.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),c.on({mousedown:function(t){""===e.$control_input.val()&&!e.settings.openOnFocus||t.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},input:function(){return e.onInput.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},focus:function(){return e.ignoreBlur=!1,e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),o.on("keydown"+n,function(t){e.isCmdDown=t[IS_MAC?"metaKey":"ctrlKey"],e.isCtrlDown=t[IS_MAC?"altKey":"ctrlKey"],e.isShiftDown=t.shiftKey}),o.on("keyup"+n,function(t){t.keyCode===KEY_CTRL&&(e.isCtrlDown=!1),t.keyCode===KEY_SHIFT&&(e.isShiftDown=!1),t.keyCode===KEY_CMD&&(e.isCmdDown=!1)}),o.on("mousedown"+n,function(t){if(e.isFocused){if(t.target===e.$dropdown[0]||t.target.parentNode===e.$dropdown[0])return!1;e.$dropdown.has(t.target).length||t.target===e.$control[0]||e.blur(t.target)}}),i.on(["scroll"+n,"resize"+n].join(" "),function(){e.isOpen&&e.positionDropdown.apply(e,arguments)}),i.on("mousemove"+n,function(){e.ignoreHover=e.settings.ignoreHover}),$("
")),a=s.children().detach();s.replaceWith(d),d.replaceWith(s),this.revertSettings={$children:a,tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),Array.isArray(t.items)&&(e.lastValidValue=t.items,e.setValue(t.items),delete t.items),SUPPORTS_VALIDITY_API&&s.on("invalid"+n,function(t){t.preventDefault(),e.isInvalid=!0,e.refreshState()}),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),!0===t.preload&&e.onSearchChange("")},setupTemplates:function(){var t=this,i=t.settings.labelField,o=t.settings.valueField,n=t.settings.optgroupLabelField;t.settings.render=$.extend({},{optgroup:function(t){return'
'+t.html+"
"},optgroup_header:function(t,e){return'
'+e(t[n])+"
"},option:function(t,e){var n=t.classes?" "+t.classes:"";return n+=""===t[o]?" selectize-dropdown-emptyoptionlabel":"","'+e(t[i])+"
"},item:function(t,e){return'
'+e(t[i])+"
"},option_create:function(t,e){return'
Add '+e(t.input)+"
"}},t.settings.render)},setupCallbacks:function(){var t,e,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(t in n)n.hasOwnProperty(t)&&(e=this.settings[n[t]])&&this.on(t,e)},onClick:function(t){this.isDropdownClosing||this.isFocused&&this.isOpen||(this.focus(),t.preventDefault())},onMouseDown:function(t){var e=this,n=t.isDefaultPrevented();$(t.target);if(e.isFocused||n||window.setTimeout(function(){e.focus()},0),t.target!==e.$control_input[0]||""===e.$control_input.val())return"single"===e.settings.mode?e.isOpen?e.close():e.open():(n||e.setActiveItem(null),e.settings.openOnFocus||(e.isOpen&&t.target===e.lastOpenTarget?(e.close(),e.lastOpenTarget=!1):(e.isOpen||(e.refreshOptions(),e.open()),e.lastOpenTarget=t.target))),!1},onChange:function(){""!==this.getValue()&&(this.lastValidValue=this.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(t){var o=this;o.isFull()||o.isInputHidden||o.isLocked?t.preventDefault():o.settings.splitOn&&setTimeout(function(){var t=o.$control_input.val();if(t.match(o.settings.splitOn))for(var e=t.trim().split(o.settings.splitOn),n=0,i=e.length;n=this.settings.maxItems},updateOriginalInput:function(t){var e,n,i,o,s,r,a=this;t=t||{},a.tagType===TAG_SELECT?(o=a.$input.find("option"),e=[],n=[],i=[],r=[],o.get().forEach(function(t){e.push(t.value)}),a.items.forEach(function(t){s=a.options[t][a.settings.labelField]||"",r.push(t),-1==e.indexOf(t)&&n.push('")}),i=e.filter(function(t){return r.indexOf(t)<0}).map(function(t){return'option[value="'+t+'"]'}),e.length-i.length+n.length!==0||a.$input.attr("multiple")||n.push(''),a.$input.find(i.join(", ")).remove(),a.$input.append(n.join(""))):(a.$input.val(a.getValue()),a.$input.attr("value",a.$input.val())),a.isSetup&&!t.silent&&a.trigger("change",a.$input.val())},updatePlaceholder:function(){var t;this.settings.placeholder&&(t=this.$control_input,this.items.length?t.removeAttr("placeholder"):t.attr("placeholder",this.settings.placeholder),t.triggerHandler("update",{force:!0}))},open:function(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.focus(),t.isOpen=!0,t.refreshState(),t.$dropdown.css({visibility:"hidden",display:"block"}),t.setupDropdownHeight(),t.positionDropdown(),t.$dropdown.css({visibility:"visible"}),t.trigger("dropdown_open",t.$dropdown))},close:function(){var t=this,e=t.isOpen;"single"===t.settings.mode&&t.items.length&&(t.hideInput(),t.isBlurring)&&t.$control_input[0].blur(),t.isOpen=!1,t.$dropdown.hide(),t.setActiveOption(null),t.refreshState(),e&&t.trigger("dropdown_close",t.$dropdown)},positionDropdown:function(){var t=this.$control,e="body"===this.settings.dropdownParent?t.offset():t.position(),t=(e.top+=t.outerHeight(!0),t[0].getBoundingClientRect().width);this.settings.minWidth&&this.settings.minWidth>t&&(t=this.settings.minWidth),this.$dropdown.css({width:t,top:e.top,left:e.left})},setupDropdownHeight:function(){if("object"==typeof this.settings.dropdownSize&&"auto"!==this.settings.dropdownSize.sizeType){var t=this.settings.dropdownSize.sizeValue;if("numberItems"===this.settings.dropdownSize.sizeType){for(var e=this.$dropdown_content.find("*").not(".optgroup, .highlight").not(this.settings.ignoreOnDropwdownHeight),n=0,i=0,o=0,s=0,r=0;r'+i+""+l)),{placeholder:n,options:[],optgroups:[],items:[]});if("select"===e)u(t,i);else{var o,s,r,a,l=t,p=i,n=l.attr(m);if(n)for(p.options=JSON.parse(n),o=0,s=p.options.length;owindow.innerHeight?o.top:o.bottom,i={width:t.outerWidth(),left:e.left};n===o.top?(n={bottom:e.top,top:"unset"},"body"===this.settings.dropdownParent&&(n.top=e.top-this.$dropdown.outerHeight(!0)-t.outerHeight(!0),n.bottom="unset"),Object.assign(i,n),this.$dropdown.addClass("selectize-position-top"),this.$control.addClass("selectize-position-top")):(Object.assign(i,{top:e.top,bottom:"unset"}),this.$dropdown.removeClass("selectize-position-top"),this.$control.removeClass("selectize-position-top")),this.$dropdown.css(i)}}),Selectize.define("auto_select_on_type",function(t){var n,i=this;i.onBlur=(n=i.onBlur,function(t){var e=i.getFirstItemMatchedByTextContent(i.lastValue,!0);return void 0!==e.attr("data-value")&&i.getValue()!==e.attr("data-value")&&i.setValue(e.attr("data-value")),n.apply(this,arguments)})}),Selectize.define("autofill_disable",function(t){var e,n=this;n.setup=(e=n.setup,function(){e.apply(n,arguments),n.$control_input.attr({autocomplete:"new-password",autofill:"no"})})}),Selectize.define("clear_button",function(e){var t,n=this;e=$.extend({title:"Clear",className:"clear",label:"×",html:function(t){return' '+t.label+""}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$button_clear=$(e.html(e)),"single"===n.settings.mode&&n.$wrapper.addClass("single"),n.$wrapper.append(n.$button_clear),""!==n.getValue()&&0!==n.getValue().length||n.$wrapper.find("."+e.className).css("display","none"),n.on("change",function(){""===n.getValue()||0===n.getValue().length?n.$wrapper.find("."+e.className).css("display","none"):n.$wrapper.find("."+e.className).css("display","")}),n.$wrapper.on("click","."+e.className,function(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.isLocked||(n.clear(),n.$wrapper.find("."+e.className).css("display","none"))})})}),Selectize.define("drag_drop",function(t){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');var i,e,n,o;"multi"===this.settings.mode&&((i=this).lock=(e=i.lock,function(){var t=i.$control.data("sortable");return t&&t.disable(),e.apply(i,arguments)}),i.unlock=(n=i.unlock,function(){var t=i.$control.data("sortable");return t&&t.enable(),n.apply(i,arguments)}),i.setup=(o=i.setup,function(){o.apply(this,arguments);var n=i.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:i.isLocked,start:function(t,e){e.placeholder.css("width",e.helper.css("width")),n.addClass("dragging")},stop:function(){n.removeClass("dragging");var t=i.$activeItems?i.$activeItems.slice():null,e=[];n.children("[data-value]").each(function(){e.push($(this).attr("data-value"))}),i.isFocused=!1,i.setValue(e),i.isFocused=!0,i.setActiveItem(t),i.positionDropdown()}})}))}),Selectize.define("dropdown_header",function(t){var e,n=this;t=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(t){return'
'+t.title+'×
'}},t),n.setup=(e=n.setup,function(){e.apply(n,arguments),n.$dropdown_header=$(t.html(t)),n.$dropdown.prepend(n.$dropdown_header),n.$dropdown_header.find("."+t.closeClass).on("click",function(){n.close()})})}),Selectize.define("optgroup_columns",function(r){function t(){var t,e,n,i,o=$("[data-group]",a.$dropdown_content),s=o.length;if(s&&a.$dropdown_content.width()){if(r.equalizeHeight){for(t=e=0;t
',t=t.firstChild,n.body.appendChild(t),e=l.width=t.offsetWidth-t.clientWidth,n.body.removeChild(t)),e});(r.equalizeHeight||r.equalizeWidth)&&(hook.after(this,"positionDropdown",t),hook.after(this,"refreshOptions",t))}),Selectize.define("remove_button",function(t){var s,e,n,i,r;"single"!==this.settings.mode&&(t=$.extend({label:"×",title:"Remove",className:"remove",append:!0},t),i=s=this,r=''+e.label+"",s.setup=(n=i.setup,function(){var o;e.append&&(o=i.settings.render.item,i.settings.render.item=function(t){return e=o.apply(s,arguments),n=r,i=e.search(/(<\/[^>]+>\s*)$/),e.substring(0,i)+n+e.substring(i);var e,n,i}),n.apply(s,arguments),s.$control.on("click","."+e.className,function(t){if(t.preventDefault(),!i.isLocked)return t=$(t.currentTarget).parent(),i.setActiveItem(t),i.deleteSelection()&&i.setCaret(i.items.length),!1})}))}),Selectize.define("restore_on_backspace",function(n){var i,t=this;n.text=n.text||function(t){return t[this.settings.labelField]},this.onKeyDown=(i=t.onKeyDown,function(t){var e;if(!(t.keyCode===KEY_BACKSPACE&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(e=this.caretPos-1)&&e"+(e.length-n)+""))}}}(),this.onFocus=function(){const e=t.onFocus;return function(t){e.apply(this,t),t&&((t=this.$control).find(".item").show(),t.find("span").remove())}}()}); return Selectize; })); ; /** * Common AnsPress functions and constructor. * @author Rahul Aryan * @license GPL 3+ * @since 4.0 */ // For preventing global namespace pollution, keep everything in AnsPress object. window.AnsPress = _.extend({ models: {}, views: {}, collections: {}, modals: {}, loadTemplate: function (id) { if (jQuery('#apTemplate').length == 0) jQuery('').appendTo('body'); jQuery.get(apTemplateUrl + '/' + id + ".html", function (html) { var tempCont = jQuery('#apTemplate'); tempCont.text(html + tempCont.text()); AnsPress.trigger('templateLoaded'); }); }, getTemplate: function (templateId) { return function () { if (jQuery('#apTemplate').length == 0) return ''; var regex = new RegExp("#START BLOCK " + templateId + " #([\\S\\s]*?)#END BLOCK " + templateId + " #", "g"); var match = regex.exec(jQuery('#apTemplate').text()); if (match == null) return ''; if (match[1]) return match[1]; } }, isJSONString: function (str) { try { return JSON.parse(str); } catch (e) { return false; } }, ajax: function (options) { var self = this; options = _.defaults(options, { url: ajaxurl, method: 'POST', // dataType: 'json', }); // Convert data to query string if object. if (_.isString(options.data)) options.data = jQuery.apParseParams(options.data); if (typeof options.data.action === 'undefined') options.data.action = 'ap_ajax'; var success = options.success; delete options.success; options.success = function (data) { var context = options.context || null; var parsedData = data; if (parsedData.snackbar) { AnsPress.trigger('snackbar', parsedData) } if (typeof success === 'function') { data = jQuery.isEmptyObject(parsedData) ? data : parsedData; success(data, context); } }; return jQuery.ajax(options); }, uniqueId: function () { return jQuery('.ap-uid').length; }, showLoading: function (elm) { /*hide any existing loading icon*/ AnsPress.hideLoading(elm); var customClass = jQuery(elm).data('loadclass') || ''; var isText = jQuery(elm).is('input[type="text"]'); var uid = this.uniqueId(); if (jQuery(elm).is('button') || jQuery(elm).is('.ap-btn')) { jQuery(elm).addClass('show-loading'); $loading = jQuery(''); $loading.height(jQuery(elm).height()); $loading.width(jQuery(elm).height()); jQuery(elm).append($loading); } else { var el = jQuery('
'); jQuery('body').append(el); var offset = jQuery(elm).offset(); var height = jQuery(elm).outerHeight(); var width = isText ? 40 : jQuery(elm).outerWidth(); el.css({ top: offset.top, left: isText ? offset.left + jQuery(elm).outerWidth() - 40 : offset.left, height: height, width: width }); jQuery(elm).data('loading', '#apuid-' + uid); return '#apuid-' + uid; } }, hideLoading: function (elm) { if (jQuery(elm).is('button') || jQuery(elm).is('.ap-btn')) { jQuery(elm).removeClass('show-loading'); jQuery(elm).find('.ap-loading-span').remove(); jQuery(elm).prop('disabled', false); } else if ('all' == elm) { jQuery('.ap-loading-icon').hide(); } else { jQuery(jQuery(elm).data('loading')).hide(); } }, getUrlParam: function (key) { var qs = jQuery.apParseParams(window.location.href); if (typeof key !== 'undefined') return typeof qs[key] !== 'undefined' ? qs[key] : null; return qs; }, modal: function (name, args) { args = args || {}; if (typeof this.modals[name] !== 'undefined') { return this.modals[name]; } this.modals[name] = new AnsPress.views.Modal(_.extend({ id: 'ap-modal-' + name, title: aplang.loading, content: '', size: 'medium' }, args)); jQuery('body').append(this.modals[name].render().$el); return this.modals[name]; }, hideModal: function (name, runCb) { if (typeof runCb === 'undefined') runCb = true; if (typeof this.modals[name] !== 'undefined') { this.modals[name].hide(runCb); delete this.modals[name]; } }, removeHash: function () { var scrollV, scrollH, loc = window.location; // Prevent scrolling by storing the page's current scroll offset scrollV = document.body.scrollTop; scrollH = document.body.scrollLeft; if ('pushState' in history) { history.pushState('', document.title, loc.pathname + loc.search); Backbone.history.navigate('/'); } else { loc.hash = ''; } // Restore the scroll offset, should be flicker free document.body.scrollTop = scrollV; document.body.scrollLeft = scrollH; }, loadCSS: function (href) { var cssLink = document.createElement('link'); cssLink.rel = 'stylesheet'; cssLink.href = href; var head = document.getElementsByTagName('head')[0]; head.parentNode.insertBefore(cssLink, head); } }, Backbone.Events); _.templateSettings = { evaluate: /<#([\s\S]+?)#>/g, interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, escape: /\{\{([^\}]+?)\}\}(?!\})/g, }; (function ($) { //pass in just the context as a $(obj) or a settings JS object $.fn.autogrow = function (opts) { var that = $(this).css({ overflow: 'hidden', resize: 'none' }) //prevent scrollies , selector = that.selector, defaults = { context: $(document) //what to wire events to , animate: true //if you want the size change to animate , speed: 50 //speed of animation , fixMinHeight: true //if you don't want the box to shrink below its initial size , cloneClass: 'autogrowclone' //helper CSS class for clone if you need to add special rules , onInitialize: false //resizes the textareas when the plugin is initialized }; opts = $.isPlainObject(opts) ? opts : { context: opts ? opts : $(document) }; opts = $.extend({}, defaults, opts); that.each(function (i, elem) { var min, clone; elem = $(elem); //if the element is "invisible", we get an incorrect height value //to get correct value, clone and append to the body. if (elem.is(':visible') || parseInt(elem.css('height'), 10) > 0) { min = parseInt(elem.css('height'), 10) || elem.innerHeight(); } else { clone = elem.clone().addClass(opts.cloneClass).val(elem.val()).css({ position: 'absolute', visibility: 'hidden', display: 'block' }); $('body').append(clone); min = clone.innerHeight(); clone.remove(); } if (opts.fixMinHeight) { elem.data('autogrow-start-height', min); //set min height } elem.css('height', min); if (opts.onInitialize && elem.length) { resize.call(elem[0]); } }); opts.context.on('keyup paste focus', selector, resize); function resize(e) { var box = $(this), oldHeight = box.innerHeight(), newHeight = this.scrollHeight, minHeight = box.data('autogrow-start-height') || 0, clone; if (oldHeight < newHeight) { //user is typing this.scrollTop = 0; //try to reduce the top of the content hiding for a second opts.animate ? box.stop().animate({ height: newHeight }, opts.speed) : box.innerHeight(newHeight); } else if (!e || e.which == 8 || e.which == 46 || (e.ctrlKey && e.which == 88)) { //user is deleting, backspacing, or cutting if (oldHeight > minHeight) { //shrink! //this cloning part is not particularly necessary. however, it helps with animation //since the only way to cleanly calculate where to shrink the box to is to incrementally //reduce the height of the box until the $.innerHeight() and the scrollHeight differ. //doing this on an exact clone to figure out the height first and then applying it to the //actual box makes it look cleaner to the user clone = box.clone() //add clone class for extra css rules .addClass(opts.cloneClass) //make "invisible", remove height restriction potentially imposed by existing CSS .css({ position: 'absolute', zIndex: -10, height: '' }) //populate with content for consistent measuring .val(box.val()); box.after(clone); //append as close to the box as possible for best CSS matching for clone do { //reduce height until they don't match newHeight = clone[0].scrollHeight - 1; clone.innerHeight(newHeight); } while (newHeight === clone[0].scrollHeight); newHeight++; //adding one back eliminates a wiggle on deletion clone.remove(); box.focus(); // Fix issue with Chrome losing focus from the textarea. //if user selects all and deletes or holds down delete til beginning //user could get here and shrink whole box newHeight < minHeight && (newHeight = minHeight); oldHeight > newHeight && opts.animate ? box.stop().animate({ height: newHeight }, opts.speed) : box.innerHeight(newHeight); } else { //just set to the minHeight box.innerHeight(minHeight); } } } return that; }; jQuery.fn.apScrollTo = function (elem, toBottom, speed) { toBottom = toBottom || false; var parentPos = $(this).scrollTop() - $(this).offset().top; var top = toBottom ? $(this).offset().top + $(this).height() : $(this).offset().top; $('html, body').stop(); $('html, body').animate({ scrollTop: top }, speed == undefined ? 1000 : speed); if (elem != undefined) $(this).animate({ scrollTop: parentPos + $(elem).offset().top }, speed == undefined ? 1000 : speed); return this; }; AnsPress.views.Snackbar = Backbone.View.extend({ id: 'ap-snackbar', template: '
{{message}}
', hover: false, initialize: function () { AnsPress.on('snackbar', this.show, this); }, events: { 'mouseover': 'toggleHover', 'mouseout': 'toggleHover', }, show: function (data) { var self = this; this.data = data.snackbar; this.data.success = data.success; this.$el.removeClass('snackbar-show'); this.render(); setTimeout(function () { self.$el.addClass('snackbar-show'); }, 0); this.hide(); }, toggleHover: function () { clearTimeout(this.hoveTimeOut); this.hover = !this.hover; if (!this.hover) this.hide(); }, hide: function () { var self = this; if (!self.hover) this.hoveTimeOut = setTimeout(function () { self.$el.removeClass('snackbar-show'); }, 5000); }, render: function () { if (this.data) { var t = _.template(this.template); this.$el.html(t(this.data)); } return this; } }); AnsPress.views.Modal = Backbone.View.extend({ className: 'ap-modal', template: "
ap-modal-{{size}}<# } #>\">
<# if(typeof title !== 'undefined' ){ #>{{title}}<# } #>
<# if(typeof content !== 'undefined'){ #>{{{content}}}<# } #>
<# if(typeof buttons !== 'undefined'){ #><# _.each(buttons, function(btn){ #>{{btn.class}}<# } #>\" href=\"#\" <# if(typeof btn.cb !== 'undefined') { #>ap=\"{{btn.cb}}\" apquery=\"{{btn.query}}\"<# } #>>{{btn.label}}<# }); #><# } #>
", events: { 'click [ap="close-modal"]': 'clickHide', 'click [ap="modal-click"]': 'clickAction', }, initialize: function (opt) { opt.title = opt.title || aplang.loading; this.data = opt; }, render: function () { $('html').css('overflow', 'hidden'); var t = _.template(this.template); this.$el.html(t(this.data)); return this; }, clickHide: function (e) { e.preventDefault(); this.hide(); }, hide: function (runCb) { if (typeof runCb === 'undefined') runCb = true; this.remove(); $('html').css('overflow', ''); if (this.data.hideCb && runCb) this.data.hideCb(this); // Callback var name = this.data.id.replace('ap-modal-', ''); if (typeof AnsPress.modals[name] !== 'undefined') delete AnsPress.modals[name]; }, setContent: function (html) { this.$el.find('.ap-modal-content').html(html); }, setTitle: function (title) { this.$el.find('.ap-modal-header strong').text(title); }, setFooter: function (content) { this.$el.find('.ap-modal-footer').html(content); }, clickAction: function (e) { e.preventDefault(); var targ = $(e.target); q = targ.data('apquery'); if (q.cb) { q.element = targ; AnsPress.trigger(q.cb, q); } } }); var re = /([^&=]+)=?([^&]*)/g; var decode = function (str) { return decodeURIComponent(str.replace(/\+/g, ' ')); }; $.apParseParams = function (query) { // recursive function to construct the result object function createElement(params, key, value) { key = key + ''; // if the key is a property if (key.indexOf('.') !== -1) { // extract the first part with the name of the object var list = key.split('.'); // the rest of the key var new_key = key.split(/\.(.+)?/)[1]; // create the object if it doesnt exist if (!params[list[0]]) params[list[0]] = {}; // if the key is not empty, create it in the object if (new_key !== '') { createElement(params[list[0]], new_key, value); } else console.warn('parseParams :: empty property in key "' + key + '"'); } else // if the key is an array if (key.indexOf('[') !== -1) { // extract the array name var list = key.split('['); key = list[0]; // extract the index of the array var list = list[1].split(']'); var index = list[0] // if index is empty, just push the value at the end of the array if (index == '') { if (!params) params = {}; if (!params[key] || !$.isArray(params[key])) params[key] = []; params[key].push(value); } else // add the value at the index (must be an integer) { if (!params) params = {}; if (!params[key] || !$.isArray(params[key])) params[key] = []; params[key][parseInt(index)] = value; } } else // just normal key { if (!params) params = {}; params[key] = value; } } // be sure the query is a string query = query + ''; if (query === '') query = window.location + ''; var params = {}, e; if (query) { // remove # from end of query if (query.indexOf('#') !== -1) { query = query.substr(0, query.indexOf('#')); } // remove ? at the begining of the query if (query.indexOf('?') !== -1) { query = query.substr(query.indexOf('?') + 1, query.length); } else return {}; // empty parameters if (query == '') return {}; // execute a createElement on every key and value while (e = re.exec(query)) { var key = decode(e[1]); var value = decode(e[2]); createElement(params, key, value); } } return params; }; })(jQuery); (function ($) { AnsPress.Common = { init: function () { AnsPress.on('showImgPreview', this.showImgPreview); AnsPress.on('formPosted', this.imageUploaded); AnsPress.on('ajaxBtnDone', this.uploadModal); AnsPress.on('ajaxBtnDone', this.commentModal); AnsPress.on('showModal', this.showModal); }, readUrl: function (input, el) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { AnsPress.trigger('showImgPreview', e.target.result, el.find('.ap-upload-list')); } reader.readAsDataURL(input.files[0]); } }, uploadModal: function (data) { if (data.action != 'ap_upload_modal' || !data.html) return; $modal = AnsPress.modal('imageUpload', { title: data.title, content: data.html, size: 'small', }); var file = $modal.$el.find('input[type="file"]'); file.on('change', function () { $modal.$el.find('.ap-img-preview').remove(); AnsPress.Common.readUrl(this, $modal.$el); }); }, showImgPreview: function (src, el) { $('').appendTo(el); }, imageUploaded: function (data) { if (data.action !== 'ap_image_upload' || typeof tinymce === 'undefined') return; if (data.files) $.each(data.files, function (old, newFile) { tinymce.activeEditor.insertContent(''); }); AnsPress.hideModal('imageUpload'); }, showModal: function (modal) { modal.size = modal.size || 'medium'; AnsPress.modal(modal.name, { title: modal.title, content: modal.content, size: modal.size, }); } }; })(jQuery); jQuery(document).ready(function ($) { AnsPress.Common.init(); var apSnackbarView = new AnsPress.views.Snackbar(); $('body').append(apSnackbarView.render().$el); $(document).on('click', function (e) { e.stopPropagation(); if (!$(e.target).is('.ap-dropdown-toggle') && !$(e.target).closest('.open').is('.open') && !$(e.target).closest('form').is('form')) { $('.ap-dropdown').removeClass('open'); } }); // Dropdown toggle $('body').on('click', '.ap-dropdown-toggle, .ap-dropdown-menu > a', function (e) { e.preventDefault(); $('.ap-dropdown').not($(this).closest('.ap-dropdown')).removeClass('open'); $(this).closest('.ap-dropdown').toggleClass('open'); }); // Subscribe button. $('[apsubscribe]').on('click', function (e) { e.preventDefault(); var self = $(this); var query = JSON.parse(self.attr('apquery')); query.ap_ajax_action = 'subscribe'; AnsPress.ajax({ data: query, success: function (data) { if (data.count) self.next().text(data.count); if (data.label) self.text(data.label); } }) }); $('body').on('click', '.ap-droptogg', function (e) { e.preventDefault(); $(this).closest('.ap-dropdown').removeClass('open'); $(this).closest('#noti-dp').hide(); }); // Ajax button. $('body').on('click', '[apajaxbtn]', function (e) { var self = this; e.preventDefault(); if ($(this).attr('aponce') != 'false' && $(this).is('.loaded')) return; var self = $(this); var query = JSON.parse(self.attr('apquery')); AnsPress.showLoading(self); AnsPress.ajax({ data: query, success: function (data) { if ($(this).attr('aponce') != 'false') $(self).addClass('loaded'); AnsPress.hideLoading(e.target); AnsPress.trigger('ajaxBtnDone', data); if (typeof data.btn !== 'undefined') if (data.btn.hide) self.hide(); if (typeof data.cb !== 'undefined') AnsPress.trigger(data.cb, data, e.target); // Open modal. if (data.modal) { AnsPress.trigger('showModal', data.modal); } } }) }); function apAddRepeatField(el, values) { values = values || false; var args = $(el).data('args'); args['index'] = $(el).find('[datarepeatid]').length; var template = $('#' + args.key + '-template').text(); var t = _.template(template); t = t(args); var regex = /(class|id|for)="([^"]+)"/g; var t = t.replace(regex, function (match, group) { return match.replace(/[[\]]/g, ''); }); var html = $(''); $.each(values, function (childName, v) { html.find('[name="' + args.key + '[' + args.index + '][' + childName + ']"]').val(v); }); var errors = $('#' + args.key + '-errors'); if (errors.length > 0) { var errors_json = JSON.parse(errors.html()); $.each(errors_json, function (i, err) { $.each(err, function (field, messages) { var fieldWrap = html.find('[name="' + args.key + '[' + i + '][' + field + ']"]').closest('.ap-form-group'); fieldWrap.addClass('ap-have-errors'); var errContain = $('
'); $.each(messages, function (code, msg) { errContain.append('' + msg + ''); }) $(errContain).insertAfter(fieldWrap.find('label')); }); }); } $(el).find('.ap-fieldrepeatable-item').append(html); } $('[data-role="ap-repeatable"]').each(function () { var self = this; $(this).find('.ap-repeatable-add').on('click', function (e) { e.preventDefault(); var self = $(this); var query = JSON.parse(self.attr('apquery')); AnsPress.showLoading(self); $count = $('[name="' + query.id + '-groups"]'); query.current_groups = $count.val(); $count.val(parseInt(query.current_groups) + 1); $nonce = $('[name="' + query.id + '-nonce"]'); query.current_nonce = $nonce.val(); AnsPress.ajax({ data: query, success: function (data) { AnsPress.hideLoading(e.target); $(data.html).insertBefore(self); $nonce.val(data.nonce); } }) }); $(this).on('click', '.ap-repeatable-delete', function (e) { e.preventDefault(); $(this).closest('.ap-form-group').remove(); }); }); $('body').on('click', '.ap-form-group', function () { $(this).removeClass('ap-have-errors'); }); $('body').on('click', 'button.show-loading', function (e) { e.preventDefault(); }); $('body').on('submit', '[apform]', function (e) { e.preventDefault(); var self = $(this); var submitBtn = $(this).find('button[type="submit"]'); if (submitBtn.length > 0) AnsPress.showLoading(submitBtn); $(this).ajaxSubmit({ url: ajaxurl, beforeSerialize: function () { if (typeof tinymce !== 'undefined') tinymce.triggerSave(); $('.ap-form-errors, .ap-field-errors').remove(); $('.ap-have-errors').removeClass('ap-have-errors'); }, success: function (data) { if (submitBtn.length > 0) AnsPress.hideLoading(submitBtn); data = data; if (data.snackbar) { AnsPress.trigger('snackbar', data) } if (typeof grecaptcha !== 'undefined' && typeof widgetId1 !== 'undefined') grecaptcha.reset(widgetId1); AnsPress.trigger('formPosted', data); if (typeof data.form_errors !== 'undefined') { $formError = $('
').prependTo(self); $.each(data.form_errors, function (i, err) { $formError.append('' + err + '
'); }); $.each(data.fields_errors, function (i, errs) { $('.ap-field-' + i).addClass('ap-have-errors'); $('.ap-field-' + i).find('.ap-field-errorsc').html('
'); $.each(errs.error, function (code, err) { $('.ap-field-' + i).find('.ap-field-errors').append('' + err + ''); }); }); self.apScrollTo(); } else if (typeof data.hide_modal !== undefined) { // Hide modal AnsPress.hideModal(data.hide_modal); } if (typeof data.redirect !== 'undefined') { window.location = data.redirect; } } }); }); $(document).on('keyup', function (e) { if (e.keyCode == 27) { $lastModal = $('.ap-modal').last(); if ($lastModal.length > 0) { $name = $lastModal.attr('id').replace('ap-modal-', ''); AnsPress.hideModal($name); } } }); AnsPress.on('loadedMoreActivities', function (data, e) { $(data.html).insertAfter($('.ap-activities:last-child')); $(e).closest('.ap-activity-item').remove(); }); AnsPress.tagsPreset = { tags: { delimiter: ',', valueField: 'term_id', labelField: 'name', searchField: 'name', persist: false, render: { option: function (item, escape) { return '
' + '' + escape(item.name) + '' + '' + escape(item.count) + '' + '' + escape(item.description) + '' + '
'; } }, create: false, maxItems: 4 } } AnsPress.tagElements = function ($el) { var type = $el.data('type'); var jsoptions = $el.data('options'); var options = $('#' + jsoptions.id + '-options').length > 0 ? JSON.parse($('#' + jsoptions.id + '-options').html()) : {}; var defaults = AnsPress.tagsPreset[type]; defaults.options = options; defaults.maxItems = jsoptions.maxItems; if (false !== jsoptions.create) { defaults.create = function (input) { return { term_id: input, name: input, description: '', count: 0, } }; } defaults.load = function (query, callback) { if (!query.length) return callback(); jQuery.ajax({ url: ajaxurl, type: 'GET', dataType: 'json', data: { action: 'ap_search_tags', q: query, __nonce: jsoptions.nonce, form: jsoptions.form, field: jsoptions.field, }, error: function () { callback(); }, success: function (res) { callback(res); } }); }; defaults.render = { option_create: function (data, escape) { return '
' + jsoptions.labelAdd + ' ' + escape(data.input) + '
'; } } $el.selectize(defaults); } $('[aptagfield]').each(function () { AnsPress.tagElements($(this)); }); $('#anspress').on('click', '.ap-remove-parent', function (e) { e.preventDefault(); $(this).parent().remove(); }) }); window.AnsPress.Helper = { toggleNextClass: function (el) { jQuery(el).closest('.ap-field-type-group').find('.ap-fieldgroup-c').toggleClass('show'); } } ; /** * Javascript code for AnsPress fontend * @since 4.0.0 * @package AnsPress * @author Rahul Aryan * @license GPL 3+ */ (function ($) { AnsPress.models.Action = Backbone.Model.extend({ defaults: { cb: '', post_id: '', title: '', label: '', query: '', active: false, header: false, href: '#', count: '', prefix: '', checkbox: '', multiple: false } }); AnsPress.collections.Actions = Backbone.Collection.extend({ model: AnsPress.models.Action }); AnsPress.views.Action = Backbone.View.extend({ id: function () { return this.postID; }, className: function () { var klass = ''; if (this.model.get('header')) klass += ' ap-dropdown-header'; if (this.model.get('active')) klass += ' active'; return klass; }, tagName: 'li', template: "<# if(!header){ #>{{{prefix}}}{{label}}<# if(count){ #>{{count}}<# } #><# } else { #>{{label}}<# } #>", initialize: function (options) { this.model = options.model; this.postID = options.postID; this.model.on('change', this.render, this); this.listenTo(this.model, 'remove', this.removed); }, events: { 'click a': 'triggerAction' }, render: function () { var t = _.template(this.template); this.$el.html(t(this.model.toJSON())); this.$el.attr('class', this.className()); return this; }, triggerAction: function (e) { var q = this.model.get('query'); if (_.isEmpty(q)) return; e.preventDefault(); var self = this; AnsPress.showLoading(e.target); var cb = this.model.get('cb'); q.ap_ajax_action = 'action_' + cb; AnsPress.ajax({ data: q, success: function (data) { AnsPress.hideLoading(e.target); if (data.redirect) window.location = data.redirect; if (data.success && (cb == 'status' || cb == 'toggle_delete_post')) AnsPress.trigger('changedPostStatus', { postID: self.postID, data: data, action: self.model }); if (data.action) { self.model.set(data.action); } self.renderPostMessage(data); if (data.deletePost) AnsPress.trigger('deletePost', data.deletePost); if (data.answersCount) AnsPress.trigger('answerCountUpdated', data.answersCount); } }); }, renderPostMessage: function (data) { if (!_.isEmpty(data.postmessage)) $('[apid="' + this.postID + '"]').find('postmessage').html(data.postmessage); else $('[apid="' + this.postID + '"]').find('postmessage').html(''); }, removed: function () { this.remove(); } }); AnsPress.views.Actions = Backbone.View.extend({ id: function () { return this.postID; }, searchTemplate: '', tagName: 'ul', className: 'ap-actions', events: { 'keyup [search-filter]': 'searchInput' }, initialize: function (options) { this.model = options.model; this.postID = options.postID; this.multiple = options.multiple; this.action = options.action; this.nonce = options.nonce; AnsPress.on('changedPostStatus', this.postStatusChanged, this); this.listenTo(this.model, 'add', this.added); }, renderItem: function (action) { var view = new AnsPress.views.Action({ model: action, postID: this.postID }); this.$el.append(view.render().$el); }, render: function () { var self = this; if (this.multiple) this.$el.append(this.searchTemplate); this.model.each(function (action) { self.renderItem(action); }); return this; }, postStatusChanged: function (args) { if (args.postID !== this.postID) return; // Remove post status class $("#post-" + this.postID).removeClass(function () { return this.className.split(' ').filter(function (className) { return className.match(/status-/) }).join(' '); }); $("#post-" + this.postID).addClass('status-' + args.data.newStatus); var activeStatus = this.model.where({ cb: 'status', active: true }); activeStatus.forEach(function (status) { status.set({ active: false }); }); }, searchInput: function (e) { var self = this; clearTimeout(this.searchTO); this.searchTO = setTimeout(function () { self.search($(e.target).val(), e.target); }, 600); }, search: function (q, e) { var self = this; var args = { nonce: this.nonce, ap_ajax_action: this.action, search: q, filter: this.filter, post_id: this.postID }; AnsPress.showLoading(e); AnsPress.ajax({ data: args, success: function (data) { console.log(data); AnsPress.hideLoading(e); if (data.success) { self.nonce = data.nonce; //self.model.reset(); while (m = self.model.first()) { self.model.remove(m); } self.model.add(data.actions); } } }); }, added: function (model) { this.renderItem(model); } }); AnsPress.models.Post = Backbone.Model.extend({ idAttribute: 'ID', defaults: { actionsLoaded: false, hideSelect: '' } }); AnsPress.views.Post = Backbone.View.extend({ idAttribute: 'ID', templateId: 'answer', tagName: 'div', actions: { view: {}, model: {} }, id: function () { return 'post-' + this.model.get('ID'); }, initialize: function (options) { this.listenTo(this.model, 'change:vote', this.voteUpdate); this.listenTo(this.model, 'change:hideSelect', this.selectToggle); }, events: { 'click [ap-vote] > a': 'voteClicked', 'click [ap="actiontoggle"]:not(.loaded)': 'postActions', 'click [ap="select_answer"]': 'selectAnswer' }, voteClicked: function (e) { e.preventDefault(); if ($(e.target).is('.disable')) return; self = this; var type = $(e.target).is('.vote-up') ? 'vote_up' : 'vote_down'; var originalValue = _.clone(self.model.get('vote')); var vote = _.clone(originalValue); if (type === 'vote_up') vote.net = (vote.active === 'vote_up' ? vote.net - 1 : vote.net + 1); else vote.net = (vote.active === 'vote_down' ? vote.net + 1 : vote.net - 1); self.model.set('vote', vote); var q = JSON.parse($(e.target).parent().attr('ap-vote')); q.ap_ajax_action = 'vote'; q.type = type; AnsPress.ajax({ data: q, success: function (data) { if (data.success && _.isObject(data.voteData)) self.model.set('vote', data.voteData); else self.model.set('vote', originalValue); // Restore original value on fail } }) }, voteUpdate: function (post) { var self = this; this.$el.find('[ap="votes_net"]').text(this.model.get('vote').net); _.each(['up', 'down'], function (e) { self.$el.find('.vote-' + e).removeClass('voted disable').addClass(self.voteClass('vote_' + e)); }); }, voteClass: function (type) { type = type || 'vote_up'; var curr = this.model.get('vote').active; var klass = ''; if (curr === 'vote_up' && type === 'vote_up') klass = 'active'; if (curr === 'vote_down' && type === 'vote_down') klass = 'active'; if (type !== curr && curr !== '') klass += ' disable'; return klass + ' prist'; }, render: function () { var attr = this.$el.find('[ap-vote]').attr('ap-vote'); try { this.model.set('vote', JSON.parse(attr), { silent: true }); } catch (err) { console.warn('Vote data empty', err) } return this; }, postActions: function (e) { var self = this; var q = JSON.parse($(e.target).attr('apquery')); if (typeof q.ap_ajax_action === 'undefined') q.ap_ajax_action = 'post_actions'; AnsPress.ajax({ data: q, success: function (data) { AnsPress.hideLoading(e.target); $(e.target).addClass('loaded'); self.actions.model = new AnsPress.collections.Actions(data.actions); self.actions.view = new AnsPress.views.Actions({ model: self.actions.model, postID: self.model.get('ID') }); self.$el.find('postActions .ap-actions').html(self.actions.view.render().$el); } }); }, selectAnswer: function (e) { e.preventDefault(); var self = this; var q = JSON.parse($(e.target).attr('apquery')); q.action = 'ap_toggle_best_answer'; AnsPress.showLoading(e.target); AnsPress.ajax({ data: q, success: function (data) { AnsPress.hideLoading(e.target); if (data.success) { if (data.selected) { self.$el.addClass('best-answer'); $(e.target).addClass('active').text(data.label); AnsPress.trigger('answerToggle', [self.model, true]); } else { self.$el.removeClass('best-answer'); $(e.target).removeClass('active').text(data.label); AnsPress.trigger('answerToggle', [self.model, false]); } } } }); }, selectToggle: function () { if (this.model.get('hideSelect')) this.$el.find('[ap="select_answer"]').addClass('hide'); else this.$el.find('[ap="select_answer"]').removeClass('hide'); } }); AnsPress.collections.Posts = Backbone.Collection.extend({ model: AnsPress.models.Post, initialize: function () { var loadedPosts = []; $('[ap="question"],[ap="answer"]').each(function (e) { loadedPosts.push({ 'ID': $(this).attr('apId') }); }); this.add(loadedPosts); } }); AnsPress.views.SingleQuestion = Backbone.View.extend({ initialize: function () { this.listenTo(this.model, 'add', this.renderItem); AnsPress.on('answerToggle', this.answerToggle, this); AnsPress.on('deletePost', this.deletePost, this); AnsPress.on('answerCountUpdated', this.answerCountUpdated, this); AnsPress.on('formPosted', this.formPosted, this); this.listenTo(AnsPress, 'commentApproved', this.commentApproved); this.listenTo(AnsPress, 'commentDeleted', this.commentDeleted); this.listenTo(AnsPress, 'commentCount', this.commentCount); this.listenTo(AnsPress, 'formPosted', this.submitComment); }, events: { 'click [ap="loadEditor"]': 'loadEditor', }, renderItem: function (post) { var view = new AnsPress.views.Post({ model: post, el: '[apId="' + post.get('ID') + '"]' }); view.render(); }, render: function () { var self = this; this.model.each(function (post) { self.renderItem(post); }); return self; }, loadEditor: function (e) { var self = this; AnsPress.showLoading(e.target); AnsPress.ajax({ data: $(e.target).data('apquery'), success: function (data) { console.log(data) AnsPress.hideLoading(e.target); $('#ap-form-main').html(data); $(e.target).closest('.ap-minimal-editor').removeClass('ap-minimal-editor'); setTimeout(() => { const iframe = $('#form_answer-post_content_ifr'); if (iframe.length) { const label = $('