1(function () { 2 const App = (window.App = window.App || {}); 3 4 App.initViewport = function () { 5 const viewport = document.querySelector('meta[name="viewport"]'); 6 if (!viewport) return; 7 8 const MIN_WIDTH = 360; 9 const DEFAULT_VALUE = 'width=device-width,initial-scale=1'; 10 const MIN_VALUE = `width=${MIN_WIDTH}`; 11 12 const applyViewport = () => { 13 const docEl = document.documentElement; 14 const candidates = [ 15 window.innerWidth, 16 window.outerWidth, 17 window.visualViewport && window.visualViewport.width, 18 docEl && docEl.clientWidth, 19 ].filter((value) => typeof value === 'number' && !Number.isNaN(value)); 20 21 const effectiveWidth = candidates.length ? Math.min(...candidates) : undefined; 22 23 let value = DEFAULT_VALUE; 24 25 if (typeof effectiveWidth === 'number') { 26 if (effectiveWidth < MIN_WIDTH) { 27 value = MIN_VALUE; 28 } 29 } 30 31 if (viewport.getAttribute('content') !== value) { 32 viewport.setAttribute('content', value); 33 } 34 }; 35 36 const mediaQuery = window.matchMedia('(max-width: 359.98px)'); 37 const handleViewportBreakpointChange = () => { 38 applyViewport(); 39 if (typeof App.updateViewportMetrics === 'function') { 40 App.updateViewportMetrics(); 41 } 42 }; 43 44 if (typeof mediaQuery.addEventListener === 'function') { 45 mediaQuery.addEventListener('change', handleViewportBreakpointChange); 46 } else if (typeof mediaQuery.addListener === 'function') { 47 mediaQuery.addListener(handleViewportBreakpointChange); 48 } 49 50 handleViewportBreakpointChange(); 51 }; 52})();
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.