0.2.0 版本发布
This commit is contained in:
1 parent
28f74e7a38
commit
b6bff1bc80
12 files changed
+4237
-50
No files matched your search
@@ -10,7 +10,7 @@ function isMobile() {
|
||||
// 文章图片灯箱
|
||||
window.ViewImage && ViewImage.init('.post-content img');
|
||||
|
||||
// 激活返回顶部插件
|
||||
// 激活返回顶部插件
|
||||
$(function () {
|
||||
$.scrollUp({
|
||||
animation: 'fade',
|
||||
@@ -145,4 +145,69 @@ function flattenComments(comments) {
|
||||
// 调用异步的弹幕加载函数
|
||||
if (document.querySelector("#Comments") && !isMobile()) {
|
||||
loadBarrager()
|
||||
}
|
||||
}
|
||||
|
||||
// 灯箱调用(首页顶部/Memos页面)
|
||||
window.ViewImage && ViewImage.init('.content_zhengwen img, .top-img,.gallery-thumbnail img,.posts_photo a,.photo-moment a');
|
||||
|
||||
// 页面上滑加载动画
|
||||
function animateSummaries() {
|
||||
const articles = document.querySelectorAll('.img-hide,.retu-hide'); // 包含新的类
|
||||
const shuffledArticles = Array.from(articles).sort(() => Math.random() - 0.5);
|
||||
|
||||
function animate(article, delay) {
|
||||
setTimeout(() => {
|
||||
article.classList.add('visible');
|
||||
}, delay);
|
||||
}
|
||||
|
||||
const options = {
|
||||
rootMargin: '0px 0px -70px 0px',
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry, index) => {
|
||||
if (entry.isIntersecting) {
|
||||
// 类名 retu-hide 延迟 100 默认 img-hide 延迟 8,实现错落效果
|
||||
const delay = entry.target.classList.contains('retu-hide') ? index * 100 : index * 8;
|
||||
animate(entry.target, delay);
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
|
||||
shuffledArticles.forEach((article) => {
|
||||
observer.observe(article);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function initEditor() {
|
||||
const loadEditorBtn = document.getElementById("loadEditorBtn");
|
||||
const memosEditor = document.querySelector(".memos-editor");
|
||||
const editorBody = document.querySelector('.index-laodao');
|
||||
|
||||
if (loadEditorBtn) {
|
||||
loadEditorBtn.addEventListener("click", function () {
|
||||
// 切换编辑器显示状态
|
||||
getEditor != "show" ? hasMemosOpenId() : '';
|
||||
memosEditor.classList.toggle("d-none");
|
||||
|
||||
// 保存编辑器显示状态到 localStorage
|
||||
if (window.localStorage) {
|
||||
const isHidden = memosEditor.classList.contains("d-none");
|
||||
window.localStorage.setItem("memos-editor-display", isHidden ? "hide" : "show");
|
||||
getEditor = window.localStorage.getItem("memos-editor-display");
|
||||
}
|
||||
|
||||
// 平滑滚动到 .index-laodao
|
||||
if (editorBody && !memosEditor.classList.contains("d-none")) {
|
||||
editorBody.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化编辑器逻辑
|
||||
initEditor();
|
||||
|
||||
Reference in new issue
Block a user