-
Notifications
You must be signed in to change notification settings - Fork 0
🧹 Fix unused _saveConfig by implementing missing settings tab functionality #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -81,7 +81,6 @@ IMPROVEMENTS OVER ORIGINALS: | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line no-unused-vars | ||||||||||||||||||||||||||||||||||
| function _saveConfig() { | ||||||||||||||||||||||||||||||||||
| GM_setValue("warning_threshold", CONFIG.thresholds.warning); | ||||||||||||||||||||||||||||||||||
| GM_setValue("danger_threshold", CONFIG.thresholds.danger); | ||||||||||||||||||||||||||||||||||
|
|
@@ -1562,6 +1561,15 @@ IMPROVEMENTS OVER ORIGINALS: | |||||||||||||||||||||||||||||||||
| document.getElementById("cts-refresh")?.addEventListener("click", () => TokenSaverModule.refresh()); | ||||||||||||||||||||||||||||||||||
| document.getElementById("cts-clear")?.addEventListener("click", () => TokenSaverModule.clear()); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Settings checkboxes | ||||||||||||||||||||||||||||||||||
| panel.querySelectorAll(".feature-checkbox").forEach((checkbox) => { | ||||||||||||||||||||||||||||||||||
| checkbox.addEventListener("change", (e) => { | ||||||||||||||||||||||||||||||||||
| const feature = e.target.dataset.feature; | ||||||||||||||||||||||||||||||||||
| CONFIG.features[feature] = e.target.checked; | ||||||||||||||||||||||||||||||||||
| _saveConfig(); | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+1565
to
+1571
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
Comment on lines
+1564
to
+1571
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Draggable header | ||||||||||||||||||||||||||||||||||
| const header = panel.querySelector(".panel-header"); | ||||||||||||||||||||||||||||||||||
| this.makeDraggable(panel, "ui_position", null, header); | ||||||||||||||||||||||||||||||||||
|
|
@@ -1617,11 +1625,11 @@ IMPROVEMENTS OVER ORIGINALS: | |||||||||||||||||||||||||||||||||
| <div class="cts-section"> | ||||||||||||||||||||||||||||||||||
| <div class="cts-section-title">⚙️ Feature Toggles</div> | ||||||||||||||||||||||||||||||||||
| <div class="cts-help"> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" ${CONFIG.features.theme ? "checked" : ""}> Dark oceanic theme</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" ${CONFIG.features.tokenSaver ? "checked" : ""}> Token Saver</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" ${CONFIG.features.codeCollapser ? "checked" : ""}> Code Collapser</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" ${CONFIG.features.usageMonitor ? "checked" : ""}> Usage Monitor</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" ${CONFIG.features.fork ? "checked" : ""}> Fork Conversation</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" class="feature-checkbox" data-feature="theme" ${CONFIG.features.theme ? "checked" : ""}> Dark oceanic theme</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" class="feature-checkbox" data-feature="tokenSaver" ${CONFIG.features.tokenSaver ? "checked" : ""}> Token Saver</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" class="feature-checkbox" data-feature="codeCollapser" ${CONFIG.features.codeCollapser ? "checked" : ""}> Code Collapser</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" class="feature-checkbox" data-feature="usageMonitor" ${CONFIG.features.usageMonitor ? "checked" : ""}> Usage Monitor</label><br> | ||||||||||||||||||||||||||||||||||
| <label><input type="checkbox" class="feature-checkbox" data-feature="fork" ${CONFIG.features.fork ? "checked" : ""}> Fork Conversation</label><br> | ||||||||||||||||||||||||||||||||||
| <br> | ||||||||||||||||||||||||||||||||||
| <small style="color:#909090;">Refresh page to apply changes</small> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
_saveConfig()here makes the settings UI appear to save, but on reload most toggles revert because_saveConfigwritesfeature_${key}(e.g.feature_tokenSaver,feature_codeCollapser,feature_usageMonitor) while initialization reads snake_case keys (feature_token_saver,feature_code_collapser,feature_usage_monitor). This means the newly wired change handler only persiststheme/forkcorrectly and silently drops the other feature choices after refresh.Useful? React with 👍 / 👎.