7 Commits

Author SHA1 Message Date
  mayx 481df19596 Update 5 files 2 months ago
  mayx 1a529143a8 Update 6 files 2 months ago
  mayx b25a864ee3 Update 3 files 2 months ago
  mayx c5ad917d9e Update 6 files 2 months ago
  mayx d6274791a8 Update 2 files 2 months ago
  mayx 111dc1e25f Update 2 files 2 months ago
  mayx c4ae25dcb1 Update 10 files 2 months ago
16 changed files with 407 additions and 193 deletions
Unified View
  1. +106
    -93
      Live2dHistoire/live2d/js/message.js
  2. +4
    -25
      _data/other_repo_list.csv
  3. +4
    -0
      _data/proxylist.yml
  4. +16
    -3
      _layouts/default.html
  5. +2
    -13
      _layouts/post.html
  6. +1
    -0
      _tools/stormkit-env_install
  7. +0
    -2
      assets/css/gitalk.css
  8. +13
    -1
      assets/css/style.scss
  9. +1
    -2
      assets/js/gitalk.min.js
  10. +0
    -1
      assets/js/jquery.min.js
  11. +6
    -0
      assets/js/jquery.pjax.min.js
  12. +44
    -21
      assets/js/main.js
  13. +14
    -28
      assets/js/main_new.js
  14. +175
    -0
      assets/js/pjax.js
  15. +3
    -3
      index.html
  16. +18
    -1
      search.html

+ 106
- 93
Live2dHistoire/live2d/js/message.js 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];
currentObject = currentObject[variable];
if (currentObject === undefined || currentObject === null) return '';
variable = currentObject[variables[i]];
if (variable === undefined || variable === 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,46 +115,22 @@ 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') {
text = '嗨! 来自 百度搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} else if (domain == 'so') {
text = '嗨! 来自 360搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} else if (domain == 'google') {
text = '嗨! 来自 谷歌搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
}
} else {
if (window.location.pathname == "/") { //主页URL判断,需要斜杠结尾
var now = (new Date()).getHours();
if (now > 23 || now <= 5) {
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?';
} else if (now > 5 && now <= 7) {
text = '早上好!一日之计在于晨,美好的一天就要开始了!';
} else if (now > 7 && now <= 11) {
text = '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!';
} else if (now > 11 && now <= 14) {
text = '中午了,工作了一个上午,现在是午餐时间!';
} else if (now > 14 && now <= 17) {
text = '午后很容易犯困呢,今天的运动目标完成了吗?';
} else if (now > 17 && now <= 19) {
text = '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~~';
} else if (now > 19 && now <= 21) {
text = '晚上好,今天过得怎么样?';
} else if (now > 21 && now <= 23) {
text = '已经这么晚了呀,早点休息吧,晚安~~';
} else {
text = '嗨~ 快来逗我玩吧!';
}
if (domain == 'baidu' || domain == 'so' || domain == 'google') {
var source = domain == 'baidu' ? '百度搜索' : domain == 'so' ? '360搜索' : '谷歌搜索';
text = '嗨! 来自 ' + source + ' 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} else { } else {
text = '欢迎阅读<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + '</span>';
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
} }
} else {
text = getWelcomeText();
} }
showMessage(text, 12000); showMessage(text, 12000);
})(); })();
@ -172,6 +157,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 +199,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 +371,100 @@ if (!norunFlag) {
}; };
}; };
//获取音乐信息初始化 //获取音乐信息初始化
var bgmListInfo = $('input[name=live2dBGM]');
if (bgmListInfo.length == 0) {
$('#musicButton').hide();
} else {
var bgmPlayNow = parseInt($('#live2d_bgm').attr('data-bgm'));
var bgmPlayTime = 0;
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num");
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime");
if (live2dBGM_Num) {
if (live2dBGM_Num <= $('input[name=live2dBGM]').length - 1) {
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();
var $bgm = $('#live2d_bgm');
// 音乐按钮点击事件(幂等,使用命名空间避免重复绑定)
$('#musicButton').off('click._bgm').on('click._bgm', function () {
if ($('#musicButton').hasClass('play')) {
$bgm[0].pause();
$('#musicButton').removeClass('play');
sessionStorage.setItem("live2dBGM_IsPlay", '1');
} else {
$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')) {
$('#live2d_bgm')[0].pause();
$('#musicButton').removeClass('play');
sessionStorage.setItem("live2dBGM_IsPlay", '1');
} else {
$('#live2d_bgm')[0].play();
$('#musicButton').addClass('play');
sessionStorage.setItem("live2dBGM_IsPlay", '0');
}
});
window.onbeforeunload = function () {
sessionStorage.setItem("live2dBGM_WindowClose", '0');
if ($('#musicButton').hasClass('play')) {
sessionStorage.setItem("live2dBGM_IsPlay", '0');
}
}
document.getElementById('live2d_bgm').addEventListener("timeupdate", function () {
var live2dBgmPlayTimeNow = document.getElementById('live2d_bgm').currentTime;
sessionStorage.setItem("live2dBGM_PlayTime", live2dBgmPlayTimeNow);
});
// BGM 事件监听(仅绑定一次,使用标志位避免重复)
if (!window._live2d._bgmEventsBound) {
$bgm[0].addEventListener("timeupdate", function () {
sessionStorage.setItem("live2dBGM_PlayTime", $bgm[0].currentTime);
}); });
document.getElementById('live2d_bgm').addEventListener("ended", function () {
var listNow = parseInt($('#live2d_bgm').attr('data-bgm'));
$bgm[0].addEventListener("ended", function () {
var listNow = parseInt($bgm.attr('data-bgm'));
listNow++; listNow++;
if (listNow > $('input[name=live2dBGM]').length - 1) {
var inputs = $('input[name=live2dBGM]');
if (inputs.length === 0) return;
if (listNow > inputs.length - 1) {
listNow = 0; listNow = 0;
} }
var listNewSrc = $('input[name=live2dBGM]').eq(listNow).val();
var listNewSrc = inputs.eq(listNow).val();
if (!listNewSrc) return;
sessionStorage.setItem("live2dBGM_Num", listNow); sessionStorage.setItem("live2dBGM_Num", listNow);
$('#live2d_bgm').attr('src', listNewSrc);
$('#live2d_bgm')[0].play();
$('#live2d_bgm').attr('data-bgm', listNow);
$bgm.attr('src', listNewSrc);
$bgm[0].play();
$bgm.attr('data-bgm', listNow);
}); });
document.getElementById('live2d_bgm').addEventListener("error", function () {
$('#live2d_bgm')[0].pause();
$bgm[0].addEventListener("error", function () {
$bgm[0].pause();
$('#musicButton').removeClass('play'); $('#musicButton').removeClass('play');
showMessage('音乐似乎加载不出来了呢!', 0); showMessage('音乐似乎加载不出来了呢!', 0);
}); });
window.onbeforeunload = function () {
sessionStorage.setItem("live2dBGM_WindowClose", '0');
if ($('#musicButton').hasClass('play')) {
sessionStorage.setItem("live2dBGM_IsPlay", '0');
}
};
window._live2d._bgmEventsBound = true;
}
// 初始化 BGM(根据当前页面是否有 BGM 输入)
if (typeof window._live2d.initBGM === 'function') {
window._live2d.initBGM();
} }
} }
// 暴露 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",


