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CardsBlock.js"],"sourcesContent":["(function () {\r\n window.oneadvanced = window.oneadvanced || {};\r\n window.oneadvanced.pricingplancardsblock = window.oneadvanced.pricingplancardsblock || {};\r\n window.oneadvanced.pricingplancardsblock.swiper = window.oneadvanced.pricingplancardsblock.swiper || {};\r\n window.oneadvanced.pricingplancardsblock.init = function () {\r\n // console.log(\"Initialising pricingplancardsblock...\");\r\n\r\n // check if swiper enabled\r\n if (window.oneadvanced.pricingplancardsblock.swiperenabled) {\r\n // a bool flag that's used to check if the swiper elements have the classes already\r\n swiperClassesAlreadyAdded = false;\r\n // gets the element that holds the 3 card divs\r\n card_container = document.getElementsByClassName(\"pricing-cards\");\r\n // gets the card divs\r\n cards = document.getElementsByClassName(\"pricing-card\");\r\n // gets the elements for the tablet side next/prev btns\r\n sidebtns = document.getElementsByClassName(\"sidebtn\");\r\n sidebtnsShown = false;\r\n // gets the bottom dots pagination element\r\n pagination = document.getElementsByClassName(\"swiper-pagination\");\r\n // when the js is initialised, get the screen width and activate the styles for that screen size\r\n checkSize(window.innerWidth);\r\n }\r\n\r\n // check if switch is enabled\r\n if (window.oneadvanced.pricingplancardsblock.switchenabled) {\r\n //setup the switch\r\n window.oneadvanced.pricingplancardsblock.costCollection = document.getElementsByClassName(\"price price__cost_toggle\");\r\n window.oneadvanced.pricingplancardsblock.toggleSwitchContainer = document.getElementById(\"toggle_switch_container\");\r\n window.oneadvanced.pricingplancardsblock.billingSwitch = document.getElementById(\"billing-switch\");\r\n window.oneadvanced.pricingplancardsblock.billingSwitch.addEventListener(\"change\", (e) => {\r\n if (e.target.checked) {\r\n // console.log(\"Checkbox is checked..\");\r\n // checked means annual which is not the default\r\n window.oneadvanced.pricingplancardsblock.toggleSwitchContainer.classList.remove(\"toggle_switch_container--monthly\");\r\n window.oneadvanced.pricingplancardsblock.toggleSwitchContainer.classList.add(\"toggle_switch_container--annual\");\r\n for (i = 0; i < window.oneadvanced.pricingplancardsblock.costCollection.length; i++) {\r\n window.oneadvanced.pricingplancardsblock.costCollection[i].classList.remove(\"price__cost_toggle--monthly\");\r\n window.oneadvanced.pricingplancardsblock.costCollection[i].classList.add(\"price__cost_toggle--annual\");\r\n }\r\n } else {\r\n // console.log(\"Checkbox is not checked..\");\r\n window.oneadvanced.pricingplancardsblock.toggleSwitchContainer.classList.remove(\"toggle_switch_container--annual\");\r\n window.oneadvanced.pricingplancardsblock.toggleSwitchContainer.classList.add(\"toggle_switch_container--monthly\");\r\n for (i = 0; i < window.oneadvanced.pricingplancardsblock.costCollection.length; i++) {\r\n window.oneadvanced.pricingplancardsblock.costCollection[i].classList.remove(\"price__cost_toggle--annual\");\r\n window.oneadvanced.pricingplancardsblock.costCollection[i].classList.add(\"price__cost_toggle--monthly\");\r\n }\r\n }\r\n });\r\n }\r\n };\r\n\r\n var swiperClassesAlreadyAdded,\r\n card_container,\r\n cards,\r\n sidebtns,\r\n sidebtnsShown,\r\n pagination;\r\n\r\n // activates the swiper styles for onload screen size\r\n function checkSize(screenWidth) {\r\n // check if large screen\r\n if (screenWidth > 1024) {\r\n removeSwiper();\r\n // check if tablet screen\r\n } else if (screenWidth > 680) {\r\n initSwiperTablet();\r\n // check if mobile screen\r\n } else {\r\n initSwiperMobile();\r\n }\r\n }\r\n\r\n // adds the necessary swiper classes to the elements so swiper can work\r\n function addSwiperClasses() {\r\n if (!swiperClassesAlreadyAdded) {\r\n for (i = 0; i < card_container.length; i++) {\r\n card_container[i].classList.add(\"swiper-wrapper\");\r\n }\r\n\r\n for (i = 0; i < cards.length; i++) {\r\n cards[i].classList.add(\"swiper-slide\");\r\n }\r\n swiperClassesAlreadyAdded = true;\r\n }\r\n }\r\n\r\n // removes swiper classes from elements so swiper stops working\r\n function removeSwiperClasses() {\r\n if (swiperClassesAlreadyAdded) {\r\n for (i = 0; i < card_container.length; i++) {\r\n card_container[i].classList.remove(\"swiper-wrapper\");\r\n }\r\n\r\n for (i = 0; i < cards.length; i++) {\r\n cards[i].classList.remove(\"swiper-slide\");\r\n }\r\n swiperClassesAlreadyAdded = false;\r\n }\r\n }\r\n\r\n // adds class to next/prev tablet buttons so they are visible\r\n function showSliderBtns() {\r\n if (!sidebtnsShown) {\r\n for (i = 0; i < sidebtns.length; i++) {\r\n sidebtns[i].classList.add(\"active\");\r\n }\r\n sidebtnsShown = true;\r\n }\r\n }\r\n\r\n // removes class from next/prev tablet buttons so they aren't visible\r\n function hideSliderBtns() {\r\n if (sidebtnsShown) {\r\n for (i = 0; i < sidebtns.length; i++) {\r\n sidebtns[i].classList.remove(\"active\");\r\n }\r\n sidebtnsShown = false;\r\n }\r\n }\r\n\r\n // takes in a bool as argument and toggles the visibility class of the dots pagination element\r\n function displayPagination(isVisible) {\r\n if (isVisible) {\r\n for (i = 0; i < pagination.length; i++) {\r\n pagination[i].classList.add(\"visible\");\r\n }\r\n } else {\r\n for (i = 0; i < pagination.length; i++) {\r\n pagination[i].classList.remove(\"visible\");\r\n }\r\n }\r\n }\r\n\r\n // used for wider screens to hide swiper elements, disable swiping by un-initialise the .swiper object\r\n function removeSwiper() {\r\n // console.log(\"Screen is too big. -> Remove Swiper\");\r\n removeSwiperClasses();\r\n hideSliderBtns();\r\n displayPagination(false);\r\n // empty out the .swiper object so that swiper is disabled on the page\r\n window.oneadvanced.pricingplancardsblock.swiper = {};\r\n\r\n // change the margins here since the swiper-added inline css margins will stay if prev device was tablet/mobile\r\n for(i = 0; i < cards.length; i++) {\r\n cards[i].style.margin = \"auto 8.5px auto 8.5px\";\r\n }\r\n }\r\n\r\n // used to toggle swiper elements and functionality when screensize is tablet\r\n function initSwiperTablet() {\r\n // console.log(\"Screen is small enough. -> Initialise Swiper for tablet\");\r\n addSwiperClasses();\r\n showSliderBtns();\r\n displayPagination(true);\r\n\r\n // remove the left margin from desktop if screen was resized\r\n // margin-right will become the spaceBetween property of the Swiper obj below\r\n for (i = 0; i < cards.length; i++) {\r\n cards[i].style.margin = \"auto 0 auto auto\";\r\n }\r\n\r\n // instantiate a swiper object which properties enable btns, pagination and how swiping should work\r\n window.oneadvanced.pricingplancardsblock.swiper = new Swiper(\".mySwiper\", {\r\n slidesPerView: 3,\r\n spaceBetween: 34,\r\n centeredSlides: true,\r\n initialSlide: 1, // make middle card centered by default\r\n navigation: {\r\n nextEl: '.swiper-button-next',\r\n prevEl: '.swiper-button-prev',\r\n },\r\n pagination: {\r\n el: '.swiper-pagination',\r\n clickable: true,\r\n }\r\n });\r\n\r\n if (window.oneadvanced.pricingplancardsblock.hasinitialised != true) {\r\n window.oneadvanced.pricingplancardsblock.hasinitialised = true;\r\n // console.log(\"pricingplancardsblock.hasinitialised is made True.\");\r\n }\r\n }\r\n\r\n // initialises swiper for mobile screens\r\n function initSwiperMobile() {\r\n // console.log(\"Screen is small enough. -> Initialise Swiper for mobile\");\r\n addSwiperClasses();\r\n hideSliderBtns();\r\n displayPagination(false);\r\n // instantiate a swiper object which properties enable swiping and how it should work\r\n window.oneadvanced.pricingplancardsblock.swiper = new Swiper(\".mySwiper\", {\r\n slidesPerView: 3,\r\n spaceBetween: 21,\r\n centeredSlides: true,\r\n initialSlide: 1, // make middle card centered by default\r\n });\r\n\r\n if (window.oneadvanced.pricingplancardsblock.hasinitialised != true) {\r\n window.oneadvanced.pricingplancardsblock.hasinitialised = true;\r\n // console.log(\"pricingplancardsblock.hasinitialised is made True.\");\r\n }\r\n }\r\n\r\n // this compares the new screen size to the old and then toggles the swiper classes and objects for that viewport\r\n window.oneadvanced.pricingplancardsblock.onchange = function (event, newSize, oldSize) {\r\n // console.log(\"pricingplancardsblock.onchange runs because of screen resize.\");\r\n // compare if the new screen size is different than the old, otherwise do nothing\r\n if (newSize != oldSize) {\r\n // desktop\r\n if (Foundation.MediaQuery.atLeast('large')) {\r\n removeSwiper();\r\n }\r\n // tablet\r\n else if (Foundation.MediaQuery.atLeast('medium') && Foundation.MediaQuery.upTo('large')) {\r\n initSwiperTablet();\r\n }\r\n // mobile\r\n else if (Foundation.MediaQuery.upTo('small')) {\r\n initSwiperMobile();\r\n }\r\n }\r\n };\r\n\r\n // envokes on screen resize, checks the width of the screen and sends to the callback function\r\n $(window).on('changed.zf.mediaquery', window.oneadvanced.pricingplancardsblock.onchange);\r\n // set this as True to mark that the JS file is loaded up\r\n window.oneadvanced.pricingplancardsblock.hasLoaded = true;\r\n})();"],"names":["swiperClassesAlreadyAdded","card_container","cards","sidebtns","sidebtnsShown","pagination","addSwiperClasses","i","length","classList","add","hideSliderBtns","remove","displayPagination","isVisible","removeSwiper","removeSwiperClasses","window","oneadvanced","pricingplancardsblock","swiper","style","margin","initSwiperTablet","showSliderBtns","Swiper","slidesPerView","spaceBetween","centeredSlides","initialSlide","navigation","nextEl","prevEl","el","clickable","hasinitialised","initSwiperMobile","init","screenWidth","swiperenabled","document","getElementsByClassName","innerWidth","switchenabled","costCollection","toggleSwitchContainer","getElementById","billingSwitch","addEventListener","e","target","checked","onchange","event","newSize","oldSize","Foundation","MediaQuery","atLeast","upTo","$","on","hasLoaded"],"sourceRoot":""}