From dbc8d7fb3cb30133ede3b1a9e8135e15c200046b Mon Sep 17 00:00:00 2001 From: mayx Date: Sun, 11 May 2025 16:23:23 +0000 Subject: Update 4 files - /_layouts/default.html - /_layouts/post.html - /assets/js/main.js - /index.html--- _layouts/default.html | 27 +++++---------------------- _layouts/post.html | 2 +- assets/js/main.js | 44 +++++++++++++++++++++++++++++++------------- index.html | 2 -- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index b2691a0..db770f7 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -21,6 +21,11 @@ + + {% if site.google_analytics %} @@ -33,27 +38,6 @@ gtag('config', '{{ site.google_analytics }}'); {% endif %} - @@ -141,7 +125,6 @@ - diff --git a/_layouts/post.html b/_layouts/post.html index a426aad..45fd562 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -2,7 +2,7 @@ layout: default --- -{{ page.date | date: "%-d %B %Y" }} - 字数统计:{% if page.layout == "encrypt" %}God Knows {% else %}{{ page.content | strip_html | strip_newlines | remove: " " | size }} - 阅读大约需要{{ page.content | strip_html | strip_newlines | remove: "" | size | divided_by: 350 | plus: 1 }}分钟{% endif %} - Hits: Loading... +{{ page.date | date: "%-d %B %Y" }} - 字数统计:{% if page.layout == "encrypt" %}God Knows {% else %}{{ page.content | strip_html | strip_newlines | remove: " " | size }} - 阅读大约需要{{ page.content | strip_html | strip_newlines | remove: "" | size | divided_by: 350 | plus: 1 }}分钟{% endif %} - Hits: Loading...

{{ page.title }}

by {{ page.author | default: site.author }}

diff --git a/assets/js/main.js b/assets/js/main.js index 3a17db6..020c269 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -14,17 +14,17 @@ var talkAPI = BlogAPI + "/ai_chat"; })(); $(function () { function showHitCount() { - $(".visitors-index").each(function() { + $(".visitors-index").each(function () { var $elem = $(this); - $.get(BlogAPI + "/count_click?id=" + $elem.attr('id'), function(data) { + $.get(BlogAPI + "/count_click?id=" + $elem.attr('id'), function (data) { $elem.text(Number(data)); }); }); } - + function addCount() { var $visitor = $(".visitors:first"); - $.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function(data) { + $.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function (data) { $visitor.text(Number(data)); }); } @@ -33,15 +33,33 @@ $(function () { } else if ($('.visitors-index').length > 0) { 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) { + $("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"); + } }); -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) { - $("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"); +function getSearchJSON(callback) { + var searchData = JSON.parse(localStorage.getItem("blog_" + lastUpdated.valueOf())); + if (!searchData) { + for (var i = 0; i < localStorage.length; i++) { + var key = localStorage.key(i); + if (key.startsWith('blog_')) { + localStorage.removeItem(key); + } + } + $.getJSON("/search.json", function (data) { + localStorage.setItem("blog_" + lastUpdated.valueOf(), JSON.stringify(data)); + callback(data); + }); + } else { + callback(searchData); + } } \ No newline at end of file diff --git a/index.html b/index.html index 277f3b9..2fc2904 100644 --- a/index.html +++ b/index.html @@ -14,9 +14,7 @@ title: 首页 - 我的文章

{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}

{{ post.date | date: "%-d %B %Y" }} - | Hits: Loading... -

{{ post.excerpt | strip_html | strip_newlines }} -- cgit 1.4.1-2-gfad0