|
225 | 225 | // @description:zu Dlala izimpendulo ze-ChatGPT ngokuzenzakalela
|
226 | 226 | // @author Adam Lui
|
227 | 227 | // @namespace https://github.com/adamlui
|
228 |
| -// @version 2025.3.31 |
| 228 | +// @version 2025.4.1 |
229 | 229 | // @license MIT
|
230 | 230 | // @icon https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@9f1ed3c/assets/images/icons/openai/black/icon48.png
|
231 | 231 | // @icon64 https://cdn.jsdelivr.net/gh/adamlui/chatgpt-auto-talk@9f1ed3c/assets/images/icons/openai/black/icon64.png
|
|
396 | 396 | // Define MENU functions
|
397 | 397 |
|
398 | 398 | const toolbarMenu = {
|
399 |
| - ids: [], state: { |
| 399 | + state: { |
400 | 400 | symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
|
401 | 401 | words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
|
402 | 402 | },
|
|
409 | 409 | register() {
|
410 | 410 |
|
411 | 411 | // Add toggles
|
412 |
| - Object.keys(settings.controls).forEach(key => { |
| 412 | + this.ids = Object.keys(settings.controls).map(key => { |
413 | 413 | const settingIsEnabled = config[key] ^ /disabled/i.test(key)
|
414 | 414 | const menuLabel = `${ settings.controls[key].symbol || this.state.symbols[+settingIsEnabled] } `
|
415 | 415 | + settings.controls[key].label
|
416 | 416 | + this.state.separator + this.state.words[+settingIsEnabled]
|
417 |
| - this.ids.push(GM_registerMenuCommand(menuLabel, () => { |
| 417 | + return GM_registerMenuCommand(menuLabel, () => { |
418 | 418 | settings.save(key, !config[key]) ; syncConfigToUI({ updatedKey: key })
|
419 | 419 | notify(`${settings.controls[key].label}: ${
|
420 | 420 | 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) |
422 | 422 | });
|
423 | 423 |
|
424 | 424 | // Add About/Donate entries
|
425 | 425 | ['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 : '' }`, |
428 | 428 | () => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
|
429 | 429 | )))
|
430 | 430 | }
|
|
0 commit comments