您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Discord web için tüm ağır DOM, animasyon ve eventleri optimize ederek CPU ve RAM kullanımını minimize eder
当前为
// ==UserScript== // @name Discord Web Ultra Performance Optimizer // @namespace http://tampermonkey.net/ // @version 2.1.0 // @description Discord web için tüm ağır DOM, animasyon ve eventleri optimize ederek CPU ve RAM kullanımını minimize eder // @license MIT // @author Sefa AVAN // @match https://discord.com/* // @run-at document-start // ==/UserScript== (function() { 'use strict'; // ---------- 1) Animasyon ve transition kapatma ---------- const style = document.createElement('style'); style.textContent = ` * { transition: none !important; animation: none !important; } img.emoji { image-rendering: pixelated; } `; document.head.appendChild(style); // ---------- 2) Event throttling ---------- const throttleMs = 50; const last = {}; ['mousemove', 'pointermove', 'scroll', 'resize'].forEach(type => { window.addEventListener(type, e => { const now = performance.now(); if(last[type] && now - last[type] < throttleMs){ e.stopImmediatePropagation(); e.stopPropagation(); return; } last[type] = now; }, true); }); // ---------- 3) Lazy-load ağır DOM öğeleri ---------- function lazyLoadElements(selector){ document.querySelectorAll(selector).forEach(el => { if(!el.dataset.lazy){ el.dataset.lazy = '1'; el.style.display = 'none'; const obs = new IntersectionObserver(entries => { if(entries[0].isIntersecting){ el.style.display = ''; obs.disconnect(); } }, { rootMargin: '2000px' }); obs.observe(el); } }); } function applyLazyLoad(){ lazyLoadElements('.emoji-picker, .gift-preview, .activity-feed'); } // ---------- 4) Arka plan sekmede GIF ve videoları durdur ---------- function manageBackgroundMedia(){ document.querySelectorAll('img[src$=".gif"], video').forEach(el => { if(document.hidden) el.pause ? el.pause() : el.style.display = 'none'; else el.play ? el.play() : el.style.display = ''; }); } document.addEventListener('visibilitychange', manageBackgroundMedia); // ---------- 5) Fixed Virtualization: eski mesajları görünür tutarken RAM düşür ---------- function virtualizeMessagesFixed(){ const messages = document.querySelectorAll('[id^="message-"]'); const viewportTop = 0; const viewportBottom = window.innerHeight; const buffer = 5; // ±5 mesaj buffer messages.forEach((msg, idx) => { const rect = msg.getBoundingClientRect(); const inViewportBuffer = rect.bottom >= viewportTop - buffer*rect.height && rect.top <= viewportBottom + buffer*rect.height; msg.style.visibility = inViewportBuffer ? 'visible' : 'hidden'; }); } // ---------- 6) SPA navigasyonları ve interval ---------- const reapplyAll = () => { applyLazyLoad(); manageBackgroundMedia(); virtualizeMessagesFixed(); }; document.addEventListener('DOMContentLoaded', reapplyAll); window.addEventListener('yt-navigate-finish', reapplyAll); window.addEventListener('popstate', reapplyAll); setInterval(virtualizeMessagesFixed, 1000); // her saniye viewport güncelle })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址