Compare commits

..

No commits in common. "156f964333ea9ca4d00d98f3c831ef05fe0b8d46" and "1a529143a833b22fb2e2600498f6703c2edd9a84" have entirely different histories.

6 changed files with 134 additions and 63 deletions

View File

@ -48,13 +48,16 @@ http://111.231.146.230:8418/mayx/blog
https://git.pwaapp.cc/mayx/blog https://git.pwaapp.cc/mayx/blog
https://an360.top/mayx/blog https://an360.top/mayx/blog
http://106.15.78.64:3000/mayx/blog http://106.15.78.64:3000/mayx/blog
https://git.wisder.net/mayx/blog
http://111.119.244.185:3000/mayx/blog http://111.119.244.185:3000/mayx/blog
http://110.41.179.36:13000/mayx/blog
https://git.influxfin.com/mayx/blog https://git.influxfin.com/mayx/blog
http://219.157.255.213:25311/mayx/blog http://219.157.255.213:25311/mayx/blog
https://git.vekus.ru/mayx/blog https://git.vekus.ru/mayx/blog
http://116.204.75.78:6180/mayx/blog http://116.204.75.78:6180/mayx/blog
http://109.228.48.121:8000/mayx/blog http://109.228.48.121:8000/mayx/blog
http://27.124.12.222:3000/mayx/blog http://27.124.12.222:3000/mayx/blog
https://git.sayndone.ru/mayx/blog
https://gitea.hintsight.com/mayx/blog https://gitea.hintsight.com/mayx/blog
http://blackobelisk.xyz:3000/mayx/blog http://blackobelisk.xyz:3000/mayx/blog
https://git.the-kn.com/mayx/blog https://git.the-kn.com/mayx/blog
@ -163,6 +166,7 @@ http://210.245.20.73:3333/mayx/blog
http://43.248.97.109:3000/mayx/blog http://43.248.97.109:3000/mayx/blog
http://113.207.86.104:3080/mayx/blog http://113.207.86.104:3080/mayx/blog
http://39.96.195.72:10082/mayx/blog http://39.96.195.72:10082/mayx/blog
http://8.148.24.160:3000/mayx/blog
https://221.219.181.35:30000/mayx/blog https://221.219.181.35:30000/mayx/blog
http://172.172.102.93:3000/mayx/blog http://172.172.102.93:3000/mayx/blog
http://115.120.245.164:3000/mayx/blog http://115.120.245.164:3000/mayx/blog
@ -264,6 +268,7 @@ https://git.cenoq.com/mayx/blog
http://8.152.205.35:3000/mayx/blog http://8.152.205.35:3000/mayx/blog
http://120.210.80.160:3000/mayx/blog http://120.210.80.160:3000/mayx/blog
http://1.95.192.200:59300/mayx/blog http://1.95.192.200:59300/mayx/blog
https://git.medis.com.vn/mayx/blog
http://194.5.152.156:3000/mayx/blog http://194.5.152.156:3000/mayx/blog
http://8.155.172.147:3001/mayx/blog http://8.155.172.147:3001/mayx/blog
https://git.erfmann.dev/mayx/blog https://git.erfmann.dev/mayx/blog
@ -354,6 +359,7 @@ https://git.veraskolivna.net/mayx/blog
https://git.lifetop.net/mayx/blog https://git.lifetop.net/mayx/blog
https://gitea.jnyuxia.com/mayx/blog https://gitea.jnyuxia.com/mayx/blog
http://git.liuhung.com/mayx/blog http://git.liuhung.com/mayx/blog
https://git.secretserver.club/mayx/blog
https://gitea.adber.tech/mayx/blog https://gitea.adber.tech/mayx/blog
https://gitea.hello.faith/mayx/blog https://gitea.hello.faith/mayx/blog
https://tea.neuron.my/mayx/blog https://tea.neuron.my/mayx/blog
@ -362,12 +368,14 @@ https://git.adityagupta.dev/mayx/blog
https://git.danpeak.co.uk/mayx/blog https://git.danpeak.co.uk/mayx/blog
https://gitea.mynas-lechner.de/mayx/blog https://gitea.mynas-lechner.de/mayx/blog
https://git.automathon.org/mayx/blog https://git.automathon.org/mayx/blog
https://aeterna.cim.mcgill.ca/mayx/blog
https://git.esen.gay/mayx/blog https://git.esen.gay/mayx/blog
https://git.webtims.ru/mayx/blog https://git.webtims.ru/mayx/blog
https://gitea.personalsoftware.space/mayx/blog https://gitea.personalsoftware.space/mayx/blog
http://gitea.yiban.com.tw:3030/mayx/blog http://gitea.yiban.com.tw:3030/mayx/blog
https://gitlab.iplusus.com/mayx/blog https://gitlab.iplusus.com/mayx/blog
https://git.cyberuk.me/mayx/blog https://git.cyberuk.me/mayx/blog
https://git.privezishop.ru/mayx/blog
https://gitea.zachl.tech/mayx/blog https://gitea.zachl.tech/mayx/blog
https://git.miasma-os.com/mayx/blog https://git.miasma-os.com/mayx/blog
https://gitea.nacsity.cn/mayx/blog https://gitea.nacsity.cn/mayx/blog
@ -384,6 +392,7 @@ http://49.232.183.190:3000/mayx/blog_cn
http://git.zxkedu.com:33769/mayx/blog_cn http://git.zxkedu.com:33769/mayx/blog_cn
https://code.wemediacn.com/mayx/blog_cn https://code.wemediacn.com/mayx/blog_cn
https://gitea.shizuka.icu/mayx/blog_cn https://gitea.shizuka.icu/mayx/blog_cn
http://43.139.2.237:3000/mayx/blog_cn
http://51.159.198.233:3000/mayx/blog http://51.159.198.233:3000/mayx/blog
https://gitea.adriangonzalezbarbosa.eu/mayx/blog https://gitea.adriangonzalezbarbosa.eu/mayx/blog
https://git.legatus.ru/mayx/blog https://git.legatus.ru/mayx/blog
@ -430,6 +439,7 @@ http://47.117.245.9:17701/mayx/blog_cn
https://git.sunlix.one/mayx/blog_cn https://git.sunlix.one/mayx/blog_cn
http://47.106.222.181:20511/mayx/blog_cn http://47.106.222.181:20511/mayx/blog_cn
http://101.43.95.130:3001/mayx/blog_cn http://101.43.95.130:3001/mayx/blog_cn
http://39.101.170.62:9080/mayx/blog_cn
https://gitea.myat4.com/mayx/blog_cn https://gitea.myat4.com/mayx/blog_cn
http://118.24.161.24:3000/mayx/blog_cn http://118.24.161.24:3000/mayx/blog_cn
http://githanea.s.odn.cc/mayx/blog_cn http://githanea.s.odn.cc/mayx/blog_cn
@ -471,6 +481,7 @@ https://papi.tkpups.com/mayx/blog
https://git.beyond-a-i.org/mayx/blog https://git.beyond-a-i.org/mayx/blog
http://huanghomenas2.myqnapcloud.com:4000/mayx/blog_cn http://huanghomenas2.myqnapcloud.com:4000/mayx/blog_cn
http://43.142.166.108:10082/mayx/blog_cn http://43.142.166.108:10082/mayx/blog_cn
https://git.ueda.sk/mayx/blog_cn
https://tm-jikayo.com/mayx/blog_cn https://tm-jikayo.com/mayx/blog_cn
http://zzdgitea.stnav.com/mayx/blog_cn http://zzdgitea.stnav.com/mayx/blog_cn
http://1.117.66.197:3000/mayx/blog_cn http://1.117.66.197:3000/mayx/blog_cn
@ -478,6 +489,7 @@ http://git.zhmight.com/mayx/blog_cn
https://intl-dev.gaia888.com/mayx/blog_cn https://intl-dev.gaia888.com/mayx/blog_cn
https://gitea.xinyuxi.com/mayx/blog_cn https://gitea.xinyuxi.com/mayx/blog_cn
http://gitea.snailtrack.cn/mayx/blog_cn http://gitea.snailtrack.cn/mayx/blog_cn
https://git.powerdata.dk/mayx/blog
http://ydds.cloud:3000/mayx/blog_cn http://ydds.cloud:3000/mayx/blog_cn
http://120.24.50.145:3000/mayx/blog_cn http://120.24.50.145:3000/mayx/blog_cn
https://code.draussenfunker.de/mayx/blog_cn https://code.draussenfunker.de/mayx/blog_cn
@ -516,6 +528,7 @@ https://gitea.molietech.com/mayx/blog_cn
http://58.87.88.234:3000/mayx/blog_cn http://58.87.88.234:3000/mayx/blog_cn
http://210.75.240.13:3000/mayx/blog_cn http://210.75.240.13:3000/mayx/blog_cn
https://git.xz-i.com:30443/mayx/blog_cn https://git.xz-i.com:30443/mayx/blog_cn
http://111.229.64.148:8080/mayx/blog_cn
https://git.fynn.vip/mayx/blog_cn https://git.fynn.vip/mayx/blog_cn
http://119.91.212.17:3000/mayx/blog_cn http://119.91.212.17:3000/mayx/blog_cn
http://git.hbg99.com:8080/mayx/blog_cn http://git.hbg99.com:8080/mayx/blog_cn
@ -527,4 +540,3 @@ https://git.extra.eiffel.com/mayx/blog
https://gitea.digitanie.org/mayx/blog https://gitea.digitanie.org/mayx/blog
http://124.207.0.162:30000/mayx/blog http://124.207.0.162:30000/mayx/blog
https://git.xleed.com/mayx/blog https://git.xleed.com/mayx/blog
https://qlcodegitserver.online/mayx/blog

