Skip to content

Commit 503d563

Browse files
committed
.
1 parent ebee097 commit 503d563

File tree

2 files changed

+47
-12
lines changed

2 files changed

+47
-12
lines changed

src/web/static/js/core/settings-manager.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const LOCAL_SETTINGS = [
2727
'lastSourceLanguage',
2828
'lastTargetLanguage',
2929
'lastApiEndpoint',
30-
'lastOpenaiEndpoint'
30+
'lastOpenaiEndpoint',
31+
'fastMode',
32+
'ttsEnabled'
3133
];
3234

3335
/**
@@ -113,6 +115,32 @@ export const SettingsManager = {
113115
providerSelect.dispatchEvent(new Event('change'));
114116
}
115117
}
118+
119+
// Apply Fast Mode setting
120+
if (prefs.fastMode !== undefined) {
121+
const fastModeCheckbox = DomHelpers.getElement('fastMode');
122+
if (fastModeCheckbox) {
123+
fastModeCheckbox.checked = prefs.fastMode;
124+
// Show/hide the info panel based on checkbox state
125+
const fastModeInfo = DomHelpers.getElement('fastModeInfo');
126+
if (fastModeInfo) {
127+
fastModeInfo.style.display = prefs.fastMode ? 'block' : 'none';
128+
}
129+
}
130+
}
131+
132+
// Apply TTS Enabled setting
133+
if (prefs.ttsEnabled !== undefined) {
134+
const ttsEnabledCheckbox = DomHelpers.getElement('ttsEnabled');
135+
if (ttsEnabledCheckbox) {
136+
ttsEnabledCheckbox.checked = prefs.ttsEnabled;
137+
// Show/hide the TTS options panel based on checkbox state
138+
const ttsOptions = DomHelpers.getElement('ttsOptions');
139+
if (ttsOptions) {
140+
ttsOptions.style.display = prefs.ttsEnabled ? 'block' : 'none';
141+
}
142+
}
143+
}
116144
},
117145

118146
/**
@@ -146,13 +174,19 @@ export const SettingsManager = {
146174
* Save current form state to local preferences
147175
*/
148176
saveCurrentState() {
177+
// Get checkbox values
178+
const fastModeCheckbox = DomHelpers.getElement('fastMode');
179+
const ttsEnabledCheckbox = DomHelpers.getElement('ttsEnabled');
180+
149181
const prefs = {
150182
lastProvider: DomHelpers.getValue('llmProvider'),
151183
lastModel: DomHelpers.getValue('model'),
152184
lastSourceLanguage: this._getLanguageValue('sourceLang', 'customSourceLang'),
153185
lastTargetLanguage: this._getLanguageValue('targetLang', 'customTargetLang'),
154186
lastApiEndpoint: DomHelpers.getValue('apiEndpoint'),
155-
lastOpenaiEndpoint: DomHelpers.getValue('openaiEndpoint')
187+
lastOpenaiEndpoint: DomHelpers.getValue('openaiEndpoint'),
188+
fastMode: fastModeCheckbox ? fastModeCheckbox.checked : false,
189+
ttsEnabled: ttsEnabledCheckbox ? ttsEnabledCheckbox.checked : false
156190
};
157191

158192
this.saveLocalPreferences(prefs);

src/web/templates/translation_interface.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,8 @@ <h2>⚙️ Translation Configuration</h2>
111111
<small>Example: `translated_{originalName}_to_FR.{ext}`</small>
112112
</div>
113113

114-
<!-- Save Settings Button -->
115-
<div style="text-align: center; margin: 20px 0;">
116-
<button type="button" class="btn btn-secondary" id="saveSettingsBtn" onclick="saveSettings()" style="padding: 8px 20px; font-size: 14px;" title="Save current settings (API keys, model, languages) to .env file for next session">
117-
💾 Save Settings
118-
</button>
119-
<span id="saveSettingsStatus" style="margin-left: 10px; font-size: 14px;"></span>
120-
</div>
121-
122-
<div class="form-group" style="margin-bottom: 30px;">
114+
<!-- Fast Mode Option -->
115+
<div class="form-group" style="margin-bottom: 15px;">
123116
<label style="display: flex; align-items: center; gap: 10px;">
124117
<input type="checkbox" id="fastMode" style="width: auto;">
125118
Fast Mode (EPUB only - removes all formatting, maximum reliability)
@@ -139,7 +132,7 @@ <h2>⚙️ Translation Configuration</h2>
139132
</div>
140133

141134
<!-- TTS (Text-to-Speech) Options -->
142-
<div class="form-group" style="margin-bottom: 30px;">
135+
<div class="form-group" style="margin-bottom: 15px;">
143136
<label style="display: flex; align-items: center; gap: 10px;">
144137
<input type="checkbox" id="ttsEnabled" style="width: auto;">
145138
🔊 Generate Audio (TTS) - Create audio narration after translation
@@ -301,6 +294,14 @@ <h4 style="margin: 0 0 12px 0; font-size: 14px; color: #fbbf24;">🎤 Voice Clon
301294
</div>
302295
</div>
303296

297+
<!-- Save Settings Button -->
298+
<div style="text-align: center; margin: 20px 0;">
299+
<button type="button" class="btn btn-secondary" id="saveSettingsBtn" onclick="saveSettings()" style="padding: 8px 20px; font-size: 14px;" title="Save current settings (API keys, model, languages) to .env file for next session">
300+
💾 Save Settings
301+
</button>
302+
<span id="saveSettingsStatus" style="margin-left: 10px; font-size: 14px;"></span>
303+
</div>
304+
304305
<div class="advanced-toggle" onclick="toggleAdvanced()">
305306
<span>🔧 Advanced Settings</span>
306307
<span id="advancedIcon"></span>

0 commit comments

Comments
 (0)