Skip to content

Commit b37cac5

Browse files
committed
Alphabetized function defs for readability
1 parent 04fc145 commit b37cac5

File tree

12 files changed

+2909
-2910
lines changed

12 files changed

+2909
-2910
lines changed

amazongpt/greasemonkey/amazongpt.user.js

Lines changed: 537 additions & 537 deletions
Large diffs are not rendered by default.

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

Lines changed: 126 additions & 126 deletions
Large diffs are not rendered by default.

bravegpt/greasemonkey/bravegpt.user.js

Lines changed: 669 additions & 669 deletions
Large diffs are not rendered by default.

chatgpt-auto-continue/greasemonkey/chatgpt-auto-continue.user.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
// @description:zu ⚡ Terus menghasilkan imibuzo eminingi ye-ChatGPT ngokwesizulu
220220
// @author Adam Lui
221221
// @namespace https://github.com/adamlui
222-
// @version 2025.2.12
222+
// @version 2025.2.12.1
223223
// @license MIT
224224
// @icon https://assets.chatgptautocontinue.com/images/icons/continue-symbol/circled/with-robot/icon48.png?v=8b39fb4
225225
// @icon64 https://assets.chatgptautocontinue.com/images/icons/continue-symbol/circled/with-robot/icon64.png?v=8b39fb4
@@ -372,6 +372,11 @@
372372
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
373373
},
374374

375+
refresh() {
376+
if (typeof GM_unregisterMenuCommand == 'undefined') return
377+
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
378+
},
379+
375380
register() {
376381

377382
// Show "Disabled (extension installed)"
@@ -401,11 +406,6 @@
401406
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
402407
))
403408
})
404-
},
405-
406-
refresh() {
407-
if (typeof GM_unregisterMenuCommand == 'undefined') return
408-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
409409
}
410410
}
411411

@@ -463,13 +463,6 @@
463463

464464
// Define UI functions
465465