+ 4
- 25
_data/other_repo_list.csv View File

@ -46,7 +46,6 @@ http://47.107.88.161:3000/mayx/blog
http://142.171.47.170:3000/mayx/blog http://142.171.47.170:3000/mayx/blog
http://111.231.146.230:8418/mayx/blog http://111.231.146.230:8418/mayx/blog
https://git.pwaapp.cc/mayx/blog https://git.pwaapp.cc/mayx/blog
https://git.sleepingforest.co.uk/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 https://git.wisder.net/mayx/blog
@ -57,7 +56,6 @@ 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
https://git.hubhoo.com/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://git.sayndone.ru/mayx/blog
https://gitea.hintsight.com/mayx/blog https://gitea.hintsight.com/mayx/blog
@ -83,7 +81,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 +195,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
@ -287,7 +283,6 @@ http://54.199.96.217:3000/mayx/blog
http://20.219.0.85:3000/mayx/blog http://20.219.0.85:3000/mayx/blog
https://dev01.open-alt.com/mayx/blog https://dev01.open-alt.com/mayx/blog
https://gitea.doinlab.com/mayx/blog https://gitea.doinlab.com/mayx/blog
https://gitea.creative-tg1.ru/mayx/blog
https://git.7af.ru/mayx/blog https://git.7af.ru/mayx/blog
https://gitea.yimoyuyan.cn/mayx/blog https://gitea.yimoyuyan.cn/mayx/blog
https://git.apextoaster.com/mayx/blog https://git.apextoaster.com/mayx/blog
@ -344,10 +339,8 @@ 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://58.213.60.6:19000/mayx/blog_cn http://58.213.60.6:19000/mayx/blog_cn
http://36.153.162.171:3000/mayx/blog_cn http://36.153.162.171:3000/mayx/blog_cn
http://47.92.113.131:3000/mayx/blog http://47.92.113.131:3000/mayx/blog
@ -357,7 +350,6 @@ https://git.gnyra.com/mayx/blog
https://git.graveyard.sh/mayx/blog https://git.graveyard.sh/mayx/blog
https://git.nathanspackman.com/mayx/blog https://git.nathanspackman.com/mayx/blog
https://git.rmarl.in/mayx/blog https://git.rmarl.in/mayx/blog
https://git.alderautomation.ca/mayx/blog
http://git.qniao.cn/mayx/blog http://git.qniao.cn/mayx/blog
https://git.fast-blast.uk/mayx/blog https://git.fast-blast.uk/mayx/blog
http://git.mynas71.myds.me/mayx/blog http://git.mynas71.myds.me/mayx/blog
@ -371,10 +363,8 @@ 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://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
@ -396,7 +386,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 +395,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 +427,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
@ -461,7 +448,6 @@ http://35.175.189.8/mayx/blog
http://meowug.com:8418/mayx/blog_cn http://meowug.com:8418/mayx/blog_cn
http://36.138.125.206:3000/mayx/blog_cn http://36.138.125.206:3000/mayx/blog_cn
https://git.4lcap.com/mayx/blog_cn https://git.4lcap.com/mayx/blog_cn
https://gitea.visoftware.com.co/mayx/blog_cn
http://101.43.238.71:3000/mayx/blog_cn http://101.43.238.71:3000/mayx/blog_cn
http://59.110.175.62:4322/mayx/blog_cn http://59.110.175.62:4322/mayx/blog_cn
https://www.luluvip.cn:8419/mayx/blog_cn https://www.luluvip.cn:8419/mayx/blog_cn
@ -497,7 +483,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
@ -506,10 +491,8 @@ 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 https://git.powerdata.dk/mayx/blog
http://ydds.cloud:3000/mayx/blog_cn http://ydds.cloud:3000/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
@ -517,7 +500,6 @@ http://www.arkproject.top/mayx/blog
http://www.bkandssp.cn:30/mayx/blog http://www.bkandssp.cn:30/mayx/blog
https://gitea.spitaki.cloud/mayx/blog https://gitea.spitaki.cloud/mayx/blog
https://git.codle.ru/mayx/blog https://git.codle.ru/mayx/blog
http://139.224.24.61:3000/mayx/blog
https://git.sao.ru/mayx/blog https://git.sao.ru/mayx/blog
https://codeop.ru/mayx/blog https://codeop.ru/mayx/blog
https://git.mirocom.org/mayx/blog https://git.mirocom.org/mayx/blog
@ -528,19 +510,15 @@ 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
https://git.sortug.com/mayx/blog https://git.sortug.com/mayx/blog
https://aivyx-gitea.cloud/mayx/blog https://aivyx-gitea.cloud/mayx/blog
https://git.akarmain.ru/mayx/blog
https://git.edenit.co.kr/mayx/blog https://git.edenit.co.kr/mayx/blog
https://git.catgirlsneed.homes/mayx/blog https://git.catgirlsneed.homes/mayx/blog
https://git.eldev.netcraze.pro/mayx/blog https://git.eldev.netcraze.pro/mayx/blog
@ -549,15 +527,16 @@ 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
https://git.xleed.com/mayx/blog

