Skip to content

Instantly share code, notes, and snippets.

@brubsby
Last active December 14, 2025 19:39
Show Gist options
  • Select an option

  • Save brubsby/4b44a52dade6c26e31b0c9a9cf59ccea to your computer and use it in GitHub Desktop.

Select an option

Save brubsby/4b44a52dade6c26e31b0c9a9cf59ccea to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name rustfinity smart hotkey
// @namespace https://www.rustfinity.com/
// @version 0.9
// @description Ctrl+Enter flow: Next Challenge -> Submit (if enabled) -> Run
// @match *://rustfinity.com/*
// @match *://www.rustfinity.com/*
// @updateURL https://gist.github.com/brubsby/4b44a52dade6c26e31b0c9a9cf59ccea/raw/rustfinity-hotkeys.user.js
// @downloadURL https://gist.github.com/brubsby/4b44a52dade6c26e31b0c9a9cf59ccea/raw/rustfinity-hotkeys.user.js
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
// Selectors for Icon-based buttons
const runSelector = 'button:has(> svg.lucide-play)';
const submitSelector = 'button:has(> svg.lucide-circle-check-big)';
document.addEventListener('keydown', (event) => {
// Only trigger on Ctrl + Enter
if (event.ctrlKey && event.code === 'Enter') {
event.preventDefault();
event.stopImmediatePropagation();
// 1. Find "Next Challenge" button by text content
// We scan all buttons because it's safer than guessing the class names
const allButtons = Array.from(document.querySelectorAll('button'));
const nextBtn = allButtons.find(b => b.textContent.includes("Next Challenge"));
// 2. Find the Icon buttons
const submitBtn = document.querySelector(submitSelector);
const runBtn = document.querySelector(runSelector);
// --- PRIORITY LOGIC ---
// PRIORITY 1: Next Challenge
if (nextBtn) {
nextBtn.click();
console.log('Rustfinity Hotkeys: Moving to Next Challenge!');
return; // Stop here
}
// PRIORITY 2: Submit (Only if enabled)
if (submitBtn && !submitBtn.disabled) {
submitBtn.click();
console.log('Rustfinity Hotkeys: Submitted!');
return; // Stop here
}
// PRIORITY 3: Run (Default)
if (runBtn) {
runBtn.click();
console.log('Rustfinity Hotkeys: Running code...');
} else {
console.warn('Rustfinity Hotkeys: No relevant buttons found.');
}
}
}, true);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment