73 lines
2.5 KiB
JavaScript
73 lines
2.5 KiB
JavaScript
// 定义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
|
|
// pjax预先加载代码
|
|
function pjax_reload() {
|
|
// 给pjax容器加入css过渡动画
|
|
// $("#pjax-container").addClass("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");
|
|
// 说说页面过渡动画
|
|
$("#shuoshuo_body").attr("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
|
|
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');
|
|
});
|
|
// pjax加载完成
|
|
document.addEventListener("pjax:complete", function () {
|
|
// pjax完成动画
|
|
NProgress.done();
|
|
// 重载一些js样式调整
|
|
pjax_reload()
|
|
// 初始化代码复制
|
|
initCodeCopy()
|
|
// 初始化代码折叠
|
|
initCodeFold()
|
|
// 初始化友链状态
|
|
if (typeof window.initLinkStatus === 'function') {
|
|
window.initLinkStatus();
|
|
}
|
|
// 重载评论
|
|
if (typeof window.initArtalk === 'function') {
|
|
window.initArtalk();
|
|
}
|
|
// 重载不蒜子统计
|
|
if (typeof window.bsz_fetch === 'function') {
|
|
window.bsz_fetch();
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|