Greasy Fork is available in English.

norg space to advance

useful keybinds for nestris puzzles

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         norg space to advance
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @description  useful keybinds for nestris puzzles
// @author       tyow
// @match        nestris.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nestris.org
// @grant        none
// @license      MIT
// ==/UserScript==

// add "//" to beginning of line 17 and remoe from line 18 to get the keybind to equal "a/A"

let retryKey = null
// let retryKey = "KeyA"

const RETRY = 1;
const NEXT = 2;


const click = (loc) => {

    let b = document.querySelectorAll(".new-puzzle-button");
    if (b) {
        b = b[loc]
        let child = b.childNodes[0]
        child.click()
    }
}

document.addEventListener('keydown', (e) => {
    if (window.location.pathname !== "/online/puzzle") return;

    if (retryKey != null && e.code == retryKey) {
        click(RETRY)
    }

    if (e.code == "Space") {
        click(e.shiftKey ? RETRY : NEXT)
    }
});