From 6ba135098bcac92f4191f3128c6504743b869b8d Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Thu, 8 Jan 2026 17:03:08 -0500 Subject: [PATCH] Use consistent button group style for mode selectors Convert DCT/LSB (encode) and Auto/LSB/DCT (decode) to use Bootstrap btn-group style matching Color/Gray and JPEG/PNG. Better mobile layout - all options on one line. Co-Authored-By: Claude Opus 4.5 --- frontends/web/templates/decode.html | 33 +++++++++++------------------ frontends/web/templates/encode.html | 28 ++++++++++++------------ 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/frontends/web/templates/decode.html b/frontends/web/templates/decode.html index 15dc998..7897078 100644 --- a/frontends/web/templates/decode.html +++ b/frontends/web/templates/decode.html @@ -241,18 +241,14 @@
- - - +
+ + + + + + +
Tries LSB first, then DCT @@ -514,15 +510,10 @@ document.querySelector('input[name="rsa_key"]')?.addEventListener('change', upda // MODE SWITCHING // ============================================================================ -const modeRadios = document.querySelectorAll('input[name="embed_mode"]'); -const modeBtns = { 'auto': document.getElementById('autoModeCard'), 'lsb': document.getElementById('lsbModeCard'), 'dct': document.getElementById('dctModeCard') }; - -modeRadios.forEach(radio => { - radio.addEventListener('change', () => { - Object.values(modeBtns).forEach(btn => btn?.classList.remove('active')); - modeBtns[radio.value]?.classList.add('active'); - }); -}); +// Apply disabled styling to DCT if not available +if (document.getElementById('modeDct')?.disabled) { + document.getElementById('dctModeLabel')?.classList.add('disabled', 'text-muted'); +} // ============================================================================ // LOADING STATE diff --git a/frontends/web/templates/encode.html b/frontends/web/templates/encode.html index 1236336..26a3447 100644 --- a/frontends/web/templates/encode.html +++ b/frontends/web/templates/encode.html @@ -206,16 +206,13 @@
- - +
+ + + + +
- |
@@ -646,7 +643,7 @@ carrierInput?.addEventListener('change', function() { // ============================================================================ const modeRadios = document.querySelectorAll('input[name="embed_mode"]'); -const modeBtns = { 'dct': document.getElementById('dctModeCard'), 'lsb': document.getElementById('lsbModeCard') }; +const dctModeLabel = document.getElementById('dctModeLabel'); const grayModeInput = document.getElementById('grayMode'); const grayModeLabel = document.getElementById('grayModeLabel'); const jpegFormatInput = document.getElementById('jpegFormat'); @@ -654,6 +651,11 @@ const jpegFormatLabel = document.getElementById('jpegFormatLabel'); const colorModeInput = document.getElementById('colorMode'); const pngFormatInput = document.getElementById('pngFormat'); +// Apply disabled styling to DCT if not available +if (document.getElementById('modeDct')?.disabled) { + dctModeLabel?.classList.add('disabled', 'text-muted'); +} + function updateOutputOptions(mode) { const isLsb = mode === 'lsb'; if (isLsb) { @@ -676,11 +678,7 @@ function updateOutputOptions(mode) { } modeRadios.forEach(radio => { - radio.addEventListener('change', () => { - Object.values(modeBtns).forEach(btn => btn?.classList.remove('active')); - modeBtns[radio.value]?.classList.add('active'); - updateOutputOptions(radio.value); - }); + radio.addEventListener('change', () => updateOutputOptions(radio.value)); }); // Initialize output options based on initial mode