elykia 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/welcome.js +15 -1
- package/package.json +1 -1
package/blog/welcome.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const elykia = {
|
|
2
2
|
// 欢迎语
|
|
3
3
|
setWelcome_info: async () => {
|
|
4
|
-
|
|
4
|
+
const WelcomeInfo = document.getElementById("welcome-info");
|
|
5
|
+
if (!WelcomeInfo) {
|
|
6
|
+
setTimeout(elykia.setWelcome_info, 200);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
5
9
|
|
|
6
10
|
try {
|
|
7
11
|
return new Promise((resolve, reject) => {
|
|
@@ -402,3 +406,13 @@ const elykia = {
|
|
|
402
406
|
document.addEventListener("DOMContentLoaded", () => {
|
|
403
407
|
elykia.setWelcome_info();
|
|
404
408
|
});
|
|
409
|
+
|
|
410
|
+
// 支持 PJAX 页面切换
|
|
411
|
+
document.addEventListener("pjax:complete", () => {
|
|
412
|
+
elykia.setWelcome_info();
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
// 支持其他可能的页面切换事件
|
|
416
|
+
document.addEventListener("turbo:load", () => {
|
|
417
|
+
elykia.setWelcome_info();
|
|
418
|
+
});
|