forked from craep0/gn-math.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoupdate.html
More file actions
25 lines (23 loc) · 883 Bytes
/
autoupdate.html
File metadata and controls
25 lines (23 loc) · 883 Bytes
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
<script>
launch();
function launch() {
try {
fetch("https://cdn.jsdelivr.net/gh/gn-math/gn-math.github.io@main/singlefile.html?t="+Date.now())
.then(response => response.text())
.then(html => {
document.documentElement.innerHTML = html;
document.documentElement.querySelectorAll('script').forEach(oldScript => {
const newScript = document.createElement('script');
if (oldScript.src) {
newScript.src = oldScript.src;
} else {
newScript.textContent = oldScript.textContent;
}
document.body.appendChild(newScript);
});
});
} catch (error) {
console.error('error:', error);
}
}
</script>