Update 10 files

- /assets/js/jquery.pjax.min.js
- /assets/js/main.js
- /assets/js/pjax.js
- /_layouts/default.html
- /_layouts/post.html
- /_data/proxylist.yml
- /_data/other_repo_list.csv
- /Live2dHistoire/live2d/js/message.js
- /index.html
- /search.html
This commit is contained in:
mayx
2026-05-21 07:38:17 +00:00
parent 862bffac80
commit c4ae25dcb1
10 changed files with 519 additions and 104 deletions

View File

@@ -22,6 +22,8 @@ if (!norunFlag) {
var sleepTimer_ = null; var sleepTimer_ = null;
var AITalkFlag = false; var AITalkFlag = false;
var talkNum = 0; var talkNum = 0;
// 暴露到全局,供 pjax.js 在页面切换后重新调用
window._live2d = { initTips: null, showMessage: null, showHitokoto: null };
(function () { (function () {
function renderTip(template, context) { function renderTip(template, context) {
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g; var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
@@ -33,11 +35,11 @@ if (!norunFlag) {
var currentObject = context; var currentObject = context;
var i, length, variable; var i, length, variable;
for (i = 0, length = variables.length; i < length; ++i) { for (i = 0, length = variables.length; i < length; ++i) {
variable = variables[i]; variable = currentObject[variables[i]];
currentObject = currentObject[variable]; if (variable === undefined || variable === null) return '';
if (currentObject === undefined || currentObject === null) return ''; currentObject = variable;
} }
return currentObject; return String(currentObject);
}); });
} }
@@ -56,14 +58,20 @@ if (!norunFlag) {
showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000); showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000);
}); });
// 缓存 message.json 数据,供 PJAX 重绑定使用
var tipsData = null;
function initTips() { function initTips() {
$.ajax({ $.ajax({
cache: true, cache: true,
url: message_Path + 'message.json', url: message_Path + 'message.json',
dataType: "json", dataType: "json",
success: function (result) { success: function (result) {
tipsData = result;
// 解绑旧事件(用命名空间避免影响其他绑定)
$.each(result.mouseover, function (index, tips) { $.each(result.mouseover, function (index, tips) {
$(tips.selector).mouseover(function () { $(tips.selector).off('mouseover._live2d_tips mouseout._live2d_tips');
$(tips.selector).on('mouseover._live2d_tips', function () {
var text = tips.text; var text = tips.text;
if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1]; if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1];
text = text.renderTip({ text: $(this).text() }); text = text.renderTip({ text: $(this).text() });
@@ -72,7 +80,7 @@ if (!norunFlag) {
clearInterval(liveTlakTimer); clearInterval(liveTlakTimer);
liveTlakTimer = null; liveTlakTimer = null;
}); });
$(tips.selector).mouseout(function () { $(tips.selector).on('mouseout._live2d_tips', function () {
showHitokoto(); showHitokoto();
if (liveTlakTimer == null) { if (liveTlakTimer == null) {
liveTlakTimer = window.setInterval(function () { liveTlakTimer = window.setInterval(function () {
@@ -82,7 +90,8 @@ if (!norunFlag) {
}); });
}); });
$.each(result.click, function (index, tips) { $.each(result.click, function (index, tips) {
$(tips.selector).click(function () { $(tips.selector).off('click._live2d_tips');
$(tips.selector).on('click._live2d_tips', function () {
if (hitFlag) { if (hitFlag) {
return false return false
} }
@@ -106,23 +115,26 @@ if (!norunFlag) {
} }
}); });
} }
window._live2d.initTips = initTips;
initTips(); initTips();
var text; var text;
if (document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host) { if (document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host) {
var referrer = document.createElement('a'); var referrer = document.createElement('a');
referrer.href = document.referrer; referrer.href = document.referrer;
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
var domain = referrer.hostname.split('.')[1]; var domain = referrer.hostname.split('.')[1];
if (domain == 'baidu') { if (domain == 'baidu' || domain == 'so' || domain == 'google') {
text = '嗨! 来自 百度搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; var source = domain == 'baidu' ? '百度搜索' : domain == 'so' ? '360搜索' : '谷歌搜索';
} else if (domain == 'so') { text = '嗨! 来自 ' + source + ' 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
text = '嗨! 来自 360搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; } else {
} else if (domain == 'google') { text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
text = '嗨! 来自 谷歌搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} }
} else if (typeof window._pjaxGetWelcomeText === 'function') {
// 复用 pjax.js 中的欢迎语生成函数,避免重复逻辑
text = window._pjaxGetWelcomeText();
} else { } else {
if (window.location.pathname == "/") { //主页URL判断需要斜杠结尾 // pjax.js 尚未加载时的兜底(首次访问且 pjax.js 在 message.js 之后加载)
if (window.location.pathname == "/") {
var now = (new Date()).getHours(); var now = (new Date()).getHours();
if (now > 23 || now <= 5) { if (now > 23 || now <= 5) {
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?'; text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?';
@@ -172,6 +184,7 @@ if (!norunFlag) {
console.log(sleepTimer_); console.log(sleepTimer_);
} }
} }
window._live2d.showHitokoto = showHitokoto;
function checkSleep() { function checkSleep() {
var sleepStatu = sessionStorage.getItem("Sleepy"); var sleepStatu = sessionStorage.getItem("Sleepy");
@@ -213,6 +226,7 @@ if (!norunFlag) {
//if (timeout === null) timeout = 5000; //if (timeout === null) timeout = 5000;
//hideMessage(timeout); //hideMessage(timeout);
} }
window._live2d.showMessage = showMessage;
function talkValTimer() { function talkValTimer() {
$('#live_talk').val('1'); $('#live_talk').val('1');
} }
@@ -384,74 +398,100 @@ if (!norunFlag) {
}; };
}; };
//获取音乐信息初始化 //获取音乐信息初始化
var bgmListInfo = $('input[name=live2dBGM]'); var $bgm = $('#live2d_bgm');
if (bgmListInfo.length == 0) {
$('#musicButton').hide(); // 音乐按钮点击事件(幂等,使用命名空间避免重复绑定)
} else { $('#musicButton').off('click._bgm').on('click._bgm', function () {
var bgmPlayNow = parseInt($('#live2d_bgm').attr('data-bgm')); if ($('#musicButton').hasClass('play')) {
var bgmPlayTime = 0; $bgm[0].pause();
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num"); $('#musicButton').removeClass('play');
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime"); sessionStorage.setItem("live2dBGM_IsPlay", '1');
if (live2dBGM_Num) { } else {
if (live2dBGM_Num <= $('input[name=live2dBGM]').length - 1) { $bgm[0].play();
bgmPlayNow = parseInt(live2dBGM_Num);
}
}
if (live2dBGM_PlayTime) {
bgmPlayTime = parseInt(live2dBGM_PlayTime);
}
var live2dBGMSrc = bgmListInfo.eq(bgmPlayNow).val();
$('#live2d_bgm').attr('data-bgm', bgmPlayNow);
$('#live2d_bgm').attr('src', live2dBGMSrc);
$('#live2d_bgm')[0].currentTime = bgmPlayTime;
$('#live2d_bgm')[0].volume = 0.5;
var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay");
var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose");
if (live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0') {
$('#live2d_bgm')[0].play();
$('#musicButton').addClass('play'); $('#musicButton').addClass('play');
sessionStorage.setItem("live2dBGM_IsPlay", '0');
} }
sessionStorage.setItem("live2dBGM_WindowClose", '1'); });
$('#musicButton').on('click', function () {
if ($('#musicButton').hasClass('play')) { // BGM 事件监听(仅绑定一次,使用标志位避免重复)
$('#live2d_bgm')[0].pause(); if (!window._live2d._bgmEventsBound) {
$('#musicButton').removeClass('play'); $bgm[0].addEventListener("timeupdate", function () {
sessionStorage.setItem("live2dBGM_IsPlay", '1'); sessionStorage.setItem("live2dBGM_PlayTime", $bgm[0].currentTime);
} else { });
$('#live2d_bgm')[0].play(); $bgm[0].addEventListener("ended", function () {
$('#musicButton').addClass('play'); var listNow = parseInt($bgm.attr('data-bgm'));
sessionStorage.setItem("live2dBGM_IsPlay", '0'); listNow++;
var inputs = $('input[name=live2dBGM]');
if (inputs.length === 0) return;
if (listNow > inputs.length - 1) {
listNow = 0;
} }
var listNewSrc = inputs.eq(listNow).val();
if (!listNewSrc) return;
sessionStorage.setItem("live2dBGM_Num", listNow);
$bgm.attr('src', listNewSrc);
$bgm[0].play();
$bgm.attr('data-bgm', listNow);
});
$bgm[0].addEventListener("error", function () {
$bgm[0].pause();
$('#musicButton').removeClass('play');
showMessage('音乐似乎加载不出来了呢!', 0);
}); });
window.onbeforeunload = function () { window.onbeforeunload = function () {
sessionStorage.setItem("live2dBGM_WindowClose", '0'); sessionStorage.setItem("live2dBGM_WindowClose", '0');
if ($('#musicButton').hasClass('play')) { if ($('#musicButton').hasClass('play')) {
sessionStorage.setItem("live2dBGM_IsPlay", '0'); sessionStorage.setItem("live2dBGM_IsPlay", '0');
} }
} };
document.getElementById('live2d_bgm').addEventListener("timeupdate", function () { window._live2d._bgmEventsBound = true;
var live2dBgmPlayTimeNow = document.getElementById('live2d_bgm').currentTime; }
sessionStorage.setItem("live2dBGM_PlayTime", live2dBgmPlayTimeNow);
}); // 初始化 BGM根据当前页面是否有 BGM 输入)
document.getElementById('live2d_bgm').addEventListener("ended", function () { if (typeof window._live2d.initBGM === 'function') {
var listNow = parseInt($('#live2d_bgm').attr('data-bgm')); window._live2d.initBGM();
listNow++;
if (listNow > $('input[name=live2dBGM]').length - 1) {
listNow = 0;
}
var listNewSrc = $('input[name=live2dBGM]').eq(listNow).val();
sessionStorage.setItem("live2dBGM_Num", listNow);
$('#live2d_bgm').attr('src', listNewSrc);
$('#live2d_bgm')[0].play();
$('#live2d_bgm').attr('data-bgm', listNow);
});
document.getElementById('live2d_bgm').addEventListener("error", function () {
$('#live2d_bgm')[0].pause();
$('#musicButton').removeClass('play');
showMessage('音乐似乎加载不出来了呢!', 0);
});
} }
} }
// 暴露 BGM 初始化函数,供 PJAX 重初始化时调用
window._live2d.initBGM = function() {
var bgmListInfo = $('input[name=live2dBGM]');
var $bgm = $('#live2d_bgm');
if (bgmListInfo.length === 0) {
$('#musicButton').hide();
if ($bgm.length) $bgm[0].pause();
return;
}
var bgmPlayNow = parseInt($bgm.attr('data-bgm')) || 0;
var bgmPlayTime = 0;
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num");
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime");
if (live2dBGM_Num) {
if (parseInt(live2dBGM_Num) <= bgmListInfo.length - 1) {
bgmPlayNow = parseInt(live2dBGM_Num);
}
}
if (live2dBGM_PlayTime) {
bgmPlayTime = parseFloat(live2dBGM_PlayTime);
}
var newSrc = bgmListInfo.eq(bgmPlayNow).val();
$bgm.attr('data-bgm', bgmPlayNow);
if ($bgm.attr('src') !== newSrc) {
$bgm[0].pause();
$bgm.attr('src', newSrc);
$bgm[0].currentTime = bgmPlayTime;
}
$bgm[0].volume = 0.5;
var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay");
var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose");
if (live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0') {
$bgm[0].play();
$('#musicButton').addClass('play');
}
sessionStorage.setItem("live2dBGM_WindowClose", '1');
$('#musicButton').show();
};
$(document).ready(function () { $(document).ready(function () {
var AIimgSrc = [ var AIimgSrc = [
message_Path + "model/histoire/histoire.1024/texture_00.png", message_Path + "model/histoire/histoire.1024/texture_00.png",

View File

@@ -83,7 +83,6 @@ http://207.180.229.193:3001/mayx/blog
http://34.81.52.16/mayx/blog http://34.81.52.16/mayx/blog
http://123.57.16.111:3000/mayx/blog http://123.57.16.111:3000/mayx/blog
https://lius.familyds.org:3000/mayx/blog https://lius.familyds.org:3000/mayx/blog
https://gitea.questline.coop/mayx/blog
http://git.chaojing-film.com:3000/mayx/blog http://git.chaojing-film.com:3000/mayx/blog
https://git.nusaerp.com/mayx/blog https://git.nusaerp.com/mayx/blog
http://35.207.205.18:3000/mayx/blog http://35.207.205.18:3000/mayx/blog
@@ -198,7 +197,6 @@ https://gitea.dsmaster.myds.me/mayx/blog
https://gitea.primecontrols-dev.com/mayx/blog https://gitea.primecontrols-dev.com/mayx/blog
http://www.scserverddns.top:13000/mayx/blog http://www.scserverddns.top:13000/mayx/blog
https://git.lucas-michel.fr/mayx/blog https://git.lucas-michel.fr/mayx/blog
http://60.205.162.59:3000/mayx/blog
https://git.imvictor.tech:2/mayx/blog https://git.imvictor.tech:2/mayx/blog
http://47.112.137.193:3000/mayx/blog http://47.112.137.193:3000/mayx/blog
http://58.38.123.148:3176/mayx/blog http://58.38.123.148:3176/mayx/blog
@@ -344,7 +342,6 @@ http://82.156.89.21:3000/mayx/blog_cn
https://git.sskuaixiu.com/mayx/blog_cn https://git.sskuaixiu.com/mayx/blog_cn
http://xujiesoft.vicp.net:3000/mayx/blog_cn http://xujiesoft.vicp.net:3000/mayx/blog_cn
http://113.44.36.103:23000/mayx/blog_cn http://113.44.36.103:23000/mayx/blog_cn
http://111.230.92.227:3000/mayx/blog_cn
https://git.mingliqiye.com/mayx/blog_cn https://git.mingliqiye.com/mayx/blog_cn
http://119.29.194.155:8894/mayx/blog_cn http://119.29.194.155:8894/mayx/blog_cn
http://43.138.249.161:3000/mayx/blog_cn http://43.138.249.161:3000/mayx/blog_cn
@@ -371,7 +368,6 @@ 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
https://git.econutrix.com/mayx/blog
https://git.violka-it.net/mayx/blog https://git.violka-it.net/mayx/blog
https://git.adityagupta.dev/mayx/blog https://git.adityagupta.dev/mayx/blog
https://code.ownwire.net/mayx/blog https://code.ownwire.net/mayx/blog
@@ -396,7 +392,6 @@ https://suprasage.com/mayx/blog
https://git.zakum.cn/mayx/blog https://git.zakum.cn/mayx/blog
https://gitea.amazingcoders.com/mayx/blog https://gitea.amazingcoders.com/mayx/blog
https://gitea.kamilklecha.dev/mayx/blog https://gitea.kamilklecha.dev/mayx/blog
https://forgejo.testbed.unict.it/mayx/blog
http://47.109.103.110:9000/mayx/blog_cn http://47.109.103.110:9000/mayx/blog_cn
http://47.105.124.101:3000/mayx/blog_cn http://47.105.124.101:3000/mayx/blog_cn
http://49.232.183.190:3000/mayx/blog_cn http://49.232.183.190:3000/mayx/blog_cn
@@ -406,7 +401,6 @@ https://gitea.shizuka.icu/mayx/blog_cn
http://43.139.2.237:3000/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
http://39.108.124.198:3000/mayx/blog
https://git.legatus.ru/mayx/blog https://git.legatus.ru/mayx/blog
https://git.kayashov.keenetic.pro/mayx/blog https://git.kayashov.keenetic.pro/mayx/blog
http://43.138.83.20:3000/mayx/blog_cn http://43.138.83.20:3000/mayx/blog_cn
@@ -439,7 +433,6 @@ http://36.133.248.69:3088/mayx/blog_cn
http://220.205.16.27:18081/mayx/blog_cn http://220.205.16.27:18081/mayx/blog_cn
http://81.69.221.216:3000/mayx/blog_cn http://81.69.221.216:3000/mayx/blog_cn
http://115.159.194.75:4000/mayx/blog_cn http://115.159.194.75:4000/mayx/blog_cn
http://115.190.214.62:3001/mayx/blog_cn
http://183.204.60.122:10081/mayx/blog_cn http://183.204.60.122:10081/mayx/blog_cn
http://43.139.240.37:17000/mayx/blog_cn http://43.139.240.37:17000/mayx/blog_cn
http://159.75.27.114:3000/mayx/blog_cn http://159.75.27.114:3000/mayx/blog_cn
@@ -497,7 +490,6 @@ 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://git.ueda.sk/mayx/blog_cn
https://tm-jikayo.com/mayx/blog_cn https://tm-jikayo.com/mayx/blog_cn
http://112.6.10.77:3000/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
http://git.zhmight.com/mayx/blog_cn http://git.zhmight.com/mayx/blog_cn
@@ -509,7 +501,6 @@ http://ydds.cloud:3000/mayx/blog_cn
https://git.keruixinda.com/mayx/blog_cn https://git.keruixinda.com/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
https://git.gede.at/mayx/blog_cn
https://git.dinsor.co.th/mayx/blog https://git.dinsor.co.th/mayx/blog
https://ofibohost.com/mayx/blog https://ofibohost.com/mayx/blog
https://lab.iishka.net/mayx/blog https://lab.iishka.net/mayx/blog
@@ -528,13 +519,10 @@ https://gitea.malxte.de/mayx/blog
https://git.nizart.me/mayx/blog https://git.nizart.me/mayx/blog
https://git.ddns.net/mayx/blog https://git.ddns.net/mayx/blog
http://222.85.214.245:9776/mayx/blog http://222.85.214.245:9776/mayx/blog
https://git.thubn.de/mayx/blog
https://git.tolyaneblan.ru/mayx/blog
https://git.kraevsky.ru/mayx/blog https://git.kraevsky.ru/mayx/blog
https://ruyiscx.cloud:3000/mayx/blog https://ruyiscx.cloud:3000/mayx/blog
https://git.0xee.eu/mayx/blog https://git.0xee.eu/mayx/blog
https://gitea.deitglobal.com/mayx/blog https://gitea.deitglobal.com/mayx/blog
https://git.sprunk.me/mayx/blog
https://www.mygitea.ru/mayx/blog https://www.mygitea.ru/mayx/blog
https://git.crwlr.ir/mayx/blog https://git.crwlr.ir/mayx/blog
https://git.nozora.top/mayx/blog https://git.nozora.top/mayx/blog
@@ -549,15 +537,15 @@ http://47.108.255.216:3000/mayx/blog_cn
https://gitea.molietech.com/mayx/blog_cn 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://gitea.twomiracles.xyz/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 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
https://git.serhii.ru/mayx/blog_cn
https://gitea.y8o.de/mayx/blog_cn
http://git.hbg99.com:8080/mayx/blog_cn http://git.hbg99.com:8080/mayx/blog_cn
https://git.eplg.services/mayx/blog https://git.eplg.services/mayx/blog
http://89.167.38.168:3001/mayx/blog http://89.167.38.168:3001/mayx/blog
http://namonba.asuscomm.com:3001/mayx/blog http://namonba.asuscomm.com:3001/mayx/blog
http://109.199.98.226:3001/mayx/blog http://109.199.98.226:3001/mayx/blog
https://git.extra.eiffel.com/mayx/blog
https://gitea.digitanie.org/mayx/blog
http://124.207.0.162:30000/mayx/blog
1 repo_url
83 http://34.81.52.16/mayx/blog
84 http://123.57.16.111:3000/mayx/blog
85 https://lius.familyds.org:3000/mayx/blog
https://gitea.questline.coop/mayx/blog
86 http://git.chaojing-film.com:3000/mayx/blog
87 https://git.nusaerp.com/mayx/blog
88 http://35.207.205.18:3000/mayx/blog
197 https://gitea.primecontrols-dev.com/mayx/blog
198 http://www.scserverddns.top:13000/mayx/blog
199 https://git.lucas-michel.fr/mayx/blog
http://60.205.162.59:3000/mayx/blog
200 https://git.imvictor.tech:2/mayx/blog
201 http://47.112.137.193:3000/mayx/blog
202 http://58.38.123.148:3176/mayx/blog
342 https://git.sskuaixiu.com/mayx/blog_cn
343 http://xujiesoft.vicp.net:3000/mayx/blog_cn
344 http://113.44.36.103:23000/mayx/blog_cn
http://111.230.92.227:3000/mayx/blog_cn
345 https://git.mingliqiye.com/mayx/blog_cn
346 http://119.29.194.155:8894/mayx/blog_cn
347 http://43.138.249.161:3000/mayx/blog_cn
368 https://gitea.adber.tech/mayx/blog
369 https://gitea.hello.faith/mayx/blog
370 https://tea.neuron.my/mayx/blog
https://git.econutrix.com/mayx/blog
371 https://git.violka-it.net/mayx/blog
372 https://git.adityagupta.dev/mayx/blog
373 https://code.ownwire.net/mayx/blog
392 https://git.zakum.cn/mayx/blog
393 https://gitea.amazingcoders.com/mayx/blog
394 https://gitea.kamilklecha.dev/mayx/blog
https://forgejo.testbed.unict.it/mayx/blog
395 http://47.109.103.110:9000/mayx/blog_cn
396 http://47.105.124.101:3000/mayx/blog_cn
397 http://49.232.183.190:3000/mayx/blog_cn
401 http://43.139.2.237:3000/mayx/blog_cn
402 http://51.159.198.233:3000/mayx/blog
403 https://gitea.adriangonzalezbarbosa.eu/mayx/blog
http://39.108.124.198:3000/mayx/blog
404 https://git.legatus.ru/mayx/blog
405 https://git.kayashov.keenetic.pro/mayx/blog
406 http://43.138.83.20:3000/mayx/blog_cn
433 http://220.205.16.27:18081/mayx/blog_cn
434 http://81.69.221.216:3000/mayx/blog_cn
435 http://115.159.194.75:4000/mayx/blog_cn
http://115.190.214.62:3001/mayx/blog_cn
436 http://183.204.60.122:10081/mayx/blog_cn
437 http://43.139.240.37:17000/mayx/blog_cn
438 http://159.75.27.114:3000/mayx/blog_cn
490 http://43.142.166.108:10082/mayx/blog_cn
491 https://git.ueda.sk/mayx/blog_cn
492 https://tm-jikayo.com/mayx/blog_cn
http://112.6.10.77:3000/mayx/blog_cn
493 http://zzdgitea.stnav.com/mayx/blog_cn
494 http://1.117.66.197:3000/mayx/blog_cn
495 http://git.zhmight.com/mayx/blog_cn
501 https://git.keruixinda.com/mayx/blog_cn
502 http://120.24.50.145:3000/mayx/blog_cn
503 https://code.draussenfunker.de/mayx/blog_cn
https://git.gede.at/mayx/blog_cn
504 https://git.dinsor.co.th/mayx/blog
505 https://ofibohost.com/mayx/blog
506 https://lab.iishka.net/mayx/blog
519 https://git.nizart.me/mayx/blog
520 https://git.ddns.net/mayx/blog
521 http://222.85.214.245:9776/mayx/blog
https://git.thubn.de/mayx/blog
https://git.tolyaneblan.ru/mayx/blog
522 https://git.kraevsky.ru/mayx/blog
523 https://ruyiscx.cloud:3000/mayx/blog
524 https://git.0xee.eu/mayx/blog
525 https://gitea.deitglobal.com/mayx/blog
https://git.sprunk.me/mayx/blog
526 https://www.mygitea.ru/mayx/blog
527 https://git.crwlr.ir/mayx/blog
528 https://git.nozora.top/mayx/blog
537 https://gitea.molietech.com/mayx/blog_cn
538 http://58.87.88.234:3000/mayx/blog_cn
539 http://210.75.240.13:3000/mayx/blog_cn
https://gitea.twomiracles.xyz/mayx/blog_cn
540 https://git.xz-i.com:30443/mayx/blog_cn
541 http://111.229.64.148:8080/mayx/blog_cn
542 https://git.fynn.vip/mayx/blog_cn
543 http://119.91.212.17:3000/mayx/blog_cn
https://git.serhii.ru/mayx/blog_cn
https://gitea.y8o.de/mayx/blog_cn
544 http://git.hbg99.com:8080/mayx/blog_cn
545 https://git.eplg.services/mayx/blog
546 http://89.167.38.168:3001/mayx/blog
547 http://namonba.asuscomm.com:3001/mayx/blog
548 http://109.199.98.226:3001/mayx/blog
549 https://git.extra.eiffel.com/mayx/blog
550 https://gitea.digitanie.org/mayx/blog
551 http://124.207.0.162:30000/mayx/blog

View File

@@ -1,6 +1,7 @@
proxies: proxies:
- https://blog.mayx.workers.dev/ - https://blog.mayx.workers.dev/
- https://mayx.deno.dev/ - https://mayx.deno.dev/
- https://mayx.val.run/
- https://yuki.gear.host/ - https://yuki.gear.host/
- https://mayx.global.ssl.fastly.net/ - https://mayx.global.ssl.fastly.net/
mirrors: mirrors:
@@ -17,6 +18,7 @@ mirrors:
- https://mayx-blog.pgs.sh/ - https://mayx-blog.pgs.sh/
- https://mayx.netlify.app/ - https://mayx.netlify.app/
- https://mayx.gitnet.page/ - https://mayx.gitnet.page/
- https://mayx.stormkit.dev/
- https://mayx.grebedoc.dev/ - https://mayx.grebedoc.dev/
- https://mabbs.kinsta.page/ - https://mabbs.kinsta.page/
- https://mayx.codeberg.page/ - https://mayx.codeberg.page/

View File

@@ -35,6 +35,15 @@ layout: xslt_container
<script> <script>
var lastUpdated = new Date("{{ site.time | date_to_rfc822 }}"); var lastUpdated = new Date("{{ site.time | date_to_rfc822 }}");
var BlogAPI = "https://summary.mayx.eu.org"; var BlogAPI = "https://summary.mayx.eu.org";
var GitalkConfig = {
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
distractionFreeMode: false,
proxy: 'https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token'
};
</script> </script>
<script src="/assets/js/main.js"></script> <script src="/assets/js/main.js"></script>
<!--[if !IE]> --> <!--[if !IE]> -->
@@ -91,7 +100,7 @@ layout: xslt_container
{% endif %} {% endif %}
</ul> </ul>
</header> </header>
<section{% unless page.layout == "default" %} class="h-entry"{% endunless %}> <section id="pjax-container"{% unless page.layout == "default" %} class="h-entry"{% endunless %}>
{{ content }} {{ content }}
@@ -105,6 +114,8 @@ layout: xslt_container
</div> </div>
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script> <script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
<!--[if !IE]> --> <!--[if !IE]> -->
<script src="/assets/js/jquery.pjax.min.js"></script>
<script src="/assets/js/pjax.js"></script>
<script src="/assets/js/main_new.js"></script> <script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script> <script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script> <script src="/Live2dHistoire/live2d/js/message.js"></script>

View File

@@ -161,19 +161,10 @@ $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), fu
<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>
<div id="gitalk-container"></div> <div id="gitalk-container" data-page-id="{{ page.id }}"></div>
<script> <script>
var gitalk = new Gitalk({ var gitalk = new Gitalk(Object.assign({ id: '{{ page.id }}' }, GitalkConfig))
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '{{ page.id }}', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container') gitalk.render('gitalk-container')
</script> </script>
<!-- <![endif]--> <!-- <![endif]-->

6
assets/js/jquery.pjax.min.js vendored Normal file
View File

@@ -0,0 +1,6 @@
/*!
* Copyright 2012, Chris Wanstrath
* Released under the MIT License
* https://github.com/defunkt/jquery-pjax
*/
!function(t){function e(e,a,r){return r=g(a,r),this.on("click.pjax",e,(function(e){var a=r;a.container||((a=t.extend({},r)).container=t(this).attr("data-pjax")),n(e,a)}))}function n(e,n,a){a=g(n,a);var i=e.currentTarget,o=t(i);if("A"!==i.tagName.toUpperCase())throw"$.fn.pjax or $.pjax.click requires an anchor element";if(!(e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||location.protocol!==i.protocol||location.hostname!==i.hostname||i.href.indexOf("#")>-1&&x(i)==x(location)||e.isDefaultPrevented())){var s={url:i.href,container:o.attr("data-pjax"),target:i},c=t.extend({},s,a),u=t.Event("pjax:click");o.trigger(u,[c]),u.isDefaultPrevented()||(r(c),e.preventDefault(),o.trigger("pjax:clicked",[c]))}}function a(e,n,a){a=g(n,a);var i=e.currentTarget,o=t(i);if("FORM"!==i.tagName.toUpperCase())throw"$.pjax.submit requires a form element";var s={type:(o.attr("method")||"GET").toUpperCase(),url:o.attr("action"),container:o.attr("data-pjax"),target:i};if("GET"!==s.type&&void 0!==window.FormData)s.data=new FormData(i),s.processData=!1,s.contentType=!1;else{if(o.find(":file").length)return;s.data=o.serializeArray()}r(t.extend({},s,a)),e.preventDefault()}function r(e){e=t.extend(!0,{},t.ajaxSettings,r.defaults,e),t.isFunction(e.url)&&(e.url=e.url());var n=v(e.url).hash,a=t.type(e.container);if("string"!==a)throw"expected string value for 'container' option; got "+a;var i,s=e.context=t(e.container);if(!s.length)throw"the container selector '"+e.container+"' did not match anything";function c(n,a,r){r||(r={}),r.relatedTarget=e.target;var i=t.Event(n,r);return s.trigger(i,a),!i.isDefaultPrevented()}e.data||(e.data={}),t.isArray(e.data)?e.data.push({name:"_pjax",value:e.container}):e.data._pjax=e.container,e.beforeSend=function(t,a){if("GET"!==a.type&&(a.timeout=0),t.setRequestHeader("X-PJAX","true"),t.setRequestHeader("X-PJAX-Container",e.container),!c("pjax:beforeSend",[t,a]))return!1;a.timeout>0&&(i=setTimeout((function(){c("pjax:timeout",[t,e])&&t.abort("timeout")}),a.timeout),a.timeout=0);var r=v(a.url);n&&(r.hash=n),e.requestUrl=m(r)},e.complete=function(t,n){i&&clearTimeout(i),c("pjax:complete",[t,n,e]),c("pjax:end",[t,e])},e.error=function(t,n,a){var r=w("",t,e),i=c("pjax:error",[t,n,a,e]);"GET"==e.type&&"abort"!==n&&i&&o(r.url)},e.success=function(a,i,u){var l=r.state,p="function"==typeof t.pjax.defaults.version?t.pjax.defaults.version():t.pjax.defaults.version,d=u.getResponseHeader("X-PJAX-Version"),h=w(a,u,e),m=v(h.url);if(n&&(m.hash=n,h.url=m.href),p&&d&&p!==d)o(h.url);else if(h.contents){if(r.state={id:e.id||f(),url:h.url,title:h.title,container:e.container,fragment:e.fragment,timeout:e.timeout},(e.push||e.replace)&&window.history.replaceState(r.state,h.title,h.url),t.contains(s,document.activeElement))try{document.activeElement.blur()}catch(t){}h.title&&(document.title=h.title),c("pjax:beforeReplace",[h.contents,e],{state:r.state,previousState:l}),s.html(h.contents);var x=s.find("input[autofocus], textarea[autofocus]").last()[0];x&&document.activeElement!==x&&x.focus(),function(e){if(!e)return;var n=t("script[src]");e.each((function(){var e=this.src;if(!n.filter((function(){return this.src===e})).length){var a=document.createElement("script"),r=t(this).attr("type");r&&(a.type=r),a.src=t(this).attr("src"),document.head.appendChild(a)}}))}(h.scripts);var g=e.scrollTo;if(n){var y=decodeURIComponent(n.slice(1)),j=document.getElementById(y)||document.getElementsByName(y)[0];j&&(g=t(j).offset().top)}"number"==typeof g&&t(window).scrollTop(g),c("pjax:success",[a,i,u,e])}else o(h.url)},r.state||(r.state={id:f(),url:window.location.href,title:document.title,container:e.container,fragment:e.fragment,timeout:e.timeout},window.history.replaceState(r.state,document.title)),d(r.xhr),r.options=e;var u,l,p=r.xhr=t.ajax(e);return p.readyState>0&&(e.push&&!e.replace&&(u=r.state.id,l=[e.container,h(s)],b[u]=l,E.push(u),S(T,0),S(E,r.defaults.maxCacheLength),window.history.pushState(null,"",e.requestUrl)),c("pjax:start",[p,e]),c("pjax:send",[p,e])),r.xhr}function i(e,n){var a={url:window.location.href,push:!1,replace:!0,scrollTo:!1};return r(t.extend(a,g(e,n)))}function o(t){window.history.replaceState(null,"",r.state.url),window.location.replace(t)}var s=!0,c=window.location.href,u=window.history.state;function l(e){s||d(r.xhr);var n,a=r.state,i=e.state;if(i&&i.container){if(s&&c==i.url)return;if(a){if(a.id===i.id)return;n=a.id<i.id?"forward":"back"}var u=b[i.id]||[],l=u[0]||i.container,p=t(l),f=u[1];if(p.length){a&&function(t,e,n){var a,i;b[e]=n,"forward"===t?(a=E,i=T):(a=T,i=E);a.push(e),(e=i.pop())&&delete b[e];S(a,r.defaults.maxCacheLength)}(n,a.id,[l,h(p)]);var m=t.Event("pjax:popstate",{state:i,direction:n});p.trigger(m);var v={id:i.id,url:i.url,container:l,push:!1,fragment:i.fragment,timeout:i.timeout,scrollTo:!1};if(f){p.trigger("pjax:start",[null,v]),r.state=i,i.title&&(document.title=i.title);var x=t.Event("pjax:beforeReplace",{state:i,previousState:a});p.trigger(x,[f,v]),p.html(f),p.trigger("pjax:end",[null,v])}else r(v);p[0].offsetHeight}else o(location.href)}s=!1}function p(e){var n=t.isFunction(e.url)?e.url():e.url,a=e.type?e.type.toUpperCase():"GET",r=t("<form>",{method:"GET"===a?"GET":"POST",action:n,style:"display:none"});"GET"!==a&&"POST"!==a&&r.append(t("<input>",{type:"hidden",name:"_method",value:a.toLowerCase()}));var i=e.data;if("string"==typeof i)t.each(i.split("&"),(function(e,n){var a=n.split("=");r.append(t("<input>",{type:"hidden",name:a[0],value:a[1]}))}));else if(t.isArray(i))t.each(i,(function(e,n){r.append(t("<input>",{type:"hidden",name:n.name,value:n.value}))}));else if("object"==typeof i){var o;for(o in i)r.append(t("<input>",{type:"hidden",name:o,value:i[o]}))}t(document.body).append(r),r.submit()}function d(e){e&&e.readyState<4&&(e.onreadystatechange=t.noop,e.abort())}function f(){return(new Date).getTime()}function h(e){var n=e.clone();return n.find("script").each((function(){this.src||t._data(this,"globalEval",!1)})),n.contents()}function m(t){return t.search=t.search.replace(/([?&])(_pjax|_)=[^&]*/g,"").replace(/^&/,""),t.href.replace(/\?($|#)/,"$1")}function v(t){var e=document.createElement("a");return e.href=t,e}function x(t){return t.href.replace(/#.*/,"")}function g(e,n){return e&&n?((n=t.extend({},n)).container=e,n):t.isPlainObject(e)?e:{container:e}}function y(t,e){return t.filter(e).add(t.find(e))}function j(e){return t.parseHTML(e,document,!0)}function w(e,n,a){var r,i,o={},s=/<html/i.test(e),c=n.getResponseHeader("X-PJAX-URL");if(o.url=c?m(v(c)):a.requestUrl,s){i=t(j(e.match(/<body[^>]*>([\s\S.]*)<\/body>/i)[0]));var u=e.match(/<head[^>]*>([\s\S.]*)<\/head>/i);r=null!=u?t(j(u[0])):i}else r=i=t(j(e));if(0===i.length)return o;if(o.title=y(r,"title").last().text(),a.fragment){var l=i;"body"!==a.fragment&&(l=y(l,a.fragment).first()),l.length&&(o.contents="body"===a.fragment?l:l.contents(),o.title||(o.title=l.attr("title")||l.data("title")))}else s||(o.contents=i);return o.contents&&(o.contents=o.contents.not((function(){return t(this).is("title")})),o.contents.find("title").remove(),o.scripts=y(o.contents,"script[src]").remove(),o.contents=o.contents.not(o.scripts)),o.title&&(o.title=t.trim(o.title)),o}u&&u.container&&(r.state=u),"state"in window.history&&(s=!1);var b={},T=[],E=[];function S(t,e){for(;t.length>e;)delete b[t.shift()]}function P(){return t("meta").filter((function(){var e=t(this).attr("http-equiv");return e&&"X-PJAX-VERSION"===e.toUpperCase()})).attr("content")}function C(){t.fn.pjax=e,t.pjax=r,t.pjax.enable=t.noop,t.pjax.disable=A,t.pjax.click=n,t.pjax.submit=a,t.pjax.reload=i,t.pjax.defaults={timeout:650,push:!0,replace:!1,type:"GET",dataType:"html",scrollTo:0,maxCacheLength:20,version:P},t(window).on("popstate.pjax",l)}function A(){t.fn.pjax=function(){return this},t.pjax=p,t.pjax.enable=C,t.pjax.disable=t.noop,t.pjax.click=t.noop,t.pjax.submit=t.noop,t.pjax.reload=function(){window.location.reload()},t(window).off("popstate.pjax",l)}t.event.props&&t.inArray("state",t.event.props)<0?t.event.props.push("state"):"state"in t.Event.prototype||t.event.addProp("state"),t.support.pjax=window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/),t.support.pjax?C():A()}(jQuery);

View File

@@ -39,7 +39,7 @@ $(function () {
"-webkit-filter": "grayscale(100%)", "-webkit-filter": "grayscale(100%)",
"filter": "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)" "filter": "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"
}) })
$('body').html(function(_, oldHTML) { $('body').html(function (_, oldHTML) {
return oldHTML.replace(/Mayx/g, 'Ghost'); return oldHTML.replace(/Mayx/g, 'Ghost');
}); });
console.warn("Mayx may already be Dead"); console.warn("Mayx may already be Dead");
@@ -66,4 +66,10 @@ function getSearchJSON(callback) {
} else { } else {
callback(searchData); callback(searchData);
} }
}
if (typeof window.go === 'undefined') {
window.go = function (url) {
window.location.href = url;
return;
}
} }

354
assets/js/pjax.js Normal file
View File

@@ -0,0 +1,354 @@
/**
* PJAX 初始化与页面切换重绑定脚本
* 依赖jQuery, jquery.pjax.min.js
* 加载顺序:在 jquery.pjax.min.js 之后body 末尾
*/
(function ($) {
// ========== 常量 ==========
var CONTAINER = '#pjax-container';
var PJAX_OPTS = {
container: CONTAINER,
fragment: CONTAINER,
timeout: 8000,
scrollTo: false
};
// ========== 工具函数 ==========
var _loadedScripts = {};
var _pendingScripts = [];
/** 动态加载外部 CSS避免重复加载 */
function loadCSS(href) {
if ($('link[href="' + href + '"]').length) return;
$('<link rel="stylesheet" href="' + href + '" />').appendTo('head');
}
/**
* 动态加载外部 JS避免重复
* 用对象跟踪已加载的 URL而不是检查 DOM 中的 <script> 标签
* pjax 替换容器内容后,惰性 <script> 标签存在但不代表已执行)
*/
function loadScript(src, callback) {
if (_loadedScripts[src]) {
if (typeof callback === 'function') callback();
return;
}
_loadedScripts[src] = true;
var s = document.createElement('script');
s.src = src;
s.onload = callback || null;
document.body.appendChild(s);
}
/**
* 按顺序执行脚本数组(内联和外部混合)
* 外部脚本加载完成后再执行后续内联脚本,保持依赖顺序
*/
function executeScripts(scripts) {
var idx = 0;
function runNext() {
while (idx < scripts.length) {
var s = scripts[idx];
idx++;
if (s.src) {
loadScript(s.src, runNext);
return; // 等待 onload 回调
}
try {
(window.execScript || function (code) {
window['eval'].call(window, code);
})(s.text);
} catch (e) {
console.warn('[pjax] inline script exec error:', e);
}
}
}
runNext();
}
// ========== 页面类型判断 ==========
/** 是否为文章页(非首页/分页) */
function isPostPage(pathname) {
return !/^(\/(index\.html)?|\/page\d+(\/index\.html)?)$/.test(pathname || window.location.pathname);
}
/** 是否为真正的文章页(用 DOM 特征判断,仅 post 布局才有这些元素) */
function isRealPostPage() {
return $(CONTAINER + ' #gitalk-container').length > 0;
}
// ========== 欢迎语生成 ==========
/**
* 根据当前时间和页面生成 Live2D 欢迎语
* 此函数暴露到 window._live2d.getWelcomeText供 message.js 首次加载时复用
* @param {string} [pathname] - 页面路径,默认当前路径
* @param {string} [title] - 页面标题,默认从 document.title 提取
* @returns {string} 欢迎语 HTML
*/
function getWelcomeText(pathname, title) {
pathname = pathname || window.location.pathname;
title = title || document.title.split(' | ')[0];
if (pathname === '/' || pathname === '/index.html') {
var now = (new Date()).getHours();
if (now > 23 || now <= 5) return '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?';
if (now > 5 && now <= 7) return '早上好!一日之计在于晨,美好的一天就要开始了!';
if (now > 7 && now <= 11) return '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!';
if (now > 11 && now <= 14) return '中午了,工作了一个上午,现在是午餐时间!';
if (now > 14 && now <= 17) return '午后很容易犯困呢,今天的运动目标完成了吗?';
if (now > 17 && now <= 19) return '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~~';
if (now > 19 && now <= 21) return '晚上好,今天过得怎么样?';
if (now > 21 && now <= 23) return '已经这么晚了呀,早点休息吧,晚安~~';
return '嗨~ 快来逗我玩吧!';
}
return '欢迎阅读<span style="color:#0099cc;">「 ' + title + ' 」</span>';
}
// ========== 各组件重初始化 ==========
/** 访问量统计 */
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 触发) */
function reinitAISummary() {
if (typeof ai_gen === 'function' && $('#ai-output').length) {
try { ai_gen(); } catch (e) { /* ignore */ }
}
}
/** 代码块复制按钮 */
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); });
});
});
}
/** Gitalk 评论post 页面专属) */
function reinitGitalk() {
if ($(CONTAINER + ' #gitalk-container').length === 0) return;
loadCSS('/assets/css/gitalk.css');
function doInitGitalk() {
if (typeof Gitalk === 'undefined') {
loadScript('/assets/js/gitalk.min.js', doInitGitalk);
return;
}
var pageId = $(CONTAINER + ' #gitalk-container').data('page-id') || window.location.pathname;
try {
new Gitalk(Object.assign({ id: pageId }, window.GitalkConfig))
.render('gitalk-container');
} catch (e) {
console.warn('[pjax] Gitalk init error:', e);
}
}
$('#gitalk-container').empty();
doInitGitalk();
}
/** 关键词高亮 */
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 页面浏览事件 */
function trackPageView() {
if (typeof gtag === 'function') {
gtag('config', window._gaId || '', { page_path: window.location.pathname });
}
}
/** Live2D 重初始化 */
var _live2dSelectors = ['.post-link', '#search-input'];
var _live2dDelegateBound = false;
function reinitLive2d() {
if (!window._live2d) return;
var pathname = window.location.pathname;
// 更新"想问这篇文章"相关状态(仅真正的文章页显示)
$('#post_id').val(pathname);
if (isRealPostPage()) {
$('.live_talk_input_name_body').show();
} else {
$('.live_talk_input_name_body').hide();
$('#load_this').prop('checked', false);
}
// 音乐按钮:根据当前页面是否有 BGM 输入来显示/隐藏
if (typeof window._live2d.initBGM === 'function') {
window._live2d.initBGM();
}
// 事件委托绑定(只执行一次)
if (!_live2dDelegateBound && typeof String.prototype.renderTip === 'function') {
var selector = CONTAINER + ' ' + _live2dSelectors.join(', ' + CONTAINER + ' ');
$(document).on('mouseover._live2d_pjax', selector, function (e) {
var $el = $(e.currentTarget || e.target);
if ($el.is('.post-link')) {
window._live2d.showMessage('要看看 ' + $el.text() + ' 么?', 3000);
} else if ($el.is('#search-input')) {
window._live2d.showMessage('在找什么东西呢,需要帮忙吗?', 3000);
}
});
$(document).on('mouseout._live2d_pjax', selector, function () {
if (window._live2d.showHitokoto) window._live2d.showHitokoto();
});
_live2dDelegateBound = true;
}
// 欢迎语
if (typeof window._live2d.showMessage === 'function') {
window._live2d.showMessage(getWelcomeText(pathname), 6000);
}
}
// ========== PJAX 导航 ==========
/** PJAX 完成后的统一处理 */
function doPjaxComplete() {
$('body').removeClass('pjax-loading');
// go() 路径:脚本在 DOM 替换前提取到了 _pendingScripts需在此执行
// pjax 库路径_pendingScripts 为空pjax 库自行处理了脚本执行
if (_pendingScripts.length > 0) {
executeScripts(_pendingScripts);
_pendingScripts = [];
}
onPjaxComplete();
}
/** 暴露给模板内 onclick/onchange 调用的导航函数 */
window.go = function (url) {
if (!url || url === '#') return;
if (/^(https?:)?\/\//.test(url) || url.startsWith('mailto:')) {
window.location.href = url;
return;
}
$('body').addClass('pjax-loading');
$.ajax({
url: url,
beforeSend: function (xhr) {
xhr.setRequestHeader('X-PJAX', 'true');
xhr.setRequestHeader('X-PJAX-Container', CONTAINER);
},
success: function (html) {
try {
var doc = (new DOMParser()).parseFromString(html, 'text/html');
var fragment = doc.querySelector(CONTAINER);
if (fragment) {
// 先提取脚本jQuery html() 会移除并可能异步处理脚本)
_pendingScripts = [];
fragment.querySelectorAll('script').forEach(function (s) {
_pendingScripts.push({
src: s.src || null,
text: s.textContent
});
s.remove();
});
$(CONTAINER).html(fragment.innerHTML);
document.title = doc.title;
history.pushState({ url: url }, document.title, url);
doPjaxComplete();
} else {
window.location.href = url;
}
} catch (e) {
console.warn('[go] parse error, fallback:', e);
window.location.href = url;
}
},
error: function () { window.location.href = url; },
timeout: PJAX_OPTS.timeout
});
};
/** 暴露 getWelcomeText 供 message.js 首次加载时复用,避免欢迎语逻辑重复 */
window._pjaxGetWelcomeText = getWelcomeText;
// ========== 初始化 ==========
/** 每次 pjax 完成后执行所有重初始化 */
function onPjaxComplete() {
reinitVisitors();
reinitCopyButtons();
reinitHighlight();
reinitGitalk();
reinitAISummary();
reinitLive2d();
trackPageView();
window.scrollTo(0, 0);
}
$(document).ready(function () {
// 排除列表外链、锚点、静态资源、Live2D 目录
var exclude = ':not([target="_blank"]):not([href^="http"]):not([href^="//"])' +
':not([href^="mailto"]):not([href^="#"])' +
':not([href$=".xml"]):not([href$=".json"]):not([href$=".tgz"]):not([href$=".zip"])' +
':not([href^="/Live2dHistoire"])';
$(document).pjax('a' + exclude, PJAX_OPTS.container, PJAX_OPTS);
$(document).on('pjax:send', function () {
$('body').addClass('pjax-loading');
});
$(document).on('pjax:complete', doPjaxComplete);
$(document).on('pjax:error', function (xhr, textStatus, error) {
console.warn('[pjax] error, fallback:', error);
});
// 首次加载初始化
reinitCopyButtons();
});
})(jQuery);

View File

@@ -5,14 +5,14 @@ image: https://screenshot.mayx.eu.org/
--- ---
{% if paginator.page == 1 %}<div class="hslice" id="LatestPost">{% endif %} {% if paginator.page == 1 %}<div class="hslice" id="LatestPost">{% endif %}
<h1 class="entry-title" style="display:inline"> 首页 - 我的文章 </h1><small><a href="/archives.html">Archives</a> | <a href="javascript:getSearchJSON(function(data){location=data[Math.floor(Math.random()*data.length)].url})">Random</a></small><br /><br /> <h1 class="entry-title" style="display:inline"> 首页 - 我的文章 </h1><small><a href="/archives.html">Archives</a> | <a href="javascript:void(0)" onclick="getSearchJSON(function(data){go(data[Math.floor(Math.random()*data.length)].url)})">Random</a></small><br /><br />
<hr /> <hr />
<!-- 遍历分页后的文章 --> <!-- 遍历分页后的文章 -->
<table class="entry-content h-feed"> <table class="entry-content h-feed">
{% for post in paginator.posts %} {% for post in paginator.posts %}
<tr><td class="h-entry" onclick="location='{{ post.url }}'"> <tr><td class="h-entry" onclick="go('{{ post.url }}')">
<h2 class="p-name"><a class="post-link u-url" href="{{ post.url }}">{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}</a></h2> <h2 class="p-name"><a class="post-link u-url" href="{{ post.url }}">{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}</a></h2>
<p> <p>
<time class="date dt-published" datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%-d %B %Y" }}</time> <time class="date dt-published" datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%-d %B %Y" }}</time>
@@ -44,7 +44,7 @@ image: https://screenshot.mayx.eu.org/
<span>&laquo; Prev</span> <span>&laquo; Prev</span>
{% endif %} {% endif %}
<select onchange="window.location = this.value == 1 ? '/index.html' : '/page' + this.value + '/index.html'"> <select onchange="go(this.value == 1 ? '/index.html' : '/page' + this.value + '/index.html')">
{% for page in (1..paginator.total_pages) %} {% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %} {% if page == paginator.page %}
<option value="{{ page }}" selected>{{ page }}</option> <option value="{{ page }}" selected>{{ page }}</option>

View File

@@ -27,7 +27,7 @@ if (mykeyword) {
</script> </script>
<script src="/assets/js/simple-jekyll-search.min.js"></script> <script src="/assets/js/simple-jekyll-search.min.js"></script>
<script> <script>
getSearchJSON(function(json){ function _doSearch(json) {
var sjs = SimpleJekyllSearch({ var sjs = SimpleJekyllSearch({
searchInput: sbox, searchInput: sbox,
resultsContainer: document.getElementById('results-container'), resultsContainer: document.getElementById('results-container'),
@@ -37,5 +37,22 @@ getSearchJSON(function(json){
}); });
sjs.search(mykeyword); sjs.search(mykeyword);
document.getElementById('search-loading').style.display = "none"; document.getElementById('search-loading').style.display = "none";
}
getSearchJSON(function(json) {
if (typeof SimpleJekyllSearch !== 'undefined') {
_doSearch(json);
} else {
// PJAX 场景:外部脚本通过 pjax 库异步加载,需要等待加载完成
var _poll = 0;
var _waitSJS = setInterval(function() {
if (typeof SimpleJekyllSearch !== 'undefined') {
clearInterval(_waitSJS);
_doSearch(json);
} else if (++_poll > 100) {
clearInterval(_waitSJS);
document.getElementById('search-loading').style.display = "none";
}
}, 50);
}
}); });
</script> </script>