Skip to content

Commit 6bcbbd2

Browse files
committed
Renamed menu obj to toolbarMenu
1 parent fe0cf47 commit 6bcbbd2

File tree

10 files changed

+167
-157
lines changed

10 files changed

+167
-157
lines changed

amazongpt/greasemonkey/amazongpt.user.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @description Adds the magic of AI to Amazon shopping
44
// @author KudoAI
55
// @namespace https://kudoai.com
6-
// @version 2025.2.12.3
6+
// @version 2025.2.12.4
77
// @license MIT
88
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
99
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
@@ -415,7 +415,7 @@
415415

416416
// Define MENU functions
417417

418-
const menu = {
418+
const toolbarMenu = {
419419
ids: [], state: {
420420
symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
421421
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
@@ -424,20 +424,20 @@
424424
refresh() {
425425
if (typeof GM_unregisterMenuCommand == 'undefined') {
426426
log.debug('GM_unregisterMenuCommand not supported.') ; return }
427-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
427+
for (const id of this.ids) { GM_unregisterMenuCommand(id) } this.register()
428428
},
429429

430430
register() {
431431

432432
// Add Proxy API Mode toggle
433-
const pmLabel = menu.state.symbols[+config.proxyAPIenabled] + ' '
433+
const pmLabel = this.state.symbols[+config.proxyAPIenabled] + ' '
434434
+ settings.controls.proxyAPIenabled.label + ' '
435-
+ menu.state.separator + menu.state.words[+config.proxyAPIenabled]
436-
menu.ids.push(GM_registerMenuCommand(pmLabel, toggle.proxyMode,
435+
+ this.state.separator + this.state.words[+config.proxyAPIenabled]
436+
this.ids.push(GM_registerMenuCommand(pmLabel, toggle.proxyMode,
437437
env.scriptManager.supportsTooltips ? { title: settings.controls.proxyAPIenabled.helptip } : undefined));
438438

439439
// Add About/Settings entries
440-
['about', 'settings'].forEach(entryType => menu.ids.push(GM_registerMenuCommand(
440+
['about', 'settings'].forEach(entryType => this.ids.push(GM_registerMenuCommand(
441441
entryType == 'about' ? `💡 ${settings.controls.about.label}` : `⚙️ ${app.msgs.menuLabel_settings}`,
442442
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
443443
)))
@@ -516,7 +516,7 @@
516516
function notify(msg, pos = '', notifDuration = '', shadow = 'shadow') {
517517

518518
// Strip state word to append styled one later
519-
const foundState = menu.state.words.find(word => msg.includes(word))
519+
const foundState = toolbarMenu.state.words.find(word => msg.includes(word))
520520
if (foundState) msg = msg.replace(foundState, '')
521521

522522
// Show notification
@@ -555,7 +555,7 @@
555555
}
556556
const styledStateSpan = dom.create.elem('span')
557557
styledStateSpan.style.cssText = `font-weight: bold ; ${
558-
stateStyles[foundState == menu.state.words[0] ? 'off' : 'on'][env.ui.site.scheme] }`
558+
stateStyles[foundState == toolbarMenu.state.words[0] ? 'off' : 'on'][env.ui.site.scheme] }`
559559
styledStateSpan.append(foundState) ; notif.insertBefore(styledStateSpan, notif.children[2])
560560
}
561561
}
@@ -975,7 +975,7 @@
975975
key.includes('Disabled') ^ config[key] ? 'OFF' : 'ON' }...`)
976976
settings.save(key, !config[key]) // update config
977977
notify(`${settings.controls[key].label} ${
978-
menu.state.words[+(key.includes('Disabled') ^ config[key])]}`)
978+
toolbarMenu.state.words[+(key.includes('Disabled') ^ config[key])]}`)
979979
log[key.includes('debug') ? 'info' : 'debug'](`Success! config.${key} = ${config[key]}`)
980980
}
981981
}
@@ -2265,7 +2265,7 @@
22652265
// Toggle button glow
22662266
if (env.ui.app.scheme == 'dark') toggle.btnGlow()
22672267
}
2268-
notify(`${settings.controls[configKey].label} ${menu.state.words[+!config[configKey]]}`)
2268+
notify(`${settings.controls[configKey].label} ${toolbarMenu.state.words[+!config[configKey]]}`)
22692269
},
22702270

22712271
btnGlow(state = '') {
@@ -2314,8 +2314,8 @@
23142314

23152315
proxyMode() {
23162316
settings.save('proxyAPIenabled', !config.proxyAPIenabled)
2317-
notify(`${app.msgs.menuLabel_proxyAPImode} ${menu.state.words[+config.proxyAPIenabled]}`)
2318-
menu.refresh()
2317+
notify(`${app.msgs.menuLabel_proxyAPImode} ${toolbarMenu.state.words[+config.proxyAPIenabled]}`)
2318+
toolbarMenu.refresh()
23192319
if (modals.settings.get()) { // update visual states of Settings toggles
23202320
const proxyToggle = document.querySelector('[id*=proxy] input'),
23212321
streamingToggle = document.querySelector('[id*=streaming] input')
@@ -2357,7 +2357,8 @@
23572357
alert.querySelector('.modal-close-btn').click() ; toggle.proxyMode() }
23582358
} else { // functional toggle
23592359
settings.save('streamingDisabled', !config.streamingDisabled)
2360-
notify(`${settings.controls.streamingDisabled.label} ${menu.state.words[+!config.streamingDisabled]}`)
2360+
notify(`${settings.controls.streamingDisabled.label} ${
2361+
toolbarMenu.state.words[+!config.streamingDisabled]}`)
23612362
}
23622363
},
23632364

@@ -3127,7 +3128,7 @@
31273128

31283129
// Run MAIN routine
31293130

3130-
menu.register()
3131+
toolbarMenu.register()
31313132

31323133
// Exit on specific pages
31333134
if (location.pathname == '/message-us')

autoclear-chatgpt-history/greasemonkey/autoclear-chatgpt-history.user.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
226226
// @author Adam Lui
227227
// @namespace https://github.com/adamlui
228-
// @version 2025.2.12.1
228+
// @version 2025.2.12.2
229229
// @license MIT
230230
// @icon https://assets.autoclearchatgpt.com/images/icons/openai/black/icon48.png?v=f461c06
231231
// @icon64 https://assets.autoclearchatgpt.com/images/icons/openai/black/icon64.png?v=f461c06
@@ -404,38 +404,38 @@
404404

405405
// Define MENU functions
406406

407-
const menu = {
407+
const toolbarMenu = {
408408
ids: [], state: {
409409
symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
410410
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
411411
},
412412

413413
refresh() {
414414
if (typeof GM_unregisterMenuCommand == 'undefined') return
415-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
415+
for (const id of this.ids) { GM_unregisterMenuCommand(id) } this.register()
416416
},
417417

418418
register() {
419419

420420
// Add toggles
421421
Object.keys(settings.controls).forEach(key => {
422422
const settingIsEnabled = config[key] ^ /disabled|hidden/i.test(key)
423-
const menuLabel = `${ settings.controls[key].symbol || menu.state.symbols[+settingIsEnabled] } `
423+
const menuLabel = `${ settings.controls[key].symbol || this.state.symbols[+settingIsEnabled] } `
424424
+ settings.controls[key].label
425-
+ ( settings.controls[key].type == 'toggle' ? menu.state.separator
426-
+ menu.state.words[+settingIsEnabled] : '' )
427-
menu.ids.push(GM_registerMenuCommand(menuLabel, () => {
425+
+ ( settings.controls[key].type == 'toggle' ? this.state.separator
426+
+ this.state.words[+settingIsEnabled] : '' )
427+
this.ids.push(GM_registerMenuCommand(menuLabel, () => {
428428
if (settings.controls[key].type == 'toggle') {
429429
settings.save(key, !config[key]) ; syncConfigToUI({ updatedKey: key })
430430
notify(`${settings.controls[key].label}: ${
431-
menu.state.words[+(config[key] ^ /disabled|hidden/i.test(key))]}`)
431+
this.state.words[+(config[key] ^ /disabled|hidden/i.test(key))]}`)
432432
} else // Clear Now action
433433
clearChatsAndGoHome()
434434
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined))
435435
});
436436

