From 404832002f9ddcb7c45759b7366c53a43ee6dbcb Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Tue, 30 Jun 2026 18:23:03 +0200 Subject: [PATCH] v2.13.3 - Auto-check 'Activate foreign changes' su pagina changelog all'apertura --- user_script/checkmk_swissknife.user.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index af90112..0f804e4 100644 --- a/user_script/checkmk_swissknife.user.js +++ b/user_script/checkmk_swissknife.user.js @@ -1130,6 +1130,7 @@ let attemptsInventory = 0; let attemptsFolderMon = 0; let attemptsViewWato = 0; + let attemptsChangelog = 0; function tryEnhanceFolderSelect() { const iDoc = getWatoDoc(FOLDER_SELECT_ID); @@ -1193,6 +1194,25 @@ addInventoryButtons(doc); } + // ========================================================================= + // FEATURE: Auto-check "Activate foreign changes" on changelog page + // ========================================================================= + + function tryAutoCheckForeignActivation() { + const doc = getTargetDoc(); + if (!doc || !doc.body) { + if (++attemptsChangelog < MAX_ATTEMPTS) setTimeout(tryAutoCheckForeignActivation, POLL_INTERVAL_MS); + return; + } + try { if (getPageMode(doc) !== 'changelog') return; } catch (e) { return; } + const cb = doc.getElementById('cb_activate_p_foreign'); + if (!cb) { + if (++attemptsChangelog < MAX_ATTEMPTS) setTimeout(tryAutoCheckForeignActivation, POLL_INTERVAL_MS); + return; + } + if (!cb.checked) cb.click(); + } + function tryAddViewWatoMenu() { const doc = getTargetDoc(); if (!doc || !doc.body) { @@ -1230,6 +1250,7 @@ attemptsInventory = 0; attemptsFolderMon = 0; attemptsViewWato = 0; + attemptsChangelog = 0; // Folder select: self-stops if element not found, always schedules. setTimeout(tryEnhanceFolderSelect, 800); // Accordion: only on pages in ACCORDION_MODES. @@ -1246,6 +1267,8 @@ setTimeout(tryAddWatoFolderMonitorButtons, 500); // WATO menu: on view.py with host rows, self-stops if not applicable. setTimeout(tryAddViewWatoMenu, 800); + // Auto-check foreign activation: only on mode=changelog. + if (!targetMode || targetMode === 'changelog') setTimeout(tryAutoCheckForeignActivation, 500); } if (document.readyState === 'complete') {