-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.html
50 lines (45 loc) · 1.76 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 lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes" />
<title>PlainApp</title>
</head>
<body>
<div id="browser-issue">Your browser is not supported or up-to-date. Please try updating it.</div>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<script type="text/javascript">
if ('customElements' in window) {
document.getElementById('browser-issue').style.display = 'none'
} else {
if (navigator.language === 'zh-CN') {
document.getElementById('browser-issue').innerHTML = '您的浏览器不支持或者版本过低,请尝试更新。'
}
}
function isTouchDevice() {
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
}
document.addEventListener('DOMContentLoaded', function () {
function handleTouchStart() {
document.body.classList.add('no-hover')
window.removeEventListener('touchstart', handleTouchStart)
window.addEventListener('mousemove', handleMouseMove)
}
function handleMouseMove() {
document.body.classList.remove('no-hover')
window.removeEventListener('mousemove', handleMouseMove)
window.addEventListener('touchstart', handleTouchStart)
}
if (isTouchDevice()) {
document.body.classList.add('no-hover')
window.addEventListener('mousemove', handleMouseMove)
} else {
window.addEventListener('touchstart', handleTouchStart)
}
})
</script>
</html>