1import { storageService } from '../app/src/services/storage.js' 2 3jQuery(document).ready(function ($) { 4 // handle home menu toggle 5 6 // Target the SVG hamburger icon 7 // You may need to adjust this selector to target your specific icon 8 const operatorHeart = $('#operator-heart') 9 const $menuToggle = $('#toggle-nav a') 10 const $whiteMenuToggle = $('#white-toggle-nav') 11 const whiteLogo = 'https://visitaw.tempurl.host/wp-content/uploads/2025/04/AW-Logo_Horizontal_positive_RGB.svg' 12 const coloredLogo = 'https://visitaw.tempurl.host/wp-content/uploads/2025/04/color-logo.svg' 13 // Create the SVG for the X icon 14 const xSvg = `<svg aria-hidden="true" class="e-font-icon-svg e-fas-times" viewBox="0 0 352 512" xmlns="http://www.w3.org/2000/svg"> 15 <path d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path> 16 </svg>` 17 18 // Store the original hamburger SVG 19 const hamburgerSvg = $('.e-font-icon-svg.e-fas-bars').prop('outerHTML') 20 21 // Function to toggle between hamburger and X icons 22 function toggleMenuIcon() { 23 const $iconWrapper = $('.e-font-icon-svg.e-fas-bars, .e-font-icon-svg.e-fas-times').parent() 24 25 if ($iconWrapper.find('.e-fas-bars').length > 0) { 26 // Change to X 27 $iconWrapper.html(xSvg) 28 } else { 29 // Change back to hamburger 30 $iconWrapper.html(hamburgerSvg) 31 } 32 } 33 34 // Toggle the icon when the menu button is clicked 35 $menuToggle.on('click', function (e) { 36 $('.home-menu').toggleClass('active') 37 $(this).toggleClass('active') 38 toggleMenuIcon() 39 }) 40 41 $whiteMenuToggle.on('click', function (e) { 42 const coloredIcons = $('.colored-icons .elementor-icon') 43 44 const $logo = $('#colored-logo img') 45 46 $('.default-menu').toggleClass('active') 47 $(this).toggleClass('active') 48 49 coloredIcons.each(function () { 50 $(this).toggleClass('active') 51 }) 52 53 // Make sure the element exists 54 if ($logo.length > 0) { 55 const currentSrc = $logo.attr('src') 56 57 if (currentSrc === coloredLogo) { 58 $logo.attr('src', whiteLogo) 59 } else { 60 $logo.attr('src', coloredLogo) 61 } 62 } else { 63 console.error('Logo element not found! Check selector: #colored-logo img') 64 } 65 toggleMenuIcon() 66 }) 67 68 function favouriteToggle() { 69 const id = parseInt(window.wpData.pageId) 70 const tripPlannerIds = storageService.getItem('trip_planner_ids') 71 72 if (tripPlannerIds) { 73 tripPlannerIds.forEach((tripId) => { 74 if (tripId == id) { 75 operatorHeart.addClass('active') 76 } 77 }) 78 } 79 80 operatorHeart.on('click', function (e) { 81 $(this).toggleClass('active') 82 storageService.toggleTripPlannerItem(parseInt(id)) 83 }) 84 85 // only fire on operator page 86 if (window.wpData.postType == 'operator') { 87 if (storageService.isTripPlannerItem(id)) { 88 operatorHeart.addClass('active') 89 } else { 90 operatorHeart.removeClass('active') 91 } 92 } 93 } 94 95 favouriteToggle() 96 97 const timeElements = document.querySelectorAll('.event-time') 98 99 timeElements.forEach((element) => { 100 const text = element.textContent.trim() 101 102 // Check for both Start Time and End Time (case-insensitive) 103 const timePattern = /^((?:start|end)\s*time:)\s*(.+)$/i 104 const match = text.match(timePattern) 105 106 if (match) { 107 const label = match[1].trim() 108 const time = match[2].trim() 109 110 // Only proceed if we have both label and time 111 if (label && time) { 112 element.innerHTML = `<strong>${label}</strong> <span style="font-weight: normal;">${time}</span>` 113 } 114 } 115 }) 116 117 // Use event delegation - listen on document for clicks on the popup when it exists 118 $(document).on('click', '#elementor-popup-modal-245', function (e) { 119 if (!$(e.target).closest('.dialog-message').length) { 120 const coloredIcons = $('.colored-icons .elementor-icon') 121 const $logo = $('#colored-logo img') 122 123 // Make sure the element exists 124 if ($logo.length > 0) { 125 const currentSrc = $logo.attr('src') 126 127 if (currentSrc === coloredLogo) { 128 $logo.attr('src', whiteLogo) 129 } else { 130 $logo.attr('src', coloredLogo) 131 } 132 } else { 133 console.error('Logo element not found! Check selector: #colored-logo img') 134 } 135 toggleMenuIcon() 136 137 $whiteMenuToggle.removeClass('active') 138 $menuToggle.removeClass('active') 139 $('.home-menu').removeClass('active') 140 $('.default-menu').removeClass('active') 141 142 coloredIcons.each(function () { 143 $(this).removeClass('active') 144 }) 145 } 146 }) 147}) 148 149// Main domains - links to these will NOT open in new tab 150const mainDomains = ['visitaw.tempurl.host', 'visitalburywodonga.com']; 151 152function setupLinks() { 153 document.querySelectorAll('a[href]').forEach(link => { 154 const href = link.href; 155 156 // Skip empty links 157 if (!href || href === '#') return; 158 159 // Check if it's a PDF 160 const isPDF = href.toLowerCase().includes('.pdf'); 161 162 // Check if it's external (any http/https link not in mainDomains) 163 const isExternal = (href.startsWith('http://') || href.startsWith('https://')) && 164 !mainDomains.some(domain => href.includes(domain)); 165 166 // Open PDFs (always) and external links in new tab
167 if (isPDF || isExternal) { 168 link.target = '_blank'; 169 link.rel = 'noopener noreferrer'; 170 } 171 }); 172} 173 174// Run on page load 175document.addEventListener('DOMContentLoaded', setupLinks); 176 177// Re-run when new content is added 178new MutationObserver(() => setupLinks()).observe(document.body, { 179 childList: true, 180 subtree: true 181}); 182 183// custom icon for home slider 184document.addEventListener('DOMContentLoaded', function() { 185 const prevButton = document.querySelector('#featured-posts-slider .elementor-swiper-button-prev'); 186 const nextButton = document.querySelector('#featured-posts-slider .elementor-swiper-button-next'); 187 188 const svgURL = 'https://visitaw.tempurl.host/wp-content/uploads/2025/04/Asset-20.svg'; 189 190 if (prevButton) { 191 prevButton.innerHTML = `<img src="${svgURL}" alt="Previous">`; 192 } 193 194 if (nextButton) { 195 nextButton.innerHTML = `<img src="${svgURL}" alt="Next" style="transform: scaleX(-1);">`; 196 } 197});
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.