Skip to content

Commit 66aa5d1

Browse files
committed
1 parent b01a116 commit 66aa5d1

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

greasemonkey/chatgpt-widescreen-mode.user.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
// @description:zu Thuthukisa iChatGPT ngemodi zesikrini ezibanzi/egcwele/ephezulu + imodi yokuvimbela i-spam. Futhi isebenza ku-perplexity.ai + poe.com!
236236
// @author Adam Lui
237237
// @namespace https://github.com/adamlui
238-
// @version 2025.2.12.1
238+
// @version 2025.2.12.2
239239
// @license MIT
240240
// @icon https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?v=844b16e
241241
// @icon64 https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?v=844b16e
@@ -435,44 +435,44 @@
435435

436436
// Define FUNCTIONS
437437

438-
const menu = {
438+
const toolbarMenu = {
439439
ids: [], state: {
440440
symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
441441
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
442442
},
443443

444444
refresh() {
445445
if (typeof GM_unregisterMenuCommand == 'undefined') return
446-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
446+
for (const id of this.ids) { GM_unregisterMenuCommand(id) } this.register()
447447
},
448448

449449
register() {
450450

451451
// Show "Disabled (extension installed)"
452452
if (env.extensionInstalled) GM_registerMenuCommand(
453-
`${menu.state.symbols[0]} ${app.msgs.menuLabel_disabled} (${app.msgs.menuLabel_extensionInstalled})`,
453+
`${this.state.symbols[0]} ${app.msgs.menuLabel_disabled} (${app.msgs.menuLabel_extensionInstalled})`,
454454
() => modals.open('about'), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
455455
)
456456

457457
// ...or add settings toggles
458458
else Object.keys(settings.controls).forEach(key => {
459459
if (sites[env.site].availFeatures.includes(key)) {
460460
const settingIsEnabled = config[key] ^ key.includes('Disabled')
461-
const menuLabel = `${ settings.controls[key].symbol || menu.state.symbols[+settingIsEnabled] } `
461+
const menuLabel = `${ settings.controls[key].symbol || this.state.symbols[+settingIsEnabled] } `
462462
+ settings.controls[key].label
463-
+ menu.state.separator + menu.state.words[+settingIsEnabled]
464-
menu.ids.push(GM_registerMenuCommand(menuLabel, () => {
463+
+ this.state.separator + this.state.words[+settingIsEnabled]
464+
this.ids.push(GM_registerMenuCommand(menuLabel, () => {
465465
settings.save(key, !config[key]) ; sync.configToUI({ updatedKey: key })
466466
notify(`${settings.controls[key].label}: ${
467-
menu.state.words[+(key.includes('Disabled') ^ config[key])]}`)
467+
this.state.words[+(key.includes('Disabled') ^ config[key])]}`)
468468
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined))
469469
}
470470
});
471471

472472
// Add About/Donate entries
473473
['about', 'donate'].forEach(entryType => {
474474
if (entryType === 'donate' && env.extensionInstalled) return
475-
menu.ids.push(GM_registerMenuCommand(
475+
this.ids.push(GM_registerMenuCommand(
476476
`${ entryType == 'about' ? '💡' : '💖' }`
477477
+ ` ${app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
478478
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
@@ -506,7 +506,7 @@
506506
if (config.notifDisabled && !msg.includes(app.msgs.menuLabel_modeNotifs)) return
507507

508508
// Strip state word to append colored one later
509-
const foundState = menu.state.words.find(word => msg.includes(word))
509+
const foundState = toolbarMenu.state.words.find(word => msg.includes(word))
510510
if (foundState) msg = msg.replace(foundState, '')
511511

512512
// Show notification
@@ -526,7 +526,8 @@
526526
}
527527
}
528528
const styledStateSpan = dom.create.elem('span')
529-
styledStateSpan.style.cssText = stateStyles[foundState == menu.state.words[0] ? 'off' : 'on'][env.ui.scheme]
529+
styledStateSpan.style.cssText = stateStyles[
530+
foundState == toolbarMenu.state.words[0] ? 'off' : 'on'][env.ui.scheme]
530531
styledStateSpan.append(foundState) ; notif.append(styledStateSpan)
531532
}
532533
}
@@ -657,7 +658,7 @@
657658
update.style.tweaks() // sync TCB/NCB/HH/HF/BA
658659
update.style.chatbar() // sync WCB
659660
chatbar.tweak() // update ChatGPT chatbar inner width + left-align Perplexity Attach File button
660-
menu.refresh() // to update state symbol/suffix
661+
toolbarMenu.refresh() // to update state symbol/suffix
661662
if (options?.updatedKey == 'btnAnimationsDisabled' && !config.btnAnimationsDisabled) // apply/remove fx
662663
// ...to visually signal location + preview fx applied by Button Animations toggle-on
663664
buttons.animate()
@@ -678,7 +679,7 @@
678679
})()
679680
}), new Promise(resolve => setTimeout(() => resolve(false), 1500))])
680681

681-
menu.register() ; if (env.extensionInstalled) return
682+
toolbarMenu.register() ; if (env.extensionInstalled) return
682683

683684
// Init UI props
684685
if (env.site == 'chatgpt') {

0 commit comments

Comments
 (0)