1'use strict'; 2(function flexible(window, document) { 3 const docEl = document.documentElement; 4 const dpr = window.devicePixelRatio || 1; 5 6 // adjust body font size 7 function setBodyFontSize() { 8 if (document.body) { 9 document.body.style.fontSize = (12 * dpr) + 'px'; 10 } else { 11 document.addEventListener('DOMContentLoaded', setBodyFontSize); 12 } 13 } 14 setBodyFontSize(); 15 16 // set 1rem = viewWidth / 10 17 function setRemUnit() { 18 const rem = docEl.clientWidth / 10; 19 docEl.style.fontSize = rem + 'px'; 20 } 21 22 setRemUnit(); 23 24 // reset rem unit on page resize 25 window.addEventListener('resize', setRemUnit); 26 window.addEventListener('pageshow', function(e) { 27 if (e.persisted) { 28 setRemUnit(); 29 } 30 }); 31 32 // detect 0.5px supports 33 if (dpr >= 2) { 34 const fakeBody = document.createElement('body'); 35 const testElement = document.createElement('div'); 36 testElement.style.border = '.5px solid transparent'; 37 fakeBody.appendChild(testElement); 38 docEl.appendChild(fakeBody); 39 if (testElement.offsetHeight === 1) { 40 docEl.classList.add('hairlines'); 41 } 42 docEl.removeChild(fakeBody); 43 } 44// eslint-disable-next-line no-undef 45}(window, document));
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.