// Set finds to a list of keywords // finds = ["cat", "gopher"] let finds = null; function checkNames() { if (finds === null) return `finds = ["cat", "gopher", ...]`; const names = document.querySelectorAll('[name="tcd-rad"]'); for (let name of names) { for (let find of finds){ if (name.value.startsWith(`${find}-`) || name.value.endsWith(`-${find}.ts.net`)) return name.value; } } return null; } // When a keywords from finds is found, a confirmation appears // Esc/cancel to keep going // Enter/OK to stay on this roll to choose the found item async function nextFind() { let cat = null; const optBtn = document.querySelector('button.icon-parent:nth-child(3)'); while (true) { cat = checkNames(); if (cat !== null) { if (confirm(cat)) break; } optBtn.click(); await new Promise(r => setTimeout(r, 1000)); } } // Run in browser console with the re-roll modal open // await nextFind()