/******************************************************************************* * Copyright 2018 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ /** * Element.matches() * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill */ if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; } // eslint-disable-next-line valid-jsdoc /** * Element.closest() * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill */ if (!Element.prototype.closest) { Element.prototype.closest = function(s) { "use strict"; var el = this; if (!document.documentElement.contains(el)) { return null; } do { if (el.matches(s)) { return el; } el = el.parentElement || el.parentNode; } while (el !== null && el.nodeType === 1); return null; }; } /******************************************************************************* * Copyright 2018 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ (function() { "use strict"; var NS = "cmp"; var IS = "tabs"; var keyCodes = { END: 35, HOME: 36, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_RIGHT: 39, ARROW_DOWN: 40 }; var selectors = { self: "[data-" + NS + '-is="' + IS + '"]', active: { tab: "cmp-tabs__tab--active", tabpanel: "cmp-tabs__tabpanel--active" } }; /** * Tabs Configuration * * @typedef {Object} TabsConfig Represents a Tabs configuration * @property {HTMLElement} element The HTMLElement representing the Tabs * @property {Object} options The Tabs options */ /** * Tabs * * @class Tabs * @classdesc An interactive Tabs component for navigating a list of tabs * @param {TabsConfig} config The Tabs configuration */ function Tabs(config) { var that = this; if (config && config.element) { init(config); } /** * Initializes the Tabs * * @private * @param {TabsConfig} config The Tabs configuration */ function init(config) { // prevents multiple initialization config.element.removeAttribute("data-" + NS + "-is"); cacheElements(config.element); that._active = getActiveIndex(that._elements["tab"]); if (that._elements.tabpanel) { refreshActive(); bindEvents(); } if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { /* * Editor message handling: * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame * - check that the message data panel container type is correct and that the id (path) matches this specific Tabs component * - if so, route the "navigate" operation to enact a navigation of the Tabs based on index data */ new window.Granite.author.MessageChannel("cqauthor", window).subscribeRequestMessage("cmp.panelcontainer", function(message) { if (message.data && message.data.type === "cmp-tabs" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { if (message.data.operation === "navigate") { navigate(message.data.index); } } }); } } /** * Returns the index of the active tab, if no tab is active returns 0 * * @param {Array} tabs Tab elements * @returns {Number} Index of the active tab, 0 if none is active */ function getActiveIndex(tabs) { if (tabs) { for (var i = 0; i < tabs.length; i++) { if (tabs[i].classList.contains(selectors.active.tab)) { return i; } } } return 0; } /** * Caches the Tabs elements as defined via the {@code data-tabs-hook="ELEMENT_NAME"} markup API * * @private * @param {HTMLElement} wrapper The Tabs wrapper element */ function cacheElements(wrapper) { that._elements = {}; that._elements.self = wrapper; var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own tab elements var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var key = hook.dataset[NS + "Hook" + capitalized]; if (that._elements[key]) { if (!Array.isArray(that._elements[key])) { var tmp = that._elements[key]; that._elements[key] = [tmp]; } that._elements[key].push(hook); } else { that._elements[key] = hook; } } } } /** * Binds Tabs event handling * * @private */ function bindEvents() { var tabs = that._elements["tab"]; if (tabs) { for (var i = 0; i < tabs.length; i++) { (function(index) { tabs[i].addEventListener("click", function(event) { navigateAndFocusTab(index); }); tabs[i].addEventListener("keydown", function(event) { onKeyDown(event); }); })(i); } } } /** * Handles tab keydown events * * @private * @param {Object} event The keydown event */ function onKeyDown(event) { var index = that._active; var lastIndex = that._elements["tab"].length - 1; switch (event.keyCode) { case keyCodes.ARROW_LEFT: case keyCodes.ARROW_UP: event.preventDefault(); if (index > 0) { navigateAndFocusTab(index - 1); } break; case keyCodes.ARROW_RIGHT: case keyCodes.ARROW_DOWN: event.preventDefault(); if (index < lastIndex) { navigateAndFocusTab(index + 1); } break; case keyCodes.HOME: event.preventDefault(); navigateAndFocusTab(0); break; case keyCodes.END: event.preventDefault(); navigateAndFocusTab(lastIndex); break; default: return; } } /** * Refreshes the tab markup based on the current {@code Tabs#_active} index * * @private */ function refreshActive() { var tabpanels = that._elements["tabpanel"]; var tabs = that._elements["tab"]; if (tabpanels) { if (Array.isArray(tabpanels)) { for (var i = 0; i < tabpanels.length; i++) { if (i === parseInt(that._active)) { tabpanels[i].classList.add(selectors.active.tabpanel); tabpanels[i].removeAttribute("aria-hidden"); tabs[i].classList.add(selectors.active.tab); tabs[i].setAttribute("aria-selected", true); tabs[i].setAttribute("tabindex", "0"); } else { tabpanels[i].classList.remove(selectors.active.tabpanel); tabpanels[i].setAttribute("aria-hidden", true); tabs[i].classList.remove(selectors.active.tab); tabs[i].setAttribute("aria-selected", false); tabs[i].setAttribute("tabindex", "-1"); } } } else { // only one tab tabpanels.classList.add(selectors.active.tabpanel); tabs.classList.add(selectors.active.tab); } } } /** * Focuses the element and prevents scrolling the element into view * * @param {HTMLElement} element Element to focus */ function focusWithoutScroll(element) { var x = window.scrollX || window.pageXOffset; var y = window.scrollY || window.pageYOffset; element.focus(); window.scrollTo(x, y); } /** * Navigates to the tab at the provided index * * @private * @param {Number} index The index of the tab to navigate to */ function navigate(index) { that._active = index; refreshActive(); } /** * Navigates to the item at the provided index and ensures the active tab gains focus * * @private * @param {Number} index The index of the item to navigate to */ function navigateAndFocusTab(index) { navigate(index); focusWithoutScroll(that._elements["tab"][index]); } } /** * Reads options data from the Tabs wrapper element, defined via {@code data-cmp-*} data attributes * * @private * @param {HTMLElement} element The Tabs element to read options data from * @returns {Object} The options read from the component data attributes */ function readData(element) { var data = element.dataset; var options = []; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var reserved = ["is", "hook" + capitalized]; for (var key in data) { if (data.hasOwnProperty(key)) { var value = data[key]; if (key.indexOf(NS) === 0) { key = key.slice(NS.length); key = key.charAt(0).toLowerCase() + key.substring(1); if (reserved.indexOf(key) === -1) { options[key] = value; } } } } return options; } /** * Document ready handler and DOM mutation observers. Initializes Tabs components as necessary. * * @private */ function onDocumentReady() { var elements = document.querySelectorAll(selectors.self); for (var i = 0; i < elements.length; i++) { new Tabs({ element: elements[i], options: readData(elements[i]) }); } var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var body = document.querySelector("body"); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // needed for IE var nodesArray = [].slice.call(mutation.addedNodes); if (nodesArray.length > 0) { nodesArray.forEach(function(addedNode) { if (addedNode.querySelectorAll) { var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); elementsArray.forEach(function(element) { new Tabs({ element: element, options: readData(element) }); }); } }); } }); }); observer.observe(body, { subtree: true, childList: true, characterData: true }); } if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady); } }()); /******************************************************************************* * Copyright 2018 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ (function() { "use strict"; var NS = "cmp"; var IS = "carousel"; var keyCodes = { SPACE: 32, END: 35, HOME: 36, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_RIGHT: 39, ARROW_DOWN: 40 }; var selectors = { self: "[data-" + NS + '-is="' + IS + '"]' }; var properties = { /** * Determines whether the Carousel will automatically transition between slides * * @memberof Carousel * @type {Boolean} * @default false */ "autoplay": { "default": false, "transform": function(value) { return !(value === null || typeof value === "undefined"); } }, /** * Duration (in milliseconds) before automatically transitioning to the next slide * * @memberof Carousel * @type {Number} * @default 5000 */ "delay": { "default": 5000, "transform": function(value) { value = parseFloat(value); return !isNaN(value) ? value : null; } }, /** * Determines whether automatic pause on hovering the carousel is disabled * * @memberof Carousel * @type {Boolean} * @default false */ "autopauseDisabled": { "default": false, "transform": function(value) { return !(value === null || typeof value === "undefined"); } } }; /** * Carousel Configuration * * @typedef {Object} CarouselConfig Represents a Carousel configuration * @property {HTMLElement} element The HTMLElement representing the Carousel * @property {Object} options The Carousel options */ /** * Carousel * * @class Carousel * @classdesc An interactive Carousel component for navigating a list of generic items * @param {CarouselConfig} config The Carousel configuration */ function Carousel(config) { var that = this; if (config && config.element) { init(config); } /** * Initializes the Carousel * * @private * @param {CarouselConfig} config The Carousel configuration */ function init(config) { // prevents multiple initialization config.element.removeAttribute("data-" + NS + "-is"); setupProperties(config.options); cacheElements(config.element); that._active = 0; that._paused = false; if (that._elements.item) { refreshActive(); bindEvents(); resetAutoplayInterval(); refreshPlayPauseActions(); } if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { /* * Editor message handling: * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame * - check that the message data panel container type is correct and that the id (path) matches this specific Carousel component * - if so, route the "navigate" operation to enact a navigation of the Carousel based on index data */ new window.Granite.author.MessageChannel("cqauthor", window).subscribeRequestMessage("cmp.panelcontainer", function(message) { if (message.data && message.data.type === "cmp-carousel" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { if (message.data.operation === "navigate") { navigate(message.data.index); } } }); } } /** * Caches the Carousel elements as defined via the {@code data-carousel-hook="ELEMENT_NAME"} markup API * * @private * @param {HTMLElement} wrapper The Carousel wrapper element */ function cacheElements(wrapper) { that._elements = {}; that._elements.self = wrapper; var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var key = hook.dataset[NS + "Hook" + capitalized]; if (that._elements[key]) { if (!Array.isArray(that._elements[key])) { var tmp = that._elements[key]; that._elements[key] = [tmp]; } that._elements[key].push(hook); } else { that._elements[key] = hook; } } } /** * Sets up properties for the Carousel based on the passed options. * * @private * @param {Object} options The Carousel options */ function setupProperties(options) { that._properties = {}; for (var key in properties) { if (properties.hasOwnProperty(key)) { var property = properties[key]; var value = null; if (options && options[key] != null) { value = options[key]; // transform the provided option if (property && typeof property.transform === "function") { value = property.transform(value); } } if (value === null) { // value still null, take the property default value = properties[key]["default"]; } that._properties[key] = value; } } } /** * Binds Carousel event handling * * @private */ function bindEvents() { if (that._elements["previous"]) { that._elements["previous"].addEventListener("click", function() { navigate(getPreviousIndex()); }); } if (that._elements["next"]) { that._elements["next"].addEventListener("click", function() { navigate(getNextIndex()); }); } var indicators = that._elements["indicator"]; if (indicators) { for (var i = 0; i < indicators.length; i++) { (function(index) { indicators[i].addEventListener("click", function(event) { navigateAndFocusIndicator(index); }); })(i); } } if (that._elements["pause"]) { if (that._properties.autoplay) { that._elements["pause"].addEventListener("click", onPauseClick); } } if (that._elements["play"]) { if (that._properties.autoplay) { that._elements["play"].addEventListener("click", onPlayClick); } } that._elements.self.addEventListener("keydown", onKeyDown); if (!that._properties.autopauseDisabled) { that._elements.self.addEventListener("mouseenter", onMouseEnter); that._elements.self.addEventListener("mouseleave", onMouseLeave); } } /** * Handles carousel keydown events * * @private * @param {Object} event The keydown event */ function onKeyDown(event) { var index = that._active; var lastIndex = that._elements["indicator"].length - 1; switch (event.keyCode) { case keyCodes.ARROW_LEFT: case keyCodes.ARROW_UP: event.preventDefault(); if (index > 0) { navigateAndFocusIndicator(index - 1); } break; case keyCodes.ARROW_RIGHT: case keyCodes.ARROW_DOWN: event.preventDefault(); if (index < lastIndex) { navigateAndFocusIndicator(index + 1); } break; case keyCodes.HOME: event.preventDefault(); navigateAndFocusIndicator(0); break; case keyCodes.END: event.preventDefault(); navigateAndFocusIndicator(lastIndex); break; case keyCodes.SPACE: if (that._properties.autoplay && (event.target !== that._elements["previous"] && event.target !== that._elements["next"])) { event.preventDefault(); if (!that._paused) { pause(); } else { play(); } } if (event.target === that._elements["pause"]) { that._elements["play"].focus(); } if (event.target === that._elements["play"]) { that._elements["pause"].focus(); } break; default: return; } } /** * Handles carousel mouseenter events * * @private * @param {Object} event The mouseenter event */ function onMouseEnter(event) { clearAutoplayInterval(); } /** * Handles carousel mouseleave events * * @private * @param {Object} event The mouseleave event */ function onMouseLeave(event) { resetAutoplayInterval(); } /** * Handles pause element click events * * @private * @param {Object} event The click event */ function onPauseClick(event) { pause(); that._elements["play"].focus(); } /** * Handles play element click events * * @private * @param {Object} event The click event */ function onPlayClick() { play(); that._elements["pause"].focus(); } /** * Pauses the playing of the Carousel. Sets {@code Carousel#_paused} marker. * Only relevant when autoplay is enabled * * @private */ function pause() { that._paused = true; clearAutoplayInterval(); refreshPlayPauseActions(); } /** * Enables the playing of the Carousel. Sets {@code Carousel#_paused} marker. * Only relevant when autoplay is enabled * * @private */ function play() { that._paused = false; // If the Carousel is hovered, don't begin auto transitioning until the next mouse leave event var hovered = false; if (that._elements.self.parentElement) { hovered = that._elements.self.parentElement.querySelector(":hover") === that._elements.self; } if (that._properties.autopauseDisabled || !hovered) { resetAutoplayInterval(); } refreshPlayPauseActions(); } /** * Refreshes the play/pause action markup based on the {@code Carousel#_paused} state * * @private */ function refreshPlayPauseActions() { setActionDisabled(that._elements["pause"], that._paused); setActionDisabled(that._elements["play"], !that._paused); } /** * Refreshes the item markup based on the current {@code Carousel#_active} index * * @private */ function refreshActive() { var items = that._elements["item"]; var indicators = that._elements["indicator"]; if (items) { if (Array.isArray(items)) { for (var i = 0; i < items.length; i++) { if (i === parseInt(that._active)) { items[i].classList.add("cmp-carousel__item--active"); items[i].removeAttribute("aria-hidden"); indicators[i].classList.add("cmp-carousel__indicator--active"); indicators[i].setAttribute("aria-selected", true); indicators[i].setAttribute("tabindex", "0"); } else { items[i].classList.remove("cmp-carousel__item--active"); items[i].setAttribute("aria-hidden", true); indicators[i].classList.remove("cmp-carousel__indicator--active"); indicators[i].setAttribute("aria-selected", false); indicators[i].setAttribute("tabindex", "-1"); } } } else { // only one item items.classList.add("cmp-carousel__item--active"); indicators.classList.add("cmp-carousel__indicator--active"); } } } /** * Focuses the element and prevents scrolling the element into view * * @param {HTMLElement} element Element to focus */ function focusWithoutScroll(element) { var x = window.scrollX || window.pageXOffset; var y = window.scrollY || window.pageYOffset; element.focus(); window.scrollTo(x, y); } /** * Retrieves the next active index, with looping * * @private * @returns {Number} Index of the next carousel item */ function getNextIndex() { return that._active === (that._elements["item"].length - 1) ? 0 : that._active + 1; } /** * Retrieves the previous active index, with looping * * @private * @returns {Number} Index of the previous carousel item */ function getPreviousIndex() { return that._active === 0 ? (that._elements["item"].length - 1) : that._active - 1; } /** * Navigates to the item at the provided index * * @private * @param {Number} index The index of the item to navigate to */ function navigate(index) { if (index < 0 || index > (that._elements["item"].length - 1)) { return; } that._active = index; refreshActive(); // reset the autoplay transition interval following navigation, if not already hovering the carousel if (that._elements.self.parentElement) { if (that._elements.self.parentElement.querySelector(":hover") !== that._elements.self) { resetAutoplayInterval(); } } } /** * Navigates to the item at the provided index and ensures the active indicator gains focus * * @private * @param {Number} index The index of the item to navigate to */ function navigateAndFocusIndicator(index) { navigate(index); focusWithoutScroll(that._elements["indicator"][index]); } /** * Starts/resets automatic slide transition interval * * @private */ function resetAutoplayInterval() { if (that._paused || !that._properties.autoplay) { return; } clearAutoplayInterval(); that._autoplayIntervalId = window.setInterval(function() { if (document.visibilityState && document.hidden) { return; } var indicators = that._elements["indicators"]; if (indicators !== document.activeElement && indicators.contains(document.activeElement)) { // if an indicator has focus, ensure we switch focus following navigation navigateAndFocusIndicator(getNextIndex()); } else { navigate(getNextIndex()); } }, that._properties.delay); } /** * Clears/pauses automatic slide transition interval * * @private */ function clearAutoplayInterval() { window.clearInterval(that._autoplayIntervalId); that._autoplayIntervalId = null; } /** * Sets the disabled state for an action and toggles the appropriate CSS classes * * @private * @param {HTMLElement} action Action to disable * @param {Boolean} [disable] {@code true} to disable, {@code false} to enable */ function setActionDisabled(action, disable) { if (!action) { return; } if (disable !== false) { action.disabled = true; action.classList.add("cmp-carousel__action--disabled"); } else { action.disabled = false; action.classList.remove("cmp-carousel__action--disabled"); } } } /** * Reads options data from the Carousel wrapper element, defined via {@code data-cmp-*} data attributes * * @private * @param {HTMLElement} element The Carousel element to read options data from * @returns {Object} The options read from the component data attributes */ function readData(element) { var data = element.dataset; var options = []; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var reserved = ["is", "hook" + capitalized]; for (var key in data) { if (data.hasOwnProperty(key)) { var value = data[key]; if (key.indexOf(NS) === 0) { key = key.slice(NS.length); key = key.charAt(0).toLowerCase() + key.substring(1); if (reserved.indexOf(key) === -1) { options[key] = value; } } } } return options; } /** * Document ready handler and DOM mutation observers. Initializes Carousel components as necessary. * * @private */ function onDocumentReady() { var elements = document.querySelectorAll(selectors.self); for (var i = 0; i < elements.length; i++) { new Carousel({ element: elements[i], options: readData(elements[i]) }); } var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var body = document.querySelector("body"); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // needed for IE var nodesArray = [].slice.call(mutation.addedNodes); if (nodesArray.length > 0) { nodesArray.forEach(function(addedNode) { if (addedNode.querySelectorAll) { var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); elementsArray.forEach(function(element) { new Carousel({ element: element, options: readData(element) }); }); } }); } }); }); observer.observe(body, { subtree: true, childList: true, characterData: true }); } if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady); } }()); /******************************************************************************* * Copyright 2017 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ if (window.Element && !Element.prototype.closest) { // eslint valid-jsdoc: "off" Element.prototype.closest = function(s) { "use strict"; var matches = (this.document || this.ownerDocument).querySelectorAll(s); var el = this; var i; do { i = matches.length; while (--i >= 0 && matches.item(i) !== el) { // continue } } while ((i < 0) && (el = el.parentElement)); return el; }; } if (window.Element && !Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { "use strict"; var matches = (this.document || this.ownerDocument).querySelectorAll(s); var i = matches.length; while (--i >= 0 && matches.item(i) !== this) { // continue } return i > -1; }; } if (!Object.assign) { Object.assign = function(target, varArgs) { // .length of function is 2 "use strict"; if (target === null) { throw new TypeError("Cannot convert undefined or null to object"); } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments[index]; if (nextSource !== null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }; } (function(arr) { "use strict"; arr.forEach(function(item) { if (item.hasOwnProperty("remove")) { return; } Object.defineProperty(item, "remove", { configurable: true, enumerable: true, writable: true, value: function remove() { this.parentNode.removeChild(this); } }); }); })([Element.prototype, CharacterData.prototype, DocumentType.prototype]); /******************************************************************************* * Copyright 2016 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ (function() { "use strict"; var NS = "cmp"; var IS = "image"; var EMPTY_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; var LAZY_THRESHOLD = 0; var SRC_URI_TEMPLATE_WIDTH_VAR = "{.width}"; var selectors = { self: "[data-" + NS + '-is="' + IS + '"]', image: '[data-cmp-hook-image="image"]', map: '[data-cmp-hook-image="map"]', area: '[data-cmp-hook-image="area"]' }; var lazyLoader = { "cssClass": "cmp-image__image--is-loading", "style": { "height": 0, "padding-bottom": "" // will be replaced with % ratio } }; var properties = { /** * An array of alternative image widths (in pixels). * Used to replace a {.width} variable in the src property with an optimal width if a URI template is provided. * * @memberof Image * @type {Number[]} * @default [] */ "widths": { "default": [], "transform": function(value) { var widths = []; value.split(",").forEach(function(item) { item = parseFloat(item); if (!isNaN(item)) { widths.push(item); } }); return widths; } }, /** * Indicates whether the image should be rendered lazily. * * @memberof Image * @type {Boolean} * @default false */ "lazy": { "default": false, "transform": function(value) { return !(value === null || typeof value === "undefined"); } }, /** * The image source. * * Can be a simple image source, or a URI template representation that * can be variable expanded - useful for building an image configuration with an alternative width. * e.g. '/path/image.coreimg{.width}.jpeg/1506620954214.jpeg' * * @memberof Image * @type {String} */ "src": { } }; var devicePixelRatio = window.devicePixelRatio || 1; function readData(element) { var data = element.dataset; var options = []; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var reserved = ["is", "hook" + capitalized]; for (var key in data) { if (data.hasOwnProperty(key)) { var value = data[key]; if (key.indexOf(NS) === 0) { key = key.slice(NS.length); key = key.charAt(0).toLowerCase() + key.substring(1); if (reserved.indexOf(key) === -1) { options[key] = value; } } } } return options; } function Image(config) { var that = this; function init(config) { // prevents multiple initialization config.element.removeAttribute("data-" + NS + "-is"); setupProperties(config.options); cacheElements(config.element); if (!that._elements.noscript) { return; } that._elements.container = that._elements.link ? that._elements.link : that._elements.self; unwrapNoScript(); if (that._properties.lazy) { addLazyLoader(); } if (that._elements.map) { that._elements.image.addEventListener("load", onLoad); } window.addEventListener("scroll", that.update); window.addEventListener("resize", onWindowResize); window.addEventListener("update", that.update); that._elements.image.addEventListener("cmp-image-redraw", that.update); that.update(); } function loadImage() { var hasWidths = that._properties.widths && that._properties.widths.length > 0; var replacement = hasWidths ? "." + getOptimalWidth() : ""; var url = that._properties.src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, replacement); if (that._elements.image.getAttribute("src") !== url) { that._elements.image.setAttribute("src", url); if (!hasWidths) { window.removeEventListener("scroll", that.update); } } if (that._lazyLoaderShowing) { that._elements.image.addEventListener("load", removeLazyLoader); } } function getOptimalWidth() { var container = that._elements.self; var containerWidth = container.clientWidth; while (containerWidth === 0 && container.parentNode) { container = container.parentNode; containerWidth = container.clientWidth; } var optimalWidth = containerWidth * devicePixelRatio; var len = that._properties.widths.length; var key = 0; while ((key < len - 1) && (that._properties.widths[key] < optimalWidth)) { key++; } return that._properties.widths[key].toString(); } function addLazyLoader() { var width = that._elements.image.getAttribute("width"); var height = that._elements.image.getAttribute("height"); if (width && height) { var ratio = (height / width) * 100; var styles = lazyLoader.style; styles["padding-bottom"] = ratio + "%"; for (var s in styles) { if (styles.hasOwnProperty(s)) { that._elements.image.style[s] = styles[s]; } } } that._elements.image.setAttribute("src", EMPTY_PIXEL); that._elements.image.classList.add(lazyLoader.cssClass); that._lazyLoaderShowing = true; } function unwrapNoScript() { var markup = decodeNoscript(that._elements.noscript.textContent.trim()); var parser = new DOMParser(); // temporary document avoids requesting the image before removing its src var temporaryDocument = parser.parseFromString(markup, "text/html"); var imageElement = temporaryDocument.querySelector(selectors.image); imageElement.removeAttribute("src"); that._elements.container.insertBefore(imageElement, that._elements.noscript); var mapElement = temporaryDocument.querySelector(selectors.map); if (mapElement) { that._elements.container.insertBefore(mapElement, that._elements.noscript); } that._elements.noscript.parentNode.removeChild(that._elements.noscript); if (that._elements.container.matches(selectors.image)) { that._elements.image = that._elements.container; } else { that._elements.image = that._elements.container.querySelector(selectors.image); } that._elements.map = that._elements.container.querySelector(selectors.map); that._elements.areas = that._elements.container.querySelectorAll(selectors.area); } function removeLazyLoader() { that._elements.image.classList.remove(lazyLoader.cssClass); for (var property in lazyLoader.style) { if (lazyLoader.style.hasOwnProperty(property)) { that._elements.image.style[property] = ""; } } that._elements.image.removeEventListener("load", removeLazyLoader); that._lazyLoaderShowing = false; } function isLazyVisible() { if (that._elements.container.offsetParent === null) { return false; } var wt = window.pageYOffset; var wb = wt + document.documentElement.clientHeight; var et = that._elements.container.getBoundingClientRect().top + wt; var eb = et + that._elements.container.clientHeight; return eb >= wt - LAZY_THRESHOLD && et <= wb + LAZY_THRESHOLD; } function resizeAreas() { if (that._elements.areas && that._elements.areas.length > 0) { for (var i = 0; i < that._elements.areas.length; i++) { var width = that._elements.image.width; var height = that._elements.image.height; if (width && height) { var relcoords = that._elements.areas[i].dataset.cmpRelcoords; if (relcoords) { var relativeCoordinates = relcoords.split(","); var coordinates = new Array(relativeCoordinates.length); for (var j = 0; j < coordinates.length; j++) { if (j % 2 === 0) { coordinates[j] = parseInt(relativeCoordinates[j] * width); } else { coordinates[j] = parseInt(relativeCoordinates[j] * height); } } that._elements.areas[i].coords = coordinates; } } } } } function cacheElements(wrapper) { that._elements = {}; that._elements.self = wrapper; var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var key = hook.dataset[NS + "Hook" + capitalized]; that._elements[key] = hook; } } function setupProperties(options) { that._properties = {}; for (var key in properties) { if (properties.hasOwnProperty(key)) { var property = properties[key]; if (options && options[key] != null) { if (property && typeof property.transform === "function") { that._properties[key] = property.transform(options[key]); } else { that._properties[key] = options[key]; } } else { that._properties[key] = properties[key]["default"]; } } } } function onWindowResize() { that.update(); resizeAreas(); } function onLoad() { resizeAreas(); } that.update = function() { if (that._properties.lazy) { if (isLazyVisible()) { loadImage(); } } else { loadImage(); } }; if (config && config.element) { init(config); } } function onDocumentReady() { var elements = document.querySelectorAll(selectors.self); for (var i = 0; i < elements.length; i++) { new Image({ element: elements[i], options: readData(elements[i]) }); } var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var body = document.querySelector("body"); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // needed for IE var nodesArray = [].slice.call(mutation.addedNodes); if (nodesArray.length > 0) { nodesArray.forEach(function(addedNode) { if (addedNode.querySelectorAll) { var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); elementsArray.forEach(function(element) { new Image({ element: element, options: readData(element) }); }); } }); } }); }); observer.observe(body, { subtree: true, childList: true, characterData: true }); } if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady); } /* on drag & drop of the component into a parsys, noscript's content will be escaped multiple times by the editor which creates the DOM for editing; the HTML parser cannot be used here due to the multiple escaping */ function decodeNoscript(text) { text = text.replace(/&(amp;)*lt;/g, "<"); text = text.replace(/&(amp;)*gt;/g, ">"); return text; } })(); /******************************************************************************* * Copyright 2017 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ (function() { "use strict"; var NS = "cmp"; var IS = "search"; var DELAY = 300; // time before fetching new results when the user is typing a search string var LOADING_DISPLAY_DELAY = 300; // minimum time during which the loading indicator is displayed var PARAM_RESULTS_OFFSET = "resultsOffset"; var keyCodes = { TAB: 9, ENTER: 13, ESCAPE: 27, ARROW_UP: 38, ARROW_DOWN: 40 }; var selectors = { self: "[data-" + NS + '-is="' + IS + '"]', item: { self: "[data-" + NS + "-hook-" + IS + '="item"]', title: "[data-" + NS + "-hook-" + IS + '="itemTitle"]', focused: "." + NS + "-search__item--is-focused" } }; var properties = { /** * The minimum required length of the search term before results are fetched. * * @memberof Search * @type {Number} * @default 3 */ minLength: { "default": 3, transform: function(value) { value = parseFloat(value); return isNaN(value) ? null : value; } }, /** * The maximal number of results fetched by a search request. * * @memberof Search * @type {Number} * @default 10 */ resultsSize: { "default": 10, transform: function(value) { value = parseFloat(value); return isNaN(value) ? null : value; } } }; var idCount = 0; function readData(element) { var data = element.dataset; var options = []; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var reserved = ["is", "hook" + capitalized]; for (var key in data) { if (data.hasOwnProperty(key)) { var value = data[key]; if (key.indexOf(NS) === 0) { key = key.slice(NS.length); key = key.charAt(0).toLowerCase() + key.substring(1); if (reserved.indexOf(key) === -1) { options[key] = value; } } } } return options; } function toggleShow(element, show) { if (element) { if (show !== false) { element.style.display = "block"; element.setAttribute("aria-hidden", false); } else { element.style.display = "none"; element.setAttribute("aria-hidden", true); } } } function serialize(form) { var query = []; if (form && form.elements) { for (var i = 0; i < form.elements.length; i++) { var node = form.elements[i]; if (!node.disabled && node.name) { var param = [node.name, encodeURIComponent(node.value)]; query.push(param.join("=")); } } } return query.join("&"); } function mark(node, regex) { if (!node || !regex) { return; } // text nodes if (node.nodeType === 3) { var nodeValue = node.nodeValue; var match = regex.exec(nodeValue); if (nodeValue && match) { var element = document.createElement("mark"); element.className = NS + "-search__item-mark"; element.appendChild(document.createTextNode(match[0])); var after = node.splitText(match.index); after.nodeValue = after.nodeValue.substring(match[0].length); node.parentNode.insertBefore(element, after); } } else if (node.hasChildNodes()) { for (var i = 0; i < node.childNodes.length; i++) { // recurse mark(node.childNodes[i], regex); } } } function Search(config) { if (config.element) { // prevents multiple initialization config.element.removeAttribute("data-" + NS + "-is"); } this._cacheElements(config.element); this._setupProperties(config.options); this._action = this._elements.form.getAttribute("action"); this._resultsOffset = 0; this._hasMoreResults = true; this._elements.input.addEventListener("input", this._onInput.bind(this)); this._elements.input.addEventListener("focus", this._onInput.bind(this)); this._elements.input.addEventListener("keydown", this._onKeydown.bind(this)); this._elements.clear.addEventListener("click", this._onClearClick.bind(this)); document.addEventListener("click", this._onDocumentClick.bind(this)); this._elements.results.addEventListener("scroll", this._onScroll.bind(this)); this._makeAccessible(); } Search.prototype._displayResults = function() { if (this._elements.input.value.length === 0) { toggleShow(this._elements.clear, false); this._cancelResults(); } else if (this._elements.input.value.length < this._properties.minLength) { toggleShow(this._elements.clear, true); } else { this._updateResults(); toggleShow(this._elements.clear, true); } }; Search.prototype._onScroll = function(event) { // fetch new results when the results to be scrolled down are less than the visible results if (this._elements.results.scrollTop + 2 * this._elements.results.clientHeight >= this._elements.results.scrollHeight) { this._resultsOffset += this._properties.resultsSize; this._displayResults(); } }; Search.prototype._onInput = function(event) { var self = this; self._cancelResults(); // start searching when the search term reaches the minimum length this._timeout = setTimeout(function() { self._displayResults(); }, DELAY); }; Search.prototype._onKeydown = function(event) { var self = this; switch (event.keyCode) { case keyCodes.TAB: if (self._resultsOpen()) { event.preventDefault(); } break; case keyCodes.ENTER: event.preventDefault(); if (self._resultsOpen()) { var focused = self._elements.results.querySelector(selectors.item.focused); if (focused) { focused.click(); } } break; case keyCodes.ESCAPE: self._cancelResults(); break; case keyCodes.ARROW_UP: if (self._resultsOpen()) { event.preventDefault(); self._stepResultFocus(true); } break; case keyCodes.ARROW_DOWN: if (self._resultsOpen()) { event.preventDefault(); self._stepResultFocus(); } else { // test the input and if necessary fetch and display the results self._onInput(); } break; default: return; } }; Search.prototype._onClearClick = function(event) { event.preventDefault(); this._elements.input.value = ""; toggleShow(this._elements.clear, false); toggleShow(this._elements.results, false); }; Search.prototype._onDocumentClick = function(event) { var inputContainsTarget = this._elements.input.contains(event.target); var resultsContainTarget = this._elements.results.contains(event.target); if (!(inputContainsTarget || resultsContainTarget)) { toggleShow(this._elements.results, false); } }; Search.prototype._resultsOpen = function() { return this._elements.results.style.display !== "none"; }; Search.prototype._makeAccessible = function() { var id = NS + "-search-results-" + idCount; this._elements.input.setAttribute("aria-owns", id); this._elements.results.id = id; idCount++; }; Search.prototype._generateItems = function(data, results) { var self = this; data.forEach(function(item) { var el = document.createElement("span"); el.innerHTML = self._elements.itemTemplate.innerHTML; el.querySelectorAll(selectors.item.title)[0].appendChild(document.createTextNode(item.title)); el.querySelectorAll(selectors.item.self)[0].setAttribute("href", item.url); results.innerHTML += el.innerHTML; }); }; Search.prototype._markResults = function() { var nodeList = this._elements.results.querySelectorAll(selectors.item.self); var escapedTerm = this._elements.input.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); var regex = new RegExp("(" + escapedTerm + ")", "gi"); for (var i = this._resultsOffset - 1; i < nodeList.length; ++i) { var result = nodeList[i]; mark(result, regex); } }; Search.prototype._stepResultFocus = function(reverse) { var results = this._elements.results.querySelectorAll(selectors.item.self); var focused = this._elements.results.querySelector(selectors.item.focused); var newFocused; var index = Array.prototype.indexOf.call(results, focused); var focusedCssClass = NS + "-search__item--is-focused"; if (results.length > 0) { if (!reverse) { // highlight the next result if (index < 0) { results[0].classList.add(focusedCssClass); } else if (index + 1 < results.length) { results[index].classList.remove(focusedCssClass); results[index + 1].classList.add(focusedCssClass); } // if the last visible result is partially hidden, scroll up until it's completely visible newFocused = this._elements.results.querySelector(selectors.item.focused); if (newFocused) { var bottomHiddenHeight = newFocused.offsetTop + newFocused.offsetHeight - this._elements.results.scrollTop - this._elements.results.clientHeight; if (bottomHiddenHeight > 0) { this._elements.results.scrollTop += bottomHiddenHeight; } else { this._onScroll(); } } } else { // highlight the previous result if (index >= 1) { results[index].classList.remove(focusedCssClass); results[index - 1].classList.add(focusedCssClass); } // if the first visible result is partially hidden, scroll down until it's completely visible newFocused = this._elements.results.querySelector(selectors.item.focused); if (newFocused) { var topHiddenHeight = this._elements.results.scrollTop - newFocused.offsetTop; if (topHiddenHeight > 0) { this._elements.results.scrollTop -= topHiddenHeight; } } } } }; Search.prototype._updateResults = function() { var self = this; if (self._hasMoreResults) { var request = new XMLHttpRequest(); var url = self._action + "?" + serialize(self._elements.form) + "&" + PARAM_RESULTS_OFFSET + "=" + self._resultsOffset; request.open("GET", url, true); request.onload = function() { // when the results are loaded: hide the loading indicator and display the search icon after a minimum period setTimeout(function() { toggleShow(self._elements.loadingIndicator, false); toggleShow(self._elements.icon, true); }, LOADING_DISPLAY_DELAY); if (request.status >= 200 && request.status < 400) { // success status var data = JSON.parse(request.responseText); if (data.length > 0) { self._generateItems(data, self._elements.results); self._markResults(); toggleShow(self._elements.results, true); } else { self._hasMoreResults = false; } // the total number of results is not a multiple of the fetched results: // -> we reached the end of the query if (self._elements.results.querySelectorAll(selectors.item.self).length % self._properties.resultsSize > 0) { self._hasMoreResults = false; } } else { // error status } }; // when the results are loading: display the loading indicator and hide the search icon toggleShow(self._elements.loadingIndicator, true); toggleShow(self._elements.icon, false); request.send(); } }; Search.prototype._cancelResults = function() { clearTimeout(this._timeout); this._elements.results.scrollTop = 0; this._resultsOffset = 0; this._hasMoreResults = true; this._elements.results.innerHTML = ""; }; Search.prototype._cacheElements = function(wrapper) { this._elements = {}; this._elements.self = wrapper; var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var key = hook.dataset[NS + "Hook" + capitalized]; this._elements[key] = hook; } }; Search.prototype._setupProperties = function(options) { this._properties = {}; for (var key in properties) { if (properties.hasOwnProperty(key)) { var property = properties[key]; if (options && options[key] != null) { if (property && typeof property.transform === "function") { this._properties[key] = property.transform(options[key]); } else { this._properties[key] = options[key]; } } else { this._properties[key] = properties[key]["default"]; } } } }; function onDocumentReady() { var elements = document.querySelectorAll(selectors.self); for (var i = 0; i < elements.length; i++) { new Search({ element: elements[i], options: readData(elements[i]) }); } var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var body = document.querySelector("body"); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // needed for IE var nodesArray = [].slice.call(mutation.addedNodes); if (nodesArray.length > 0) { nodesArray.forEach(function(addedNode) { if (addedNode.querySelectorAll) { var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); elementsArray.forEach(function(element) { new Search({ element: element, options: readData(element) }); }); } }); } }); }); observer.observe(body, { subtree: true, childList: true, characterData: true }); } if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady); } })(); /******************************************************************************* * Copyright 2016 Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ (function() { "use strict"; var NS = "cmp"; var IS = "formText"; var IS_DASH = "form-text"; var selectors = { self: "[data-" + NS + '-is="' + IS + '"]' }; var properties = { /** * A validation message to display if there is a type mismatch between the user input and expected input. * * @type {String} */ constraintMessage: { }, /** * A validation message to display if no input is supplied, but input is expected for the field. * * @type {String} */ requiredMessage: { } }; function readData(element) { var data = element.dataset; var options = []; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var reserved = ["is", "hook" + capitalized]; for (var key in data) { if (data.hasOwnProperty(key)) { var value = data[key]; if (key.indexOf(NS) === 0) { key = key.slice(NS.length); key = key.charAt(0).toLowerCase() + key.substring(1); if (reserved.indexOf(key) === -1) { options[key] = value; } } } } return options; } function FormText(config) { if (config.element) { // prevents multiple initialization config.element.removeAttribute("data-" + NS + "-is"); } this._cacheElements(config.element); this._setupProperties(config.options); this._elements.input.addEventListener("invalid", this._onInvalid.bind(this)); this._elements.input.addEventListener("input", this._onInput.bind(this)); } FormText.prototype._onInvalid = function(event) { event.target.setCustomValidity(""); if (event.target.validity.typeMismatch) { if (this._properties.constraintMessage) { event.target.setCustomValidity(this._properties.constraintMessage); } } else if (event.target.validity.valueMissing) { if (this._properties.requiredMessage) { event.target.setCustomValidity(this._properties.requiredMessage); } } }; FormText.prototype._onInput = function(event) { event.target.setCustomValidity(""); }; FormText.prototype._cacheElements = function(wrapper) { this._elements = {}; this._elements.self = wrapper; var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS_DASH + "]"); for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; var capitalized = IS; capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); var key = hook.dataset[NS + "Hook" + capitalized]; this._elements[key] = hook; } }; FormText.prototype._setupProperties = function(options) { this._properties = {}; for (var key in properties) { if (properties.hasOwnProperty(key)) { var property = properties[key]; if (options && options[key] != null) { if (property && typeof property.transform === "function") { this._properties[key] = property.transform(options[key]); } else { this._properties[key] = options[key]; } } else { this._properties[key] = properties[key]["default"]; } } } }; function onDocumentReady() { var elements = document.querySelectorAll(selectors.self); for (var i = 0; i < elements.length; i++) { new FormText({ element: elements[i], options: readData(elements[i]) }); } var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var body = document.querySelector("body"); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // needed for IE var nodesArray = [].slice.call(mutation.addedNodes); if (nodesArray.length > 0) { nodesArray.forEach(function(addedNode) { if (addedNode.querySelectorAll) { var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); elementsArray.forEach(function(element) { new FormText({ element: element, options: readData(element) }); }); } }); } }); }); observer.observe(body, { subtree: true, childList: true, characterData: true }); } if (document.readyState !== "loading") { onDocumentReady(); } else { document.addEventListener("DOMContentLoaded", onDocumentReady); } })(); /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0=o.clientWidth&&n>=o.clientHeight}),l=0a[e]&&!t.escapeWithReference&&(n=J(f[o],a[e]-('right'===e?f.width:f.height))),ae({},o,n)}};return l.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';f=le({},f,m[t](e))}),e.offsets.popper=f,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,n=t.reference,i=e.placement.split('-')[0],r=Z,p=-1!==['top','bottom'].indexOf(i),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(n[s])&&(e.offsets.popper[d]=r(n[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var n;if(!q(e.instance.modifiers,'arrow','keepTogether'))return e;var i=o.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexOf(r),l=a?'height':'width',f=a?'Top':'Left',m=f.toLowerCase(),h=a?'left':'top',c=a?'bottom':'right',u=S(i)[l];d[c]-us[c]&&(e.offsets.popper[m]+=d[m]+u-s[c]),e.offsets.popper=g(e.offsets.popper);var b=d[m]+d[l]/2-u/2,y=t(e.instance.popper),w=parseFloat(y['margin'+f],10),E=parseFloat(y['border'+f+'Width'],10),v=b-e.offsets.popper[m]-w-E;return v=$(J(s[l]-u,v),0),e.arrowElement=i,e.offsets.arrow=(n={},ae(n,m,Q(v)),ae(n,h,''),n),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),n=e.placement.split('-')[0],i=T(n),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case he.FLIP:p=[n,i];break;case he.CLOCKWISE:p=z(n);break;case he.COUNTERCLOCKWISE:p=z(n,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(n!==s||p.length===d+1)return e;n=e.placement.split('-')[0],i=T(n);var a=e.offsets.popper,l=e.offsets.reference,f=Z,m='left'===n&&f(a.right)>f(l.left)||'right'===n&&f(a.left)f(l.top)||'bottom'===n&&f(a.top)f(o.right),g=f(a.top)f(o.bottom),b='left'===n&&h||'right'===n&&c||'top'===n&&g||'bottom'===n&&u,y=-1!==['top','bottom'].indexOf(n),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(n=p[d+1]),w&&(r=G(r)),e.placement=n+(r?'-'+r:''),e.offsets.popper=le({},e.offsets.popper,C(e.instance.popper,e.offsets.reference,e.placement)),e=P(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],n=e.offsets,i=n.popper,r=n.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return i[p?'left':'top']=r[o]-(s?i[p?'width':'height']:0),e.placement=T(t),e.offsets.popper=g(i),e}},hide:{order:800,enabled:!0,fn:function(e){if(!q(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=D(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.rightthis._items.length-1||t<0))if(this._isSliding)g(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},De="show",we="out",Ae={HIDE:"hide"+Ee,HIDDEN:"hidden"+Ee,SHOW:"show"+Ee,SHOWN:"shown"+Ee,INSERTED:"inserted"+Ee,CLICK:"click"+Ee,FOCUSIN:"focusin"+Ee,FOCUSOUT:"focusout"+Ee,MOUSEENTER:"mouseenter"+Ee,MOUSELEAVE:"mouseleave"+Ee},Ne="fade",Oe="show",ke=".tooltip-inner",Pe=".arrow",Le="hover",je="focus",He="click",Re="manual",Ue=function(){function i(t,e){if("undefined"==typeof u)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=g(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(g(this.getTipElement()).hasClass(Oe))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),g.removeData(this.element,this.constructor.DATA_KEY),g(this.element).off(this.constructor.EVENT_KEY),g(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&g(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===g(this.element).css("display"))throw new Error("Please use show on visible elements");var t=g.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){g(this.element).trigger(t);var n=_.findShadowRoot(this.element),i=g.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=_.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&g(o).addClass(Ne);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();g(o).data(this.constructor.DATA_KEY,this),g.contains(this.element.ownerDocument.documentElement,this.tip)||g(o).appendTo(l),g(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new u(this.element,o,{placement:a,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:Pe},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}}),g(o).addClass(Oe),"ontouchstart"in document.documentElement&&g(document.body).children().on("mouseover",null,g.noop);var c=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,g(e.element).trigger(e.constructor.Event.SHOWN),t===we&&e._leave(null,e)};if(g(this.tip).hasClass(Ne)){var h=_.getTransitionDurationFromElement(this.tip);g(this.tip).one(_.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=g.Event(this.constructor.Event.HIDE),o=function(){e._hoverState!==De&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),g(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(g(this.element).trigger(i),!i.isDefaultPrevented()){if(g(n).removeClass(Oe),"ontouchstart"in document.documentElement&&g(document.body).children().off("mouseover",null,g.noop),this._activeTrigger[He]=!1,this._activeTrigger[je]=!1,this._activeTrigger[Le]=!1,g(this.tip).hasClass(Ne)){var r=_.getTransitionDurationFromElement(n);g(n).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){g(this.getTipElement()).addClass(Ce+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},t.setContent=function(){var t=this.getTipElement();this.setElementContent(g(t.querySelectorAll(ke)),this.getTitle()),g(t).removeClass(Ne+" "+Oe)},t.setElementContent=function(t,e){var n=this.config.html;"object"==typeof e&&(e.nodeType||e.jquery)?n?g(e).parent().is(t)||t.empty().append(e):t.text(g(e).text()):t[n?"html":"text"](e)},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getContainer=function(){return!1===this.config.container?document.body:_.isElement(this.config.container)?g(this.config.container):g(document).find(this.config.container)},t._getAttachment=function(t){return be[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)g(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==Re){var e=t===Le?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===Le?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;g(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}}),g(this.element).closest(".modal").on("hide.bs.modal",function(){i.element&&i.hide()}),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?je:Le]=!0),g(e.getTipElement()).hasClass(Oe)||e._hoverState===De?e._hoverState=De:(clearTimeout(e._timeout),e._hoverState=De,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===De&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?je:Le]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=we,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===we&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){return"number"==typeof(t=l({},this.constructor.Default,g(this.element).data(),"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),_.typeCheckConfig(pe,t,this.constructor.DefaultType),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Te);null!==e&&e.length&&t.removeClass(e.join(""))},t._handlePopperPlacementChange=function(t){var e=t.instance;this.tip=e.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},t._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(g(t).removeClass(Ne),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},i._jQueryInterface=function(n){return this.each(function(){var t=g(this).data(ve),e="object"==typeof n&&n;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),g(this).data(ve,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.2.1"}},{key:"Default",get:function(){return Ie}},{key:"NAME",get:function(){return pe}},{key:"DATA_KEY",get:function(){return ve}},{key:"Event",get:function(){return Ae}},{key:"EVENT_KEY",get:function(){return Ee}},{key:"DefaultType",get:function(){return Se}}]),i}();g.fn[pe]=Ue._jQueryInterface,g.fn[pe].Constructor=Ue,g.fn[pe].noConflict=function(){return g.fn[pe]=ye,Ue._jQueryInterface};var We="popover",xe="bs.popover",Fe="."+xe,qe=g.fn[We],Me="bs-popover",Ke=new RegExp("(^|\\s)"+Me+"\\S+","g"),Qe=l({},Ue.Default,{placement:"right",trigger:"click",content:"",template:''}),Be=l({},Ue.DefaultType,{content:"(string|element|function)"}),Ve="fade",Ye="show",Xe=".popover-header",ze=".popover-body",Ge={HIDE:"hide"+Fe,HIDDEN:"hidden"+Fe,SHOW:"show"+Fe,SHOWN:"shown"+Fe,INSERTED:"inserted"+Fe,CLICK:"click"+Fe,FOCUSIN:"focusin"+Fe,FOCUSOUT:"focusout"+Fe,MOUSEENTER:"mouseenter"+Fe,MOUSELEAVE:"mouseleave"+Fe},Je=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var o=i.prototype;return o.isWithContent=function(){return this.getTitle()||this._getContent()},o.addAttachmentClass=function(t){g(this.getTipElement()).addClass(Me+"-"+t)},o.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},o.setContent=function(){var t=g(this.getTipElement());this.setElementContent(t.find(Xe),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(ze),e),t.removeClass(Ve+" "+Ye)},o._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},o._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ke);null!==e&&0=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t-1||u.indexOf("em")>-1);function s(e,t){return i.getComputedStyle||(i.getComputedStyle=function(e,t){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return"float"==t&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle&&e.currentStyle[t]?e.currentStyle[t]:null},this}),i.getComputedStyle(e,null).getPropertyValue(t)}function p(t){var n=t||e.clientHeight,i=d(e);return Math.max(Math.floor(n/i),0)}function d(e){var t=s(e,"line-height");return"normal"==t&&(t=1.187*parseInt(s(e,"font-size"))),Math.ceil(parseFloat(t))}l.truncationHTML&&((n=document.createElement("span")).innerHTML=l.truncationHTML);var h,f,C,m,v=l.splitOnChars.slice(0),g=v[0];function y(t){if(t.lastChild)return t.lastChild.childNodes&&t.lastChild.childNodes.length>0?y(Array.prototype.slice.call(t.childNodes).pop()):t.lastChild&&t.lastChild.nodeValue&&""!==t.lastChild.nodeValue&&t.lastChild.nodeValue!=l.truncationChar?t.lastChild:(t.lastChild.parentNode.removeChild(t.lastChild),y(e))}function H(e,t){e.nodeValue=t+l.truncationChar}if("auto"==u?u=p():c&&(u=p(parseInt(u))),o&&l.useNativeClamp)a.overflow="hidden",a.textOverflow="ellipsis",a.webkitBoxOrient="vertical",a.display="-webkit-box",a.webkitLineClamp=u,c&&(a.height=l.clamp+"px");else{var M=(m=u,d(e)*m);M0?v.shift():"",h=r.split(g)),h.length>1?(f=h.pop(),H(i,h.join(g))):h=null,n&&(i.nodeValue=i.nodeValue.replace(l.truncationChar,""),e.innerHTML=i.nodeValue+" "+n.innerHTML+l.truncationChar),h){if(e.clientHeight<=a){if(!(v.length>=0&&""!==g))return e.innerHTML;H(i,h.join(g)+g+f),h=null}}else""===g&&(H(i,""),i=y(e),v=l.splitOnChars.slice(0),g=v[0],h=null,f=null);if(!l.animate)return t(i,a);setTimeout(function(){t(i,a)},!0===l.animate?10:l.animate)}}(y(e),M))}return{original:r,clamped:C}}}); !function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('', prevArrow: '', mobileFirst: true, responsive: [ { breakpoint: 1023, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: true, dotsClass: 'carousel-indicators', arrows: true, mobileFirst: true } } ] }); } else { //standard carousel navigation style selected $('.multiquote-carousel-wrapper.multiquote-standard').slick({ dotsClass: 'carousel-indicators', infinite: true, slidesToShow: 1, slidesToScroll: 1, arrows: true, nextArrow: '', prevArrow: '', mobileFirst: true, responsive: [ { breakpoint: 1023, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: true, dotsClass: 'carousel-indicators', arrows: true, mobileFirst: true } } ] }); //dot carousel navigation style selected $('.multiquote-carousel-wrapper.multiquote-dots').slick({ dotsClass: 'carousel-indicators', infinite: true, slidesToShow: 1, slidesToScroll: 1, arrows: false, mobileFirst: true, responsive: [ { breakpoint: 1023, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: true, dotsClass: 'carousel-indicators', arrows: false, dots: true, autoplay: true, autoplaySpeed: 3000, pauseOnHover: true, pauseOnFocus: true, mobileFirst: true } } ] }); } /* Media carousel update - 866065 end*/ //Commenting below code because this makes all the slides of same height as the largest slide, thus adding // more space below image for slides having less or no caption text /*.on('setPosition', function (event, slick) { if($(window).width() < 1024) { slick.$slides.css('height', slick.$slideTrack.height() + 'px'); } }); */ $('.multiquote-carousel-wrapper').find('button').removeClass('hidden'); $('.slick-dots').addClass("carousel-indicators"); function carouselContent() { $('.multiquote-carousel-wrapper').find('.carousel-content').hide(); $('.multiquote-carousel-wrapper').find('.media-carousel-play-icon').hide(); $('.multiquote-carousel-wrapper').find('.carousel-list.slick-active .carousel-content').show(); $('.multiquote-carousel-wrapper').find('.carousel-list.slick-active .media-carousel-play-icon').show(); } carouselContent(); $('.multiquote-carousel-wrapper').on('beforeChange', function(event, slick, currentSlide, nextSlide){ if ($(window).width() < 1024) { $(this).find('.carousel-content').show(); $(this).find('.media-carousel-play-icon').hide(); } else { $(this).find('.carousel-content').hide(); $(this).find('.media-carousel-play-icon').hide(); } }); $('.multiquote-carousel-wrapper').on('afterChange', function(event, slick, currentSlide) { if ( $(window).width() > 1023 ) { carouselContent(); } }); //for media carousel with images navigation arrows var $slickTrack = $('.multiquote-carousel-wrapper').find('.slick-track'); var $buttonPrev = $('.multiquote-carousel-wrapper').find('.slick-prev'); var $buttonNext = $('.multiquote-carousel-wrapper').find('.slick-next'); if ( $(window).width() < 480 ) { $slickTrack.css("height","100%"); } $buttonNext.click(function(){ if ( $(window).width() < 480 ) { $slickTrack.css("height","100%"); } }); $buttonPrev.click(function(){ if ( $(window).width() < 480 ) { $slickTrack.css("height","100%"); } }); }); /* Multiquote Carousel end */; // Initialize and add the map $(document).ready(function() { var $navigation = $(".tabs .tab-nav"), $title = $navigation.find('.navTitle'), $item = $navigation.find('.item'), maxheight = [], count = $item.length; if (count < 6) { $('.tabs .slick-track').css('width','100%'); } function titleHeight() { $title.each(function() { maxheight = ($(this).height() > maxheight ? $(this).height() : maxheight); }); $title.height(maxheight); } function SlickActive() { var windowSize = $(window).width(); if (windowSize > 800) { var cuttoff = count - 6; } else if (windowSize > 600) { var cuttoff = count - 4; } else if (windowSize > 480) { var cuttoff = count - 3; } else { var cuttoff = count - 2; } //set slick active on all items showing on page $navigation.click(function(){ if ($(".tabs .tab-nav .slick-current").attr('data-slick-index') > cuttoff ){ $('.item').filter(function () { return $(this).data('slick-index') > cuttoff - 1; }).addClass('slick-active'); //$('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); } $('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); }); } $(window).resize(function(){ $title.removeAttr("style"); maxheight = []; SlickActive(); titleHeight(); }); //slick slider to create carousel tabs $('.tabs .tab-for').each(function(key, item) { var sliderIdName = 'slider' + key; var sliderNavIdName = 'sliderNav' + key; this.id = sliderIdName; $('.tabs .tab-nav')[key].id = sliderNavIdName; var sliderId = '#' + sliderIdName; var sliderNavId = '#' + sliderNavIdName; //$('.tabs button.slick-prev').before('') $('.tabs button.slick-prev').remove(); $(sliderId).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, infinite: false, asNavFor: sliderNavId, draggable: false, autoplay: false }); $(sliderNavId).slick({ slidesToShow: 6, slidesToScroll: 1, asNavFor: sliderId, dots: false, infinite: false, centerMode: false, draggable: false, focusOnSelect: true, // variableWidth: true, responsive: [ { breakpoint: 480, settings: { slidesToShow: 2 } }, { breakpoint: 600, settings: { slidesToShow: 3 } }, { breakpoint: 800, settings: { slidesToShow: 4 } } ] }); }); if (count < 6) { $('.tabs .slick-track .slick-search-tab').css({ 'width': '100%', 'display': 'flex' }); } /*$('.slick-slide').click(function(){ $(this).find('p').click(); });*/ $('.tabs .slick-back').click(function(e){ e.preventDefault(); var parent = $(this).parent('.tab-nav'); $( parent ).slick('slickGoTo', 0 ); }); SlickActive(); titleHeight(); // --------------- For adjusting height of grey background according to searchfilter results in tabs component --------------------- $tabBody = $('.tabs .tab-for'); $itemSlickslide = $('.tabs .tab-for .item'); $itemSlickslideActive = $('.tabs .tab-for .item.slick-current'); $itemSlickslide.removeClass('noclick'); //enable the tabs body on DOM ready //On page load set height of first active tab window.addEventListener('load', ()=> { if ($('.tabs .tab-for').length >=1) { var $currSlideHeight = $('.tabs .tab-for').find('.slick-slide.slick-current.slick-active').height(); var $finalCurrSlideHeight = $currSlideHeight + 'px'; var $slickTrack = $('.tabs .tab-for').find('.slick-slide.slick-current.slick-active').parents().eq(0); $slickTrack.css("height",$finalCurrSlideHeight); $item.removeClass('noclick'); } }); //on click of tabs adjust height as per its content /*$navigation.find('.item').click(function(){ //$(this).parents().eq(2).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(2).next(); var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); $tabForCurrentItem.each(function(){ var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $currTabBody.find('.slick-track').css("height",finalHeight); }); });*/ //On clicking body of tab re-adjust tab body height as per its content /*$tabBody.find('.slick-track').click(function(e){ //if(e.target !== e.currentTarget) return; e.stopImmediatePropagation(); $(this).parents().eq(1).find('.slick-track').css("height","100%"); //if($(this).find('.searchfilter').length <= 0){ setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); //} else { // return; //} });*/ // On Drag event in mobile mode $(".tabs .tab-nav").find('.draggable').on('touchend', function() { $(this).parents().eq(0).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(0).next(); var $tabForCurrentItem = $(this).parents().eq(0).next().find('.item.slick-slide.slick-current').eq(0); $tabForCurrentItem.each(function(){ var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $currTabBody.find('.slick-track').css("height",finalHeight); }); }); // On swipe of tab navigation in mobile $(".tabs .tab-nav").find('.item').on('touchend', function() { $(this).parents().eq(2).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(2).next(); //var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); setTimeout(function(){ $currTabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); // On swipe of tab body in mobile $tabBody.find('.slick-track').on('touchend', function(e){ //$(this).parents().eq(1).find('.slick-track').css("height","100%"); setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); //When clicking '+' icon to load more search results in tabs $tabBody.find('.search-lazy-load .icon-Add').click(function(){ $(this).parents().eq(8).find('.slick-track').css("height","100%"); /*var tabBody = $(this).parents().eq(8); setTimeout(function(){ tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; console.log('lazy height'+finalHeight); $(this).find('.slick-track').css("height",finalHeight); }); }, 2000);*/ }); //--------------------------------------------------------- End ---------------------------------------------------------------- }); $(function () { if ($('.tabs .tab-nav').length === 0) { return; } const $currentPagePathInput = $('#currentPagePath'); const pathValue = $currentPagePathInput.length ? $currentPagePathInput.val() : ''; const regex = /(?:global|Language_masters)\/([a-z]{2}(?:_[a-z]{2})?)/; let extractedLocale = 'Not found'; const match = pathValue.match(regex); if (match && match[1]) { extractedLocale = match[1]; const localeMap = { 'en': 'en-US', 'pt': 'pt-BR', 'zh': 'zh-CN' }; finalLang = localeMap[extractedLocale] || extractedLocale; } $('.tabItemText').attr('lang', finalLang); const mediaQuery = window.matchMedia("(min-width: 1200px)"); function applyConditionalBreaks() { const characterLimit = 25; const emailRegex = /(\S+)@(\S+\.\S+)/g; $('.tabItemText').each(function() { let $element = $(this); let content = $element.html().trim(); if (!content.includes('
@')) { let newContent = content; if (mediaQuery.matches) { // Screen is >= 1200px: Apply break unconditionally newContent = content.replace(emailRegex, '$1
@$2'); } else if (content.length > characterLimit) { // Screen is < 1200px AND content is too long: Apply break newContent = content.replace(emailRegex, '$1
@$2'); } if (newContent !== content) { $element.html(newContent); } } }); } applyConditionalBreaks(); mediaQuery.addEventListener('change', applyConditionalBreaks); }); ;(function($) { var ProcessChain = function(el) { this.$ctx = $(el); this.setup(); }; ProcessChain.prototype = { setup: function() { var self = this; self.bindEvents(); self.setupItemContentWidth(); self.checkTwoItemVariation(); }, elmo: function(el, mo, isClass) { mo = (mo) ? '--'+mo : ''; if (isClass) return 'cmp-processchain__' + el + mo; return '.cmp-processchain__' + el + mo; }, bindEvents: function() { var self = this; var $cmp = self.$ctx; var b = self.elmo; $cmp.find(b('process-item-header')).each(function(count, value) { $(this).parent().data('count', count); }); $cmp.find(b('process-item-header')).on('click', function(){ var thisItem = this; var count = $(this).parent().data('count') == 0 || self.isMobileViewport() ? $(this).parent().data('count') : $(this).parent().data('count') - 1; var containerWidth = $cmp.find(b('inner')).width(); var itemWidth = self.isMobileViewport() ? containerWidth / 5 : containerWidth / 12; var spacerWidth = $cmp.find(b('process-item-first-spacer')).width(); if ($(this).parent().hasClass(b('process-item', 'expanded', true))) { $(this).parent().removeClass(b('process-item', 'expanded', true)); $(this).parent().parent().removeClass(b('inner', 'item-expanded', true)) } else { $cmp.find(b('process-item', 'expanded')).removeClass(b('process-item', 'expanded', true)); $(this).parent().addClass(b('process-item', 'expanded', true)); $(this).parent().parent().addClass(b('inner', 'item-expanded', true)); $cmp.find(b('container')).animate({scrollLeft: itemWidth * (count) + spacerWidth}, 250); } }); $cmp.find(b('close')).on('click', function(){ $(this).parent().removeClass(b('process-item', 'expanded', true)); $(this).parent().parent().removeClass(b('inner', 'item-expanded', true)) }); $(window).on('resize', function(){ self.setupItemContentWidth(); }); }, setupItemContentWidth: function(){ var self = this; var $cmp = self.$ctx; var b = self.elmo; var containerWidth = $cmp.find(b('inner')).width(); var items = $cmp.find(b('process-item')).length; var itemContentWidth = self.isMobileViewport() ? containerWidth : containerWidth - ((containerWidth / 12) *2); $cmp.find(b('process-item-content')).width(itemContentWidth); }, isMobileViewport: function() { return ($(window).width() < 1024 ) ? true : false; }, checkTwoItemVariation: function() { var self = this; var $cmp = self.$ctx; var b = self.elmo; var itemCount = $cmp.find(b('process-item')).length; if (itemCount === 2) { $cmp.find(b('clipping')).addClass(b('clipping', 'two-item-variation', true)); $cmp.find(b('mobile-accordion')).addClass(b('mobile-accordion', 'two-item-variation', true)); } } }; buhler={}; buhler.components={}; buhler.components.processchain=ProcessChain; $(function() { $('.cmp-processchain').each(function() { new ProcessChain(this); }); }); })($); $(document).ready(function() { var $navigation = $(".tabscontainer .tab-nav"), $title = $navigation.find('.navTitle'), $item = $navigation.find('.item'), maxheight = [], count = $item.length; if (count < 6) { $('.tabscontainer .slick-track').css('width','100%'); } function titleHeight() { $navigation.each(function () { var maxheight = 0; var $titles = $(this).find('.tabItemText'); $titles.css('height', 'auto'); $titles.each(function () { var h = $(this).height(); maxheight = h > maxheight ? h : maxheight; }); $titles.height(maxheight); }); } function SlickActive() { var windowSize = $(window).width(); if (windowSize > 800) { var cuttoff = count - 6; } else if (windowSize > 600) { var cuttoff = count - 4; } else if (windowSize > 480) { var cuttoff = count - 3; } else { var cuttoff = count - 2; } //set slick active on all items showing on page $navigation.click(function(){ if ($(".tabscontainer .tab-nav .slick-current").attr('data-slick-index') > cuttoff ){ $('.item').filter(function () { return $(this).data('slick-index') > cuttoff - 1; }).addClass('slick-active'); //$('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); } $('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); }); } $(window).resize(function(){ $title.removeAttr("style"); maxheight = []; SlickActive(); titleHeight(); }); //slick slider to create carousel tabs $('.tabscontainer .tab-for').each(function(key, item) { var sliderIdName = 'slider' + key; var sliderNavIdName = 'sliderNav' + key; this.id = sliderIdName; $('.tabscontainer .tab-nav')[key].id = sliderNavIdName; var sliderId = '#' + sliderIdName; var sliderNavId = '#' + sliderNavIdName; //$('.tabscontainer button.slick-prev').before('') $('.tabscontainer button.slick-prev').remove(); $(sliderId).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, infinite: false, asNavFor: sliderNavId, draggable: false, autoplay: false }); $(sliderNavId).slick({ slidesToShow: 6, slidesToScroll: 1, asNavFor: sliderId, dots: false, infinite: false, centerMode: false, draggable: false, focusOnSelect: true, // variableWidth: true, responsive: [ { breakpoint: 480, settings: { slidesToShow: 2 } }, { breakpoint: 600, settings: { slidesToShow: 3 } }, { breakpoint: 800, settings: { slidesToShow: 4 } } ] }); }); if (count < 6) { $('.tabscontainer .slick-track .slick-search-tab').css({ 'width': '100%', 'display': 'flex' }); } /*$('.slick-slide').click(function(){ $(this).find('p').click(); });*/ $('.tabscontainer .slick-back').click(function(e){ e.preventDefault(); var parent = $(this).parent('.tab-nav'); $( parent ).slick('slickGoTo', 0 ); }); SlickActive(); titleHeight(); // --------------- For adjusting height of grey background according to searchfilter results in tabs component --------------------- $tabBody = $(".tabscontainer .tab-for"); $itemSlickslide = $(".tabscontainer .tab-for .item"); $itemSlickslideActive = $(".tabscontainer .tab-for .item.slick-current"); $itemSlickslide.removeClass('noclick'); //enable the tabs body on DOM ready window.addEventListener('load', function () { if ($(".tabscontainer .tab-for").length >= 1) { // Small delay to let Slick finish layout setTimeout(function () { var $container = $(".tabscontainer .tab-for"); var $currentSlide = $container.find('.slick-slide.slick-current.slick-active'); var currSlideHeight = $currentSlide.outerHeight(); if (currSlideHeight) { var $slickTrack = $container.find('.slick-track'); $slickTrack.css("height", currSlideHeight + 'px'); } // Remove or fix this line – $item is not defined $item.removeClass('noclick'); }, 100); // adjust timeout if needed } }); //on click of tabs adjust height as per its content /*$navigation.find('.item.slick-current').click(function(){ var $currTabBody = $(this).parents().eq(2).next(); var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); $(this).parents().eq(2).next().find('.slick-track').css("height","100% !important"); });*/ //On clicking body of tab re-adjust tab body height as per its content /*$tabBody.find('.slick-track').click(function(e){ //if(e.target !== e.currentTarget) return; e.stopImmediatePropagation(); $(this).parents().eq(1).find('.slick-track').css("height","100%"); //if($(this).find('.searchfilter').length <= 0){ setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); //} else { // return; //} }); */ // On Drag event in mobile mode $(".tabscontainer .tab-nav").find('.draggable').on('touchend', function() { $(this).parents().eq(0).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(0).next(); var $tabForCurrentItem = $(this).parents().eq(0).next().find('.item.slick-slide.slick-current').eq(0); $tabForCurrentItem.each(function(){ var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $currTabBody.find('.slick-track').css("height",finalHeight); }); }); // On swipe of tab navigation in mobile $(".tabscontainer .tab-nav").find('.item').on('touchend', function() { $(this).parents().eq(2).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(2).next(); //var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); setTimeout(function(){ $currTabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); // On swipe of tab body in mobile $tabBody.find('.slick-track').on('touchend', function(e){ //$(this).parents().eq(1).find('.slick-track').css("height","100%"); setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); //When clicking '+' icon to load more search results in tabs $tabBody.find('.search-lazy-load .icon-Add').click(function(){ $(this).parents().eq(8).find('.slick-track').css("height","100%"); /*var tabBody = $(this).parents().eq(8); setTimeout(function(){ tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; console.log('lazy height'+finalHeight); $(this).find('.slick-track').css("height",finalHeight); }); }, 2000);*/ }); //--------------------------------------------------------- End ---------------------------------------------------------------- }); $(function () { if ($('.tabscontainer .tab-nav').length === 0) { return; } const $currentPagePathInput = $('#currentPagePath'); const pathValue = $currentPagePathInput.length ? $currentPagePathInput.val() : ''; const regex = /(?:global|Language_masters)\/([a-z]{2}(?:_[a-z]{2})?)/; let extractedLocale = 'Not found'; const match = pathValue.match(regex); if (match && match[1]) { extractedLocale = match[1]; const localeMap = { 'en': 'en-US', 'pt': 'pt-BR', 'zh': 'zh-CN' }; finalLang = localeMap[extractedLocale] || extractedLocale; } $('.tabItemText').attr('lang', finalLang); const mediaQuery = window.matchMedia("(min-width: 1200px)"); function applyConditionalBreaks() { const characterLimit = 25; const emailRegex = /(\S+)@(\S+\.\S+)/g; $('.tabItemText').each(function() { let $element = $(this); let content = $element.html().trim(); if (!content.includes('
@')) { let newContent = content; if (mediaQuery.matches) { // Screen is >= 1200px: Apply break unconditionally newContent = content.replace(emailRegex, '$1
@$2'); } else if (content.length > characterLimit) { // Screen is < 1200px AND content is too long: Apply break newContent = content.replace(emailRegex, '$1
@$2'); } if (newContent !== content) { $element.html(newContent); } } }); } applyConditionalBreaks(); mediaQuery.addEventListener('change', applyConditionalBreaks); }); $(document).ready(function() { var $navigation = $(".processlinetabs .tab-nav"), $title = $navigation.find('.navTitle'), $item = $navigation.find('.item'), maxheight = [], count = $item.length; if (count < 6) { $('.slick-track').css('width','100%'); } function titleHeight() { $title.each(function() { maxheight = ($(this).height() > maxheight ? $(this).height() : maxheight); }); $title.height(maxheight); } function SlickActive() { var windowSize = $(window).width(); if (windowSize > 800) { var cuttoff = count - 6; } else if (windowSize > 600) { var cuttoff = count - 4; } else if (windowSize > 480) { var cuttoff = count - 3; } else { var cuttoff = count - 2; } //set slick active on all items showing on page $navigation.click(function(){ if ($(".processlinetabs .tab-nav .slick-current").attr('data-slick-index') > cuttoff ){ $('.item').filter(function () { return $(this).data('slick-index') > cuttoff - 1; }).addClass('slick-active'); //$('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); } $('.item .buhler-media-carousel .carousel-list').addClass('slick-active'); }); } $(window).resize(function(){ $title.removeAttr("style"); maxheight = []; SlickActive(); titleHeight(); }); //slick slider to create carousel tabs $('.tab-for').each(function(key, item) { var sliderIdName = 'slider' + key; var sliderNavIdName = 'sliderNav' + key; this.id = sliderIdName; $('.tab-nav')[key].id = sliderNavIdName; var sliderId = '#' + sliderIdName; var sliderNavId = '#' + sliderNavIdName; $('.tab-for button.slick-prev').before('') $('.tab-for button.slick-prev').remove(); $(sliderId).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: false, infinite: false, asNavFor: sliderNavId, draggable: false, autoplay: false }); $(sliderNavId).slick({ slidesToShow: 6, slidesToScroll: 1, asNavFor: sliderId, dots: false, infinite: false, centerMode: false, draggable: false, focusOnSelect: true, // variableWidth: true, responsive: [ { breakpoint: 480, settings: { slidesToShow: 2 } }, { breakpoint: 600, settings: { slidesToShow: 3 } }, { breakpoint: 800, settings: { slidesToShow: 4 } } ] }); }); if (count < 6) { $('.slick-track .slick-search-tab').css({ 'width': '100%', 'display': 'flex' }); } /*$('.slick-slide').click(function(){ $(this).find('p').click(); });*/ $('.slick-back').click(function(e){ e.preventDefault(); var parent = $(this).parent('.tab-nav'); $( parent ).slick('slickGoTo', 0 ); }); SlickActive(); titleHeight(); // --------------- For adjusting height of grey background according to searchfilter results in tabs component --------------------- $tabBody = $(".processlinetabs .tab-for"); $itemSlickslide = $(".processlinetabs .tab-for .item"); $itemSlickslideActive = $(".processlinetabs .tab-for .item.slick-current"); $itemSlickslide.removeClass('noclick'); //enable the tabs body on DOM ready //On page load set height of first active tab window.addEventListener('load', ()=> { if ($(".processlinetabs .tab-for").length >=1) { var $currSlideHeight = $(".processlinetabs .tab-for").find('.slick-slide.slick-current.slick-active').height(); var $finalCurrSlideHeight = $currSlideHeight + 'px'; var $slickTrack = $(".processlinetabs .tab-for").find('.slick-slide.slick-current.slick-active').parents().eq(0); $slickTrack.css("height",$finalCurrSlideHeight); $item.removeClass('noclick'); } }); //on click of tabs adjust height as per its content $navigation.find('.item').click(function(){ $(this).parents().eq(2).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(2).next(); var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); $tabForCurrentItem.each(function(){ var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $currTabBody.find('.slick-track').css("height",finalHeight); }); }); //On clicking body of tab re-adjust tab body height as per its content $tabBody.find('.slick-track').click(function(e){ //if(e.target !== e.currentTarget) return; //$(this).parents().eq(1).find('.slick-track').css("height","100%"); //if($(this).find('.searchfilter').length <= 0){ setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); //} else { // return; //} }); // On Drag event in mobile mode $(".processlinetabs .tab-nav").find('.draggable').on('touchend', function() { $(this).parents().eq(0).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(0).next(); var $tabForCurrentItem = $(this).parents().eq(0).next().find('.item.slick-slide.slick-current').eq(0); $tabForCurrentItem.each(function(){ var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $currTabBody.find('.slick-track').css("height",finalHeight); }); }); // On swipe of tab navigation in mobile $(".processlinetabs .tab-nav").find('.item').on('touchend', function() { $(this).parents().eq(2).next().find('.slick-track').css("height","100%"); var $currTabBody = $(this).parents().eq(2).next(); //var $tabForCurrentItem = $(this).parents().eq(2).next().find('.item.slick-slide.slick-current'); setTimeout(function(){ $currTabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); // On swipe of tab body in mobile $tabBody.find('.slick-track').on('touchend', function(e){ $(this).parents().eq(1).find('.slick-track').css("height","100%"); setTimeout(function(){ $tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; $(this).find('.slick-track').css("height",finalHeight); }); }, 350); }); //When clicking '+' icon to load more search results in tabs $tabBody.find('.search-lazy-load .icon-Add').click(function(){ $(this).parents().eq(8).find('.slick-track').css("height","100%"); /*var tabBody = $(this).parents().eq(8); setTimeout(function(){ tabBody.each(function(){ var $tabForCurrentItem = $(this).find('.item.slick-slide.slick-current'); var resultTileHeight = $tabForCurrentItem.height(); var finalHeight = resultTileHeight + "px"; console.log('lazy height'+finalHeight); $(this).find('.slick-track').css("height",finalHeight); }); }, 2000);*/ }); //--------------------------------------------------------- End ---------------------------------------------------------------- }); $(document).ready(function () { var mq = window.matchMedia('(max-width: 1023px)'); function isMobile() { return mq.matches; } $('.cmp-tabs').each(function () { var $root = $(this); // Ensure a back header exists at top of each panel $root.find('.cmp-tabs__tabpanel').each(function () { var $panel = $(this); if ($panel.find('.cmp-tabs__panel-header').length) { return; } var $header = $('
', { class: 'cmp-tabs__panel-header' }); var $backBtn = $('