1/*-------------------------------------------------- 2List View / Map View toggle 3 4Default state is list view: the map is hidden and reserves no 5space. Clicking "Map View" shows the map as a full-width takeover 6and hides the listings; "List View" reverses it. The Leaflet map 7instance is initialized once on page load (possibly while hidden), 8so switching to map view must call invalidateSize() to force it to 9recalculate its now-visible dimensions, then re-fit the markers. 10--------------------------------------------------*/ 11(function ($) { 12 'use strict'; 13 14 $(document).ready(function () { 15 var $wrap = $('#view-toggle-wrap'); 16 var $mapCol = $('#map-col'); 17 18 if (!$wrap.length) { 19 return; 20 } 21 22 // placeholder marks #map-col's original spot in the DOM so it can be 23 // moved back on "List View". Moving it to a direct child of <body> 24 // when in map view guarantees position:fixed measures against the 25 // real viewport, regardless of any ancestor (container, transform, 26 // etc.) that might otherwise re-scope it. 27 var $placeholder = $('<div style="display:none"></div>').insertAfter($mapCol); 28 29 $wrap.on('click', 'button', function () { 30 var view = $(this).data('view'); 31 32 $wrap.find('button').removeClass('active'); 33 $(this).addClass('active'); 34 35 if (view === 'map') { 36 var headerHeight = $('#header-nav').outerHeight(true) || 0; 37 38 $mapCol.appendTo('body'); 39 $('body').addClass('view-map'); 40 41 // set directly as inline style (not via CSS class) so it always 42 // wins with no ambiguity about custom-property inheritance/timing 43 $mapCol.css({ 44 top: headerHeight + 'px', 45 height: 'calc(100vh - ' + headerHeight + 'px)' 46 }); 47 48 if (window.dpMap) { 49 setTimeout(function () { 50 window.dpMap.invalidateSize(); 51 52 if (window.dpMapBounds) { 53 window.dpMap.fitBounds(window.dpMapBounds); 54 } 55 }, 50); 56 } 57 } else { 58 $('body').removeClass('view-map'); 59 $mapCol.css({ top: '', height: '' }); 60 $mapCol.insertBefore($placeholder); 61 } 62 }); 63 }); 64})(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.