466-
function syncConfigToUI() { menu.refresh() /* prefixes/suffixes */ }
467-
468-
function getScheme() {
469-
return document.documentElement.className
470-
|| (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
471-
}
472-
473466
function checkBtnsToClick() {
474467
let continueBtnClicked = false // to increase delay before next check if true to avoid repeated clicks
475468
const btnTypesToCheck = ['Continue'] ; if (config.autoScroll) btnTypesToCheck.push('Scroll')
@@ -485,6 +478,13 @@
485478
setTimeout(checkBtnsToClick, continueBtnClicked ? 5000 : 500)
486479
}
487480

481+
function getScheme() {
482+
return document.documentElement.className
483+
|| (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
484+
}
485+
486+
function syncConfigToUI() { menu.refresh() /* prefixes/suffixes */ }
487+
488488
// Run MAIN routine
489489

490490
env.extensionInstalled = await Promise.race([

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

Lines changed: 97 additions & 97 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.2.12
223+
// @version 2025.2.12.1
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
@@ -422,6 +422,11 @@
422422
words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()]
423423
},
424424

425+
refresh() {
426+
if (typeof GM_unregisterMenuCommand == 'undefined') return
427+
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
428+
},
429+
425430
register() {
426431

427432
// Init prompt setting status labels
@@ -469,11 +474,6 @@
469474
+ ` ${app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
470475
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
471476
)))
472-
},
473-
474-
refresh() {
475-
if (typeof GM_unregisterMenuCommand == 'undefined') return
476-
for (const id of menu.ids) { GM_unregisterMenuCommand(id) } menu.register()
477477
}
478478
}
479479

@@ -534,89 +534,6 @@
534534
stack: [], // of types of undismissed modals
535535
class: `${app.slug}-modal`,
536536

537-
alert(title = '', msg = '', btns = '', checkbox = '', width = '') { // generic one from chatgpt.alert()
538-
const alertID = chatgpt.alert(title, msg, btns, checkbox, width),
539-
alert = document.getElementById(alertID).firstChild
540-
this.init(alert) // add classes + rising particles bg
541-
return alert
542-
},
543-
544-
open(modalType, modalSubType) {
545-
const modal = modalSubType ? this[modalType][modalSubType]() : this[modalType]() // show modal
546-
if (!modal) return // since no div returned
547-
this.stack.unshift(modalSubType ? `${modalType}_${modalSubType}` : modalType) // add to stack
548-
this.init(modal) // add classes + rising particles bg
549-
this.observeRemoval(modal, modalType, modalSubType) // to maintain stack for proper nav
550-
},
551-
552-
init(modal) {
553-
if (!this.styles) this.stylize() // to init/append stylesheet
554-
modal.classList.add('no-user-select', this.class) ; modal.parentNode.classList.add(`${this.class}-bg`)
555-
dom.addRisingParticles(modal)
556-
},
557-
558-
stylize() {
559-
if (!this.styles) {
560-
this.styles = dom.create.style(null, { id: `${this.class}-styles` })
561-
document.head.append(this.styles)
562-
}
563-
this.styles.innerText = (
564-
`.no-user-select {
565-
user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none }`
566-
+ `.${this.class} {` // modals
567-
+ 'font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,'
568-
+ 'Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;'
569-
+ 'padding: 20px 25px 24px 25px !important ; font-size: 20px ;'
570-
+ `color: ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;`
571-
+ `background-image: linear-gradient(180deg, ${
572-
env.ui.scheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) }`
573-
+ `.${this.class} [class*=modal-close-btn] {`
574-
+ 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
575-
+ 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
576-
+ `.${this.class} [class*=modal-close-btn] svg { height: 10px }`
577-
+ `.${this.class} [class*=modal-close-btn] path {`
578-
+ `${ env.ui.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: #9f9f9f ; fill: #9f9f9f' }}`
579-
+ ( env.ui.scheme == 'dark' ? // invert dark mode hover paths
580-
`.${this.class} [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' )
581-
+ `.${this.class} [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay
582-
+ `.${this.class} [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay
583-
+ `.${this.class} a { color: #${ env.ui.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }`
584-
+ `.${this.class} h2 { font-weight: bold }`
585-
+ `.${this.class} button {`
586-
+ '--btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ;'
587-
+ 'font-size: 14px ; text-transform: uppercase ;' // shrink/uppercase labels
588-
+ 'border-radius: 0 !important ;' // square borders
589-
+ 'transition: var(--btn-transition) ;' // smoothen hover fx
590-
+ '-webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ;'
591-
+ '-o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) ;'
592-
+ 'cursor: pointer !important ;' // add finger cursor
593-
+ `border: 1px solid ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;`
594-
+ 'padding: 8px !important ; min-width: 102px }' // resize
595-
+ `.${this.class} button:hover {` // add zoom, re-scheme
596-
+ 'transform: scale(1.055) ; color: black !important ;'
597-
+ `background-color: #${ env.ui.scheme == 'dark' ? '00cfff' : '9cdaff' } !important }`
598-
+ ( !env.browser.isMobile ? `.${this.class} .modal-buttons { margin-left: -13px !important }` : '' )
599-
+ `.about-em { color: ${ env.ui.scheme == 'dark' ? 'white' : 'green' } !important }`
600-
)
601-
},
602-
603-
observeRemoval(modal, modalType, modalSubType) { // to maintain stack for proper nav
604-
const modalBG = modal.parentNode
605-
new MutationObserver(([mutation], obs) => {
606-
mutation.removedNodes.forEach(removedNode => { if (removedNode == modalBG) {
607-
if (modals.stack[0].includes(modalSubType || modalType)) { // new modal not launched so nav back
608-
modals.stack.shift() // remove this modal type from stack 1st
609-
const prevModalType = modals.stack[0]
610-
if (prevModalType) { // open it
611-
modals.stack.shift() // remove type from stack since re-added on open
612-
modals.open(prevModalType)
613-
}
614-
}
615-
obs.disconnect()
616-
}})
617-
}).observe(modalBG.parentNode, { childList: true, subtree: true })
618-
},
619-
620537
about() {
621538

622539
// Show modal
@@ -678,6 +595,13 @@
678595
return aboutModal
679596
},
680597

598+
alert(title = '', msg = '', btns = '', checkbox = '', width = '') { // generic one from chatgpt.alert()
599+
const alertID = chatgpt.alert(title, msg, btns, checkbox, width),
600+
alert = document.getElementById(alertID).firstChild
601+
this.init(alert) // add classes + rising particles bg
602+
return alert
603+
},
604+
681605
donate() {
682606

683607
// Show modal
@@ -734,6 +658,84 @@
734658
return donateModal
735659
},
736660

661+
init(modal) {
662+
if (!this.styles) this.stylize() // to init/append stylesheet
663+
modal.classList.add('no-user-select', this.class) ; modal.parentNode.classList.add(`${this.class}-bg`)
664+
dom.addRisingParticles(modal)
665+
},
666+
667+
observeRemoval(modal, modalType, modalSubType) { // to maintain stack for proper nav
668+
const modalBG = modal.parentNode
669+
new MutationObserver(([mutation], obs) => {
670+
mutation.removedNodes.forEach(removedNode => { if (removedNode == modalBG) {
671+
if (modals.stack[0].includes(modalSubType || modalType)) { // new modal not launched so nav back
672+
modals.stack.shift() // remove this modal type from stack 1st
673+
const prevModalType = modals.stack[0]
674+
if (prevModalType) { // open it
675+
modals.stack.shift() // remove type from stack since re-added on open
676+
modals.open(prevModalType)
677+
}
678+
}
679+
obs.disconnect()
680+
}})
681+
}).observe(modalBG.parentNode, { childList: true, subtree: true })
682+
},
683+
684+
open(modalType, modalSubType) {
685+
const modal = modalSubType ? this[modalType][modalSubType]() : this[modalType]() // show modal
686+
if (!modal) return // since no div returned
687+
this.stack.unshift(modalSubType ? `${modalType}_${modalSubType}` : modalType) // add to stack
688+
this.init(modal) // add classes + rising particles bg
689+
this.observeRemoval(modal, modalType, modalSubType) // to maintain stack for proper nav
690+
},
691+
692+
safeWinOpen(url) { open(url, '_blank', 'noopener') }, // to prevent backdoor vulnerabilities
693+
694+
stylize() {
695+
if (!this.styles) {
696+
this.styles = dom.create.style(null, { id: `${this.class}-styles` })
697+
document.head.append(this.styles)
698+
}
699+
this.styles.innerText = (
700+
`.no-user-select {
701+
user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none }`
702+
+ `.${this.class} {` // modals
703+
+ 'font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,'
704+
+ 'Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;'
705+
+ 'padding: 20px 25px 24px 25px !important ; font-size: 20px ;'
706+
+ `color: ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;`
707+
+ `background-image: linear-gradient(180deg, ${
708+
env.ui.scheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) }`
709+
+ `.${this.class} [class*=modal-close-btn] {`
710+
+ 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
711+
+ 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
712+
+ `.${this.class} [class*=modal-close-btn] svg { height: 10px }`
713+
+ `.${this.class} [class*=modal-close-btn] path {`
714+
+ `${ env.ui.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: #9f9f9f ; fill: #9f9f9f' }}`
715+
+ ( env.ui.scheme == 'dark' ? // invert dark mode hover paths
716+
`.${this.class} [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' )
717+
+ `.${this.class} [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay
718+
+ `.${this.class} [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay
719+
+ `.${this.class} a { color: #${ env.ui.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }`
720+
+ `.${this.class} h2 { font-weight: bold }`
721+
+ `.${this.class} button {`
722+
+ '--btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ;'
723+
+ 'font-size: 14px ; text-transform: uppercase ;' // shrink/uppercase labels
724+
+ 'border-radius: 0 !important ;' // square borders
725+
+ 'transition: var(--btn-transition) ;' // smoothen hover fx
726+
+ '-webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ;'
727+
+ '-o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) ;'
728+
+ 'cursor: pointer !important ;' // add finger cursor
729+
+ `border: 1px solid ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;`
730+
+ 'padding: 8px !important ; min-width: 102px }' // resize
731+
+ `.${this.class} button:hover {` // add zoom, re-scheme
732+
+ 'transform: scale(1.055) ; color: black !important ;'
733+
+ `background-color: #${ env.ui.scheme == 'dark' ? '00cfff' : '9cdaff' } !important }`
734+
+ ( !env.browser.isMobile ? `.${this.class} .modal-buttons { margin-left: -13px !important }` : '' )
735+
+ `.about-em { color: ${ env.ui.scheme == 'dark' ? 'white' : 'green' } !important }`
736+
)
737+
},
738+
737739
update: {
738740
width: 377,
739741

@@ -767,24 +769,22 @@
767769
'', '', modals.update.width
768770
)
769771
}
770-
},
771-
772-
safeWinOpen(url) { open(url, '_blank', 'noopener') } // to prevent backdoor vulnerabilities
772+
}
773773
}
774774

775775
// Define UI functions
776776

777+
function getScheme() {
778+
return document.documentElement.className
779+
|| (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
780+
}
781+
777782
function syncConfigToUI(options) {
778783
if (options?.updatedKey == 'arDisabled') toggleAutoRefresh()
779784
if (/arDisabled|toggleHidden/.test(options?.updatedKey)) toggles.sidebar.update.state()
780785
menu.refresh() // prefixes/suffixes
781786
}
782787

783-
function getScheme() {
784-
return document.documentElement.className
785-
|| (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
786-
}
787-
788788
const toggles = {
789789

790790
sidebar: {

0 commit comments

Comments
 (0)