[GC] Neggsweeper: Right-Click to Unflag

Right click for flagging and unflagging.

目前为 2024-03-15 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name [GC] Neggsweeper: Right-Click to Unflag
  3. // @namespace https://gf.qytechs.cn/en/users/1225524-kaitlin
  4. // @match https://www.grundos.cafe/games/neggsweeper/*
  5. // @grant none
  6. // @license MIT
  7. // @version 1.1
  8. // @author Cupkait
  9. // @icon https://i.imgur.com/4Hm2e6z.png
  10. // @description Right click for flagging and unflagging.
  11.  
  12. // @description Note: Approved by GC devs in ticket #3839.
  13.  
  14. // ==/UserScript==
  15. // Disables the normal right-click menu and instead when you right click
  16. // a negg it flags it and leaves you ready to either reveal a negg or right
  17. // click the next without having to toggle flagging back and forth.
  18. const flagtext = document.querySelector('.center.medfont');
  19. const container = document.getElementById('neggsweeper_status');
  20.  
  21. // Hides the flag column/checkbox since right-click is enabled to prevent confusion.
  22. container.children[1].style.display = 'none';
  23. container.children[4].style.display = 'none';
  24. container.style.gridTemplateColumns = '50% 50%';
  25.  
  26. // Changes flag info text for clarity.
  27. flagtext.textContent = 'Right-click on a negg to flag it or unflag it.';
  28. flagtext.style.cssText = 'font-size: 18px; font-weight: bold; color: blue;';
  29.  
  30. // Right clicking a negg will enable the flagging and click the element you right-clicked.
  31. // Grid is set to not persist after page load so you can seamlessly continue with left or right clicking.
  32. document.addEventListener('contextmenu', async function(event) {
  33. event.preventDefault();
  34. document.getElementById('flag_it').click();
  35. document.getElementById('persist').value = 'false';
  36. event.target.click();
  37. });

QingJ © 2025

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