|
306 | 306 | <input class="input" id="navUrl" placeholder="https://example.com" /> |
307 | 307 | <button class="btn" id="navGo">Go</button> |
308 | 308 | <button class="btn" id="navReload">Reload</button> |
309 | | - <button class="btn" id="navNewTab">New tab</button> |
310 | 309 | </div> |
311 | 310 | <div class="actions"> |
312 | 311 | <button class="btn" id="addOpenBtn">Add new</button> |
|
373 | 372 | const navUrlEl = shadow.getElementById('navUrl'); |
374 | 373 | const navGoBtn = shadow.getElementById('navGo'); |
375 | 374 | const navReloadBtn = shadow.getElementById('navReload'); |
376 | | - const navNewTabBtn = shadow.getElementById('navNewTab'); |
377 | 375 | const hintTextEl = shadow.getElementById('hintText'); |
378 | 376 |
|
379 | 377 | function toast(msg, opts = {}) { |
|
651 | 649 | localStorage.setItem('wplace-auto-load-manager', 'true'); |
652 | 650 | window.location.reload(); |
653 | 651 | }); |
654 | | - navNewTabBtn.addEventListener('click', () => { |
655 | | - const u = navUrlEl.value.trim(); |
656 | | - if (!u) { |
657 | | - toast('Enter a URL first', { danger: true }); |
658 | | - return; |
659 | | - } |
660 | | - try { |
661 | | - // Validate URL |
662 | | - new URL(u, location.href); |
663 | | - const newTab = window.open(u, '_blank'); |
664 | | - if (!newTab) { |
665 | | - toast('Popup blocked. Please allow popups for this site.', { |
666 | | - danger: true, |
667 | | - }); |
668 | | - } else { |
669 | | - toast('Opened in new tab'); |
670 | | - } |
671 | | - } catch { |
672 | | - toast('Please enter a valid URL', { danger: true }); |
673 | | - } |
674 | | - }); |
675 | 652 |
|
676 | 653 | function submitForm(runAfter) { |
677 | 654 | const id = editingIdInput.value.trim(); |
|
0 commit comments