mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
928 B
JavaScript
1 line
928 B
JavaScript
(()=>{return(e,t)=>{if(document.URL.replace(window.location.search,"")==="https://t.bilibili.com/"){(async()=>{t.applyImportantStyle("foldCommentStyle");const e=await SpinQuery.select(".card-list .feed-card>.content");const l=e=>{const t=t=>{const l=document.createElement("div");l.classList.add("fold-comment");l.innerHTML="收起评论";const n=t.querySelector(".bb-comment");if(n===null){console.error("未找到评论区");return}else if(n.querySelector(".fold-comment")!==null){return}else{l.addEventListener("click",()=>{const t=e.querySelector(".button-bar").children[1];if(t!==null){t.click();e.scrollIntoView()}});n.insertAdjacentElement("beforeend",l)}};const l=e.querySelector(".panel-area");if(l===null){console.log(e)}if(l.childElementCount===0){const e=Observer.childList(l,n=>{if(n.length>0){t(l);e.forEach(e=>e.stop())}})}else{t(l)}};Observer.childList(e,()=>e.querySelectorAll("div.card").forEach(l))})()}}})(); |