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