PageSourceSearch

https://029463.bet/js/fontSize.js

js 029463.bet collected 2026-10-09 04:33:58 UTC 2,922 bytes, 73 lines download raw bytes

1/**
2 * Created by lenovo on 2016/5/20.
3 */
4
5function resizeFontsize(){    
6    var w = document.getElementById("app").offsetWidth;
7    var _w = window.screen.width;
8    if(_w<window.rem*3.8){
9        document.documentElement.style.fontSize = window.rem*_w/w +"px"
10    }
11}
12!function(win) {
13    function resize() {
14        var domWidth = domEle.getBoundingClientRect().width;
15        if(domWidth / v > 540){
16            domWidth = 540 * v;
17        }
18        win.rem = domWidth / 3.75;
19        domEle.style.fontSize = win.rem + "px";
20        try{
21            resizeFontsize()
22        }catch(e){}
23    }
24    var v, initial_scale, timeCode, dom = win.document, domEle = dom.documentElement, viewport = dom.querySelector('meta[name="viewport"]'), flexible = dom.querySelector('meta[name="flexible"]');
25    if (viewport) {
26        //viewport:<meta name="viewport"content="initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5,user-scalable=no,minimal-ui"/>
27        var o = viewport.getAttribute("content").match(/initial\-scale=(["']?)([\d\.]+)\1?/);
28        if(o){
29            initial_scale = parseFloat(o[2]);
30            v = parseInt(1 / initial_scale);
31        }
32    } else {
33        if (flexible) {
34            var o = flexible.getAttribute("content").match(/initial\-dpr=(["']?)([\d\.]+)\1?/);
35            if(o){
36                v = parseFloat(o[2]);
37                initial_scale = parseFloat((1 / v).toFixed(2))
38            }
39        }
40    }
41    if (!v && !initial_scale) {
42        var n = (win.navigator.appVersion.match(/android/gi), win.navigator.appVersion.match(/iphone/gi));
43        v = win.devicePixelRatio;
44        v = n ? v >= 3 ? 3 : v >= 2 ? 2 : 1 : 1, initial_scale = 1 / v
45    }
46    //没有viewport标签的情况下
47    if (domEle.setAttribute("data-dpr", v), !viewport) {
48        if (viewport = dom.createElement("meta"), viewport.setAttribute("name", "viewport"), viewport.setAttribute("content", "initial-scale=" + initial_scale + ", maximum-scale=" + initial_scale + ", minimum-scale=" + initial_scale + ", user-scalable=no"), domEle.firstElementChild) {
49            domEle.firstElementChild.appendChild(viewport)
50        } else {
51            var m = dom.createElement("div");
52            m.appendChild(viewport), dom.write(m.innerHTML)
53        }
54    }
55    win.dpr = v;
56    win.addEventListener("resize", function() {
57        clearTimeout(timeCode), timeCode = setTimeout(resize, 300)
58    }, false);
59    win.addEventListener("pageshow", function(b) {
60        b.persisted && (clearTimeout(timeCode), timeCode = setTimeout(resize, 300))
61    }, false);
62    /* 个人觉得没必要完成后就把body的字体设置为12
63     "complete" === dom.readyState ? dom.body.style.fontSize = 12 * v + "px" : dom.addEventListener("DOMContentLoaded", function() {
64     //dom.body.style.fontSize = 12 * v + "px"
65     }, false);
66     */
67    resize();
68}(window);
69
70
71window.onload = function(){
72    resizeFontsize()
73}

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.