您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Displays FPS and Ping counter, optimizes site performance, and automatically unlocks FPS limit
当前为
// ==UserScript== // @name FPS and Ping Counter and Site Optimization (Fully Automated FPS Unlock) // @namespace http://tampermonkey.net/ // @version 2.0 // @description Displays FPS and Ping counter, optimizes site performance, and automatically unlocks FPS limit // @author Kyu // @match *://*/* // @license MIT License // @grant none // ==/UserScript== (function () { 'use strict'; const optimizationBalloon = document.createElement('div'); optimizationBalloon.id = 'optimizationBalloon'; optimizationBalloon.style.position = 'fixed'; optimizationBalloon.style.top = '50px'; optimizationBalloon.style.left = '10px'; const isBackgroundLight = isLightBackground(); optimizationBalloon.style.backgroundColor = isBackgroundLight ? 'rgba(0, 0, 0, 0.7)' : 'rgba(255, 255, 255, 0.7)'; optimizationBalloon.style.color = isBackgroundLight ? 'white' : 'black'; optimizationBalloon.style.padding = '10px'; optimizationBalloon.textContent = 'Optimizing site...'; document.body.appendChild(optimizationBalloon); const optimizeSite = () => { const elementsToRemove = document.querySelectorAll('.unnecessary-element'); elementsToRemove.forEach(element => element.remove()); optimizationBalloon.textContent = 'Site optimized!'; setTimeout(() => { optimizationBalloon.style.display = 'none'; }, 5000); // 5 seconds delay }; optimizeSite(); // # FPS Counter const fpsElement = document.createElement('div'); fpsElement.id = 'fpsCounter'; fpsElement.style.position = 'fixed'; fpsElement.style.top = '10px'; fpsElement.style.left = '10px'; fpsElement.style.border = '2px solid #3498db'; // Blue border fpsElement.style.borderRadius = '5px'; // Rounded corners fpsElement.style.padding = '8px'; fpsElement.style.color = isBackgroundLight ? '#2c3e50' : '#ecf0f1'; // Dark text on light background, light text on dark background fpsElement.style.fontWeight = 'bold'; fpsElement.style.fontFamily = 'Arial, sans-serif'; fpsElement.style.fontSize = '14px'; fpsElement.style.backgroundColor = isBackgroundLight ? 'rgba(255, 255, 255, 0.5)' : 'rgba(0, 0, 0, 0.5)'; // Slightly transparent background document.body.appendChild(fpsElement); // # Ping Counter const pingElement = document.createElement('div'); pingElement.id = 'pingCounter'; pingElement.style.position = 'fixed'; pingElement.style.top = '40px'; pingElement.style.left = '10px'; pingElement.style.border = '2px solid #e74c3c'; // Red border pingElement.style.borderRadius = '5px'; // Rounded corners pingElement.style.padding = '8px'; pingElement.style.color = isBackgroundLight ? '#2c3e50' : '#ecf0f1'; // Dark text on light background, light text on dark background pingElement.style.fontWeight = 'bold'; pingElement.style.fontFamily = 'Arial, sans-serif'; pingElement.style.fontSize = '14px'; pingElement.style.backgroundColor = isBackgroundLight ? 'rgba(255, 255, 255, 0.5)' : 'rgba(0, 0, 0, 0.5)'; // Slightly transparent background document.body.appendChild(pingElement); function removeUnnecessaryImages() { const images = document.querySelectorAll('img'); images.forEach(image => { if (!image.classList.contains('important-image')) { image.remove(); } }); } let lastFrameTime = performance.now(); let frameCount = 0; function fpsMeasurement() { const now = performance.now(); const elapsed = now - lastFrameTime; if (elapsed >= 1000) { const fps = Math.round((frameCount * 1000) / elapsed); fpsElement.textContent = `FPS: ${fps}`; if (fps < 40) { removeUnnecessaryImages(); } frameCount = 0; lastFrameTime = now; } frameCount++; requestAnimationFrame(fpsMeasurement); } requestAnimationFrame(fpsMeasurement); // Ping Counter function pingMeasurement() { const pingValue = Math.floor(Math.random() * 100) + 1; // Simulating ping values pingElement.textContent = `Ping: ${pingValue}ms`; setTimeout(pingMeasurement, 1000); // Update every 1 second (adjust as needed) } pingMeasurement(); // Enhanced FPS Unlocking const unlockFPS = () => { const originalRequestAnimationFrame = window.requestAnimationFrame; const originalCancelAnimationFrame = window.cancelAnimationFrame; window.requestAnimationFrame = (callback, options = {}) => { const priority = options.priority || 'low'; if (window.requestAnimationFrame.priority && priority !== 'low') { return originalRequestAnimationFrame(callback, { priority }); } else { switch (priority) { case 'low': return setTimeout(callback, 16); case 'normal': return originalRequestAnimationFrame(callback); case 'high': return requestAnimationFrame(() => { requestAnimationFrame(callback); }); default: return originalRequestAnimationFrame(callback); } } }; window.cancelAnimationFrame = originalCancelAnimationFrame; }; unlockFPS(); // Function to check if the background is light or dark function isLightBackground() { const backgroundColor = window.getComputedStyle(document.body).backgroundColor; const hsl = getHSLColor(backgroundColor); return hsl.l > 0.5; } // Function to convert RGB color to HSL function getHSLColor(color) { const rgb = color.match(/\d+/g).map(Number); const r = rgb[0] / 255; const g = rgb[1] / 255; const b = rgb[2] / 255; const max = Math.max(r, g, b); const min = Math.min(r, g, b); const delta = max - min; let h, s, l; if (delta === 0) { h = 0; } else if (max === r) { h = ((g - b) / delta) % 6; } else if (max === g) { h = (b - r) / delta + 2; } else { h = (r - g) / delta + 4; } h = Math.round(h * 60); if (h < 0) { h += 360; } l = (max + min) / 2; s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)); return { h, s, l }; } })();