tagliatelle

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 92574b5632c5709e932421d45b5917a4f9bd7ee8
parent 2696b9935b7fd1f3c6fc82fe2a3dba4e74f6331a
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Thu, 30 Jul 2026 11:46:27 +0100

Merge common autoHideSuccess

Diffstat:
Mstatic/admin-tabs.js | 9+--------
Mstatic/common.js | 11+++++++++++
Mstatic/thumbnails.js | 15+--------------
3 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/static/admin-tabs.js b/static/admin-tabs.js @@ -29,12 +29,5 @@ function showThumbnailSubTab(subTabName) { document.addEventListener('DOMContentLoaded', function() { showAdminTab(window.activeAdminTab || 'settings'); showThumbnailSubTab('missing'); - - document.querySelectorAll('.auto-hide-success').forEach(div => { - setTimeout(() => { - div.style.transition = 'opacity 0.5s'; - div.style.opacity = '0'; - setTimeout(() => div.remove(), 500); - }, 5000); - }); + autoHideSuccessMessages(); }); \ No newline at end of file diff --git a/static/common.js b/static/common.js @@ -13,3 +13,14 @@ function appendHidden(form, name, value) { input.dataset.generated = '1'; form.appendChild(input); } + +// Fades out and removes elements matching selector +function autoHideSuccessMessages(selector = '.auto-hide-success', delay = 5000) { + document.querySelectorAll(selector).forEach(div => { + setTimeout(() => { + div.style.transition = 'opacity 0.5s'; + div.style.opacity = '0'; + setTimeout(() => div.remove(), 500); + }, delay); + }); +} diff --git a/static/thumbnails.js b/static/thumbnails.js @@ -15,20 +15,7 @@ function showTab(tabName) { document.getElementById('tab-' + tabName).style.fontWeight = 'bold'; } -// Auto-hide success messages -function autoHideSuccess() { - const successDivs = document.querySelectorAll('.auto-hide-success'); - successDivs.forEach(div => { - setTimeout(() => { - div.style.transition = 'opacity 0.5s'; - div.style.opacity = '0'; - setTimeout(() => div.remove(), 500); - }, 5000); - }); -} - -// Call auto-hide -autoHideSuccess(); +autoHideSuccessMessages(); // Add video preview on hover document.querySelectorAll('video').forEach(video => {