Skip to content

Commit

Permalink
Split config/settings inits into 2 lines for readability ↞ [auto-…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Nov 23, 2024
1 parent 56e63f6 commit 65a8872
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Init ENV context
const env = { browser: { isMobile: chatgpt.browser.isMobile() }}

// Init CONFIG
// Init SETTINGS
await settings.load('extensionDisabled', ...Object.keys(settings.controls))
if (!config.replyLanguage) settings.save('replyLanguage', (await chrome.i18n.getAcceptLanguages())[0]) // init reply language if unset
if (!config.replyTopic) settings.save('replyTopic', 'ALL') // init reply topic if unset
Expand Down
3 changes: 2 additions & 1 deletion chrome/extension/lib/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const config = {}, settings = {
const config = {}
const settings = {

controls: {
autoStart: { type: 'toggle',
Expand Down
2 changes: 1 addition & 1 deletion firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// Init ENV context
const env = { browser: { isMobile: chatgpt.browser.isMobile() }}

// Init CONFIG
// Init SETTINGS
await settings.load('extensionDisabled', ...Object.keys(settings.controls))
if (!config.replyLanguage) settings.save('replyLanguage', (await chrome.i18n.getAcceptLanguages())[0]) // init reply language if unset
if (!config.replyTopic) settings.save('replyTopic', 'ALL') // init reply topic if unset
Expand Down
3 changes: 2 additions & 1 deletion firefox/extension/lib/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const config = {}, settings = {
const config = {}
const settings = {

controls: {
autoStart: { type: 'toggle',
Expand Down
7 changes: 4 additions & 3 deletions greasemonkey/chatgpt-infinity.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
// @description:zh-TW 從無所不知的 ChatGPT 生成無窮無盡的答案 (用任何語言!)
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.11.22.10
// @version 2024.11.22.11
// @license MIT
// @match *://chatgpt.com/*
// @match *://chat.openai.com/*
Expand Down Expand Up @@ -346,8 +346,9 @@
Object.assign(app.msgs, localizedMsgs)
}

// Init CONFIG
const config = {}, settings = {
// Init SETTINGS
const config = {}
const settings = {
load(...keys) {
if (Array.isArray(keys[0])) keys = keys[0] // use 1st array arg, else all comma-separated ones
keys.forEach(key => config[key] = GM_getValue(app.configKeyPrefix + '_' + key, false))
Expand Down

0 comments on commit 65a8872

Please sign in to comment.