Skip to content

Commit ff49fe0

Browse files
committed
Abstracted settings.controls[key] to ctrl ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-auto-refresh]
1 parent 132db2c commit ff49fe0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

chatgpt/chatgpt-auto-refresh/chatgpt-auto-refresh.user.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
// @description:zu *NGOKUPHEPHA* susa ukusetha kabusha ingxoxo yemizuzu eyi-10 + amaphutha enethiwekhi ahlala njalo + Ukuhlolwa kwe-Cloudflare ku-ChatGPT.
221221
// @author Adam Lui
222222
// @namespace https://github.com/adamlui
223-
// @version 2025.4.20
223+
// @version 2025.4.24
224224
// @license MIT
225225
// @icon https://assets.chatgptautorefresh.com/images/icons/openai/black/icon48.png?v=f11a0a8
226226
// @icon64 https://assets.chatgptautorefresh.com/images/icons/openai/black/icon64.png?v=f11a0a8
@@ -436,17 +436,15 @@
436436

437437
// Add toggles
438438
this.entryIDs = Object.keys(settings.controls).map(key => {
439-
const ctrlType = settings.controls[key].type
440-
const ctrlStatus = settings.controls[key].status
439+
const ctrl = settings.controls[key]
441440
const menuLabel = `${
442-
settings.controls[key].symbol || this.state.symbols[+settings.typeIsEnabled(key)] } ${
443-
settings.controls[key].label} ${
444-
ctrlType == 'toggle' ? this.state.separator + this.state.words[+settings.typeIsEnabled(key)]
445-
: ctrlStatus ? `— ${ctrlStatus}` : '' }`
441+
ctrl.symbol || this.state.symbols[+settings.typeIsEnabled(key)] } ${ctrl.label} ${
442+
ctrl.type == 'toggle' ? this.state.separator + this.state.words[+settings.typeIsEnabled(key)]
443+
: ctrl.status ? `— ${ctrl.status}` : '' }`
446444
return GM_registerMenuCommand(menuLabel, () => {
447-
if (ctrlType == 'toggle') {
445+
if (ctrl.type == 'toggle') {
448446
settings.save(key, !config[key])
449-
notify(`${settings.controls[key].label}: ${this.state.words[+settings.typeIsEnabled(key)]}`)
447+
notify(`${ctrl.label}: ${this.state.words[+settings.typeIsEnabled(key)]}`)
450448
} else { // Refresh Interval prompt
451449
while (true) {
452450
const refreshInterval = prompt(
@@ -467,7 +465,7 @@
467465
}}
468466
}
469467
syncConfigToUI({ updatedKey: key })
470-
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined)
468+
}, env.scriptManager.supportsTooltips ? { title: ctrl.helptip || ' ' } : undefined)
471469
});
472470

473471
// Add About/Donate entries

0 commit comments

Comments
 (0)