1 repo_url
48 https://git.pwaapp.cc/mayx/blog
49 https://an360.top/mayx/blog
50 http://106.15.78.64:3000/mayx/blog
51 https://git.wisder.net/mayx/blog
52 http://111.119.244.185:3000/mayx/blog
53 http://110.41.179.36:13000/mayx/blog
54 https://git.influxfin.com/mayx/blog
55 http://219.157.255.213:25311/mayx/blog
56 https://git.vekus.ru/mayx/blog
57 http://116.204.75.78:6180/mayx/blog
58 http://109.228.48.121:8000/mayx/blog
59 http://27.124.12.222:3000/mayx/blog
60 https://git.sayndone.ru/mayx/blog
61 https://gitea.hintsight.com/mayx/blog
62 http://blackobelisk.xyz:3000/mayx/blog
63 https://git.the-kn.com/mayx/blog
166 http://43.248.97.109:3000/mayx/blog
167 http://113.207.86.104:3080/mayx/blog
168 http://39.96.195.72:10082/mayx/blog
169 http://8.148.24.160:3000/mayx/blog
170 https://221.219.181.35:30000/mayx/blog
171 http://172.172.102.93:3000/mayx/blog
172 http://115.120.245.164:3000/mayx/blog
268 http://8.152.205.35:3000/mayx/blog
269 http://120.210.80.160:3000/mayx/blog
270 http://1.95.192.200:59300/mayx/blog
271 https://git.medis.com.vn/mayx/blog
272 http://194.5.152.156:3000/mayx/blog
273 http://8.155.172.147:3001/mayx/blog
274 https://git.erfmann.dev/mayx/blog
359 https://git.lifetop.net/mayx/blog
360 https://gitea.jnyuxia.com/mayx/blog
361 http://git.liuhung.com/mayx/blog
362 https://git.secretserver.club/mayx/blog
363 https://gitea.adber.tech/mayx/blog
364 https://gitea.hello.faith/mayx/blog
365 https://tea.neuron.my/mayx/blog
368 https://git.danpeak.co.uk/mayx/blog
369 https://gitea.mynas-lechner.de/mayx/blog
370 https://git.automathon.org/mayx/blog
371 https://aeterna.cim.mcgill.ca/mayx/blog
372 https://git.esen.gay/mayx/blog
373 https://git.webtims.ru/mayx/blog
374 https://gitea.personalsoftware.space/mayx/blog
375 http://gitea.yiban.com.tw:3030/mayx/blog
376 https://gitlab.iplusus.com/mayx/blog
377 https://git.cyberuk.me/mayx/blog
378 https://git.privezishop.ru/mayx/blog
379 https://gitea.zachl.tech/mayx/blog
380 https://git.miasma-os.com/mayx/blog
381 https://gitea.nacsity.cn/mayx/blog
392 http://git.zxkedu.com:33769/mayx/blog_cn
393 https://code.wemediacn.com/mayx/blog_cn
394 https://gitea.shizuka.icu/mayx/blog_cn
395 http://43.139.2.237:3000/mayx/blog_cn
396 http://51.159.198.233:3000/mayx/blog
397 https://gitea.adriangonzalezbarbosa.eu/mayx/blog
398 https://git.legatus.ru/mayx/blog
439 https://git.sunlix.one/mayx/blog_cn
440 http://47.106.222.181:20511/mayx/blog_cn
441 http://101.43.95.130:3001/mayx/blog_cn
442 http://39.101.170.62:9080/mayx/blog_cn
443 https://gitea.myat4.com/mayx/blog_cn
444 http://118.24.161.24:3000/mayx/blog_cn
445 http://githanea.s.odn.cc/mayx/blog_cn
481 https://git.beyond-a-i.org/mayx/blog
482 http://huanghomenas2.myqnapcloud.com:4000/mayx/blog_cn
483 http://43.142.166.108:10082/mayx/blog_cn
484 https://git.ueda.sk/mayx/blog_cn
485 https://tm-jikayo.com/mayx/blog_cn
486 http://zzdgitea.stnav.com/mayx/blog_cn
487 http://1.117.66.197:3000/mayx/blog_cn
489 https://intl-dev.gaia888.com/mayx/blog_cn
490 https://gitea.xinyuxi.com/mayx/blog_cn
491 http://gitea.snailtrack.cn/mayx/blog_cn
492 https://git.powerdata.dk/mayx/blog
493 http://ydds.cloud:3000/mayx/blog_cn
494 http://120.24.50.145:3000/mayx/blog_cn
495 https://code.draussenfunker.de/mayx/blog_cn
528 http://58.87.88.234:3000/mayx/blog_cn
529 http://210.75.240.13:3000/mayx/blog_cn
530 https://git.xz-i.com:30443/mayx/blog_cn
531 http://111.229.64.148:8080/mayx/blog_cn
532 https://git.fynn.vip/mayx/blog_cn
533 http://119.91.212.17:3000/mayx/blog_cn
534 http://git.hbg99.com:8080/mayx/blog_cn
540 https://gitea.digitanie.org/mayx/blog
541 http://124.207.0.162:30000/mayx/blog
542 https://git.xleed.com/mayx/blog
https://qlcodegitserver.online/mayx/blog