437437
// Add About/Donate entries
438-
['about', 'donate'].forEach(entryType => menu.ids.push(GM_registerMenuCommand(
438+
['about', 'donate'].forEach(entryType => this.ids.push(GM_registerMenuCommand(
439439
`${ entryType == 'about' ? '💡' : '💖' }`
440440
+ ` ${app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
441441
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
@@ -469,7 +469,7 @@
469469
function notify(msg, pos = '', notifDuration = '', shadow = '') {
470470

471471
// Strip state word to append colored one later
472-
const foundState = menu.state.words.find(word => msg.includes(word))
472+
const foundState = toolbarMenu.state.words.find(word => msg.includes(word))
473473
if (foundState) msg = msg.replace(foundState, '')
474474

475475
// Show notification
@@ -489,7 +489,8 @@
489489
}
490490
}
491491
const styledStateSpan = dom.create.elem('span')
492-
styledStateSpan.style.cssText = stateStyles[foundState == menu.state.words[0] ? 'off' : 'on'][env.ui.scheme]
492+
styledStateSpan.style.cssText = stateStyles[
493+
foundState == toolbarMenu.state.words[0] ? 'off' : 'on'][env.ui.scheme]
493494
styledStateSpan.append(foundState) ; notif.append(styledStateSpan)
494495
}
495496
}
@@ -771,7 +772,7 @@
771772
function syncConfigToUI(options) {
772773
if (options?.updatedKey == 'autoclear' && config.autoclear) clearChatsAndGoHome()
773774
if (/autoclear|toggleHidden/.test(options?.updatedKey)) toggles.sidebar.update.state()
774-
menu.refresh() // prefixes/suffixes
775+
toolbarMenu.refresh() // prefixes/suffixes
775776
}
776777

777778
const toggles = {
@@ -812,7 +813,7 @@
812813
`var(--sidebar-surface-${event.type == 'mouseover' ? 'secondary' : 'primary'})`)
813814
this.div.onclick = () => {
814815
settings.save('autoclear', !this.toggleInput.checked) ; syncConfigToUI({ updatedKey: 'autoclear' })
815-
notify(`${app.msgs.mode_autoclear}: ${menu.state.words[+config.autoclear]}`)
816+
notify(`${app.msgs.mode_autoclear}: ${toolbarMenu.state.words[+config.autoclear]}`)
816817
}
817818
},
818819

@@ -928,7 +929,7 @@
928929

929930
// Run MAIN routine
930931

931-
menu.register() // create browser toolbar menu
932+
toolbarMenu.register() // create browser toolbar menu
932933
toggles.sidebar.update.navicon({ preload: true }) // preload sidebar NAVICON variants
933934

934935
// Init UI props

bravegpt/greasemonkey/bravegpt.user.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.2.12.3
151+
// @version 2025.2.12.4
152152
// @license MIT
153153
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
154154
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
@@ -587,7 +587,7 @@
587587

588588
// Define MENU functions
589589

590-
const menu = {
590+
const toolbarMenu = {
591591
ids: [], state: {
592592
symbols: ['❌', '✔️'], separator: env.scriptManager.name == 'Tampermonkey' ? ' — ' : ': ',
593593
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
@@ -596,20 +596,20 @@
596596
refresh() {
597597
if (typeof GM_unregisterMenuCommand == 'undefined') {
598598
log.debug('GM_unregisterMenuCommand not supported.') ; return }
599-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
599+
for (const id of this.ids) { GM_unregisterMenuCommand(id) } this.register()
600600
},
601601

602602
register() {
603603

604604
// Add Proxy API Mode toggle
605-
const pmLabel = menu.state.symbols[+config.proxyAPIenabled] + ' '
605+
const pmLabel = this.state.symbols[+config.proxyAPIenabled] + ' '
606606
+ settings.controls.proxyAPIenabled.label + ' '
607-
+ menu.state.separator + menu.state.words[+config.proxyAPIenabled]
608-
menu.ids.push(GM_registerMenuCommand(pmLabel, toggle.proxyMode,
607+
+ this.state.separator + this.state.words[+config.proxyAPIenabled]
608+
this.ids.push(GM_registerMenuCommand(pmLabel, toggle.proxyMode,
609609
env.scriptManager.supportsTooltips ? { title: settings.controls.proxyAPIenabled.helptip } : undefined));
610610

611611
// Add About/Settings entries
612-
['about', 'settings'].forEach(entryType => menu.ids.push(GM_registerMenuCommand(
612+
['about', 'settings'].forEach(entryType => this.ids.push(GM_registerMenuCommand(
613613
entryType == 'about' ? `💡 ${settings.controls.about.label}` : `⚙️ ${app.msgs.menuLabel_settings}`,
614614
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
615615
)))
@@ -689,7 +689,7 @@
689689
function notify(msg, pos = '', notifDuration = '', shadow = 'shadow') {
690690

691691
// Strip state word to append styled one later
692-
const foundState = menu.state.words.find(word => msg.includes(word))
692+
const foundState = toolbarMenu.state.words.find(word => msg.includes(word))
693693
if (foundState) msg = msg.replace(foundState, '')
694694

695695
// Show notification
@@ -726,7 +726,7 @@
726726
}
727727
const styledStateSpan = dom.create.elem('span')
728728
styledStateSpan.style.cssText = `font-weight: bold ; ${
729-
stateStyles[foundState == menu.state.words[0] ? 'off' : 'on'][env.ui.site.scheme] }`
729+
stateStyles[foundState == toolbarMenu.state.words[0] ? 'off' : 'on'][env.ui.site.scheme] }`
730730
styledStateSpan.append(foundState) ; notif.insertBefore(styledStateSpan, notif.children[2])
731731
}
732732
}
@@ -1199,7 +1199,7 @@
11991199
key.includes('Disabled') ^ config[key] ? 'OFF' : 'ON' }...`)
12001200
settings.save(key, !config[key]) // update config
12011201
notify(`${settings.controls[key].label} ${
1202-
menu.state.words[+(key.includes('Disabled') ^ config[key])]}`)
1202+
toolbarMenu.state.words[+(key.includes('Disabled') ^ config[key])]}`)
12031203
log[key.includes('debug') ? 'info' : 'debug'](`Success! config.${key} = ${config[key]}`)
12041204
}
12051205
}
@@ -2866,7 +2866,7 @@
28662866
if (anchorToggle.checked != config.anchored) modals.settings.toggle.switch(anchorToggle)
28672867
}
28682868
menus.pin.topPos = menus.pin.rightPos = null
2869-
notify(`${app.msgs.mode_anchor} ${menu.state.words[+config.anchored]}`)
2869+
notify(`${app.msgs.mode_anchor} ${toolbarMenu.state.words[+config.anchored]}`)
28702870
},
28712871

