[GC] Neggsweeper: Right-Click to Unflag

Right click for flagging and unflagging.

目前為 2024-03-15 提交的版本,檢視 最新版本

// ==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.0
// @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==


(function() {
	'use strict';
	GM_addStyle(`
	.flagging img[src="https://grundoscafe.b-cdn.net/games/php_games/neggsweeper/negg.gif"]:hover {
		 content: url("https://grundoscafe.b-cdn.net/games/php_games/neggsweeper/flagnegg.gif")
	}
	#container {
    grid-template-areas:
        'top top aio'
        'side banner aio'
        'side content aio'
        'side event aio'
        'side footer aio';
	}
    #page_content {
    margin-top: 16.5px;
    }
    main > p.center:not(.medfont) {
    position: absolute;
    background: var(--bgcolor);
    top: 117px;
    right: 735px;
}`);


	$('#flag_it').on('change', () => {
		let flag = $('#flag_it').prop('checked');
		if (persistent)
			GM_setValue('flag', flag);

		if(flag) {
            $('#neggsweeper_grid').addClass('flagging');
            return;
		}
		$('#neggsweeper_grid').removeClass('flagging');
	});


	$('.bonus_negg').insertAfter('#neggsweeper_grid');

	$(document).keydown(function(e) {
        if (e.which == 88) //x
            $('#flag_it').click();
        if (e.which == 69) //e
            $('input.ns_start:nth-child(3)').click();
        if (e.which == 77) //m
            $('input.ns_start:nth-child(4)').click();
        if (e.which == 72) //h
            $('input.ns_start:nth-child(5)').click();
	});

})();