index.js 707 B

12345678910111213141516171819202122
  1. // Copyright 2019-2024 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. const WebviewWindow = window.__TAURI__.webview.WebviewWindow
  5. const routeSelect = document.querySelector('#route')
  6. const link = document.querySelector('#link')
  7. routeSelect.addEventListener('change', (event) => {
  8. link.href = event.target.value
  9. })
  10. document.querySelector('#go').addEventListener('click', () => {
  11. window.location.href = window.location.origin + '/' + routeSelect.value
  12. })
  13. document.querySelector('#open-window').addEventListener('click', () => {
  14. new WebviewWindow(Math.random().toString().replace('.', ''), {
  15. url: routeSelect.value
  16. })
  17. })