28722872
animations(layer) {
@@ -2884,15 +2884,15 @@
28842884
// Toggle button glow
28852885
if (env.ui.app.scheme == 'dark') toggle.btnGlow()
28862886
}
2887-
notify(`${settings.controls[configKey].label} ${menu.state.words[+!config[configKey]]}`)
2887+
notify(`${settings.controls[configKey].label} ${toolbarMenu.state.words[+!config[configKey]]}`)
28882888
},
28892889

28902890
autoGet() {
28912891
settings.save('autoGetDisabled', !config.autoGetDisabled)
28922892
if (appDiv.querySelector('[class*=standby-btn]')) show.reply.standbyBtnClickHandler()
28932893
if (!config.autoGetDisabled) // disable Prefix/Suffix mode if enabled
28942894
['prefix', 'suffix'].forEach(mode => config[`${mode}Enabled`] && toggle.manualGet(mode))
2895-
notify(`${settings.controls.autoGetDisabled.label} ${menu.state.words[+!config.autoGetDisabled]}`)
2895+
notify(`${settings.controls.autoGetDisabled.label} ${toolbarMenu.state.words[+!config.autoGetDisabled]}`)
28962896
if (modals.settings.get()) { // update visual state of Settings toggle
28972897
const autoGetToggle = document.querySelector('[id*=autoGet] input')
28982898
if (autoGetToggle.checked == config.autoGetDisabled) modals.settings.toggle.switch(autoGetToggle)
@@ -2931,7 +2931,7 @@
29312931
const modeKey = `${mode}Enabled`
29322932
settings.save(modeKey, !config[modeKey])
29332933
if (config[modeKey] && !config.autoGetDisabled) toggle.autoGet() // disable Auto-Get mode if enabled
2934-
notify(`${settings.controls[modeKey].label} ${menu.state.words[+config[modeKey]]}`)
2934+
notify(`${settings.controls[modeKey].label} ${toolbarMenu.state.words[+config[modeKey]]}`)
29352935
if (modals.settings.get()) { // update visual state of Settings toggle
29362936
const modeToggle = document.querySelector(`[id*=${modeKey}] input`)
29372937
if (modeToggle.checked != config[modeKey]) modals.settings.toggle.switch(modeToggle)
@@ -2957,8 +2957,8 @@
29572957

29582958
proxyMode() {
29592959
settings.save('proxyAPIenabled', !config.proxyAPIenabled)
2960-
notify(`${app.msgs.menuLabel_proxyAPImode} ${menu.state.words[+config.proxyAPIenabled]}`)
2961-
menu.refresh()
2960+
notify(`${app.msgs.menuLabel_proxyAPImode} ${toolbarMenu.state.words[+config.proxyAPIenabled]}`)
2961+
toolbarMenu.refresh()
29622962
if (modals.settings.get()) { // update visual states of Settings toggles
29632963
const proxyToggle = document.querySelector('[id*=proxy] input'),
29642964
streamingToggle = document.querySelector('[id*=streaming] input')
@@ -2980,7 +2980,7 @@
29802980
.then(queries => show.related(queries))
29812981
.catch(err => { log.error(err.message) ; api.tryNew(get.related) })
29822982
update.answerPreMaxHeight()
2983-
notify(`${app.msgs.menuLabel_relatedQueries} ${menu.state.words[+!config.rqDisabled]}`)
2983+
notify(`${app.msgs.menuLabel_relatedQueries} ${toolbarMenu.state.words[+!config.rqDisabled]}`)
29842984
},
29852985

29862986
sidebar(mode, state = '') {
@@ -3007,7 +3007,7 @@
30073007
if (mode == 'sticky' && prevStickyState == config.stickySidebar) return
30083008
notify(`${ app.msgs[`menuLabel_${ mode }Sidebar`]
30093009
|| mode.charAt(0).toUpperCase() + mode.slice(1) + ' Sidebar' } ${
3010-
menu.state.words[+config[configKeyName]]}`)
3010+
toolbarMenu.state.words[+config[configKeyName]]}`)
30113011
},
30123012

30133013
streaming() {
@@ -3038,7 +3038,8 @@
30383038
alert.querySelector('.modal-close-btn').click() ; toggle.proxyMode() }
30393039
} else { // functional toggle
30403040
settings.save('streamingDisabled', !config.streamingDisabled)
3041-
notify(`${settings.controls.streamingDisabled.label} ${menu.state.words[+!config.streamingDisabled]}`)
3041+
notify(`${settings.controls.streamingDisabled.label} ${
3042+
toolbarMenu.state.words[+!config.streamingDisabled]}`)
30423043
}
30433044
},
30443045

@@ -4002,7 +4003,7 @@
40024003

40034004
// Run MAIN routine
40044005

4005-
menu.register()
4006+
toolbarMenu.register()
40064007

40074008
// Init UI props
40084009
env.ui = { app: { scheme: config.scheme || getScheme() }, site: { scheme: getScheme() }}

0 commit comments

Comments
 (0)