fixed 维护一下项目结构
This commit is contained in:
1 parent
c7acf03b4a
commit
6ad43b2c08
87 files changed
+6864
-11017
No files matched your search
@@ -0,0 +1,143 @@
|
||||
// 定义pjax 预设pjax
|
||||
(function() {
|
||||
if (typeof Pjax === 'undefined') {
|
||||
console.error('Pjax library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
var pjax = new Pjax({
|
||||
// 这里填写页面中改变的部分(和 CSS 选择器用法一样)
|
||||
selectors: ["title", "#pjax-container"],
|
||||
cacheBust: false,
|
||||
elements: "a", // 拦截所有链接
|
||||
switches: {
|
||||
"#pjax-container": Pjax.switches.default
|
||||
}
|
||||
});
|
||||
|
||||
// 将 pjax 实例挂载到 window 以便调试或外部访问
|
||||
window.pjax = pjax;
|
||||
|
||||
console.log("Pjax initialized:", pjax);
|
||||
})();
|
||||
|
||||
// pjax预先加载代码
|
||||
function pjax_reload() {
|
||||
console.log("Pjax reload triggered");
|
||||
// 给pjax容器加入css过渡动画
|
||||
// var pjaxContainer = document.getElementById("pjax-container");
|
||||
// if (pjaxContainer) pjaxContainer.classList.add("uk-animation-slide-bottom-small");
|
||||
|
||||
// 评论区过渡动画
|
||||
var selectors = [
|
||||
".comment-meta",
|
||||
".comment-author vcard",
|
||||
".comment-metadata",
|
||||
".comment-content",
|
||||
".reply"
|
||||
];
|
||||
|
||||
selectors.forEach(function(selector) {
|
||||
document.querySelectorAll(selector).forEach(function(el) {
|
||||
el.setAttribute("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
});
|
||||
});
|
||||
|
||||
// 说说页面过渡动画
|
||||
var shuoshuoBody = document.getElementById("shuoshuo_body");
|
||||
if (shuoshuoBody) {
|
||||
shuoshuoBody.setAttribute("uk-scrollspy", "target: > .shuoshuo; cls: uk-animation-fade; delay: 250");
|
||||
}
|
||||
}
|
||||
|
||||
// pjax发送时期
|
||||
document.addEventListener("pjax:send", function () {
|
||||
// pjax动画减少圆圈动画
|
||||
NProgress.configure({
|
||||
showSpinner: false
|
||||
});
|
||||
// pjax执行动画开始
|
||||
NProgress.start(); //加载动画效果开始
|
||||
});
|
||||
|
||||
// Pjax 成功后,重新加载下面的函数
|
||||
document.addEventListener("pjax:success", function () {
|
||||
// 重载图片懒加载插件的js
|
||||
if (typeof lazyLoadInit === 'function') {
|
||||
lazyLoadInit({
|
||||
// coverColor: "white",
|
||||
// coverDiv: "<div style='display: flex; justify-content: center; align-items: center; height: 200px; color: #000000;'><span>优世界·一个记录生活点滴的小站</span></div>",
|
||||
offsetBottom: 800,
|
||||
offsetTopm: 800,
|
||||
showTime: 1100
|
||||
});
|
||||
}
|
||||
// 激活文章图片灯箱
|
||||
if (window.ViewImage) {
|
||||
ViewImage.init('.post-content img');
|
||||
}
|
||||
});
|
||||
|
||||
// pjax加载完成
|
||||
document.addEventListener("pjax:complete", function () {
|
||||
// pjax完成动画
|
||||
if (typeof NProgress !== 'undefined') {
|
||||
NProgress.done();
|
||||
}
|
||||
|
||||
// 重载一些js样式调整
|
||||
pjax_reload();
|
||||
|
||||
// 初始化代码复制
|
||||
if (typeof initCodeCopy === 'function') initCodeCopy();
|
||||
|
||||
// 初始化代码折叠
|
||||
if (typeof initCodeFold === 'function') initCodeFold();
|
||||
|
||||
// 初始化段落评论
|
||||
if (typeof window.initParagraphComments === 'function') {
|
||||
try {
|
||||
window.initParagraphComments();
|
||||
} catch (e) {
|
||||
console.error('initParagraphComments error:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化无限加载
|
||||
if (typeof window.initInfiniteScroll === 'function' && window.enableInfiniteScroll) {
|
||||
window.initInfiniteScroll();
|
||||
}
|
||||
|
||||
// 初始化友链状态
|
||||
if (typeof window.initLinkStatus === 'function') {
|
||||
try {
|
||||
window.initLinkStatus();
|
||||
} catch(e) { console.error('initLinkStatus error:', e); }
|
||||
}
|
||||
|
||||
// 重载评论
|
||||
if (typeof window.initArtalk === 'function') {
|
||||
try {
|
||||
window.initArtalk();
|
||||
} catch(e) { console.error('initArtalk error:', e); }
|
||||
}
|
||||
|
||||
// 重载不蒜子统计
|
||||
if (typeof window.bsz_fetch === 'function') {
|
||||
try {
|
||||
window.bsz_fetch();
|
||||
} catch(e) { console.error('bsz_fetch error:', e); }
|
||||
}
|
||||
|
||||
// 重载 Search 和 Floating Tools (Moved from main.js)
|
||||
if (typeof window.initFloatingTools === 'function') {
|
||||
try {
|
||||
window.initFloatingTools();
|
||||
} catch(e) { console.error('initFloatingTools error:', e); }
|
||||
}
|
||||
if (typeof window.initSearch === 'function') {
|
||||
try {
|
||||
window.initSearch();
|
||||
} catch(e) { console.error('initSearch error:', e); }
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user