|
3 | 3 | <head> |
4 | 4 | <meta charset="UTF-8"> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | | - <title>Vision Browser</title> |
| 6 | + <title>Vision</title> |
7 | 7 | <script src="https://cdn.tailwindcss.com"></script> |
8 | 8 | <style> |
9 | 9 | :root { |
10 | | - --bg: #000000; |
11 | | - --nav-bg: #0d0d0d; |
12 | | - --tab-active: #0d0d0d; |
| 10 | + --bg: #0a0a0a; |
| 11 | + --nav-bg: #0f0f0f; |
| 12 | + --tab-active: #0f0f0f; |
13 | 13 | --text-main: #ffffff; |
14 | | - --text-dim: #555555; |
15 | | - --border: rgba(255, 255, 255, 0.04); |
| 14 | + --text-dim: #777777; |
| 15 | + --border: rgba(255, 255, 255, 0.06); |
| 16 | + --input-gray: #121212; |
16 | 17 | } |
17 | 18 |
|
18 | 19 | body { |
|
60 | 61 | border-radius: 10px 10px 0 0; |
61 | 62 | } |
62 | 63 |
|
63 | | - .tab:hover { color: #888; } |
| 64 | + .tab:hover { color: #aaa; } |
64 | 65 |
|
65 | 66 | .tab.active { |
66 | 67 | background: var(--tab-active); |
|
145 | 146 | align-items: center; |
146 | 147 | justify-content: center; |
147 | 148 | border-radius: 6px; |
148 | | - color: #444; |
| 149 | + color: #555; |
149 | 150 | transition: all 0.2s; |
150 | 151 | } |
151 | 152 |
|
152 | 153 | .nav-btn:hover { background: rgba(255,255,255,0.05); color: #fff; } |
153 | 154 |
|
154 | 155 | .address-box { |
155 | 156 | position: relative; |
156 | | - width: 720px; |
| 157 | + width: 950px; |
157 | 158 | margin: 0 auto; |
158 | 159 | } |
159 | 160 |
|
160 | 161 | .address-bar { |
161 | 162 | width: 100%; |
162 | 163 | height: 32px; |
163 | | - background: #050505; |
| 164 | + background: var(--input-gray); |
164 | 165 | border: 1px solid var(--border); |
165 | 166 | border-radius: 16px; |
166 | 167 | padding: 0 32px; |
|
172 | 173 | } |
173 | 174 |
|
174 | 175 | .address-bar:focus { |
175 | | - border-color: #333; |
| 176 | + border-color: #444; |
176 | 177 | color: #fff; |
177 | | - background: #000; |
| 178 | + background: #1a1a1a; |
178 | 179 | } |
179 | 180 |
|
180 | 181 | .address-icon { |
181 | 182 | position: absolute; |
182 | 183 | left: 12px; |
183 | 184 | top: 50%; |
184 | 185 | transform: translateY(-50%); |
185 | | - color: #333; |
| 186 | + color: #444; |
186 | 187 | } |
187 | 188 |
|
188 | 189 | .viewport { |
|
211 | 212 | justify-content: center; |
212 | 213 | margin-bottom: 6px; |
213 | 214 | margin-left: 20px; |
214 | | - color: #333; |
| 215 | + color: #444; |
215 | 216 | border-radius: 4px; |
216 | 217 | transition: all 0.2s; |
217 | 218 | } |
|
238 | 239 | <div class="address-icon"> |
239 | 240 | <svg width="12" height="12" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg> |
240 | 241 | </div> |
241 | | - <input type="text" id="address-input" class="address-bar" placeholder="Search with Vision or type a URL" autocomplete="off" spellcheck="false"> |
| 242 | + <input type="text" id="address-input" class="address-bar" placeholder="Search Vision" autocomplete="off" spellcheck="false"> |
242 | 243 | </div> |
243 | | - |
244 | 244 | <div style="width: 100px;"></div> |
245 | 245 | </div> |
246 | 246 |
|
|
263 | 263 | const val = input.trim(); |
264 | 264 | if (!val) return 'newtab.html'; |
265 | 265 |
|
266 | | - if (val.startsWith('http://') || val.startsWith('https://')) { |
| 266 | + if (val.startsWith('https://')) { |
| 267 | + return `/active/embed.html?url=${val}`; |
| 268 | + } else if (val.startsWith('http://')) { |
267 | 269 | return `/active/embed.html?url=${val}`; |
268 | 270 | } else if (val.includes('.') && !val.includes(' ')) { |
269 | 271 | return `/active/embed.html?url=https://${val}`; |
|
274 | 276 |
|
275 | 277 | function getDisplayUrl(url) { |
276 | 278 | if (url === 'newtab.html') return ''; |
277 | | - if (url.includes('url=https://')) { |
278 | | - return decodeURIComponent(url.split('url=https://')[1]); |
279 | | - } |
| 279 | + let target = url; |
280 | 280 | if (url.includes('url=')) { |
281 | | - return decodeURIComponent(url.split('url=')[1]); |
| 281 | + target = decodeURIComponent(url.split('url=')[1]); |
282 | 282 | } |
283 | | - return url; |
| 283 | + return target.replace(/^https?:\/\//, ''); |
284 | 284 | } |
285 | 285 |
|
286 | 286 | function extractDomain(url) { |
287 | 287 | try { |
288 | | - const target = url.includes('url=') ? decodeURIComponent(url.split('url=')[1]) : url; |
| 288 | + let target = url; |
| 289 | + if (url.includes('url=')) { |
| 290 | + target = decodeURIComponent(url.split('url=')[1]); |
| 291 | + } |
289 | 292 | if (!target.startsWith('http')) return 'google.com'; |
290 | 293 | return new URL(target).hostname; |
291 | 294 | } catch (e) { return 'google.com'; } |
|
370 | 373 | const currentTab = tabs.find(t => t.id === activeTabId); |
371 | 374 |
|
372 | 375 | currentTab.url = resolved; |
373 | | - currentTab.title = getDisplayUrl(resolved) || 'Loading...'; |
| 376 | + currentTab.title = getDisplayUrl(resolved) || 'Vision'; |
374 | 377 | currentTab.favicon = FAVICON_SERVICE + extractDomain(resolved); |
375 | 378 |
|
376 | 379 | document.getElementById(`iframe-${activeTabId}`).src = resolved; |
|
390 | 393 | if (e.data && e.data.type === 'meta-update') { |
391 | 394 | const t = tabs.find(x => x.id === activeTabId); |
392 | 395 | if (t) { |
393 | | - t.title = e.data.title || t.title; |
| 396 | + if (e.data.title) t.title = e.data.title; |
394 | 397 | if (e.data.url) { |
395 | 398 | t.url = e.data.url; |
396 | 399 | addressInput.value = getDisplayUrl(t.url); |
397 | 400 | } |
398 | | - t.favicon = FAVICON_SERVICE + extractDomain(t.url); |
| 401 | + t.favicon = FAVICON_SERVICE + extractDomain(t.url || ''); |
399 | 402 | renderTabs(); |
400 | 403 | } |
401 | 404 | } |
|
0 commit comments