vendor/github.com/go-rod/rod/lib/assets/assets.go
189 lines · 5365 bytes
1// Package assets is generated by "lib/assets/generate"
2package assets
3
4// MousePointer for rod.
5const MousePointer = `<?xml version="1.0" encoding="UTF-8"?>
6<svg width="277px" height="401px" viewBox="0 0 277 401" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
7 <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
8 <title>mouse-pointer</title>
9 <desc>Created with Sketch.</desc>
10 <defs>
11 <polygon id="path-1" points="0 0 0 299 60 241 103 341 170 313 130 218 217 216"></polygon>
12 <filter x="-24.2%" y="-11.0%" width="148.4%" height="130.8%" filterUnits="objectBoundingBox" id="filter-2">
13 <feOffset dx="0" dy="15" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
14 <feGaussianBlur stdDeviation="15" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
15 <feColorMatrix values="0 0 0 0 0.138818027 0 0 0 0 0.138818027 0 0 0 0 0.138818027 0 0 0 0.502660779 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
16 </filter>
17 </defs>
18 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
19 <g id="mouse-pointer" transform="translate(30.000000, 15.000000)">
20 <g id="outside">
21 <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
22 <use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-1"></use>
23 </g>
24 <polygon id="inside" fill="#000000" points="18 44 18 255 66 207 110 313 145 299 102 198 171 197"></polygon>
25 </g>
26 </g>
27</svg>`
28
29// Monitor for rod.
30const Monitor = `<html>
31 <head>
32 <title>Rod Monitor - Pages</title>
33 <style>
34 body {
35 margin: 0;
36 background: #2d2c2f;
37 color: white;
38 padding: 20px;
39 font-family: sans-serif;
40 }
41 a {
42 color: white;
43 padding: 1em;
44 margin: 0.5em 0;
45 font-size: 1em;
46 text-decoration: none;
47 display: block;
48 border-radius: 0.3em;
49 border: 1px solid transparent;
50 background: #212225;
51 }
52 a:visited {
53 color: #c3c3c3;
54 }
55 a:hover {
56 background: #25272d;
57 border-color: #8d8d96;
58 }
59 </style>
60 </head>
61 <body>
62 <h3>Choose a Page to Monitor</h3>
63
64 <div id="targets"></div>
65
66 <script>
67 async function update() {
68 const list = await (await fetch('/api/pages')).json()
69 let html = ''
70 list.forEach((el) => {
71 html += ` + "`" + `<a href='/page/${el.targetId}' title="${el.url}">${el.title}</a>` + "`" + `
72 })
73
74 window.targets.innerHTML = html
75
76 setTimeout(update, 1000)
77 }
78
79 update()
80 </script>
81 </body>
82</html>
83`
84
85// MonitorPage for rod.
86const MonitorPage = `<html>
87 <head>
88 <style>
89 body {
90 margin: 0;
91 background: #2d2c2f;
92 color: #ffffff;
93 }
94 .navbar {
95 font-family: sans-serif;
96 border-bottom: 1px solid #1413158c;
97 display: flex;
98 flex-direction: row;
99 }
100 .error {
101 color: #ff3f3f;
102 background: #3e1f1f;
103 border-bottom: 1px solid #1413158c;
104 display: none;
105 padding: 10px;
106 margin: 0;
107 }
108 input {
109 background: transparent;
110 color: white;
111 border: none;
112 border: 1px solid #4f475a;
113 border-radius: 3px;
114 padding: 5px;
115 margin: 5px;
116 }
117 .title {
118 flex: 2;
119 }
120 .url {
121 flex: 5;
122 }
123 .rate {
124 flex: 1;
125 }
126 </style>
127 </head>
128 <body>
129 <div class="navbar">
130 <input
131 type="text"
132 class="title"
133 title="title of the remote page"
134 readonly
135 />
136 <input type="text" class="url" title="url of the remote page" readonly />
137 <input
138 type="number"
139 class="rate"
140 value="0.5"
141 min="0"
142 step="0.1"
143 title="refresh rate (second)"
144 />
145 </div>
146 <pre class="error"></pre>
147 <img class="screen" />
148 </body>
149 <script>
150 const id = location.pathname.split('/').slice(-1)[0]
151 const elImg = document.querySelector('.screen')
152 const elTitle = document.querySelector('.title')
153 const elUrl = document.querySelector('.url')
154 const elRate = document.querySelector('.rate')
155 const elErr = document.querySelector('.error')
156
157 document.title = ` + "`" + `Rod Monitor - ${id}` + "`" + `
158
159 async function update() {
160 const res = await fetch(` + "`" + `/api/page/${id}` + "`" + `)
161 const info = await res.json()
162 elTitle.value = info.title
163 elUrl.value = info.url
164
165 await new Promise((resolve, reject) => {
166 const now = new Date()
167 elImg.src = ` + "`" + `/screenshot/${id}?t=${now.getTime()}` + "`" + `
168 elImg.style.maxWidth = innerWidth + 'px'
169 elImg.onload = resolve
170 elImg.onerror = () => reject(new Error('error loading screenshots'))
171 })
172 }
173
174 async function mainLoop() {
175 try {
176 await update()
177 elErr.attributeStyleMap.delete('display')
178 } catch (err) {
179 elErr.style.display = 'block'
180 elErr.textContent = err + ''
181 }
182
183 setTimeout(mainLoop, parseFloat(elRate.value) * 1000)
184 }
185
186 mainLoop()
187 </script>
188</html>
189`