IdlePixel Quick Fight Go Brrrrr

Adds space hotkey for "Collect Loot & Fight Again" button when quick fighting.

  1. // ==UserScript==
  2. // @name IdlePixel Quick Fight Go Brrrrr
  3. // @namespace com.anwinity.idlepixel
  4. // @version 1.0.0
  5. // @description Adds space hotkey for "Collect Loot & Fight Again" button when quick fighting.
  6. // @author Anwinity
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play*
  9. // @grant none
  10. // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. const IMAGE_URL = "https://cdn.idle-pixel.com/images/";
  17.  
  18. class QuickFightGoBrrrrrPlugin extends IdlePixelPlusPlugin {
  19. constructor() {
  20. super("quickfightgobrrrrr", {
  21. about: {
  22. name: GM_info.script.name,
  23. version: GM_info.script.version,
  24. author: GM_info.script.author,
  25. description: GM_info.script.description
  26. }
  27. });
  28. }
  29.  
  30. handleSpace(event) {
  31. const focused = document.activeElement;
  32. if(focused && (focused.tagName == 'INPUT' || focused.tagName == 'TEXTAREA' || focused.isContentEditable)) {
  33. return;
  34. }
  35.  
  36. const button = document.querySelector("#modal-loot.show button#modal-loot-collect-and-fight");
  37. if(!button) {
  38. return;
  39. }
  40. const computedButtonStyles = window.getComputedStyle(button);
  41. if(computedButtonStyles.display == "none" || computedButtonStyles.visibility == "hidden") {
  42. return;
  43. }
  44.  
  45. event.preventDefault();
  46. button.click();
  47. }
  48.  
  49. onLogin() {
  50. document.addEventListener("keydown", (event) => {
  51. if(event.key === " ") {
  52. this.handleSpace(event);
  53. }
  54. });
  55. }
  56. }
  57.  
  58. const plugin = new QuickFightGoBrrrrrPlugin();
  59. IdlePixelPlus.registerPlugin(plugin);
  60.  
  61. })();

QingJ © 2025

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