+ 4
- 0
_data/proxylist.yml View File

@ -1,6 +1,8 @@
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://mayx.azion.app/
- https://yuki.gear.host/ - https://yuki.gear.host/
- https://mayx.global.ssl.fastly.net/ - https://mayx.global.ssl.fastly.net/
mirrors: mirrors:
@ -17,10 +19,12 @@ 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/
- 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/


+ 16
- 3
_layouts/default.html View File

@ -17,6 +17,8 @@ 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" />
<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 }}" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" /> <link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
@ -35,6 +37,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]> -->
@ -65,8 +76,8 @@ layout: xslt_container
<p class="p-note">{{ site.description | default: site.github.project_tagline }}</p> <p class="p-note">{{ site.description | default: site.github.project_tagline }}</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
<form id="search-input-all" action="/search.html">
<input type="text" name="keyword" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form> </form>
<br /> <br />
@ -91,7 +102,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 }}
@ -108,6 +119,8 @@ layout: xslt_container
<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>
<script src="/assets/js/jquery.pjax.min.js"></script>
<script src="/assets/js/pjax.js"></script>
<!-- <![endif]--> <!-- <![endif]-->
</body> </body>
</html> </html>

+ 2
- 13
_layouts/post.html View File

@ -158,22 +158,11 @@ $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), fu
</div> </div>
<!--[if !IE]> --> <!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<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({
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"
})
var gitalk = new Gitalk(Object.assign({ id: '{{ page.id }}' }, GitalkConfig))
gitalk.render('gitalk-container') gitalk.render('gitalk-container')
</script> </script>
<!-- <![endif]--> <!-- <![endif]-->

+ 1
- 0
_tools/stormkit-env_install View File

@ -0,0 +1 @@
curl -LO https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.4.5/portable-ruby-3.4.5.x86_64_linux.bottle.tar.gz && mkdir -p ~/.local/portable-ruby && tar -xvf portable-ruby-3.4.5.x86_64_linux.bottle.tar.gz -C ~/.local/portable-ruby --strip-components=1 && export PATH="$HOME/.local/portable-ruby/3.4.5/bin:$PATH" && bundle install

