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.

Revisions

  1. wilhelm-murdoch revised this gist Oct 31, 2025. 1 changed file with 6 additions and 34 deletions.
    40 changes: 6 additions & 34 deletions clicker.js
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,17 @@
    let clickerInterval = null;
    const targetText = "Start session";
    const intervalMs = 10000;
    const REFRESH_STORAGE_KEY = 'autoClickerRefreshPending';
    const intervalMs = 30000;

    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.`);
    console.log(`[AutoClicker] Found button with text "${targetText}". Clicking now...`);
    button.click();
    return;
    return;
    }
    }

    console.log(`[AutoClicker] Button not found. Retrying in ${intervalMs / 1000} second(s).`);
    }

    @@ -22,44 +20,18 @@ function startSessionClicker() {
    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.`);
    console.log(`[AutoClicker] Starting to 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;
    console.log("[AutoClicker] Clicker stopped.");
    } 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();
    startSessionClicker();
  2. wilhelm-murdoch revised this gist Oct 31, 2025. 1 changed file with 30 additions and 6 deletions.
    36 changes: 30 additions & 6 deletions clicker.js
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,19 @@
    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...`);
    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).`);
    }

    @@ -20,22 +22,44 @@ function startSessionClicker() {
    console.warn("[AutoClicker] Clicker is already running. Stop it first using stopSessionClicker().");
    return;
    }
    console.log(`[AutoClicker] Starting to watch for button "${targetText}" every ${intervalMs}ms.`);

    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.");
    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(`Call \`startSessionClicker()\` to begin watching for the button "${targetText}".`);
    console.log(`Call \`stopSessionClicker()\` to manually stop the process.`);
    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.`);

    startSessionClicker();
    checkRefreshPersistence();
  3. wilhelm-murdoch revised this gist Oct 31, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion clicker.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    let clickerInterval = null;
    const targetText = "Start session";
    const intervalMs = 1000;
    const intervalMs = 10000;

    function attemptClick() {
    const buttons = document.querySelectorAll('button');
  4. wilhelm-murdoch revised this gist Oct 31, 2025. 1 changed file with 1 addition and 25 deletions.
    26 changes: 1 addition & 25 deletions clicker.js
    Original file line number Diff line number Diff line change
    @@ -1,51 +1,29 @@
    // --- Session Auto-Clicker Utility ---
    // This script is designed to run in the browser's Developer Tools Console.
    // It searches for a button with the exact text content "Start session" every second (1000ms).

    let clickerInterval = null;
    const targetText = "Start session";
    const intervalMs = 1000;

    /**
    * Searches the DOM for a button with the target text content and clicks it.
    * Stops the interval upon a successful click to prevent unintended multiple actions.
    */
    function attemptClick() {
    // Look for all button elements on the page
    const buttons = document.querySelectorAll('button');

    // Iterate over the buttons to find the one with the exact text
    for (const button of buttons) {
    // Use trim() to handle potential leading/trailing whitespace
    if (button.textContent.trim() === targetText) {
    console.log(`[AutoClicker] Found button with text "${targetText}". Clicking now...`);
    // Simulate a click event
    button.click();

    // Stop the clicker after a successful interaction
    stopSessionClicker();
    return; // Exit the function after the click
    return;
    }
    }
    console.log(`[AutoClicker] Button not found. Retrying in ${intervalMs / 1000} second(s).`);
    }

    /**
    * Starts the interval to check for the button every second.
    */
    function startSessionClicker() {
    if (clickerInterval) {
    console.warn("[AutoClicker] Clicker is already running. Stop it first using stopSessionClicker().");
    return;
    }
    console.log(`[AutoClicker] Starting to watch for button "${targetText}" every ${intervalMs}ms.`);
    // Set up the interval timer
    clickerInterval = setInterval(attemptClick, intervalMs);
    }

    /**
    * Stops the running interval.
    */
    function stopSessionClicker() {
    if (clickerInterval) {
    clearInterval(clickerInterval);
    @@ -56,10 +34,8 @@ function stopSessionClicker() {
    }
    }

    // --- INITIALIZATION ---
    console.log("--- Session Auto-Clicker Utility Loaded ---");
    console.log(`Call \`startSessionClicker()\` to begin watching for the button "${targetText}".`);
    console.log(`Call \`stopSessionClicker()\` to manually stop the process.`);

    // Automatically start the utility for convenience
    startSessionClicker();
  5. wilhelm-murdoch created this gist Oct 31, 2025.
    65 changes: 65 additions & 0 deletions clicker.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    // --- Session Auto-Clicker Utility ---
    // This script is designed to run in the browser's Developer Tools Console.
    // It searches for a button with the exact text content "Start session" every second (1000ms).

    let clickerInterval = null;
    const targetText = "Start session";
    const intervalMs = 1000;

    /**
    * Searches the DOM for a button with the target text content and clicks it.
    * Stops the interval upon a successful click to prevent unintended multiple actions.
    */
    function attemptClick() {
    // Look for all button elements on the page
    const buttons = document.querySelectorAll('button');

    // Iterate over the buttons to find the one with the exact text
    for (const button of buttons) {
    // Use trim() to handle potential leading/trailing whitespace
    if (button.textContent.trim() === targetText) {
    console.log(`[AutoClicker] Found button with text "${targetText}". Clicking now...`);
    // Simulate a click event
    button.click();

    // Stop the clicker after a successful interaction
    stopSessionClicker();
    return; // Exit the function after the click
    }
    }
    console.log(`[AutoClicker] Button not found. Retrying in ${intervalMs / 1000} second(s).`);
    }

    /**
    * Starts the interval to check for the button every second.
    */
    function startSessionClicker() {
    if (clickerInterval) {
    console.warn("[AutoClicker] Clicker is already running. Stop it first using stopSessionClicker().");
    return;
    }
    console.log(`[AutoClicker] Starting to watch for button "${targetText}" every ${intervalMs}ms.`);
    // Set up the interval timer
    clickerInterval = setInterval(attemptClick, intervalMs);
    }

    /**
    * Stops the running interval.
    */
    function stopSessionClicker() {
    if (clickerInterval) {
    clearInterval(clickerInterval);
    clickerInterval = null;
    console.log("[AutoClicker] Clicker stopped.");
    } else {
    console.log("[AutoClicker] Clicker is not currently running.");
    }
    }

    // --- INITIALIZATION ---
    console.log("--- Session Auto-Clicker Utility Loaded ---");
    console.log(`Call \`startSessionClicker()\` to begin watching for the button "${targetText}".`);
    console.log(`Call \`stopSessionClicker()\` to manually stop the process.`);

    // Automatically start the utility for convenience
    startSessionClicker();