Skip to content

Commit 5099e37

Browse files
committed
Added slider support to settings.load() ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/duckduckgpt]
1 parent e8426d9 commit 5099e37

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

chatgpt/duckduckgpt/duckduckgpt.user.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.5.26.4
151+
// @version 2025.5.26.5
152152
// @license MIT
153153
// @icon https://assets.ddgpt.com/images/icons/app/icon48.png?v=533ce0f
154154
// @icon64 https://assets.ddgpt.com/images/icons/app/icon64.png?v=533ce0f
@@ -338,10 +338,12 @@
338338
window.config = {}
339339
window.settings = {
340340
load(...keys) {
341-
keys.flat().forEach(key => {
342-
config[key] = GM_getValue(`${app.configKeyPrefix}_${key}`,
343-
this.controls?.[key]?.defaultVal ?? this.controls?.[key]?.type == 'toggle')
344-
})
341+
keys.flat().forEach(key => config[key] = GM_getValue(`${app.configKeyPrefix}_${key}`, initDefaultVal(key)))
342+
function initDefaultVal(key) {
343+
return this.controls?.[key]?.defaultVal
344+
?? this.controls?.[key]?.type == 'slider' ? 100
345+
: this.controls?.[key]?.type == 'toggle'
346+
}
345347
},
346348
save(key, val) { GM_setValue(`${app.configKeyPrefix}_${key}`, val) ; config[key] = val }
347349
}

0 commit comments

Comments
 (0)