// javascript document ! function(a) { function b() { var b = g.getboundingclientrect().width; b / c > 640 && (b = 640 * c), a.rem = b / 16, g.style.fontsize = a.rem + "px" } var c, d, e, f = a.document, g = f.documentelement, h = f.queryselector('meta[name="viewport"]'), i = f.queryselector('meta[name="flexible"]'); if (h) { console.warn("将根据已有的meta标签来设置缩放比例"); var j = h.getattribute("content").match(/initial\-scale=(["']?)([\d\.]+)\1?/); j && (d = parsefloat(j[2]), c = parseint(1 / d)) } else if (i) { var j = i.getattribute("content").match(/initial\-dpr=(["']?)([\d\.]+)\1?/); j && (c = parsefloat(j[2]), d = parsefloat((1 / c).tofixed(2))) } if (!c && !d) { var k = (a.navigator.appversion.match(/android/gi), a.navigator.appversion.match(/iphone/gi)), c = a.devicepixelratio; c = k ? c >= 3 ? 3 : c >= 2 ? 2 : 1 : 1, d = 1 / c } if (g.setattribute("data-dpr", c), !h) if (h = f.createelement("meta"), h.setattribute("name", "viewport"), h.setattribute("content", "initial-scale=" + d + ", maximum-scale=" + d + ", minimum-scale=" + d + ", user-scalable=no"), g.firstelementchild) g.firstelementchild.appendchild(h); else { var l = f.createelement("div"); l.appendchild(h), f.write(l.innerhtml) } a.dpr = c, a.addeventlistener("resize", function() { cleartimeout(e), e = settimeout(b, 300) }, !1), a.addeventlistener("pageshow", function(a) { a.persisted && (cleartimeout(e), e = settimeout(b, 300)) }, !1), "complete" === f.readystate ? f.body.style.fontsize = 12 * c + "px" : f.addeventlistener("domcontentloaded", function() { f.body.style.fontsize = 12 * c + "px" }, !1), b() }(window);