mirror of
https://github.com/gnu4cn/ts-learnings.git
synced 2024-12-25 20:30:28 +08:00
Updated.
This commit is contained in:
parent
f761480d76
commit
c8807b0b3c
9
src/404.md
Normal file
9
src/404.md
Normal file
@ -0,0 +1,9 @@
|
||||
### Document not found(404)
|
||||
|
||||
**文档未找到(404)**
|
||||
|
||||
|
||||
抱歉,此 URL 无效。请使用导航栏或搜索继续。将在 <span class="sec-count" style="font-style: italic;font-weight:bold;font-size:large;">n</span> 秒后重定向到主页......
|
||||
|
||||
|
||||
This URL is invalid, sorry. Please use the navigation bar or search to continue. It will be redirected to home in <span class="sec-count" style="font-style: italic;font-weight:bold;font-size:large;">n</span> seconds...
|
@ -47,3 +47,21 @@ window.addEventListener('load', function() {
|
||||
|
||||
// Handle active elements on scroll
|
||||
window.addEventListener("scroll", updateFunction);
|
||||
|
||||
if(document.querySelector("#document-not-found404")) {
|
||||
let timeLeft = 10;
|
||||
|
||||
var timerId = setInterval(() => {
|
||||
if(timeLeft == -1) {
|
||||
clearTimeout(timerId);
|
||||
let siteRoot = window.location.origin;
|
||||
window.location.replace(siteRoot);
|
||||
} else {
|
||||
let secCounts = document.querySelectorAll(".sec-count")
|
||||
secCounts.forEach(count => {
|
||||
count.innerHTML = timeLeft;
|
||||
});
|
||||
timeLeft--;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user