-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
50 lines (50 loc) · 1.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%=htmlWebpackPlugin.options.title%></title>
<script>
(function (baseFontSize, fontscale) {
var _baseFontSize = baseFontSize || 100;
var _fontscale = fontscale || 1;
var win = window;
var doc = win.document;
var ua = navigator.userAgent;
var matches = ua.match(/Android[\S\s]+AppleWebkit\/(\d{3})/i);
var UCversion = ua.match(/U3\/((\d+|\.){5,})/i);
var isUCHd = UCversion && parseInt(UCversion[1].split('.').join(''), 10) >= 80;
var isIos = navigator.appVersion.match(/(iphone|ipad|ipod)/gi);
var dpr = win.devicePixelRatio || 1;
if (!isIos && !(matches && matches[1] > 534) && !isUCHd) {
// 如果非iOS, 非Android4.3以上, 非UC内核, 就不执行高清, dpr设为1;
dpr = 1;
}
var scale = 1 / dpr;
var metaEl = doc.querySelector('meta[name="viewport"]');
if (!metaEl) {
metaEl = doc.createElement('meta');
metaEl.setAttribute('name', 'viewport');
doc.head.appendChild(metaEl);
}
metaEl.setAttribute('content', 'width=device-width,user-scalable=no,initial-scale=' + scale + ',maximum-scale=' + scale + ',minimum-scale=' + scale);
doc.documentElement.style.fontSize = _baseFontSize / 2 * dpr * _fontscale + 'px';
window.viewportScale = dpr;
})();
if (!window.Promise) {
document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"' + '>' + '<' + '/' + 'script>');
}
</script>
<script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js"></script>
<script src="https://as.alipayobjects.com/g/component/fastclick/1.0.6/fastclick.js"></script>
<script>
if ('addEventListener' in document) {
window.addEventListener('load', function() {
FastClick.attach(document.body);
}, false);
}
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>