Bilibili-Evolved/min/fold-comment.min.js
2019-07-03 20:33:42 +08:00

1 line
872 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 n=e=>{const t=t=>{const n=document.createElement("div");n.classList.add("fold-comment");n.innerHTML="收起评论";const c=t.querySelector(".bb-comment");if(c===null){console.error("未找到评论区");return}else{n.addEventListener("click",()=>{const t=e.querySelector(".button-bar").children[1];if(t!==null){t.click();e.scrollIntoView()}});c.insertAdjacentElement("beforeend",n)}};const n=e.querySelector(".panel-area");if(n===null){console.log(e)}if(n.childElementCount===0){const e=Observer.childList(n,c=>{if(c.length>0){t(n);e.forEach(e=>e.stop())}})}else{t(n)}};Observer.childList(e,()=>e.querySelectorAll("div.card").forEach(n))})()}}})();