1window.addEventListener('DOMContentLoaded', () => { 2 setTimeout(function() { 3 const currentUrl = window.location.href; 4 5 // Check if locationFilterData exists 6 if (typeof locationFilterData === 'undefined' || !locationFilterData.locationTagMapSettings) { 7 return; 8 } 9 10 const locationTagMapSettings = locationFilterData.locationTagMapSettings; 11 12 const selectElement = document.querySelector('select[name="mpfy_tag"]'); 13 if (!selectElement) { 14 return; 15 } 16 17 let matchedLocationTag = null; 18 for (let locationTag in locationTagMapSettings) { 19 if (currentUrl.includes(locationTagMapSettings[locationTag].url)) { 20 matchedLocationTag = locationTagMapSettings[locationTag]; 21 break; 22 } 23 } 24 25 26 if (matchedLocationTag) { 27 // On locationTag map page, show all locations 28 selectElement.value = matchedLocationTag.category_id || ''; 29 } else { 30 // On main page, filter out all specified categories 31 const categoriesToFilter = Object.values(locationTagMapSettings).map(locationTag => locationTag.category_id); 32 Array.from(selectElement.options).forEach(option => { 33 if (categoriesToFilter.includes(option.value)) { 34 option.remove(); 35 } 36 }); 37 } 38 39 // Trigger change event 40 const event = new Event('change'); 41 selectElement.dispatchEvent(event); 42 43 // Update custom-styled element (if using a custom select plugin) 44 const selectedItem = document.querySelector('.selecter-item[data-value="' + selectElement.value + '"]'); 45 if (selectedItem) { 46 const currentlySelected = document.querySelector('.selecter-item.selected'); 47 if (currentlySelected) { 48 currentlySelected.classList.remove('selected'); 49 } 50 selectedItem.classList.add('selected'); 51 const selecterSelected = document.querySelector('.selecter-selected'); 52 if (selecterSelected) { 53 selecterSelected.textContent = selectedItem.textContent; 54 } 55 } 56 57 }, 200); // Reduced timeout to match the second snippet 58});
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.