1(function (designWidth, maxWidth) { 2 var doc = document, 3 win = window, 4 docEl = doc.documentElement, 5 remStyle = document.createElement("style"), 6 tid; 7 8 function refreshRem() { 9 var width = docEl.getBoundingClientRect().width; 10 maxWidth = maxWidth || 540; 11 width > maxWidth && (width = maxWidth); 12 var rem = width * 100 / designWidth; 13 remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'; 14 } 15 16 if (docEl.firstElementChild) { 17 docEl.firstElementChild.appendChild(remStyle); 18 } else { 19 var wrap = doc.createElement("div"); 20 wrap.appendChild(remStyle); 21 doc.write(wrap.innerHTML); 22 wrap = null; 23 } 24 //è¦ç wiewport 设置好åæè½æ§è¡ refreshRemï¼ä¸ç¶ refreshRem 伿§è¡2æ¬¡ï¼ 25 refreshRem(); 26 27 win.addEventListener("resize", function () { 28 clearTimeout(tid); //鲿¢æ§è¡ä¸¤æ¬¡ 29 tid = setTimeout(refreshRem, 300); 30 }, false); 31 32 win.addEventListener("pageshow", function (e) { 33 if (e.persisted) { // æµè§å¨åéçæ¶åéæ°è®¡ç® 34 clearTimeout(tid); 35 tid = setTimeout(refreshRem, 300); 36 } 37 }, false); 38 39 if (doc.readyState === "complete") { 40 doc.body.style.fontSize = "16px"; 41 } else { 42 doc.addEventListener("DOMContentLoaded", function (e) { 43 doc.body.style.fontSize = "16px"; 44 }, false); 45 } 46})(750, 750);
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.