diff --git a/Scriptmonkey_Beta.ps1 b/Scriptmonkey_Beta.ps1 index 28585bf..2686e8d 100644 --- a/Scriptmonkey_Beta.ps1 +++ b/Scriptmonkey_Beta.ps1 @@ -1140,30 +1140,38 @@ document.addEventListener('DOMContentLoaded', () => { container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = master.checked); } - document.addEventListener('DOMContentLoaded', () => { - const master = document.getElementById('installDattoRMM'); - if (master) master.addEventListener('change', toggleDattoRMMOptions); - - // Fetch sites when the "Enter" key is pressed in the password input field - const passwordField = document.getElementById('Password'); - const goButton = document.querySelector("button[onclick='fetchSites()']"); - + document.addEventListener('DOMContentLoaded', () => { + // Hook up the main DattoRMM checkbox → show/hide its sub-options/password/dropdown + const master = document.getElementById('installDattoRMM'); + if (master) { + master.addEventListener('change', toggleDattoRMMOptions); + } + + // Fetch sites when the "Enter" key is pressed in the password input field + const passwordField = document.getElementById('Password'); + const goButton = document.querySelector("button[onclick='fetchSites()']"); + + if (passwordField && goButton) { passwordField.addEventListener('keydown', (e) => { - if (e.key === 'Enter') { // Check if the key pressed is 'Enter' + if (e.key === 'Enter') { goButton.click(); // Trigger the 'Go' button click } }); + } - // Trigger 'Run Selected' button click when 'Enter' is pressed after selecting a site - const siteDropdown = document.getElementById('dattoDropdown'); - const runButton = document.querySelector('.run-button'); - - siteDropdown.addEventListener('keydown', (e) => { - if (e.key === 'Enter' && siteDropdown.value) { // Check if the key pressed is 'Enter' and a site is selected - runButton.click(); // Trigger the 'Run Selected' button click - } + // Trigger 'Run Selected' button click when 'Enter' is pressed after selecting a site + const siteDropdown = document.getElementById('dattoDropdown'); + const runButton = document.querySelector('.run-button'); + + if (siteDropdown && runButton) { + siteDropdown.addEventListener('keydown', (e) => { + if (e.key === 'Enter' && siteDropdown.value) { + runButton.click(); // Trigger the 'Run Selected' button click + } }); - }); + } + }); + // =======================================================================