From c595d3461bf18619365e6f99af3a8d9dff7616a2 Mon Sep 17 00:00:00 2001 From: LegendMC Date: Wed, 8 May 2024 11:57:30 +0200 Subject: [PATCH] Added disable launch attached when close on launch is checked. --- app/assets/css/launcher.css | 12 +++++++++++- app/assets/js/scripts/settings.js | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/assets/css/launcher.css b/app/assets/css/launcher.css index 8b239311..3dea4bb8 100644 --- a/app/assets/css/launcher.css +++ b/app/assets/css/launcher.css @@ -26,7 +26,7 @@ * * * Element Styles * * * - ******************************************************************************/ + ******************************************************************************/ /* Reset body, html, and div presets. */ body, html, div { @@ -1360,6 +1360,11 @@ body, button { border-radius: 50px; border: 1px solid rgba(126, 126, 126, 0.57); } +input:disabled + .toggleSwitchSlider { + background-color: rgb(77, 77, 77); + /* box-shadow: inset 2px 1px 20px black; */ + border: 1px solid rgb(30, 31, 30) +} .toggleSwitchSlider:before { position: absolute; content: ""; @@ -1372,6 +1377,11 @@ body, button { border-radius: 50px; transition: .4s; } +input:checked:disabled + .toggleSwitchSlider { + background-color: rgb(74, 95, 71); + /* box-shadow: inset 2px 1px 20px black; */ + border: 1px solid rgb(74, 83, 72) +} input:checked + .toggleSwitchSlider { background-color: rgb(31, 140, 11); /* box-shadow: inset 2px 1px 20px black; */ diff --git a/app/assets/js/scripts/settings.js b/app/assets/js/scripts/settings.js index 81a65a70..36508b1c 100644 --- a/app/assets/js/scripts/settings.js +++ b/app/assets/js/scripts/settings.js @@ -89,6 +89,19 @@ bindFileSelectors() * will be disabled until the value is corrected. This is an automated * process. More complex UI may need to be bound separately. */ + +closeOnLaunchCheckbox = document.querySelector('input[cValue="CloseOnLaunch"]') +launchDetachedCheckbox = document.querySelector('input[cValue="LaunchDetached"]') + +closeOnLaunchCheckbox.addEventListener('change', function() { + if (this.checked) { + launchDetachedCheckbox.disabled = true + launchDetachedCheckbox.checked = true + } else { + launchDetachedCheckbox.disabled = false + } +}) + function initSettingsValidators(){ const sEls = document.getElementById('settingsContainer').querySelectorAll('[cValue]') Array.from(sEls).map((v, index, arr) => {