-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathindex.html
More file actions
128 lines (116 loc) · 5.14 KB
/
index.html
File metadata and controls
128 lines (116 loc) · 5.14 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE HTML>
<html>
<head>
<title>tmpUI App</title>
<meta name="description" content="start">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="renderer" content="webkit" />
<script type="text/javascript">
'use strict';
try {
var f = new Function("class tmpUITest{a=0}");
} catch (e) {
window.location.href = '/version.html';
}
// 注册 Service Worker (支持 PWA)
if ('serviceWorker' in navigator) {
// 尽早监听消息,防止漏掉 SW 的更新通知
navigator.serviceWorker.addEventListener('message', event => {
if (event.data?.type === 'UPDATE_AVAILABLE') {
console.log('New version detected, reloading...');
window.location.reload();
}
});
window.addEventListener('load', () => {
navigator.serviceWorker.register('/pwa_sw.js')
.then(registration => {
console.log('SW registered:', registration);
// 定时检查更新 (每 60 秒)
setInterval(() => {
if (registration.active) {
// console.log('Checking for updates...');
registration.active.postMessage({
type: 'CHECK_UPDATE',
url: window.location.href
});
}
}, 60 * 1000);
})
.catch(error => console.log('SW registration failed:', error));
});
}
</script>
<script type="text/javascript" src="./tmpui.js"></script>
<script type="text/javascript">
var app = new tmpUI({
"version": 6,
"siteroot": "/",
"dynamicRouter": "route",
"googleAnalytics": "G-4DGYKM9EHS",
"pageNotFound": "/404.html",
"loadingIcon": "/tpl/img/logo.png",
"loadingPage": true,
"loadingProgress": true,
"extendStaticHost": '',
"language": {
"en": "/tpl/lang/en.json",
"cn": "/tpl/lang/cn.json"
},
"preload": {
"init": {
"/tpl/plugin/bootstrap4/jquery.min.js": { "type": "js", "reload": false },
"/tpl/plugin/bootstrap4/bootstrap.bundle.min.js": { "type": "js", "reload": false },
"/tpl/plugin/bootstrap4/bootstrap.min.css": { "type": "css", "reload": false },
"/tpl/css/reset.css": { "type": "css", "reload": false },
"/tpl/plugin/highlightjs/min.js": { "type": "js", "reload": false },
"/tpl/plugin/highlightjs/min.css": { "type": "css", "reload": false }
}
},
"append": {
"framework": {
"/tpl/include/head.html": { "type": "html", "target": { "type": "id", "val": "tpl_header" } },
"/tpl/include/foot.html": { "type": "html", "target": { "type": "id", "val": "tpl_footer" } },
"/tpl/init.js": { "type": "js-es6" }
}
},
"path": {
"/": {
"title": "tmpUI App!",
"preload": ["init"],
"append": ["framework"],
"body": {
"/tpl/index.html": { "type": "html", "target": { "type": "body" } }
}
},
"/404.html": {
"title": "tmpUI App!",
"preload": ["init"],
"append": ["framework"],
"body": {
"/tpl/404.html": { "type": "html", "target": { "type": "body" } }
}
},
"/getting_started.html": {
"title": "tmpUI App - getting started",
"preload": ["init"],
"append": ["framework"],
"body": {
"/tpl/getting_started.html": { "type": "html", "target": { "type": "body" } },
"/tpl/pages/introducation.html": { "type": "html", "target": { "type": "id", "val": "tpl_introducation" } },
"/tpl/pages/config.html": { "type": "html", "target": { "type": "id", "val": "tpl_config" } },
"/tpl/pages/function.html": { "type": "html", "target": { "type": "id", "val": "tpl_function" } },
"/tpl/pages/tips.html": { "type": "html", "target": { "type": "id", "val": "tpl_tips" } }
}
}
}
}
);
</script>
</head>
<body>
<div id="tmpui"></div>
<div id="tmpui_body" class="d-flex flex-column"></div>
</body>
</html>