MooMoo.io Show FPS

Display FPS

  1. // ==UserScript==
  2. // @name MooMoo.io Show FPS
  3. // @description Display FPS
  4. // @author KOOKY WARRIOR
  5. // @match *://*.moomoo.io/*
  6. // @icon https://moomoo.io/img/favicon.png?v=1
  7. // @require https://cdnjs.cloudflare.com/ajax/libs/msgpack-lite/0.1.26/msgpack.min.js
  8. // @run-at document-start
  9. // @grant unsafeWindow
  10. // @license MIT
  11. // @version 0.4
  12. // @namespace https://gf.qytechs.cn/users/999838
  13. // ==/UserScript==
  14.  
  15. ;(() => {
  16. unsafeWindow.showFPS = true
  17.  
  18. let pingDisplay = null
  19. const fps = document.createElement("div")
  20. unsafeWindow.addEventListener("DOMContentLoaded", () => {
  21. const style = document.createElement("style")
  22. style.innerHTML = `
  23. #pingAndFPSContainer {
  24. position: absolute;
  25. top: 20px;
  26. left: 50%;
  27. transform: translateX(-50%);
  28. display: flex;
  29. color: white;
  30. }
  31. #pingDisplay {
  32. position: initial !important;
  33. transform: none !important;
  34. margin-right: 10px;
  35. }`
  36. document.head.appendChild(style)
  37.  
  38. pingDisplay = document.getElementById("pingDisplay")
  39.  
  40. const container = document.createElement("div")
  41. container.id = "pingAndFPSContainer"
  42. container.appendChild(pingDisplay)
  43.  
  44. fps.id = "fps"
  45. container.appendChild(fps)
  46. document.body.appendChild(container)
  47. })
  48.  
  49. function update() {
  50. const updateDelay = 500
  51. let lastFpsUpdate = 0
  52. let frames = 0
  53. function updateFPS() {
  54. let now = Date.now()
  55. let elapsed = now - lastFpsUpdate
  56. if (elapsed < updateDelay) {
  57. ++frames
  58. } else {
  59. fps.innerText = `Fps: ${Math.round(frames / (elapsed / 1000))}`
  60. frames = 0
  61. lastFpsUpdate = now
  62. }
  63. unsafeWindow.requestAnimationFrame(updateFPS)
  64. }
  65. lastFpsUpdate = Date.now()
  66. unsafeWindow.requestAnimationFrame(updateFPS)
  67. }
  68. update()
  69. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址