Bilibili-Evolved/min/remove-promotions.min.js
2020-10-30 17:42:34 +08:00

1 line
1.2 KiB
JavaScript

(()=>(e,t)=>{if(document.URL.replace(window.location.search,"")==="https://www.bilibili.com/"){addSettingsListener("removeGameMatchModule",(e=>{document.body.classList.toggle("remove-game-match-module",e)}),true);SpinQuery.any((()=>dqa(".gg-pic")),(t=>{t.forEach((t=>{const n=t.parentElement;n.style.display="none";const l=[...n.parentElement.childNodes].indexOf(n)+1;const i=n.parentElement.parentElement.querySelector(`.pic li:nth-child(${l})`);if(i){i.style.display="flex";const t=i.querySelector("a:not(.more-text)");t.insertAdjacentHTML("afterend",`\n<div class="blocked">${e.showBlockedAdsTip?"🚫已屏蔽广告":""}</div>\n`);t.style.visibility="hidden";i.querySelector("a.more-text").style.display="none";i.querySelector("img").style.display="none"}}))}));SpinQuery.select(".focus-carousel.home-slide").then((t=>{if(!t){return}[...t.querySelectorAll(".gg-icon,.bypb-icon")].map((e=>e.parentElement.parentElement)).forEach((t=>{t.style.display="none";t.insertAdjacentHTML("afterend",`\n<div class="blocked new">${e.showBlockedAdsTip?"🚫已屏蔽广告":""}</div>\n`)}))}))}addSettingsListener("preserveEventBanner",(e=>{document.body.classList.toggle("preserve-event-banner",e)}),true)})();