跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[分享创造] b 站黑神话防剧透插件

发表于

黑神话悟空上线之后 b 站的推荐简直没法看。一不小心就被剧透。所以做了这个油猴插件。 需要先安装 https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo

安装后之后

gccKRzI.png

把下面的代码粘贴进去。

ZA1DEHd.png

// ==UserScript==
// @name         b 站屏蔽黑悟空相关推荐
// @namespace    http://tampermonkey.net/
// @version      2024-08-23
// @description  try to take over the world!
// @author       h3l
// @match        https://www.bilibili.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant        none
// ==/UserScript==

(function() {
   'use strict';

   // 关键字列表,使用 base64 保存,看到了也不会被剧透
   const encryptedKeywords = ["6buR56We6K+d", "5a2Z5oKf56m6", "57qi5a2p5YS/", "6JmO5YWI6ZSL", "6KW/5ri46K6w", "6buR5oKf56m6", "6buR54y0"];

   // 创建一个新数组,用于存储解码后的字符串
   const keywords = encryptedKeywords.map(encodedString => decodeURIComponent(escape(atob(encodedString))));

   function removeMatchedCards() {
       // 获取所有的 feed-card 与 bili-video-card 元素
       const cards = document.querySelectorAll('.feed-card, .bili-video-card');

       cards.forEach(card => {
           const authorElement = card.querySelector('.bili-video-card__info--author');
           const titleElement = card.querySelector('.bili-video-card__info--tit');

           // 检查作者名和标题是否存在
           if (authorElement && titleElement) {
               const authorName = authorElement.textContent.trim();
               const titleText = titleElement.textContent.trim();

               // 检查是否命中关键字
               const isKeywordHit = keywords.some(keyword =>
                                                  authorName.includes(keyword) || titleText.includes(keyword)
                                                 );

               // 如果命中关键字,删除该 feed-card 元素
               if (isKeywordHit) {
                   console.log(titleText, "removed")
                   card.hidden = true
               }
           }
       });
   }

   // 初始调用,删除已存在的匹配元素
   removeMatchedCards();

   // 使用 MutationObserver 监控页面的变化
   const observer = new MutationObserver((mutations) => {
       mutations.forEach((mutation) => {
           // 当页面发生变化时,重新检查并删除匹配的卡片
           removeMatchedCards();
       });
   });

   // 监控页面的主体部分(可以根据具体情况调整选择器)
   observer.observe(document.body, { childList: true, subtree: true });

})();

效果如下: ot2Cieq.jpeg

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.