fixed: memos 适配pjax刷新

This commit is contained in:
小赵同学 committed 2025-02-22 14:41:44 +08:00
1 parent 7c5a70dbe1
commit 218da80cb5
6 files changed
+1269 -291

No files matched your search

+8 -20
View File
@@ -254,7 +254,7 @@ function updateHTMl(data,mode){
// 在动画执行之前调整 z-index
document.querySelector('.memos-more-ico').style.zIndex = '1';
// 在DOM加载完毕后执行滑动加载动画
animateSummaries();
// animateSummaries();
if(document.querySelector('button.button-load')) document.querySelector('button.button-load').textContent = '再来几篇';
}
@@ -316,7 +316,7 @@ function loadArtalk(memo_id) {
pageTitle: '',
server: 'https://artalk.5b2.cn/',
site: '优世界',
darkMode: 'auto'
darkMode: false
});
} else {
commentDiv.classList.add('hidden');
@@ -471,18 +471,17 @@ function getEditIcon() {
getEditor == "show" ? hasMemosOpenId() : '';
};
loadEditorBtn.addEventListener("click", function () {
$('.load-memos-editor').on('click', function() {
getEditor != "show" ? hasMemosOpenId() : '';
document.querySelector(".memos-editor").classList.toggle("d-none");
window.localStorage && window.localStorage.setItem("memos-editor-display", document.querySelector(".memos-editor").classList.contains("d-none") ? "hide" : "show");
getEditor = window.localStorage && window.localStorage.getItem("memos-editor-display");
// 点击唠叨一下,平滑滚动到.index-laodao
let editorBody = document.querySelector('.index-laodao');
if (editorBody && !document.querySelector(".memos-editor").classList.contains("d-none")) {
editorBody.scrollIntoView({ behavior: 'smooth' });
}
// 点击唠叨一下,平滑滚动到.index-laodao
let editorBody = document.querySelector('.index-laodao');
if (editorBody && !document.querySelector(".memos-editor").classList.contains("d-none")) {
editorBody.scrollIntoView({ behavior: 'smooth' });
}
});
//标签数据
@@ -1249,14 +1248,3 @@ function handleTextareaInput() {
handleTextareaInput();
document.querySelector('.memos-editor-textarea').addEventListener('input', handleTextareaInput);
//memos、评论链接跳转中间页
document.body.addEventListener('click', function(e) {
let target = e.target.closest('.atk-comment-wrap a, .datacont a');
if (target && !target.href.includes('usj.cc')) {
e.preventDefault();
let encodedUrl = btoa(target.href);
let url = '/tiaozhuan?target=' + encodedUrl;
window.open(url, '_blank');
}
});