1 2;(function(designWidth, maxWidth) { 3 const doc = document, 4 win = window, 5 docEl = doc.documentElement, 6 remStyle = document.createElement('style') 7 8 // 设å¤ç±»åæ£æµï¼ä¼åæ£åï¼ 9 const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) 10 11 function refreshRem() { 12 let width = docEl.clientWidth 13 14 // éç§»å¨ç«¯å®½åº¦è¡¥å¿ï¼ä» PCä¸éRetinaå±ï¼ 15 if(!isMobile && window.devicePixelRatio === 1) { 16 width = Math.min(width + 17, maxWidth) 17 } 18 19 // ååºå¼æç¹è®¾ç½® 20 if (width <= 750) { 21 designWidth = 375 // ç§»å¨ç«¯åºå 22 } else if(width <= 1200) { 23 width = 1200 // å¹³æ¿éé 24 designWidth = 1200 25 } else { 26 designWidth = maxWidth // PC端åºå 27 } 28 29 const rem = (width / designWidth) * 10 30 remStyle.textContent = `html{font-size:${rem}px !important}` 31 } 32 33 // æ ·å¼æ³¨å ¥ä¼å 34 doc.head.appendChild(remStyle) 35 36 // äºä»¶çå¬ä¼å 37 const raf = win.requestAnimationFrame || 38 (fn => setTimeout(fn, 16)) 39 40 win.addEventListener('resize', () => raf(refreshRem), false) 41 win.addEventListener('pageshow', (e) => { 42 e.persisted && refreshRem() 43 }) 44 45 // åå§åæ§è¡ 46 doc.addEventListener('DOMContentLoaded', refreshRem, false) 47})(1920, 1920)
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.