fixed bug
This commit is contained in:
1 parent
7b945786ed
commit
54b18039e3
21 files changed
+2363
-408
No files matched your search
@@ -1,26 +1,55 @@
|
||||
// 定义pjax 预设pjax
|
||||
var pjax = new Pjax({
|
||||
// 这里填写页面中改变的部分(和 CSS 选择器用法一样)
|
||||
selectors: ["title", "#pjax-container"],
|
||||
cacheBust: false,
|
||||
elements: "a"
|
||||
// 移除 sideBySide,改用默认替换以配合骨架屏逻辑
|
||||
});
|
||||
// 设置图片灯箱回调函数
|
||||
// Removed redundant lazyimg_pjax definition as EasyLazyload.min.js handles it globally now
|
||||
(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过渡动画
|
||||
// $("#pjax-container").addClass("uk-animation-slide-bottom-small");
|
||||
// var pjaxContainer = document.getElementById("pjax-container");
|
||||
// if (pjaxContainer) pjaxContainer.classList.add("uk-animation-slide-bottom-small");
|
||||
|
||||
// 评论区过渡动画
|
||||
$(".comment-meta").attr("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
$(".comment-author vcard").attr("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
$(".comment-metadata").attr("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
$(".comment-content").attr("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
$(".reply").attr("uk-scrollspy", "cls: uk-animation-fade; delay: 100");
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
// 说说页面过渡动画
|
||||
$("#shuoshuo_body").attr("uk-scrollspy", "target: > .shuoshuo; cls: uk-animation-fade; delay: 250");
|
||||
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动画减少圆圈动画
|
||||
@@ -30,43 +59,57 @@ document.addEventListener("pjax:send", function () {
|
||||
// pjax执行动画开始
|
||||
NProgress.start(); //加载动画效果开始
|
||||
});
|
||||
|
||||
// Pjax 成功后,重新加载下面的函数
|
||||
document.addEventListener("pjax:success", function () {
|
||||
// 重载图片懒加载插件的js
|
||||
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 (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
|
||||
});
|
||||
}
|
||||
// 激活文章图片灯箱
|
||||
window.ViewImage && ViewImage.init('.post-content img');
|
||||
if (window.ViewImage) {
|
||||
ViewImage.init('.post-content img');
|
||||
}
|
||||
});
|
||||
|
||||
// pjax加载完成
|
||||
document.addEventListener("pjax:complete", function () {
|
||||
// pjax完成动画
|
||||
NProgress.done();
|
||||
if (typeof NProgress !== 'undefined') {
|
||||
NProgress.done();
|
||||
}
|
||||
|
||||
// 重载一些js样式调整
|
||||
pjax_reload()
|
||||
pjax_reload();
|
||||
|
||||
// 初始化代码复制
|
||||
initCodeCopy()
|
||||
if (typeof initCodeCopy === 'function') initCodeCopy();
|
||||
|
||||
// 初始化代码折叠
|
||||
initCodeFold()
|
||||
if (typeof initCodeFold === 'function') initCodeFold();
|
||||
|
||||
// 初始化友链状态
|
||||
if (typeof window.initLinkStatus === 'function') {
|
||||
window.initLinkStatus();
|
||||
}
|
||||
|
||||
// 重载评论
|
||||
if (typeof window.initArtalk === 'function') {
|
||||
window.initArtalk();
|
||||
}
|
||||
|
||||
// 重载不蒜子统计
|
||||
if (typeof window.bsz_fetch === 'function') {
|
||||
window.bsz_fetch();
|
||||
}
|
||||
|
||||
// 重载 Search 和 Floating Tools (Moved from main.js)
|
||||
if (typeof window.initFloatingTools === 'function') window.initFloatingTools();
|
||||
if (typeof window.initSearch === 'function') window.initSearch();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user