// ==UserScript== // @name FPS显示 // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description FPS显示 旨在为移动端设备提供实时的帧率 (FPS) 显示。该脚本在页面的固定位置创建一个半透明的显示框,实时更新并展示当前页面的帧率信息。 // @license MIT // @author zzzwq // @match http://*/* // @match https://*/* // @grant none // ==/UserScript== (function() { 'use strict'; var bzyfps; if (!document.getElementById("fps")) { bzyfps = document.createElement("span"); bzyfps.id = "fps"; bzyfps.innerHTML = "fps:0"; bzyfps.style.cssText = "text-align:center !important;font-size:15px;width:60px;height:28px;line-height:28px;text-align:center;float:right;position:fixed;right:10px;top:10px;color:#9370DB;background:transparent;cursor:pointer;z-index:999999999;box-shadow:0px 0px 10px #888;border-radius:10%;-webkit-tap-highlight-color:transparent;user-select:none"; // 修改: 确保点击穿透 bzyfps.style.pointerEvents = 'none'; document.body.appendChild(bzyfps); } var showFPS = function() { var t, n, e, o, i, p = window.webkitRequestAnimationFrame || function(t) { window.setTimeout(t, 1e3 / 60); }; return ( (t = 0), (n = Date.now()), (o = function() { (e = Date.now() - n), t += 1, e >= 1e3 && ((n += e), i(t), (t = 0)), p(o); }), (i = function(t) { bzyfps.innerHTML = "fps:" + t; }), { setParentElementId: function(t) { t; }, go: function() { o(); } } ); }(); showFPS.go(); // 修改: 移除显示/隐藏逻辑,确保FPS显示框常驻显示 bzyfps.style.display = 'block'; })();