mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
(()=>{return(t,e)=>{let n=true;const i="disable-feeds-details-style";const a=`\n.card[data-did] .content { cursor: text }\n.card[data-did] .content .details {\n font-size: 12px;\n opacity: 0.6;\n cursor: pointer;\n display: block;\n}\n`;e.applyImportantStyleFromText(".card[data-did] .content .details { display: none }","disable-feeds-details-init-style");const s=()=>e.applyImportantStyleFromText(a,i);const r=document.URL.replace(location.search,"");const c=r.startsWith("https://t.bilibili.com/")||r.startsWith("https://space.bilibili.com/");(async()=>{if(!c){return}s();const{feedsCardsManager:t,feedsCardTypes:i}=await e.importAsync("feeds-apis");const a=await t.startWatching();if(!a){console.error("feedsCardsManager.startWatching() failed");return}const r=t=>{const e=t.element;e.addEventListener("click",t=>{if(t.ctrlKey||!n){return}const i=dqa(e,".content");const a=t.target;if(a.hasAttribute("click-title")){return}if(i.some(t=>t===a||t.contains(a))){t.stopImmediatePropagation()}},{capture:true});const i=dq(e,".post-content");if(!i){return}if(dq(i,".video-container")||dq(i,".bangumi-container")){return}if(dq(i,".details")){return}if(i.classList.contains("repost")){const t=dq(i,".content");if(!t){return}const e=document.createElement("div");e.classList.add("details");e.setAttribute("click-title","详情");e.innerHTML=`\n 详情<i class="mdi mdi-chevron-right" click-title></i>\n`;t.insertAdjacentElement("beforeend",e)}};t.cards.forEach(r);t.addEventListener("addCard",t=>{const e=t.detail;r(e)})})();return{reload:()=>{if(c){s();n=true}},unload:()=>{if(c){const t=document.getElementById(i);t&&t.remove();n=false}}}}})(); |