tailnet.js
Brut
// 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;
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()
1 | // Set finds to a list of keywords |
2 | // finds = ["cat", "gopher"] |
3 | let finds = null; |
4 | |
5 | function checkNames() { |
6 | if (finds === null) return `finds = ["cat", "gopher", ...]`; |
7 | const names = document.querySelectorAll('[name="tcd-rad"]'); |
8 | for (let name of names) { |
9 | for (let find of finds){ |
10 | if (name.value.endsWith(`-${find}.ts.net`) || name.value.startsWith(`${find}-`)) return name.value; |
11 | } |
12 | } |
13 | return null; |
14 | } |
15 | |
16 | // When a keywords from finds is found, a confirmation appears |
17 | // Esc/cancel to keep going |
18 | // Enter/OK to stay on this roll to choose the found item |
19 | async function nextFind() { |
20 | let cat = null; |
21 | const optBtn = document.querySelector('button.icon-parent:nth-child(3)'); |
22 | while (true) { |
23 | cat = checkNames(); |
24 | if (cat !== null) { |
25 | if (confirm(cat)) break; |
26 | } |
27 | optBtn.click(); |
28 | await new Promise(r => setTimeout(r, 1000)); |
29 | } |
30 | } |
31 | |
32 | // Run in browser console with the re-roll modal open |
33 | // await nextFind() |