🏠 返回首頁 

Greasy Fork is available in English.

[GC] Neggsweeper: Right-Click to Unflag

Right click for flagging and unflagging.

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