Update samy.js

This commit is contained in:
2025-12-21 18:36:42 -05:00
parent fa324e361a
commit 2d8fe9f921

24
samy.js
View File

@@ -667,10 +667,28 @@ document.addEventListener("DOMContentLoaded", () => {
function updateVisibility() {
const checked = masterCheckbox.checked;
container.style.display = checked ? "block" : "none";
container
.querySelectorAll('input[type="checkbox"]')
.forEach((cb) => (cb.checked = checked));
const subCbs = container.querySelectorAll('input[type="checkbox"]');
// Special-case: 1Password sub-options should be user-chosen
if (taskId === "install1Password") {
if (!checked) {
// turning OFF -> clear sub-options
subCbs.forEach((cb) => (cb.checked = false));
} else {
// turning ON -> if nothing selected yet, default to desktop
const anySelected = Array.from(subCbs).some((cb) => cb.checked);
if (!anySelected) {
const desktop = container.querySelector('input[type="checkbox"][value="desktop"]');
if (desktop) desktop.checked = true;
}
}
} else {
// Default behavior for other tasks (Datto, etc): mirror master checkbox
subCbs.forEach((cb) => (cb.checked = checked));
}
// Keep your Datto UI show/hide behavior
if (taskId === "installDattoRMM") {
const pwdBox = document.getElementById("PasswordContainer");
const rmmBox = document.getElementById("dattoRmmContainer");