// 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.endsWith(`-${find}.ts.net`) || name.value.startsWith(`${find}-`)) 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; while (true) { cat = checkNames(); if (cat !== null) { if (confirm(cat)) break; } optBtn.click(); await new Promise(r => setTimeout(r, 1000)); } } // await nextFind()