From 90d0cfd1c8124d78fffac5617613181da4c70749 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sun, 3 Sep 2023 12:53:44 +0200 Subject: [PATCH] Refactor run button initialization and timepicker usage - Removed the `initTimepicker()` function call from `document.addEventListener` block - Added a new line to initialize `selecttimedatepicker` if it is undefined in the event listener for `.run` buttons - Moved the modal show code before initializing `selecttimedatepicker` - Removed duplicate modal show code from `initRunButtons()` function --- assets/js/job/index.js | 8 ++++---- config/packages/nelmio_security.yaml | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/job/index.js b/assets/js/job/index.js index 2f7b52e..5c28f86 100644 --- a/assets/js/job/index.js +++ b/assets/js/job/index.js @@ -9,7 +9,6 @@ document.addEventListener("readystatechange", event => { if(event.target.readyState === 'complete') { initDeleteButtons(); initRunButtons(); - initTimepicker(); Utils.initTags(); } }); @@ -45,6 +44,10 @@ function initTimepicker() { } function initRunButtons() { document.querySelectorAll('.run').forEach(elem => elem.addEventListener("click", event => { + var bsModal = new Modal('#run_selecttime'); + bsModal.show(); + + if(typeof selecttimedatepicker === 'undefined') initTimepicker() let me = event.currentTarget; let norun = me.closest('tr').classList.contains('norun') let maxdate = new DateTime(me.dataset.nextrun) @@ -66,9 +69,6 @@ function initRunButtons() { } }) - var bsModal = new Modal('#run_selecttime'); - bsModal.show(); - let schedulefn = event => { bsModal.hide(); let time = Math.floor(selecttimedatepicker.dates.lastPicked / 1000); diff --git a/config/packages/nelmio_security.yaml b/config/packages/nelmio_security.yaml index 4ebac3c..7c2c7b5 100644 --- a/config/packages/nelmio_security.yaml +++ b/config/packages/nelmio_security.yaml @@ -50,6 +50,8 @@ nelmio_security: - 'data:' connect-src: - 'self' + base-uri: + - 'none' block-all-mixed-content: true # defaults to false, blocks HTTP content over HTTPS transport # upgrade-insecure-requests: true # defaults to false, upgrades HTTP requests to HTTPS transport report: