bilinovel

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

您需要先安裝使用者腳本管理器擴展,如 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.11
// @description  去除bilinovel检测到屏蔽后隐藏内容
// @author       karl
// @match        https://www.bilinovel.com/*
// @match        https://www.linovelib.com/*
// @grant        unsafeWindow
// @run-at       document-start
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bilinovel.com
// @license      GPLv3
// ==/UserScript==

(function() {
  'use strict';

  // --- Part 1: Block eval and Function (保持不变) ---
  console.log('Tampermonkey: 尝试覆盖 eval() 和 Function()...');
  const targets = [window, unsafeWindow].filter(w => w);
  targets.forEach(targetWindow => {
      try {
          const originalEval = targetWindow.eval;
          const originalFunction = targetWindow.Function;
          Object.defineProperty(targetWindow, 'eval', {
              value: function(str) {
                  console.warn(`Tampermonkey: 检测到 ${targetWindow === window ? 'window' : 'unsafeWindow'}.eval() 调用并已阻止:`, str);
                  throw new Error('Tampermonkey: eval() 已被禁用');
              }, writable: false, configurable: true
          });
          Object.defineProperty(targetWindow, 'Function', {
              value: function(...args) {
                  const code = args.length > 0 ? args[args.length - 1] : '';
                  console.warn(`Tampermonkey: 检测到 ${targetWindow === window ? 'window' : 'unsafeWindow'}.Function() 调用并已阻止:`, code);
                  throw new Error('Tampermonkey: new Function() 已被禁用');
              }, writable: false, configurable: true
          });
      } catch (e) {
          console.error(`Tampermonkey: 覆盖 ${targetWindow === window ? 'window' : 'unsafeWindow'} 的 eval/Function 时出错:`, e);
      }
  });
  console.log('Tampermonkey: eval() 和 Function() 已尝试覆盖。');


  // --- Part 2: Force display of #acontent (修改部分) ---
  const checkElementInterval = 150;
  const maxWaitTime = 15000;
  let timeWaited = 0;

  console.log('Tampermonkey: 开始轮询检查 #acontent 元素...');

  const intervalId = setInterval(() => {
      const element = document.getElementById('acontent');
      timeWaited += checkElementInterval;

      if (element) {
          console.log('Tampermonkey: 找到 #acontent 元素。');
          clearInterval(intervalId);

          try {
              // **核心改动:移除 adv-box 类**
              if (element.classList.contains('adv-box')) {
                  element.classList.remove('adv-box');
                  console.log('Tampermonkey: 已移除 #acontent 的 adv-box 类,以避免UA样式覆盖。');
              } else {
                  console.log('Tampermonkey: #acontent 未找到 adv-box 类,无需移除。');
              }

              // 设置内联样式仍然有用,可以覆盖其他可能的作者样式规则
              // 即使移除了 adv-box,可能还有其他规则隐藏它
              element.style.setProperty('display', 'block', 'important');
              console.log('Tampermonkey: #acontent 的 display 样式已强制设置为 block !important');

          } catch (e) {
              console.error('Tampermonkey: 修改 #acontent 类或样式时出错:', e);
          }

      } else if (timeWaited >= maxWaitTime) {
          console.warn('Tampermonkey: 等待 #acontent 元素超时 (' + maxWaitTime + 'ms),停止检查。');
          clearInterval(intervalId);
      }

  }, checkElementInterval);

})();