anti techgrow

Remove the height/overflow limits of readmore-container and set the height of readmore-init to 100%.

当前为 2025-09-08 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         anti techgrow
// @version      1.0.1
// @description  Remove the height/overflow limits of readmore-container and set the height of readmore-init to 100%.
// @author       zhumeme
// @namespace   https://github.com/zhumeme/anti-techgrow
// @match        *://*/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';
  console.log('[readmore-fix] userscript loaded', location.href);

  /* 1. Create a style with the highest specificity */
  const style = document.createElement('style');
  style.textContent = `
    #readmore-container{
      height:auto !important;
      max-height:none !important;
      overflow:visible !important;
    }`;
  document.head.appendChild(style);

  /* 2. Fix the height setting in readmore-init */
  function patchInitScript(node) {
    if (node.id === 'readmore-init') {
      node.textContent = node.textContent
        .replace(/height\s*:\s*['"]?\d+['"]?/, 'height:"100%"');
      const s = document.createElement('script');
      s.textContent = node.textContent;
      node.after(s);           // Re-execute
      node.remove();           // Remove the original script
      console.log('[readmore-fix] init-script patched');
    }
  }

  /* 3. Patch already existing scripts once */
  [...document.scripts].forEach(patchInitScript);

  /* 4. Observe SPA route changes or asynchronous insertions */
  const ob = new MutationObserver(muts => {
    muts.forEach(m => m.addedNodes.forEach(n => patchInitScript(n)));
  });
  ob.observe(document.documentElement, { childList: true, subtree: true });
})();