1(function($) { 2 "use strict"; 3 /* ================================= 4 === Widget Slider ==== 5 =================================== */ 6 function initializeSwiper(selector, desktopView = 1, tabletView = 1, mobileView = 1) { 7 var swiper = new Swiper(selector, { 8 direction: 'horizontal', 9 loop: true, 10 autoplay: { 11 delay: 3000, 12 }, 13 speed: 500, 14 slidesPerView: desktopView, // Default for desktop 15 // Navigation arrows 16 navigation: { 17 nextEl: '.swiper-button-next', 18 prevEl: '.swiper-button-prev', 19 }, 20 breakpoints: { 21 240: { 22 slidesPerView: mobileView, 23 spaceBetween: 0, 24 }, 25 640: { 26 slidesPerView: mobileView, 27 spaceBetween: 0, 28 }, 29 768: { 30 slidesPerView: tabletView, 31 spaceBetween: 10, 32 }, 33 991: { 34 slidesPerView: desktopView, 35 spaceBetween: 24, 36 }, 37 } 38 }); 39 } 40 initializeSwiper('.wigethomemain'); 41 initializeSwiper('.homemain'); 42 initializeSwiper('.featured_cat_slider'); 43 initializeSwiper('.colmnthree',3,2,1); 44 45 /* ================================= 46 === Tiker SLIDER ==== 47 =================================== */ 48 function newspaperupTicker() { 49 var swiper = new Swiper(".bs-latest-news-slider.swipe", { 50 direction: "vertical", 51 slidesPerView: 1, 52 loop: true, 53 autoplay: { 54 delay: 3000, 55 }, 56 speed:1000, 57 }); 58 } 59 newspaperupTicker(); 60 61 /* ================================= 62 === SCROLL TOP ==== 63 =================================== */ 64 var scrollToTopBtn = document.querySelector(".bs_upscr"); 65 var rootElement = document.documentElement; 66 67 function handleScroll() { 68 69 // Do something on scroll 70 var scrollTotal = rootElement.scrollHeight - rootElement.clientHeight; 71 if (rootElement.scrollTop / scrollTotal > 0.05) { 72 // Show button 73 scrollToTopBtn.classList.add("showBtn"); 74 } else { 75 // Hide button 76 scrollToTopBtn.classList.remove("showBtn"); 77 } 78 } 79 80 function scrollToTop(event) { 81 // Scroll to top logic 82 event.preventDefault(); 83 rootElement.scrollTo({ 84 top: 0, 85 behavior: "smooth" 86 }); 87 } 88 if (scrollToTopBtn) { 89 scrollToTopBtn.addEventListener("click", scrollToTop); 90 document.addEventListener("scroll", handleScroll); 91 } 92 93 /* ================================= 94 === STICKY HEADER ==== 95 =================================== */ 96 document.addEventListener('DOMContentLoaded', function () { 97 let stickyHeader = document.querySelector(".bs-menu-full.sticky-header"); 98 if(stickyHeader) { 99 let scrollDownElement = stickyHeader.offsetTop; 100 101 window.addEventListener("scroll", function () { 102 if (window.scrollY > scrollDownElement) { 103 stickyHeader.classList.add("header-sticky"); 104 } else { 105 stickyHeader.classList.remove("header-sticky"); 106 } 107 } 108 ); 109 } 110 }); 111 112 var elements = document.getElementsByClassName('bs-sticky'); 113 114 for (var i = 0; i < elements.length; i++) { 115 new hcSticky(elements[i], { 116 stickTo: elements[i].parentNode, 117 top: 0, 118 bottomEnd: 0, 119 }); 120 } 121 122 jQuery(document).ready(function() { 123 jQuery('.sm').smartmenus({ 124 subMenusSubOffsetX: 1, 125 subMenusSubOffsetY: -8 126 }); 127 }); 128 129 /*--------------------------------------- 130 Off Canvas 131 -----------------------------------------*/ 132 let clickableAddElementRight = document.querySelectorAll('[bs-data-clickable-end]'); 133 let clickableRemoveElement = document.querySelector('[bs-data-removable]'); 134 let clickableRemoveElementTwo = document.querySelector('[bs-remove-overlay]'); 135 let targetElement = document.querySelector('[bs-data-targeted]'); 136 let targetBody = document.querySelector('body'); 137 138 // Function to handle the click event 139 function handleClickRight() { 140 targetElement.classList.add('from-right'); 141 clickableRemoveElementTwo.classList.add('show'); 142 targetBody.style.overflow = 'hidden'; 143 targetBody.style.paddingRight = '17px'; 144 if (clickableRemoveElement) { 145 clickableRemoveElement.focus(); 146 } 147 } 148 149 function handleClickRemove(event) { 150 event.preventDefault(); 151 targetElement.classList.remove('from-right'); 152 clickableRemoveElementTwo.classList.remove('show'); 153 targetBody.style.overflow = null; 154 targetBody.style.paddingRight = null; 155 if (clickableAddElementRight.length > 0) { 156 clickableAddElementRight[0].focus(); 157 } 158 } 159 160 // Attach the handleClick function to the click event of the clickable element 161 if( (clickableAddElementRight !== null) && (clickableAddElementRight !== undefined)) { 162 clickableAddElementRight.forEach(function(element) { 163 element.addEventListener('click', handleClickRight); 164 });
165 } 166 167 // Safety checks for the removal elements 168 if (clickableRemoveElement) { 169 clickableRemoveElement.addEventListener('click', handleClickRemove); 170 } 171 if (clickableRemoveElementTwo) { 172 clickableRemoveElementTwo.addEventListener('click', handleClickRemove); 173 } 174 document.addEventListener('keydown', function(e) { 175 if (e.key === 'Escape' && targetElement.classList.contains('from-right')) { 176 handleClickRemove(e); 177 } 178 }); 179 180 document.addEventListener('keydown', function(e) { 181 182 if (e.key === 'Tab' && targetElement.classList.contains('from-right')) { 183 184 const firstElement = document.querySelector('[bs-data-removable]'); 185 const lastElement = document.querySelector('.empty-sidebar-widget-text a'); 186 // const lastElement = document.querySelector('[bs-data-last]'); 187 188 if (!firstElement || !lastElement) return; 189 190 if (document.activeElement === lastElement && !e.shiftKey) { 191 e.preventDefault(); 192 firstElement.focus(); 193 } 194 195 if (document.activeElement === firstElement && e.shiftKey) { 196 e.preventDefault(); 197 lastElement.focus(); 198 } 199 } 200 }); 201 202 /* ================================= 203 === Featured Tabs ==== 204 =================================== */ 205 function featuredTabsWidget() { 206 document.querySelectorAll('.tab-wrapper').forEach(container => { 207 const tabButtons = container.querySelectorAll('.tab-button'); 208 const tabContents = container.querySelectorAll('.tab-content'); 209 210 tabButtons.forEach((button, index) => { 211 button.addEventListener('click', function () { 212 tabButtons.forEach(btn => btn.classList.remove('active')); 213 tabContents.forEach(tab => tab.style.display = 'none'); 214 tabContents[index].style.display = 'block'; 215 button.classList.add('active'); 216 }); 217 }); 218 219 // Initialize first tab as active 220 tabButtons[0].classList.add('active'); 221 tabContents[0].style.display = 'block'; 222 }); 223 } 224 featuredTabsWidget(); 225 226 /*--------------------------------------- 227 Search 228 -----------------------------------------*/ 229 let clickAddElementSearch = document.querySelectorAll('[bs-search-clickable]'); 230 let targetSearchElement = document.querySelector('[bs-search-targeted]'); 231 let targetHideSearch = document.querySelector('[bs-dismiss-search]'); 232 233 // Function to handle the click event 234 function openSearch(event) { 235 event.preventDefault(); 236 clickableRemoveElementTwo.classList.add('show'); 237 targetSearchElement.classList.add('show-search'); 238 targetBody.style.overflow = 'hidden'; 239 targetBody.style.paddingRight = '17px'; 240 setTimeout(function () { 241 const closeBtn = targetSearchElement.querySelector('[bs-dismiss-search]'); 242 if (closeBtn) { 243 closeBtn.focus(); 244 } 245 }, 10); 246 } 247 function hideSearch() { 248 clickableRemoveElementTwo.classList.remove('show'); 249 targetSearchElement.classList.remove('show-search'); 250 targetBody.style.overflow = null; 251 targetBody.style.paddingRight = null; 252 if (clickAddElementSearch.length > 0) { 253 clickAddElementSearch[0].focus(); 254 } 255 } 256 if(clickAddElementSearch){ 257 clickAddElementSearch.forEach(function(element) { 258 element.addEventListener('click', openSearch); 259 }); 260 } 261 // clickableRemoveElementTwo.addEventListener('click', hideSearch); 262 targetHideSearch.addEventListener('click', hideSearch); 263 264 clickAddElementSearch.forEach(function(element) { 265 element.addEventListener('keydown', function(e) { 266 if (e.key === 'Enter') { 267 e.preventDefault(); 268 openSearch(e); 269 } 270 }); 271 }); 272 273 document.addEventListener('keydown', function(e) { 274 if (e.key === 'Escape' && targetSearchElement.classList.contains('show-search')) { 275 hideSearch(); 276 } 277 }); 278 document.addEventListener('keydown', function(e) { 279 280 if (e.key !== 'Tab') return; 281 if (!targetSearchElement.classList.contains('show-search')) return; 282 283 const firstElement = targetSearchElement.querySelector('[bs-dismiss-search]'); 284 const lastElement = targetSearchElement.querySelector('.search-popup-content .search-form .search-submit'); 285 286 if (!firstElement || !lastElement) return; 287 288 if (document.activeElement === lastElement && !e.shiftKey) { 289 e.preventDefault(); 290 firstElement.focus(); 291 } 292 if (document.activeElement === firstElement && e.shiftKey) { 293 e.preventDefault(); 294 lastElement.focus(); 295 } 296 297 }); 298 299 $(document).ready(function(){ 300 $(".menu-btn").click(function() { 301 console.log('yes'); 302 $(this).toggleClass("on"); 303 $("#main-nav").slideToggle(); 304 $("#menu-header-menu").css("transition", "all 0.8s"); 305 });
306 }); 307 308 function addKeydownListener() { 309 document.addEventListener('keydown', keydownHandler); 310 } 311 312 function removeKeydownListener() { 313 document.removeEventListener('keydown', keydownHandler); 314 } 315 316 function keydownHandler(event) { 317 if (event.key === 'Tab') { 318 var focusedElement = document.activeElement; 319 var parentElement = document.getElementById('main-nav'); 320 var ulParent = parentElement.querySelector("ul.sm.sm-clean"); 321 var lastChild = ulParent.lastElementChild.firstElementChild; 322 323 // Check if the focused element is the last child 324 if (focusedElement === lastChild) { 325 // Prevent the default tab behavior 326 event.preventDefault(); 327 328 // Perform your actions here 329 const returnFocus = document.querySelector('button.menu-btn'); 330 returnFocus.click(); 331 returnFocus.focus(); 332 } 333 } 334 } 335 336 function checkWindowSize() { 337 if (window.innerWidth < 992) { 338 addKeydownListener(); 339 } else { 340 removeKeydownListener(); 341 document.getElementById('main-nav').style.display = ''; 342 } 343 } 344 345 // Check window size on initial load 346 checkWindowSize(); 347 348 // Check window size on resize 349 window.addEventListener('resize', checkWindowSize); 350 351 document.addEventListener('DOMContentLoaded', function() { 352 var pageTitle = document.querySelector('.bs-card-box.page-entry-title + .row .page-title'); 353 if (pageTitle) { 354 pageTitle.remove(); 355 } 356 }); 357 358})(jQuery);
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.