Skip to content

Commit 6c229d2

Browse files
committed
Eliminated toolbarMenu.ids init to condense .register() ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-auto-talk]
1 parent fd28397 commit 6c229d2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

chatgpt/chatgpt-auto-talk/chatgpt-auto-talk.user.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
// @description:zu Dlala izimpendulo ze-ChatGPT ngokuzenzakalela
226226
// @author Adam Lui
227227
// @namespace https://github.com/adamlui
228-
// @version 2025.3.31
228+
// @version 2025.4.1
229229
// @license MIT
230230
// @icon https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@9f1ed3c/assets/images/icons/openai/black/icon48.png
231231
// @icon64 https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@9f1ed3c/assets/images/icons/openai/black/icon64.png
@@ -396,7 +396,7 @@
396396
// Define MENU functions
397397

398398
const toolbarMenu = {
399-
ids: [], state: {
399+
state: {
400400
symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
401401
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
402402
},
@@ -409,22 +409,22 @@
409409
register() {
410410

411411
// Add toggles
412-
Object.keys(settings.controls).forEach(key => {
412+
this.ids = Object.keys(settings.controls).map(key => {
413413
const settingIsEnabled = config[key] ^ /disabled/i.test(key)
414414
const menuLabel = `${ settings.controls[key].symbol || this.state.symbols[+settingIsEnabled] } `
415415
+ settings.controls[key].label
416416
+ this.state.separator + this.state.words[+settingIsEnabled]
417-
this.ids.push(GM_registerMenuCommand(menuLabel, () => {
417+
return GM_registerMenuCommand(menuLabel, () => {
418418
settings.save(key, !config[key]) ; syncConfigToUI({ updatedKey: key })
419419
notify(`${settings.controls[key].label}: ${
420420
this.state.words[+(config[key] ^ /disabled/i.test(key))]}`)
421-
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined))
421+
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined)
422422
});
423423

424424
// Add About/Donate entries
425425
['about', 'donate'].forEach(entryType => this.ids.push(GM_registerMenuCommand(
426-
`${ entryType == 'about' ? '💡' : '💖' }`
427-
+ ` ${app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
426+
`${ entryType == 'about' ? '💡' : '💖' } ${
427+
app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
428428
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
429429
)))
430430
}

0 commit comments

Comments
 (0)