mirror of
https://www.gitlink.org.cn/mayx/mayx.gitlink.net
synced 2026-05-27 20:12:43 +00:00
Compare commits
5 Commits
d6274791a8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
156f964333 | ||
|
|
481df19596 | ||
|
|
1a529143a8 | ||
|
|
b25a864ee3 | ||
|
|
c5ad917d9e |
@@ -129,35 +129,8 @@ if (!norunFlag) {
|
|||||||
} else {
|
} else {
|
||||||
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
|
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
|
||||||
}
|
}
|
||||||
} else if (typeof window._pjaxGetWelcomeText === 'function') {
|
|
||||||
// 复用 pjax.js 中的欢迎语生成函数,避免重复逻辑
|
|
||||||
text = window._pjaxGetWelcomeText();
|
|
||||||
} else {
|
} else {
|
||||||
// pjax.js 尚未加载时的兜底(首次访问且 pjax.js 在 message.js 之后加载)
|
text = getWelcomeText();
|
||||||
if (window.location.pathname == "/") {
|
|
||||||
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 = '嗨~ 快来逗我玩吧!';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
text = '欢迎阅读<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
showMessage(text, 12000);
|
showMessage(text, 12000);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -46,20 +46,15 @@ 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
|
|
||||||
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
|
||||||
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://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
|
||||||
@@ -168,7 +163,6 @@ 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
|
||||||
@@ -270,7 +264,6 @@ 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
|
||||||
@@ -285,7 +278,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,7 +336,6 @@ 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
|
||||||
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
|
||||||
@@ -354,7 +345,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
|
||||||
@@ -364,24 +354,20 @@ 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
|
||||||
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
|
||||||
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
|
||||||
@@ -398,7 +384,6 @@ 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
|
||||||
@@ -445,7 +430,6 @@ 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
|
||||||
@@ -454,7 +438,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
|
||||||
@@ -488,7 +471,6 @@ 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
|
||||||
@@ -496,9 +478,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
|
||||||
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.dinsor.co.th/mayx/blog
|
https://git.dinsor.co.th/mayx/blog
|
||||||
@@ -508,7 +488,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,7 +507,6 @@ 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
|
||||||
@@ -538,7 +516,6 @@ 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
|
||||||
@@ -549,3 +526,5 @@ http://109.199.98.226:3001/mayx/blog
|
|||||||
https://git.extra.eiffel.com/mayx/blog
|
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://qlcodegitserver.online/mayx/blog
|
||||||
|
|||||||
|
@@ -2,6 +2,7 @@ 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.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:
|
||||||
@@ -23,6 +24,7 @@ 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/
|
||||||
|
|||||||
@@ -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" />
|
||||||
@@ -74,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">
|
<form id="search-input-all" action="/search.html">
|
||||||
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
<input type="text" name="keyword" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -114,11 +116,11 @@ 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>
|
||||||
|
<script src="/assets/js/jquery.pjax.min.js"></script>
|
||||||
|
<script src="/assets/js/pjax.js"></script>
|
||||||
<!-- <![endif]-->
|
<!-- <![endif]-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -158,8 +158,6 @@ $.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" data-page-id="{{ page.id }}"></div>
|
<div id="gitalk-container" data-page-id="{{ page.id }}"></div>
|
||||||
|
|
||||||
|
|||||||
1
_tools/stormkit-env_install
Normal file
1
_tools/stormkit-env_install
Normal 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
|
||||||
@@ -1274,5 +1274,3 @@
|
|||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=gitalk.css.map*/
|
|
||||||
@@ -191,3 +191,15 @@ 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
assets/js/gitalk.min.js
vendored
1
assets/js/gitalk.min.js
vendored
File diff suppressed because one or more lines are too long
1
assets/js/jquery.min.js
vendored
1
assets/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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,25 +30,7 @@ $(function () {
|
|||||||
$(function () { $backToTopFun(); });
|
$(function () { $backToTopFun(); });
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function showHitCount() {
|
initVisitors();
|
||||||
$(".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({
|
||||||
@@ -73,3 +71,22 @@ if (typeof window.go === 'undefined') {
|
|||||||
return;
|
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>';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
$(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();
|
||||||
|
|
||||||
@@ -41,37 +45,24 @@ $(function () {
|
|||||||
$('section').each(function () {
|
$('section').each(function () {
|
||||||
highlightTextNodes(this);
|
highlightTextNodes(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)
|
||||||
|
.then(function () { $btn.text('✅'); })
|
||||||
|
.catch(function () { $btn.text('❌'); })
|
||||||
|
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var $codeBlocks = $('div.highlight');
|
highlightKeyword();
|
||||||
|
initCopyButtons();
|
||||||
$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);
|
|
||||||
|
|
||||||
navigator.clipboard.writeText(code)
|
|
||||||
.then(function() {
|
|
||||||
$button.text('✅');
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
$button.text('❌');
|
|
||||||
console.error('复制失败:', err);
|
|
||||||
})
|
|
||||||
.finally(function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
$button.text('📋');
|
|
||||||
}, 1500);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@@ -14,121 +14,8 @@
|
|||||||
scrollTo: false
|
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 触发) */
|
/** 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) {
|
||||||
@@ -136,73 +23,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 代码块复制按钮 */
|
|
||||||
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 { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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') {
|
||||||
@@ -220,7 +40,7 @@
|
|||||||
|
|
||||||
// 更新"想问这篇文章"相关状态(仅真正的文章页显示)
|
// 更新"想问这篇文章"相关状态(仅真正的文章页显示)
|
||||||
$('#post_id').val(pathname);
|
$('#post_id').val(pathname);
|
||||||
if (isRealPostPage()) {
|
if ($(CONTAINER + ' #gitalk-container').length > 0) {
|
||||||
$('.live_talk_input_name_body').show();
|
$('.live_talk_input_name_body').show();
|
||||||
} else {
|
} else {
|
||||||
$('.live_talk_input_name_body').hide();
|
$('.live_talk_input_name_body').hide();
|
||||||
@@ -261,71 +81,43 @@
|
|||||||
function doPjaxComplete() {
|
function doPjaxComplete() {
|
||||||
$('body').removeClass('pjax-loading');
|
$('body').removeClass('pjax-loading');
|
||||||
// 清理可能残留的浮层(如推荐文章 tooltip,hover 后点击跳转时 mouseleave 来不及触发)
|
// 清理可能残留的浮层(如推荐文章 tooltip,hover 后点击跳转时 mouseleave 来不及触发)
|
||||||
$('.content-tooltip').hide();
|
$('.content-tooltip').remove();
|
||||||
// go() 路径:脚本在 DOM 替换前提取到了 _pendingScripts,需在此执行
|
|
||||||
// pjax 库路径:_pendingScripts 为空,pjax 库自行处理了脚本执行
|
|
||||||
if (_pendingScripts.length > 0) {
|
|
||||||
executeScripts(_pendingScripts);
|
|
||||||
_pendingScripts = [];
|
|
||||||
}
|
|
||||||
onPjaxComplete();
|
onPjaxComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 暴露给模板内 onclick/onchange 调用的导航函数 */
|
/** 暴露给模板内 onclick/onchange 调用的导航函数 */
|
||||||
window.go = function (url) {
|
window.go = function (url) {
|
||||||
$('body').addClass('pjax-loading');
|
$.pjax({ url: url, ...PJAX_OPTS });
|
||||||
$.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 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() {
|
||||||
reinitVisitors();
|
initVisitors();
|
||||||
reinitCopyButtons();
|
initCopyButtons();
|
||||||
reinitHighlight();
|
highlightKeyword();
|
||||||
reinitGitalk();
|
|
||||||
reinitAISummary();
|
reinitAISummary();
|
||||||
reinitLive2d();
|
reinitLive2d();
|
||||||
trackPageView();
|
trackPageView();
|
||||||
window.scrollTo(0, 0);
|
scrollToAnchor();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@@ -335,7 +127,9 @@
|
|||||||
':not([href$=".xml"]):not([href$=".json"]):not([href$=".tgz"]):not([href$=".zip"])' +
|
':not([href$=".xml"]):not([href$=".json"]):not([href$=".tgz"]):not([href$=".zip"])' +
|
||||||
':not([href^="/Live2dHistoire"])';
|
':not([href^="/Live2dHistoire"])';
|
||||||
$(document).pjax('a' + exclude, PJAX_OPTS.container, PJAX_OPTS);
|
$(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 () {
|
$(document).on('pjax:send', function () {
|
||||||
$('body').addClass('pjax-loading');
|
$('body').addClass('pjax-loading');
|
||||||
});
|
});
|
||||||
@@ -343,9 +137,28 @@
|
|||||||
$(document).on('pjax:error', function (xhr, textStatus, error) {
|
$(document).on('pjax:error', function (xhr, textStatus, error) {
|
||||||
console.warn('[pjax] error, fallback:', 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 () {
|
||||||
reinitCopyButtons();
|
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);
|
})(jQuery);
|
||||||
Reference in New Issue
Block a user