1/** 2 * created this file to run seperately 3 * This function was not working when we compile in wp-scripts 4 * @param {object} keyupEvent 5 * @returns 6 */ 7function searchDestinations(keyupEvent) { 8 9 // Declare variables 10 let input = document.querySelector('#search-input'); 11 let filter = input.value.toUpperCase(); 12 let destinationsList = document.querySelector("#search-list"); 13 let singleDestinations = destinationsList.querySelectorAll('li[data-link-item]'); 14 let parentDestinations = destinationsList.querySelectorAll('.home-search__list > li'); 15 16 // Redirect to search page if click enter 17 // console.log(keyupEvent); 18 if(keyupEvent.keyCode == 13) { 19 window.location.href = frontend_ajax_object.homeurl+"/search/?keyword=" + input.value; 20 return; 21 } 22 input.addEventListener('keyup', function() { 23 if (window.getComputedStyle(destinationsList).display === 'none') { 24 destinationsList.style.display = 'block'; 25 } 26 }); 27 // Loop through all list items, and hide those who don't match the search query 28 for (i = 0; i < singleDestinations.length; i++) { 29 let a = singleDestinations[i].getElementsByTagName("a")[0]; 30 let txtValue = a.textContent || a.innerText; 31 if (txtValue.toUpperCase().indexOf(filter) > -1) { 32 singleDestinations[i].classList.remove('is-hidden'); 33 } else { 34 singleDestinations[i].classList.add('is-hidden'); 35 } 36 } 37 for (i = 0; i < parentDestinations.length; i++) { 38 let childrenDestinations = parentDestinations[i].querySelectorAll('li[data-link-item]'); 39 let hideParentDestination = true; 40 for (let j = 0; j < childrenDestinations.length; j++) { 41 if( !childrenDestinations[j].classList.contains("is-hidden") ) { 42 hideParentDestination = false; 43 } 44 } 45 if(hideParentDestination) { 46 parentDestinations[i].classList.add('is-hidden'); 47 } else { 48 parentDestinations[i].classList.remove('is-hidden'); 49 } 50 } 51 } 52 53 function copyToClipboard(element) { 54 var $temp = $("<input>"); 55 $("body").append($temp); 56 $temp.val($(element).text()).select(); 57 document.execCommand("copy"); 58 $temp.remove(); 59 60 // Update the button text to 'Copied Discount Code' 61 var button = document.getElementById("copyButton"); 62 button.textContent = "Copied Discount Code!"; 63 64 // Revert the button text after 6 seconds 65 setTimeout(function() { 66 button.textContent = "Get Discount Code"; 67 }, 6000); 68 69 } 70 71 72/**=============================== 73* "Read More / Read Less" button 74==================================**/ 75function taxonomyPageToggleReadMore(button) { 76 button.classList.toggle("read-less"); 77 document.querySelector(".taxonomy-page__description").classList.toggle("open"); 78} 79function initReadMoreReadLessButton() { 80 let descriptionHeight = document.querySelector(".taxonomy-page__description")?.clientHeight; 81 let readMoreButton = document.querySelector(".taxonomy-page__read-more"); 82 if(descriptionHeight < 356 && readMoreButton) { 83 document.querySelector(".taxonomy-page__description").classList.add("open"); 84 document.querySelector(".taxonomy-page__read-more").style.display = "none"; 85 } 86} 87document.addEventListener("scroll", (event) => { 88 initReadMoreReadLessButton() 89}); 90initReadMoreReadLessButton(); 91 92 93 94 const swiper = new Swiper('.home_card_slider_carousel', { 95 // Basic settings 96 slidesPerView: 5, 97 spaceBetween: 10, 98 loopFillGroupWithBlank: false, 99 loop: true, 100 101 // Grid settings for mobile rows 102 grid: { 103 rows: 1, 104 fill: 'row', 105 }, 106 107 // Navigation 108 navigation: { 109 nextEl: '.swiper-button-next', 110 prevEl: '.swiper-button-prev', 111 }, 112 113 // // Pagination 114 // pagination: { 115 // el: '.swiper-pagination', 116 // clickable: true, 117 // dynamicBullets: false, 118 // }, 119 120 // Responsive breakpoints 121 breakpoints: { 122 // When window width is >= 0px (mobile) 123 0: { 124 slidesPerView: 2, 125 slidesPerGroup: 2, 126 loop: false, 127 grid: { 128 rows: 2, 129 fill: 'row', 130 }, 131 navigation: { 132 enabled: false 133 }, 134 pagination: { 135 el: '.swiper-pagination', 136 clickable: true, 137 dynamicBullets: false, 138 } 139 }, 140 // When window width is >= 580px 141 580: { 142 slidesPerView: 2, 143 slidesPerGroup: 2, 144 loop: true, 145 }, 146 // When window width is >= 768px 147 768: { 148 slidesPerView: 4, 149 // slidesPerGroup: 4, 150 loop: true, 151 navigation: { 152 enabled: false 153 } 154 }, 155 // When window width is >= 1025px 156 1025: { 157 slidesPerView: 5, 158 // slidesPerGroup: 5, 159 loop: true, 160 navigation: { 161 enabled: false 162 } 163 }, 164 // When window width is >= 1260px 165 1260: { 166 slidesPerView: 5, 167 // slidesPerGroup: 5, 168 loop: true, 169 // loopFillGroupWithBlank: false, 170 navigation: { 171 enabled: true 172 } 173 } 174 } 175 }); 176 177 function initHtSupportSlider() { 178 if (window.innerWidth < 992) { 179 if (!document.querySelector('.ht-support-slider.swiper-initialized')) { 180 new Swiper('.ht-support-slider', { 181 slidesPerView: 1, 182 spaceBetween: 16, 183 pagination: { el: '.swiper-pagination', clickable: true, dynamicBullets: false, }, 184 breakpoints: { 185 768: { slidesPerView: 2 } 186 } 187 }); 188 } 189 } 190 } 191 window.addEventListener('load', initHtSupportSlider); 192 window.addEventListener('resize', initHtSupportSlider);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.