summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--_layouts/default.html2
-rw-r--r--_layouts/post.html7
-rw-r--r--assets/js/main.js31
3 files changed, 15 insertions, 25 deletions
diff --git a/_layouts/default.html b/_layouts/default.html
index db770f7..54fdaed 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -22,7 +22,7 @@
 
   <script src="/assets/js/jquery.min.js"></script>
   <script>
-    var lastUpdated = new Date("{{ site.time | date_to_xmlschema }}");
+    var lastUpdated = new Date("{{ site.time | date_to_rfc822 }}");
     var BlogAPI = "https://summary.mayx.eu.org";
   </script>
   <script src="/assets/js/main.js"></script>
diff --git a/_layouts/post.html b/_layouts/post.html
index 45fd562..95dd40d 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -12,12 +12,7 @@ layout: default
   <br /><br />
 </div>
 <script>
-  BirthDay = new Date("{{ page.date | date_to_xmlschema }}");
-  today = new Date();
-  timeold = (today.getTime() - BirthDay.getTime());
-  secondsold = Math.floor(timeold / 1000);
-  e_daysold = timeold / (24 * 60 * 60 * 1000);
-  daysold = Math.floor(e_daysold);
+  daysold = Math.floor((new Date().getTime() - new Date("{{ page.date | date_to_rfc822 }}").getTime()) / (24 * 60 * 60 * 1000));
   if (daysold > 90) {
     document.getElementById("outdate").style.display = "block";
     document.getElementById("outime").innerHTML = daysold;
diff --git a/assets/js/main.js b/assets/js/main.js
index 020c269..444e7cf 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -1,18 +1,19 @@
 var message_Path = '/Live2dHistoire/live2d/';
 var talkAPI = BlogAPI + "/ai_chat";
 
-(function () {
-    var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
-        .text($backToTopTxt).attr("title", $backToTopTxt).click(function () {
-            $("html, body").animate({ scrollTop: 0 }, 120);
-        }), $backToTopFun = function () {
-            var st = $(document).scrollTop(), winh = $(window).height();
-            (st > 0) ? $backToTopEle.show() : $backToTopEle.hide();
-        };
-    $(window).bind("scroll", $backToTopFun);
-    $(function () { $backToTopFun(); });
-})();
 $(function () {
+    (function () {
+        var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
+            .text($backToTopTxt).attr("title", $backToTopTxt).click(function () {
+                $("html, body").animate({ scrollTop: 0 }, 120);
+            }), $backToTopFun = function () {
+                var st = $(document).scrollTop(), winh = $(window).height();
+                (st > 0) ? $backToTopEle.show() : $backToTopEle.hide();
+            };
+        $(window).bind("scroll", $backToTopFun);
+        $(function () { $backToTopFun(); });
+    })();
+
     function showHitCount() {
         $(".visitors-index").each(function () {
             var $elem = $(this);
@@ -21,7 +22,6 @@ $(function () {
             });
         });
     }
-
     function addCount() {
         var $visitor = $(".visitors:first");
         $.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function (data) {
@@ -34,12 +34,7 @@ $(function () {
         showHitCount();
     }
 
-    today = new Date();
-    timeold = (today.getTime() - lastUpdated.getTime());
-    secondsold = Math.floor(timeold / 1000);
-    e_daysold = timeold / (24 * 60 * 60 * 1000);
-    daysold = Math.floor(e_daysold);
-    if (daysold > 90) {
+    if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
         $("html")[0].style = "-webkit-filter: grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(graysale=1);";
         $("html")[0].innerHTML = $("html")[0].innerHTML.replace(/Mayx/g, "Ghost");
         console.warn("Mayx may already be Dead");