+ 0
- 2
assets/css/gitalk.css View File

@ -1274,5 +1274,3 @@
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
/*# sourceMappingURL=gitalk.css.map*/

+ 13
- 1
assets/css/style.scss View File

@ -190,4 +190,16 @@ td.h-entry {
td.h-entry:hover { td.h-entry:hover {
background: #f9f9f9; background: #f9f9f9;
}
}
body.pjax-loading::after {
content: '';
position: fixed;
top: 16px;
right: 16px;
width: 20px;
height: 20px;
background: url('/images/loading.svg') center / contain no-repeat;
z-index: 9999;
pointer-events: none;
}

+ 1
- 2
assets/js/gitalk.min.js
File diff suppressed because it is too large
View File


+ 0
- 1
assets/js/jquery.min.js
File diff suppressed because it is too large
View File


+ 6
- 0
assets/js/jquery.pjax.min.js
File diff suppressed because it is too large
View File


+ 44
- 21
assets/js/main.js View File

@ -1,6 +1,22 @@
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"))
@ -14,32 +30,14 @@ $(function () {
$(function () { $backToTopFun(); }); $(function () { $backToTopFun(); });
})(); })();
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();
}
initVisitors();
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({
"-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 +64,29 @@ function getSearchJSON(callback) {
} else { } else {
callback(searchData); callback(searchData);
} }
}
}
if (typeof window.go === 'undefined') {
window.go = function (url) {
window.location.href = url;
return;
}
}
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>';
}

+ 14
- 28
assets/js/main_new.js View File

@ -43,35 +43,21 @@ $(function () {
}); });
}); });
$(function() {
var $codeBlocks = $('div.highlight');
$codeBlocks.each(function() {
var $copyButton = $('<button>', {
class: 'copy',
type: 'button',
text: '📋'
});
$(this).append($copyButton);
$copyButton.on('click', function() {
var code = $(this).siblings('pre').find('code').text().trim();
var $button = $(this);
function initCopyButtons() {
$('.copy').remove();
$('div.highlight').each(function () {
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' });
$(this).append($btn);
$btn.on('click', function () {
var code = $btn.siblings('pre').find('code').text().trim();
navigator.clipboard.writeText(code) navigator.clipboard.writeText(code)
.then(function() {
$button.text('✅');
})
.catch(function(err) {
$button.text('❌');
console.error('复制失败:', err);
})
.finally(function() {
setTimeout(function() {
$button.text('📋');
}, 1500);
});
.then(function () { $btn.text('✅'); })
.catch(function () { $btn.text('❌'); })
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
}); });
}); });
}
$(function() {
initCopyButtons();
}); });

+ 175
- 0
assets/js/pjax.js View File

@ -0,0 +1,175 @@
/**
* 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
};
// ========== 各组件重初始化 ==========
/** AI 摘要(post.html 内联脚本,pjax 后由 executeScripts 触发) */
function reinitAISummary() {
if (typeof ai_gen === 'function' && $('#ai-output').length) {
try { ai_gen(); } catch (e) { /* ignore */ }
}
}
/** 关键词高亮 */
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 ($(CONTAINER + ' #gitalk-container').length > 0) {
$('.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');
// 清理可能残留的浮层(如推荐文章 tooltip,hover 后点击跳转时 mouseleave 来不及触发)
$('.content-tooltip').remove();
onPjaxComplete();
}
/** 暴露给模板内 onclick/onchange 调用的导航函数 */
window.go = function (url) {
$.pjax({ url: url, ...PJAX_OPTS });
};
// ========== 初始化 ==========
/** 每次 pjax 完成后执行所有重初始化 */
function onPjaxComplete() {
initVisitors();
initCopyButtons();
reinitHighlight();
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('submit', 'form#search-input-all', function (e) {
$.pjax.submit(e, 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);
});
$(document).on('pjax:end', function (event, xhr, options) {
var $container = $(options.container || PJAX_OPTS.container);
$container.find('script[type="module"]').each(function () {
var oldScript = this;
var newScript = document.createElement('script');
newScript.type = 'module';
// 如果是外链脚本 (<script src="..."></script>)
if (oldScript.src) {
newScript.src = oldScript.src;
} else {
// 如果是行内脚本 (<script>...code...</script>)
newScript.textContent = oldScript.textContent;
}
// 插入到 body 中触发浏览器执行
document.body.appendChild(newScript);
// 运行完后建议移除,防止 DOM 变得混乱(不影响模块执行)
newScript.remove();
});
});
});
})(jQuery);

+ 3
- 3
index.html 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="if (!event.target.closest('a.p-category')) 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>


+ 18
- 1
search.html 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>

Loading…
Cancel
Save