vendor/github.com/go-rod/rod/lib/assets/monitor.html

53 lines · 1100 bytes

 1<html>
 2  <head>
 3    <title>Rod Monitor - Pages</title>
 4    <style>
 5      body {
 6        margin: 0;
 7        background: #2d2c2f;
 8        color: white;
 9        padding: 20px;
10        font-family: sans-serif;
11      }
12      a {
13        color: white;
14        padding: 1em;
15        margin: 0.5em 0;
16        font-size: 1em;
17        text-decoration: none;
18        display: block;
19        border-radius: 0.3em;
20        border: 1px solid transparent;
21        background: #212225;
22      }
23      a:visited {
24        color: #c3c3c3;
25      }
26      a:hover {
27        background: #25272d;
28        border-color: #8d8d96;
29      }
30    </style>
31  </head>
32  <body>
33    <h3>Choose a Page to Monitor</h3>
34
35    <div id="targets"></div>
36
37    <script>
38      async function update() {
39        const list = await (await fetch('/api/pages')).json()
40        let html = ''
41        list.forEach((el) => {
42          html += `<a href='/page/${el.targetId}' title="${el.url}">${el.title}</a>`
43        })
44
45        window.targets.innerHTML = html
46
47        setTimeout(update, 1000)
48      }
49
50      update()
51    </script>
52  </body>
53</html>