// Set finds to a list of keywords // finds = ["cat", "gopher"] let finds = null; function checkNames() { if (finds === null) return "honk!"; 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; } async function nextCat() { let cat = null; while (true) { cat = checkNames(); if (cat !== null) { if (confirm(cat)) break; } optBtn.click(); await new Promise(r => setTimeout(r, 1000)); } }