Make Upgradebar draggable.

Drag with right-click, upgrade with left click.

当前为 2021-04-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @namespace -
  3. // @grant none
  4. // @version 1.0.0
  5. // @author Stew#4055
  6. // @run-at document-start
  7. // @match *://moomoo.io/*
  8. // @match *://dev.moomoo.io/*
  9. // @match *://sandbox.moomoo.io/*
  10. // @supportURL https://discord.gg/G2gJFbx7GD
  11. // @name Make Upgradebar draggable.
  12. // @description Drag with right-click, upgrade with left click.
  13. // ==/UserScript==
  14.  
  15. class a {
  16. constructor() {
  17. $("body").on("contextmenu", function (e) {
  18. return false;
  19. });
  20. let e = document.getElementById("upgradeHolder");
  21. e.addEventListener("mousedown", function (t) {
  22. if (3 === t.which) {
  23. let o = t.clientX,
  24. i = t.clientY;
  25.  
  26. function n(t) {
  27. let n = o - t.clientX,
  28. l = i - t.clientY;
  29. const c = e.getBoundingClientRect();
  30. e.style.left = c.left - n + "px", e.style.top = c.top - l + "px", o = t.clientX, i = t.clientY
  31. }
  32. window.addEventListener("mousemove", n), window.addEventListener("mouseup", function e() {
  33. window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", e)
  34. })
  35. }
  36. })
  37. }
  38. }
  39. new a;