bilinovel

去除bilinovel检测到屏蔽后隐藏内容

目前為 2025-04-23 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         bilinovel
// @namespace    http://tampermonkey.net/
// @version      1.9
// @description  去除bilinovel检测到屏蔽后隐藏内容
// @author       karl
// @match        https://www.bilinovel.com/*
// @grant        none
// @run-at       document-idle
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bilinovel.com
// @license      GPLv3
// ==/UserScript==

(function() {
  'use strict';

  const AD_TIPS_SELECTOR = '.adblock-tips'; // 反广告拦截脚本添加的提示框的选择器
  const CONTENT_ID = 'acontent'; // 被反广告拦截脚本隐藏的内容区域的 ID
  // 更新:选择器,用于定位在标题和内容之间的动态生成的 DIV,并确保它不是内容区本身
  const DYNAMIC_AD_DIV_SELECTOR = '#apage > .atitle + div:not([id="acontent"])';
  const MAX_ATTEMPTS = 10;
  const CHECK_INTERVAL = 500;

  let attempts = 0;
  let cleanupInterval = null;

  function performCleanup() {
      attempts++;
      let needsFurtherChecks = false;

      // 1. 隐藏提示信息
      const adBlockTips = document.querySelector(AD_TIPS_SELECTOR);
      if (adBlockTips && adBlockTips.style.display !== 'none') {
          adBlockTips.style.display = 'none';
          needsFurtherChecks = true;
      } else if (adBlockTips) {
          needsFurtherChecks = true;
      }

      // 2. 恢复内容区域
      const contentArea = document.getElementById(CONTENT_ID);
      if (contentArea && contentArea.style.display === 'none') {
          contentArea.style.display = '';
          needsFurtherChecks = true;
      } else if (contentArea) {
           needsFurtherChecks = true;
      }

      // 3. 隐藏动态生成的广告位 (使用更新后的选择器)
      const dynamicAdDiv = document.querySelector(DYNAMIC_AD_DIV_SELECTOR);
      if (dynamicAdDiv && dynamicAdDiv.style.display !== 'none') {
          dynamicAdDiv.setAttribute('style', 'display: none !important');
          needsFurtherChecks = true;
      } else if (dynamicAdDiv) {
           needsFurtherChecks = true;
      }

      // 4. 停止检查逻辑
      if (attempts >= MAX_ATTEMPTS) {
          if (cleanupInterval) clearInterval(cleanupInterval);
      }
  }

  // 立即执行一次清理
  performCleanup();

  // 继续使用 setInterval 定期检查
  cleanupInterval = setInterval(performCleanup, CHECK_INTERVAL);

})();