🧠 X.com 高级 JavaScript 优化器+

优化 X.com/Twitter 性能:移除高负载 CSS、限制 FPS、减少 DOM、暂停屏幕外视频、屏蔽分析并在卡顿时自动启用高性能模式。

当前为 2025-10-23 提交的版本,查看 最新版本

这些是此脚本变更过代码的版本。 显示所有版本。

  • v1.3.9 2025-12-25

    Changed

    • Localization: Added Vietnamese (vi) / English (en) menu translations for GM_registerMenuCommand, with a language toggle.
  • v1.3.8 2025-12-25

    Added

    • Page-context injection: heavy patches now run inside the real page context via injected <script> instead of relying on @inject-into auto behavior.
    • CSP nonce support: introduced waitForNonceAndInject() to poll for an existing script[nonce] and inject with the same nonce. Includes a timeout-based fallback injection.
    • Config option for preload removal: added NUKE_PRELOAD toggle (with menu item) to enable/disable removing preload/prefetch/modulepreload links.
    • XHR metrics blocking: metrics blocking now covers XMLHttpRequest in addition to fetch.
    • Selective sendBeacon blocking: blocks only “noisy” metric endpoints instead of disabling all beacons.

    Changed

    • Feed cleanup strategy:

      • prunes old tweets using content-visibility: hidden + locked height (contain-intrinsic-size/height) to reduce paint/layout cost while preserving scroll layout.
    • Preload removal behavior:

      • removal is optional and controlled by NUKE_PRELOAD.
    • Injection string building:

      • avoids template-literal wrapping for injected code to prevent syntax breakage when main() contains template strings.

    Removed

    • Global MutationObserver override (v1 soft-throttle): removed to reduce the risk of breaking React/virtualized rendering behavior.
    • Global PerformanceObserver override (v1 “brutal block”): removed to avoid interfering with page performance instrumentation.
    • Hard tweet removal loop (v1 articles[i].remove() GC): removed for stability and to avoid breaking feed state/infinite scroll.
  • v1.3.7 2025-12-19

    Set default injection mode = auto/page

  • v1.3.6 2025-11-08

    v1.3.6
    - perf: throttle setTimeout same as setInterval to reduce CPU wakeups
    - fix: correct override to no-op only longtask/resource/paint observers
    - perf: add modulepreload removal to block bundler prefetch
    - perf: apply content-visibility to sidebarColumn to reduce offscreen layout cost
    - perf: lower fetchPriority for images to save bandwidth
    - style: extend cleanup for gradient/shadow utility classes

  • v1.3.5 2025-11-06

    v1.3.5
    - feat: add localization & extended language support (50 locales)
    - chore: unify metadata descriptions & names

  • v1.3.4 2025-11-06

    v1.3.4
    - refactor: replace MutationObserver blocker with throttled version
    - fix: restore feed loading & modals on X.com (no more broken infinite scroll)

  • v1.3.3 2025-11-06

    v1.3.3
    - refactor: rewrite PerformanceObserver patch to safe version (fix arguments/constructor issue)

  • v1.3.2 2025-10-23
  • v1.3.1 2025-10-23

    🧠 X.com Heavy JS Optimizer+ — Changelog

    v1.3.1-pre (2025-10-23)

    Fixes & Stability

    • Fixed critical TypeError: root.querySelectorAll is not a function caused when onReady() fired before the DOM was available.
    • Added safety guards for both scanVideos() and scanImg() to prevent crashes on non-Element nodes.
    • Ensured first DOM scan is triggered correctly using onReady() (no more skipped optimization for initial videos/images).
    • Improved overall stability on browsers with aggressive preload or delayed DOM construction.

    Performance Enhancements

    • Maintained @run-at document-start for maximum patch coverage (fetch, rAF, and setInterval hooks initialize early).
    • Added lightweight checks to reduce redundant MutationObserver calls.
    • Optimized early CSS injection timing for faster compositor cleanup.

    Behavior Improvements

    • Video & image optimization now runs both:
      • Once after DOM ready (onReady).
      • Continuously via live MutationObserver for new tweets.
    • Prevented double-injection and redundant event listeners.

    Developer Notes

    • This version is functionally identical to v1.3.0, but much safer and crash-free.
    • Considered stable for daily use.
    • Future builds will focus on:
      • Live FPS/Memory overlay (performance HUD).
      • Smart DOM cleanup (auto remove old tweets after 10+ minutes).

    v1.3.0 (Initial Public Release)

    Core Features

    • Full optimization suite for X.com/Twitter:
      • Removes heavy CSS (blur, backdrop-filter, linear-gradient).
      • Forces content-visibility: auto on feed articles for massive paint savings.
      • Caps frame rate to ~45 FPS during long tasks (Aggressive Mode).
      • Pauses offscreen videos and enforces single active video decoding.
      • Auto-lazy-loads and async-decodes all images.
      • Optionally blocks analytics (scribe, metrics, client_event, etc.).
    • User menu (GM_registerMenuCommand) to toggle:
      • Aggressive Mode ON/OFF
      • DOM feed limit
      • Analytics blocking

    Adaptive Runtime

    • Auto-detects browser long tasks via PerformanceObserver.
    • Dynamically enables “Aggressive” or “Ultra” mode when lag spikes.
    • Reduces setInterval density to lighten CPU usage.

    Author

    Oppai1442
    GreasyFork Profile

    License: MIT

  • v1.3.0 2025-10-22