View File

@ -24,7 +24,6 @@ mirrors:
- https://mabbs.kinsta.page/ - https://mabbs.kinsta.page/
- https://mayx.codeberg.page/ - https://mayx.codeberg.page/
- https://mayx.tildepages.org/ - https://mayx.tildepages.org/
- https://mayx.pandastack.app/
- https://mayx.pages.lain.la/ - https://mayx.pages.lain.la/
- https://mayx.4everland.app/ - https://mayx.4everland.app/
- https://mayx.readthedocs.io/ - https://mayx.readthedocs.io/

View File

@ -17,7 +17,7 @@ layout: xslt_container
<link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" /> <link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" />
<!--[if !IE]> --> <!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" /> <link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<link rel="stylesheet" href="/assets/css/gitalk.css" /> <link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script> <script src="/assets/js/gitalk.min.js"></script>
<!-- <![endif]--> <!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" /> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" />

View File

@ -1,22 +1,6 @@
var message_Path = '/Live2dHistoire/live2d/'; var message_Path = '/Live2dHistoire/live2d/';
var talkAPI = BlogAPI + "/ai_chat"; var talkAPI = BlogAPI + "/ai_chat";
function initVisitors() {
if ($('.visitors').length === 1) {
var $visitor = $('.visitors:first');
$.get(BlogAPI + '/count_click_add?id=' + $visitor.attr('id'), function (data) {
$visitor.text(Number(data));
});
} else if ($('.visitors-index').length > 0) {
$('.visitors-index').each(function () {
var $elem = $(this);
$.get(BlogAPI + '/count_click?id=' + $elem.attr('id'), function (data) {
$elem.text(Number(data));
});
});
}
}
$(function () { $(function () {
(function () { (function () {
var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body")) var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
@ -30,7 +14,25 @@ $(function () {
$(function () { $backToTopFun(); }); $(function () { $backToTopFun(); });
})(); })();
initVisitors(); function showHitCount() {
$(".visitors-index").each(function () {
var $elem = $(this);
$.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) {
$visitor.text(Number(data));
});
}
if ($('.visitors').length == 1) {
addCount();
} else if ($('.visitors-index').length > 0) {
showHitCount();
}
if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) { if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
$("html").css({ $("html").css({

View File

@ -1,8 +1,4 @@
/** $(function () {
* 根据 URL ?kw= 参数高亮页面内匹配的关键词
* 提取为全局函数 pjax.js 在页面切换后复用避免重复实现
*/
function highlightKeyword() {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const keyword = urlParams.get('kw')?.trim(); const keyword = urlParams.get('kw')?.trim();
@ -14,7 +10,7 @@ function highlightKeyword() {
const regex = new RegExp(`(${escapedKeyword})`, 'gi'); const regex = new RegExp(`(${escapedKeyword})`, 'gi');
// 递归遍历并高亮文本节点 // 递归遍历并高亮文本节点
const escapeHTML = str => str.replace(/[&<>"']/g, const escapeHTML = str => str.replace(/[&<>"']/g,
tag => ({ tag => ({
'&': '&amp;', '&': '&amp;',
'<': '&lt;', '<': '&lt;',
@ -45,24 +41,37 @@ function highlightKeyword() {
$('section').each(function () { $('section').each(function () {
highlightTextNodes(this); highlightTextNodes(this);
}); });
}; });
function initCopyButtons() { $(function() {
$('.copy').remove(); var $codeBlocks = $('div.highlight');
$('div.highlight').each(function () {
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' }); $codeBlocks.each(function() {
$(this).append($btn); var $copyButton = $('<button>', {
$btn.on('click', function () { class: 'copy',
var code = $btn.siblings('pre').find('code').text().trim(); type: 'button',
text: '📋'
});
$(this).append($copyButton);
$copyButton.on('click', function() {
var code = $(this).siblings('pre').find('code').text().trim();
var $button = $(this);
navigator.clipboard.writeText(code) navigator.clipboard.writeText(code)
.then(function () { $btn.text('✅'); }) .then(function() {
.catch(function () { $btn.text('❌'); }) $button.text('✅');
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); }); })
.catch(function(err) {
$button.text('❌');
console.error('复制失败:', err);
})
.finally(function() {
setTimeout(function() {
$button.text('📋');
}, 1500);
});
}); });
}); });
}
$(function () {
highlightKeyword();
initCopyButtons();
}); });

View File

@ -16,6 +16,25 @@
// ========== 各组件重初始化 ========== // ========== 各组件重初始化 ==========
/** 访问量统计 */
function reinitVisitors() {
if (typeof BlogAPI === 'undefined') return;
var apiBase = BlogAPI;
if ($('.visitors').length === 1) {
var $visitor = $('.visitors:first');
$.get(apiBase + '/count_click_add?id=' + $visitor.attr('id'), function (data) {
$visitor.text(Number(data));
});
} else if ($('.visitors-index').length > 0) {
$('.visitors-index').each(function () {
var $elem = $(this);
$.get(apiBase + '/count_click?id=' + $elem.attr('id'), function (data) {
$elem.text(Number(data));
});
});
}
}
/** AI 摘要post.html 内联脚本pjax 后由 executeScripts 触发) */ /** AI 摘要post.html 内联脚本pjax 后由 executeScripts 触发) */
function reinitAISummary() { function reinitAISummary() {
if (typeof ai_gen === 'function' && $('#ai-output').length) { if (typeof ai_gen === 'function' && $('#ai-output').length) {
@ -23,6 +42,51 @@
} }
} }
/** 代码块复制按钮 */
function reinitCopyButtons() {
$('.copy').remove();
$('div.highlight').each(function () {
var $block = $(this);
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' });
$block.append($btn);
$btn.on('click', function () {
var code = $btn.siblings('pre').find('code').text().trim();
navigator.clipboard.writeText(code)
.then(function () { $btn.text('✅'); })
.catch(function () { $btn.text('❌'); })
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
});
});
}
/** 关键词高亮 */
function reinitHighlight() {
var keyword = new URLSearchParams(window.location.search).get('kw');
if (!keyword) return;
keyword = keyword.trim();
if (!keyword) return;
var escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
var regex = new RegExp('(' + escaped + ')', 'gi');
var escapeHTML = function (str) {
return str.replace(/[&<>"']/g, function (t) {
return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[t] || t;
});
};
function walk(node) {
$(node).contents().each(function () {
if (this.nodeType === Node.TEXT_NODE) {
var $t = $(this);
var text = escapeHTML($t.text());
if (regex.test(text)) $t.replaceWith(text.replace(regex, '<mark>$1</mark>'));
} else if (this.nodeType === Node.ELEMENT_NODE && !$(this).is('script, style, noscript, textarea')) {
walk(this);
}
});
}
$('section').each(function () { walk(this); });
}
/** Google Analytics 页面浏览事件 */ /** Google Analytics 页面浏览事件 */
function trackPageView() { function trackPageView() {
if (typeof gtag === 'function') { if (typeof gtag === 'function') {
@ -92,32 +156,15 @@
// ========== 初始化 ========== // ========== 初始化 ==========
/** pjax 完成后滚动到目标位置:有锚点则定位锚点,否则回到顶部 */
function scrollToAnchor() {
var hash = window.location.hash;
if (hash) {
// 中文等非 ASCII 字符在 URL 中会被编码,需先解码再匹配元素 id
var id = hash.slice(1);
try { id = decodeURIComponent(id); } catch (e) { /* 保持原值 */ }
var target = document.getElementById(id) ||
document.querySelector('a[name="' + id + '"]');
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
return;
}
}
window.scrollTo(0, 0);
}
/** 每次 pjax 完成后执行所有重初始化 */ /** 每次 pjax 完成后执行所有重初始化 */
function onPjaxComplete() { function onPjaxComplete() {
initVisitors(); reinitVisitors();
initCopyButtons(); reinitCopyButtons();
highlightKeyword(); reinitHighlight();
reinitAISummary(); reinitAISummary();
reinitLive2d(); reinitLive2d();
trackPageView(); trackPageView();
scrollToAnchor(); window.scrollTo(0, 0);
} }
$(document).ready(function () { $(document).ready(function () {
@ -159,6 +206,8 @@
newScript.remove(); newScript.remove();
}); });
}); });
// 首次加载初始化
reinitCopyButtons();
}); });
})(jQuery); })(jQuery);