// Delegated event handlers extracted from inline on* attributes in the // dashboard, dashboard editor, embed, and wizard templates, moved here for CSP // compliance (so script-src can drop 'unsafe-inline'). The dispatcher in // the core module invokes each of these by name with `this` bound to the dispatching // element and any data-arg/data-arg2 attributes passed as arguments. Bodies // are preserved verbatim from the original inline handlers. // setActiveTab is defined in the core module and takes the clicked button as its // argument; the inline handlers called setActiveTab(this), so wrap it. window.onSetActiveTab = function () { setActiveTab(this); }; // Reactivate-account form: schedule a page reload after the HTMX request. window.reactivateReload = function () { setTimeout(function(){ window.location.reload(); }, 500); }; // Blog editor breadcrumb / cancel links: after navigating, activate the Blog tab. window.blogTabNav = function () { setTimeout(function(){document.getElementById('tab-blog').click()},100); }; // Copy the item id to the clipboard and flash feedback on the button. window.onCopyItemId = function (id) { navigator.clipboard.writeText(id); this.textContent='Copied!'; setTimeout(()=>this.textContent='Copy Item ID', 1500); }; // Custom page reset form: confirm before submitting. data-submit auto-prevents // the native submit, so re-submit programmatically when confirmed. window.confirmResetPage = function () { if (confirm('Reset this page to the platform default? This clears your custom HTML and CSS.')) this.submit(); };