diff --git a/web/static/numerus.js b/web/static/numerus.js index 4b778a3..ec8edf3 100644 --- a/web/static/numerus.js +++ b/web/static/numerus.js @@ -401,6 +401,7 @@ class Tags extends HTMLDivElement { customElements.define('numerus-multiselect', Multiselect, {extends: 'div'}); customElements.define('numerus-tags', Tags, {extends: 'div'}); +let savedTitle = ''; htmx.onLoad((target) => { if (target.tagName === 'DIALOG') { @@ -408,6 +409,8 @@ htmx.onLoad((target) => { for (const detail of details) { detail.removeAttribute('open'); } + savedTitle = document.title; + document.title = target.querySelector('h2').textContent + ' — ' + savedTitle.substring(savedTitle.indexOf("—") + 1); target.showModal(); const button = target.querySelector('.close-dialog'); if (button) { @@ -425,6 +428,7 @@ htmx.on('closeModal', () => { } openDialog.close(); openDialog.remove(); + document.title = savedTitle; }); htmx.on(document, 'alpine:init', () => {