1(() => { 2 const REGION_COOKIE_NAME = 'floorPlanPricing.region'; 3 const DEFAULT_REGION = 'melbourne'; 4 const REGION_NAMES_MAP = { 5 melbourne: 'Melbourne', 6 geelong: 'Geelong', 7 ballarat: 'Ballarat', 8 bendigo: 'Bendigo', 9 shepparton: 'Shepparton/Echuca/Moama', 10 gippsland: 'Gippsland', 11 bairnsdale: 'Bairnsdale', 12 }; 13 14 let isReloading = false; 15 16 const view = (() => { 17 const buildInModal = $('#build_in_modal'); 18 19 return { 20 buildInModal, 21 regionSelectors: buildInModal.find('.region-selector'), 22 currentRegionName: $('.current-region-name') 23 }; 24 })(); 25 26 const getRegion = () => Cookies.get(REGION_COOKIE_NAME) || DEFAULT_REGION; 27 28 const updateRegionNames = region => { 29 view.currentRegionName.text(REGION_NAMES_MAP[region] || REGION_NAMES_MAP[DEFAULT_REGION]); 30 }; 31 32 const setRegion = region => { 33 Cookies.set(REGION_COOKIE_NAME, region); 34 updateRegionNames(region); 35 }; 36 37 if (!Cookies.get(REGION_COOKIE_NAME)) { 38 setRegion(DEFAULT_REGION); 39 if (view.buildInModal.length) { 40 setTimeout(() => { 41 view.buildInModal[0].showModal(); 42 }, 1000); 43 } 44 } else { 45 updateRegionNames(getRegion()); 46 } 47 48 view.regionSelectors.each((index, element) => { 49 const regionSelector = $(element); 50 const region = regionSelector.data('region'); 51 regionSelector.click(() => { 52 if (!isReloading) { 53 isReloading = true; 54 setRegion(region); 55 window.location.reload(); 56 } 57 }); 58 }); 59 60 // Kept for API compatibility; currently unused by active scripts. 61 const getPrice = async () => null; 62 63 window.floorPlanPricing = { 64 getPrice, 65 getRegion, 66 setRegion 67 }; 68})();
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.