Przeglądaj źródła

[fix] make page load better!

Steven Yan 3 lat temu
rodzic
commit
b33c67791f
3 zmienionych plików z 67 dodań i 41 usunięć
  1. 20 16
      404.html
  2. 23 18
      index.html
  3. 24 7
      index.js

+ 20 - 16
404.html

@@ -33,23 +33,27 @@
 </head>
 
 <body>
-    <h1>404,您请求的文件不存在!</h1>
-    <div id="text"></div>
-</body>
-<script type="text/javascript">
-    window.onload = function () {
-        redirect();
-    }
-    var i = 0;
+    <center>
+        <h1>404,您请求的页面不存在!</h1>
+    </center>
+    <div id="text">
+        请检查链接
+    </div>
+    <script type="text/javascript">
+        window.onload = function () {
+            redirect();
+        }
+        var i = 0;
 
-    function redirect() {
-        document.getElementById("text").innerHTML = (5 - i + " 秒后跳转回<a href=\"https://stevenapis.xyz\">主页</a>");
-        i++;
-        if (i > 5) {
-            window.location.href = "https://stevenapis.xyz/";
+        function redirect() {
+            document.getElementById("text").innerHTML = (5 - i + " 秒后跳转回<a href=\"https://stevenapis.xyz\">主页</a>");
+            i++;
+            if (i > 5) {
+                window.location.href = "https://stevenapis.xyz/";
+            }
+            setTimeout(redirect, 1000);
         }
-        setTimeout(redirect, 1000);
-    }
-</script>
+    </script>
+</body>
 
 </html>

+ 23 - 18
index.html

@@ -1,4 +1,5 @@
 <!DOCTYPE html>
+<html lang="zh-CN">
 
 <head>
   <title>Steven的启动页</title>
@@ -372,6 +373,22 @@
     opacity: 0;
     z-index: -10;
   }
+
+  .footer {
+    position: fixed;
+    bottom: 8px;
+    left: 50%;
+    width: 120px;
+    transform: translate(-60px, 0);
+    font-weight: 300;
+    font-size: 8px;
+    color: white;
+  }
+
+  .footer :link {
+    color: inherit;
+    text-decoration: none;
+  }
 </style>
 
 <body>
@@ -471,13 +488,16 @@
         <p><img class="icon" src="https://ryzenx.com/img/icon.png"></p>
         <p class="url">RyzenX 博客</p>
       </div>
-
+    </div>
+    <div class="footer">
     </div>
   </section>
   <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
-  <script src="clock.js"></script>
+  <script src="index.js"></script>
   <script src="click.js"></script>
   <script>
+    nowTime();
+    loadICP();
     function loadBG(src) {
       document.getElementById('bg-img').src = src + "/api/bing";
       document.getElementById('bg-img').alt = "Background Image";
@@ -491,7 +511,6 @@
       // clock();
       loadBG(host);
     }
-    nowTime();
 
     function search1() {
       var value = document.getElementById("search_input_bd").value;
@@ -508,21 +527,7 @@
         document.getElementById("search_input_go").value = "";
       }
     }
-    var OriginTitile = document.title;
-    var titleTime;
-    document.addEventListener('visibilitychange', function () {
-      if (document.hidden) {
-        $('[rel="shortcut icon"]').attr('href', "./hahaha.ico");
-        document.title = '(╯°Д°)╯喔唷~崩溃啦___' + OriginTitile;
-        clearTimeout(titleTime);
-      } else {
-        $('[rel="shortcut icon"]').attr('href', "./favicon.ico");
-        document.title = '(`・ω・´)又好了______' + OriginTitile;
-        titleTime = setTimeout(function () {
-          document.title = OriginTitile;
-        }, 2000);
-      }
-    });
+
   </script>
 </body>
 

+ 24 - 7
clock.js → index.js

@@ -1,12 +1,29 @@
 var stopTime;
+var OriginTitile = document.title;
+var titleTime;
+document.addEventListener("visibilitychange", function () {
+  if (document.hidden) {
+    $('[rel="shortcut icon"]').attr("href", "./hahaha.ico");
+    document.title = "喔唷~崩溃啦";
+    clearTimeout(titleTime);
+  } else {
+    $('[rel="shortcut icon"]').attr("href", "./favicon.ico");
+    document.title = "欢迎回来 ~ ~ " + OriginTitile;
+    titleTime = setTimeout(function () {
+      document.title = OriginTitile;
+    }, 2000);
+  }
+});
+
+var loadICP = function () {};
 
-function startTimer() {
+var startTimer = function () {
   var today = new Date();
   stopTime = today.getTime() + 120 * 1000;
-  console.log("Timer start.");
-}
+  console.log("Timer started.");
+};
 
-function nowTime() {
+var nowTime = function () {
   var formatNumber = function (n) {
     n = n.toString();
     return n[1] ? n : "0" + n;
@@ -29,9 +46,9 @@ function nowTime() {
   var now = formatTime(new Date().getTime());
   document.getElementById("nowTime").innerHTML = "" + now;
   setTimeout(nowTime, 800);
-}
+};
 
-function toClipboard() {
+var toClipboard = function () {
   var timeTag = document.getElementById("nowTime");
   var text = timeTag.innerText;
   var input = document.getElementById("textarea");
@@ -45,4 +62,4 @@ function toClipboard() {
   } else {
     timeTag.innerHTML = "复制失败!";
   }
-}
+};