Bilibili-Evolved/min/remove-promotions.min.js
2020-04-13 15:12:53 +08:00

1 line
1.2 KiB
JavaScript

(()=>{return(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 s=n.parentElement.parentElement.querySelector(`.pic li:nth-child(${l})`);if(s){s.style.display="flex";const t=s.querySelector("a:not(.more-text)");t.insertAdjacentHTML("afterend",`\n<div class="blocked-ads">${e.showBlockedAdsTip?"🚫已屏蔽广告":""}</div>\n`);t.style.visibility="hidden";s.querySelector("a.more-text").style.display="none";s.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-ads new">${e.showBlockedAdsTip?"🚫已屏蔽广告":""}</div>\n`)})})}addSettingsListener("preserveEventBanner",e=>{document.body.classList.toggle("preserve-event-banner",e)},true)}})();