anti techgrow

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

目前為 2025-09-08 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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 });
})();