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