button_masher_script_for_immich_dup_finder
(function() { const buttonLabelPattern = /^Trash \d+$/; const interval = 1000; const checkInterval = 500; let clickIntervalId = null; let checkTimeoutId = null; function clickButton() { const buttons = document.querySelectorAll('button'); for (let button of buttons) { if (button.innerText.trim().match(buttonLabelPattern)) { button.click(); console.log(`Button "${button.innerText.trim()}" pressed`); return; } } console.warn(`button not found`); } function waitForButton() { const buttons = document.querySelectorAll('button'); for (let button of buttons) { if (button.innerText.trim().match(buttonLabelPattern)) { console.log(`Button "${button.innerText.trim()}" found! clicking...`); clickIntervalId = setInterval(clickButton, interval); return; } } console.log(`Waiting for trash button...`); checkTimeoutId = setTimeout(waitForButton, checkInterval); } waitForButton(); window.stopSpamming = function() { if (clickIntervalId !== null) { clearInterval(clickIntervalId); console.log("Stopped clicking..."); } if (checkTimeoutId !== null) { clearTimeout(checkTimeoutId); console.log("Stopped checking..."); } }; })();
button_masher_script_for_immich_dup_finder.txt · Last modified: 2025/03/08 21:31 by 192.168.1.82