|
148 | 148 | // @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!) |
149 | 149 | // @author KudoAI |
150 | 150 | // @namespace https://kudoai.com |
151 | | -// @version 2026.1.26.1 |
| 151 | +// @version 2026.1.26.3 |
152 | 152 | // @license MIT |
153 | 153 | // @icon https://assets.bravegpt.com/images/icons/app/icon48.png?v=e8ca7c2 |
154 | 154 | // @icon64 https://assets.bravegpt.com/images/icons/app/icon64.png?v=e8ca7c2 |
|
198 | 198 | // @require https://cdn.jsdelivr.net/npm/json5@2.2.3/dist/index.min.js#sha256-S7ltnVPzgKyAGBlBG4wQhorJqYTehj5WQCrADCKJufE= |
199 | 199 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/components/buttons.js#sha256-bam0MF6WM+Lyt5Wgop3rfHPYZHmOPXq4ZxbUXort2+M= |
200 | 200 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/components/icons.js#sha256-nAcuQD4FVFzUN1pS6pOjw2V3IvkDwYV+P3m5IN8nsdo= |
201 | | -// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/components/menus.js#sha256-3c/0V6/lug+yy7AGCI99Em7G+QGYcnfYpbN3VZSv4go= |
| 201 | +// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@787f07b/assets/js/chatbot/components/menus.js#sha256-YaV3USVJvvChUwPjoF2jwRwbKVBdjoFfLS6ThEnZchE= |
202 | 202 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/components/replyBubble.js#sha256-zN/oMInc63biUtC+qNfP48vntQiEw2zyCIVszeBxLmg= |
203 | 203 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/components/tooltip.js#sha256-/xPw7DnS8F9dBH/s0ffMrErweHgFBeKpkUM4tUDy4vo= |
204 | | -// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/api.js#ha256-9mC3x8yqdVp3WpWMreBsTzunXu1+VSm0bXvVOQz3ODs= |
| 204 | +// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@787f07b/assets/js/chatbot/lib/api.js#sha256-9mC3x8yqdVp3WpWMreBsTzunXu1+VSm0bXvVOQz3ODs= |
205 | 205 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/feedback.js#sha256-ri8OzNa/8sQINDn7bW84F2OuVYZxubMSm/Zpli/cPnQ= |
206 | 206 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/log.js#sha256-puXwoSKgog6EhgDzlJrAzMnGRM6kLMTT8NF0jYncIt8= |
207 | 207 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/prompts.js#sha256-Z9QsKpAcqSoclxyPTkPfe8/K3s9eDrbSYgumr/GYyLc= |
208 | 208 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/session.js#sha256-cH2e3l2bZQRekQHxaeSShdNguqD41evEOkMrrVIydHQ= |
209 | 209 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/themes.js#sha256-NSiOkXoRC/fF8zdmnbIk9XL5tKWWP5MU2NOfdJ9G0NU= |
210 | 210 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/ui.js#sha256-+UnPhc4zxrdWEuLU8PFrnpAW9TFS2c1hOGbcby2HlEU= |
211 | 211 | // @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@30ce038/assets/js/chatbot/lib/userscript.js#sha256-DTD+Tj/9angBw8/Q4e8PMz2SBwueqvNzeY8PwZlMgbs= |
212 | | -// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@ed7d80f/assets/js/lib/css.js/dist/css.min.js#sha256-BCcXA39Aq/Thsxgzl5di1FFCVQK5JiVQykPs8KBVxl8= |
213 | | -// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@ed7d80f/assets/js/lib/css.js/dist/css.min.js#sha256-BCcXA39Aq/Thsxgzl5di1FFCVQK5JiVQykPs8KBVxl8= |
214 | | -// @require https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@3683a79/assets/js/lib/dom.js/dist/dom.min.js#sha256-Xl5ghi373aMe12nN4vOKB+C5IJQY43AtjVAdB0K3Dag= |
| 212 | +// @require https://cdn.jsdelivr.net/gh/adamlui/userscripts@ff2baba/assets/js/lib/css.js/dist/css.min.js#sha256-zf9s8C0cZ/i+gnaTIUxa0+RpDYpsJVlyuV5L2q4KUdA= |
| 213 | +// @require https://cdn.jsdelivr.net/gh/adamlui/userscripts@ff2baba/assets/js/lib/dom.js/dist/dom.min.js#sha256-nTc2by3ZAz6AR7B8fOqjloJNETvjAepe15t2qlghMDo= |
215 | 214 | // @require https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js#sha256-PI9snFGy1YvX4fiT8SJ01RveRSa6vZujEJxk8y/jvVs= |
216 | 215 | // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js#sha256-g3pvpbDHNrUrveKythkPMF2j/J7UFoHbUyFQcFe1yEY= |
217 | 216 | // @require https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.js#sha256-n0UwfFeU7SR6DQlfOmLlLvIhWmeyMnIDp/2RmVmuedE= |
|
353 | 352 | const reInvertFlags = /disabled|hidden/i |
354 | 353 | return reInvertFlags.test(key) // flag in control key name |
355 | 354 | && !reInvertFlags.test(this.controls[key]?.label || '') // but not in label msg key name |
356 | | - ? !config[key] : app.config[key] // so invert since flag reps opposite type state, else don't |
| 355 | + ? !app.config[key] : app.config[key] // so invert since flag reps opposite type state, else don't |
357 | 356 | } |
358 | 357 | } |
359 | 358 | settings.load('debugMode') ; log.debug('Initializing settings...') |
|
415 | 414 | about: { type: 'modal', icon: 'questionMarkCircle', |
416 | 415 | label: `${app.msgs.menuLabel_about} ${app.name}...` } |
417 | 416 | }}) |
418 | | - Object.assign(config, { lineHeightRatio: 1.313, maxFontSize: 24, minFontSize: 11 }) |
| 417 | + Object.assign(app.config, { lineHeightRatio: 1.313, maxFontSize: 24, minFontSize: 11 }) |
419 | 418 | settings.load(Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized') |
420 | 419 | if (!app.config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset |
421 | 420 | if (!app.config.fontSize) settings.save('fontSize', 12.8791) // init reply font size if unset |
422 | 421 | if (!env.scriptManager.supportsStreaming) settings.save('streamingDisabled', true) // disable Streaming in unspported env |
423 | | - log.debug(`Success! config = ${log.prettifyObj(config)}`) |
| 422 | + log.debug(`Success! app.config = ${log.prettifyObj(app.config)}`) |
424 | 423 |
|
425 | 424 | // Define UI functions |
426 | 425 |
|
|
998 | 997 | const anchorToggle = document.querySelector('[id*=anchor] input') |
999 | 998 | if (anchorToggle.checked != app.config.anchored) modals.settings.toggle.switch(anchorToggle) |
1000 | 999 | } |
1001 | | - feedback.notify(`${app.msgs.mode_anchor} ${menus.toolbar.state.words[+config.anchored]}`, |
| 1000 | + feedback.notify(`${app.msgs.mode_anchor} ${menus.toolbar.state.words[+app.config.anchored]}`, |
1002 | 1001 | undefined, sidebarModeToggled ? 2.75 : undefined) // +1s duration if conflicting mode notif shown |
1003 | 1002 | }, |
1004 | 1003 |
|
1005 | 1004 | animations(layer) { |
1006 | 1005 | const configKey = `${layer}AnimationsDisabled` |
1007 | | - settings.save(configKey, !config[configKey]) |
| 1006 | + settings.save(configKey, !app.config[configKey]) |
1008 | 1007 | update.appStyle() ; if (layer == 'bg') { update.risingParticles() ; update.replyPrefix() } |
1009 | 1008 | if (layer == 'fg' && modals.settings.get()) { // toggle ticker-scroll of About status label |
1010 | 1009 | const aboutStatusLabel = document.querySelector('#about-settings-entry > span > div') |
1011 | 1010 | aboutStatusLabel.innerHTML = modals.settings.aboutContent[ |
1012 | 1011 | app.config.fgAnimationsDisabled ? 'short' : 'long'] |
1013 | 1012 | aboutStatusLabel.style.float = app.config.fgAnimationsDisabled ? 'right' : '' |
1014 | 1013 | } |
1015 | | - feedback.notify(`${settings.controls[configKey].label} ${menus.toolbar.state.words[+!config[configKey]]}`) |
| 1014 | + feedback.notify(`${settings.controls[configKey].label} ${menus.toolbar.state.words[+!app.config[configKey]]}`) |
1016 | 1015 | }, |
1017 | 1016 |
|
1018 | 1017 | autoGen(mode) { |
1019 | 1018 | const validModes = ['get', 'summarize'], |
1020 | 1019 | modeKey = `auto${log.toTitleCase(mode)}${ mode == 'get' ? 'Disabled' : '' }` |
1021 | 1020 | let conflictingModeToggled = false // to extend this notif duration |
1022 | | - settings.save(modeKey, !config[modeKey]) |
| 1021 | + settings.save(modeKey, !app.config[modeKey]) |
1023 | 1022 | if (settings.typeIsEnabled(modeKey)) { // this Auto-Gen mode toggled on, disable other one + Manual-Gen + do it |
1024 | 1023 | const otherMode = validModes[+(mode == validModes[0])], |
1025 | 1024 | otherModeKey = `auto${log.toTitleCase(otherMode)}${ otherMode == 'get' ? 'Disabled' : '' }` |
|
1054 | 1053 | manualGen(mode) { // Prefix/Suffix modes |
1055 | 1054 | const modeKey = `${mode}Enabled` |
1056 | 1055 | let autoGenToggled = false // to extend this notif duration |
1057 | | - settings.save(modeKey, !config[modeKey]) |
| 1056 | + settings.save(modeKey, !app.config[modeKey]) |
1058 | 1057 | if (app.config[modeKey]) // Manual-Gen toggled on, disable all Auto-Gen |
1059 | 1058 | ['get', 'summarize'].forEach(mode => { |
1060 | 1059 | if (settings.typeIsEnabled(`auto${log.toTitleCase(mode)}${ mode == 'get' ? 'Disabled' : '' }`)) { |
1061 | 1060 | toggle.autoGen(mode) ; autoGenToggled = true } |
1062 | 1061 | }) |
1063 | | - feedback.notify(`${settings.controls[modeKey].label} ${menus.toolbar.state.words[+config[modeKey]]}`, |
| 1062 | + feedback.notify(`${settings.controls[modeKey].label} ${menus.toolbar.state.words[+app.config[modeKey]]}`, |
1064 | 1063 | undefined, autoGenToggled ? 2.75 : undefined) // +1s duration if conflicting mode notif shown) |
1065 | 1064 | if (modals.settings.get()) { // update visual state of Settings toggle |
1066 | 1065 | const modeToggle = document.querySelector(`[id*=${modeKey}] input`) |
|
1088 | 1087 |
|
1089 | 1088 | proxyMode() { |
1090 | 1089 | settings.save('proxyAPIenabled', !app.config.proxyAPIenabled) |
1091 | | - feedback.notify(`${app.msgs.menuLabel_proxyAPImode} ${menus.toolbar.state.words[+config.proxyAPIenabled]}`) |
| 1090 | + feedback.notify(`${app.msgs.menuLabel_proxyAPImode} ${menus.toolbar.state.words[+app.config.proxyAPIenabled]}`) |
1092 | 1091 | menus.toolbar.refresh() |
1093 | 1092 | if (modals.settings.get()) { // update visual states of Settings toggles |
1094 | 1093 | const proxyToggle = document.querySelector('[id*=proxy] input'), |
|
1126 | 1125 | let anchorModeDisabled = false // to extend this notif duration |
1127 | 1126 |
|
1128 | 1127 | // Save new state + disable incompatible Anchor mode |
1129 | | - if (state == 'on' || !state && !config[configKeyName]) { // toggle on |
| 1128 | + if (state == 'on' || !state && !app.config[configKeyName]) { // toggle on |
1130 | 1129 | if (mode == 'sticky' && app.config.anchored) { toggle.anchorMode() ; anchorModeDisabled = true } |
1131 | 1130 | settings.save(configKeyName, true) |
1132 | 1131 | } else settings.save(configKeyName, false) |
|
1147 | 1146 | if (mode == 'sticky' && prevStickyState == app.config.stickySidebar) return |
1148 | 1147 | feedback.notify( |
1149 | 1148 | `${ app.msgs[`menuLabel_${mode}Sidebar`] || log.toTitleCase(mode) + ' Sidebar' } ${ |
1150 | | - menus.toolbar.state.words[+config[configKeyName]]}`, |
| 1149 | + menus.toolbar.state.words[+app.config[configKeyName]]}`, |
1151 | 1150 | undefined, anchorModeDisabled ? 2.75 : undefined // +1s duration if conflicting mode notif shown |
1152 | 1151 | ) |
1153 | 1152 | }, |
|
2328 | 2327 |
|
2329 | 2328 | // ...or generically toggle/notify |
2330 | 2329 | else { |
2331 | | - settings.save(key, !config[key]) // update config |
| 2330 | + settings.save(key, !app.config[key]) // update config |
2332 | 2331 | feedback.notify(`${settings.controls[key].label} ${ |
2333 | 2332 | menus.toolbar.state.words[+(key.includes('Disabled') != app.config[key])]}`) |
2334 | 2333 | } |
|
0 commit comments