Files
pulse-signage/src/web/public/js/settings/background-tasks.js
T
lzstealth bbd517abbb
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m14s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 32s
Fix scheduled task run notification
2026-08-17 00:54:13 +01:00

52 lines
1.6 KiB
JavaScript

(function () {
var normalizedPathname = window.location.pathname.replace(/\/$/, '');
if (normalizedPathname !== '/settings/tasks-background' && normalizedPathname !== '/settings/tasks-scheduled') {
return;
}
function updateBackgroundTasksCardHeight() {
var card = document.getElementById('background-tasks-task-card');
if (!card) {
return;
}
var cardRect = card.getBoundingClientRect();
var bottomInset = 16;
var availableHeight = Math.max(0, window.innerHeight - cardRect.top - bottomInset);
card.style.setProperty('--background-tasks-task-card-max-height', availableHeight + 'px');
}
var scheduleUpdate = window.requestAnimationFrame ? function () {
window.requestAnimationFrame(updateBackgroundTasksCardHeight);
} : updateBackgroundTasksCardHeight;
if (window.addEventListener) {
window.addEventListener('resize', scheduleUpdate);
window.addEventListener('orientationchange', scheduleUpdate);
window.addEventListener('load', scheduleUpdate);
}
if (window.ResizeObserver) {
try {
var summary = document.getElementById('background-tasks-summary');
if (summary) {
new ResizeObserver(scheduleUpdate).observe(summary);
}
} catch (_error) {
// Ignore ResizeObserver setup failures.
}
}
scheduleUpdate();
try {
var url = new URL(window.location.href);
if (!url.searchParams.has('message')) {
return;
}
url.searchParams.delete('message');
window.history.replaceState({}, document.title, url.pathname + (url.search ? url.search : '') + url.hash);
} catch (_error) {
// Ignore URL cleanup failures.
}
}());