Skip to content

Instantly share code, notes, and snippets.

@wilhelm-murdoch
Last active October 31, 2025 12:44
Show Gist options
  • Select an option

  • Save wilhelm-murdoch/6965a9cf9a36c9067745d9f53fe8cc4c to your computer and use it in GitHub Desktop.

Select an option

Save wilhelm-murdoch/6965a9cf9a36c9067745d9f53fe8cc4c to your computer and use it in GitHub Desktop.
let clickerInterval = null;
const targetText = "Start session";
const intervalMs = 10000;
const REFRESH_STORAGE_KEY = 'autoClickerRefreshPending';
function attemptClick() {
const buttons = document.querySelectorAll('button');
for (const button of buttons) {
if (button.textContent.trim() === targetText) {
console.log(`[AutoClicker] Found button with text "${targetText}". Clicking now. The watch will continue.`);
button.click();
return;
}
}
console.log(`[AutoClicker] Button not found. Retrying in ${intervalMs / 1000} second(s).`);
}
function startSessionClicker() {
if (clickerInterval) {
console.warn("[AutoClicker] Clicker is already running. Stop it first using stopSessionClicker().");
return;
}
console.log(`[AutoClicker] Starting CONTINUOUS watch for button "${targetText}" every ${intervalMs}ms.`);
clickerInterval = setInterval(attemptClick, intervalMs);
}
function stopSessionClicker() {
if (clickerInterval) {
clearInterval(clickerInterval);
clickerInterval = null;
console.log("[AutoClicker] Clicker STOPPED explicitly.");
localStorage.removeItem(REFRESH_STORAGE_KEY);
return true;
} else {
console.log("[AutoClicker] Clicker is not currently running.");
return false;
}
}
function refreshAndWatch() {
console.log(`[AutoClicker] Preparing to refresh page and restart CONTINUOUS watch mode.`);
stopSessionClicker();
localStorage.setItem(REFRESH_STORAGE_KEY, 'true');
console.log('[AutoClicker] Reloading page now...');
location.reload();
}
function checkRefreshPersistence() {
if (localStorage.getItem(REFRESH_STORAGE_KEY) === 'true') {
localStorage.removeItem(REFRESH_STORAGE_KEY);
console.log("[AutoClicker] Detected pending refresh state. Automatically starting clicker watch.");
startSessionClicker();
}
}
console.log("--- Session Auto-Clicker Utility Loaded ---");
console.log(`Watch Interval: ${intervalMs / 1000} seconds. This script runs continuously until stopped.`);
console.log(`Call \`startSessionClicker()\` to start watching immediately.`);
console.log(`Call \`refreshAndWatch()\` to refresh the page and then automatically start watching.`);
console.log(`Call \`stopSessionClicker()\` to manually stop the process and clear all flags.`);
checkRefreshPersistence();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment