您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Works on any website. Shows fps, frame time, used memory. Changes by click
当前为
// ==UserScript== // @name Performance monitor // @description Works on any website. Shows fps, frame time, used memory. Changes by click // @name:ru Монитор производительности // @description:ru Работает на любом сайте. Отображает fps, время кадра, используемую память. Смена по клику // @version 1.0.0 // @author elivovciwbilkosivitceri // @namespace https://greasyfork.org/users/462954 // @include * // @grant none // @require https://cdn.jsdelivr.net/npm/[email protected] // @require https://cdn.jsdelivr.net/npm/[email protected] // ==/UserScript== /* jshint esversion: 6 */ /* eslint-disable no-undef */ (function() { 'use strict'; const stats = new Stats(); stats.dom.style.touchAction = 'none'; stats.dom.style.width = '80px'; stats.dom.style.height = '48px'; stats.dom.style.padding = 0; document.body.appendChild(stats.dom); interact(stats.dom).draggable({ // keep the element within the area of it's parent modifiers: [ interact.modifiers.restrictRect({ restriction: 'parent', endOnly: true }) ], listeners: { // call this function on every dragmove event move(event) { const target = event.target; // keep the dragged position in the data-x/data-y attributes const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx; const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; // translate the element target.style.webkitTransform = 'translate(' + x + 'px, ' + y + 'px)'; target.style.webkitTransform = target.style.transform; // update the position attributes target.setAttribute('data-x', x); target.setAttribute('data-y', y); }, // call this function on every dragend event end(event) { stats.showPanel(-1); } } }); requestAnimationFrame(function loop() { stats.update(); requestAnimationFrame(loop); }); })();