1(function () { 2 var STORAGE_KEY = 'ccc_saved_providers'; 3 4 function readSaved() { 5 try { 6 return JSON.parse(window.localStorage.getItem(STORAGE_KEY) || '{}'); 7 } catch (e) { 8 return {}; 9 } 10 } 11 12 function writeSaved(saved) { 13 try { 14 window.localStorage.setItem(STORAGE_KEY, JSON.stringify(saved)); 15 } catch (e) { 16 /* localStorage unavailable (private mode, quota, etc.) -- save button just won't persist. */ 17 } 18 } 19 20 function applySavedState(btn, isSaved) { 21 btn.textContent = isSaved ? 'â¥' : 'â¡'; 22 btn.classList.toggle('is-saved', isSaved); 23 btn.setAttribute('aria-pressed', isSaved ? 'true' : 'false'); 24 } 25 26 document.addEventListener('DOMContentLoaded', function () { 27 var saved = readSaved(); 28 29 var buttons = document.querySelectorAll('.rv-save[data-provider-id]'); 30 buttons.forEach(function (btn) { 31 var id = btn.getAttribute('data-provider-id'); 32 applySavedState(btn, !!saved[id]); 33 34 btn.addEventListener('click', function () { 35 saved = readSaved(); 36 saved[id] = !saved[id]; 37 if (!saved[id]) { 38 delete saved[id]; 39 } 40 writeSaved(saved); 41 applySavedState(btn, !!saved[id]); 42 }); 43 }); 44 45 var sortSelect = document.querySelector('.rv-sort select'); 46 if (sortSelect) { 47 sortSelect.addEventListener('change', function () { 48 var url = new URL(window.location.href); 49 if (sortSelect.value === 'ranking') { 50 url.searchParams.delete('sort'); 51 } else { 52 url.searchParams.set('sort', sortSelect.value); 53 } 54 url.searchParams.delete('page'); 55 window.location.href = url.toString(); 56 }); 57 } 58 59 var quickViewToggles = document.querySelectorAll('.rv-quickview-toggle'); 60 quickViewToggles.forEach(function (toggle) { 61 toggle.addEventListener('click', function () { 62 var wrap = toggle.closest('.rv-row-wrap'); 63 if (!wrap) { 64 return; 65 } 66 var isOpen = wrap.classList.toggle('is-open'); 67 toggle.setAttribute('aria-expanded', isOpen ? 'true' : 'false'); 68 }); 69 }); 70 71 var typeTabs = document.querySelectorAll('.rv-type-tab input[name="type"]'); 72 var searchSubmit = document.getElementById('search'); 73 var typeButtonLabels = { 74 all: 'Find Child Care', 75 center: 'Find Child Care Centers', 76 home: 'Find Home Daycare' 77 }; 78 if (typeTabs.length && searchSubmit) { 79 typeTabs.forEach(function (radio) { 80 radio.addEventListener('change', function () { 81 searchSubmit.textContent = typeButtonLabels[radio.value] || typeButtonLabels.all; 82 typeTabs.forEach(function (r) { 83 r.closest('.rv-type-tab').classList.toggle('rv-type-tab--active', r.checked); 84 }); 85 }); 86 }); 87 } 88 89 var geolocateBtn = document.getElementById('rv-geolocate'); 90 if (geolocateBtn) { 91 geolocateBtn.addEventListener('click', function () { 92 if (!('geolocation' in navigator)) { 93 geolocateBtn.textContent = 'Location not supported by this browser'; 94 return; 95 } 96 var originalText = geolocateBtn.textContent; 97 geolocateBtn.textContent = 'Locatingâ¦'; 98 geolocateBtn.disabled = true; 99 100 navigator.geolocation.getCurrentPosition( 101 function (position) { 102 var typeInput = document.querySelector('.rv-type-tab input[name="type"]:checked'); 103 var params = new URLSearchParams({ 104 lat: position.coords.latitude, 105 lng: position.coords.longitude, 106 type: typeInput ? typeInput.value : 'center' 107 }); 108 window.location.href = '/search/nearby?' + params.toString(); 109 }, 110 function () { 111 geolocateBtn.textContent = 'Couldn\'t get your location â try typing it instead'; 112 geolocateBtn.disabled = false;
113 setTimeout(function () { 114 geolocateBtn.textContent = originalText; 115 }, 3000); 116 }, 117 { timeout: 10000 } 118 ); 119 }); 120 } 121 }); 122})();
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.