Skip to content

Commit

Permalink
Improved readability of streamingSupported key names ↞ [auto-sync f…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Nov 20, 2024
1 parent a387636 commit c1f467e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions greasemonkey/duckduckgpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.11.20.3
// @version 2024.11.20.4
// @license MIT
// @icon https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302
// @icon64 https://media.ddgpt.com/images/icons/duckduckgpt/icon64.png?af89302
Expand Down Expand Up @@ -334,8 +334,8 @@
// Init COMPATIBILITY flags
log.debug('Initializing compatibility flags...')
const streamingSupported = {
browser: !(env.scriptManager.name == 'Tampermonkey' && (env.browser.isChrome || env.browser.isEdge || env.browser.isBrave)),
scriptManager: /Tampermonkey|ScriptCat/.test(env.scriptManager.name) }
byBrowser: !(env.scriptManager.name == 'Tampermonkey' && (env.browser.isChrome || env.browser.isEdge || env.browser.isBrave)),
byScriptManager: /Tampermonkey|ScriptCat/.test(env.scriptManager.name) }
log.debug(`Success! streamingSupported = ${log.prettifyObj(streamingSupported)}`)

// Init CONFIG
Expand All @@ -347,7 +347,7 @@
'replyLanguage', 'rqDisabled', 'scheme', 'stickySidebar', 'streamingDisabled', 'suffixEnabled', 'widerSidebar')
if (!config.replyLanguage) settings.save('replyLanguage', config.userLanguage) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', 14) // init reply font size if unset
if (!streamingSupported.browser || !streamingSupported.scriptManager) settings.save('streamingDisabled', true) // disable Streaming in unspported env
if (!streamingSupported.byBrowser || !streamingSupported.byScriptManager) settings.save('streamingDisabled', true) // disable Streaming in unspported env
if (!config.notFirstRun && env.browser.isMobile) settings.save('autoGet', true) // reverse default auto-get disabled if mobile
settings.save('notFirstRun', true)
log.debug(`Success! config = ${log.prettifyObj(config)}`)
Expand Down Expand Up @@ -1217,7 +1217,7 @@
// Add click listener
settingItem.onclick = () => {
if (!(key == 'streamingDisabled' // visually switch toggle if not Streaminng...
&& (!streamingSupported.browser || !streamingSupported.scriptManager // ...in unsupported env...
&& (!streamingSupported.byBrowser || !streamingSupported.byScriptManager // ...in unsupported env...
|| !config.proxyAPIenabled) // ...or in OpenAI mode
)) modals.settings.toggle.switch(settingToggle)

Expand Down Expand Up @@ -2706,7 +2706,7 @@
const scriptCatLink = env.browser.isFF ? 'https://addons.mozilla.org/firefox/addon/scriptcat/'
: env.browser.isEdge ? 'https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh'
: 'https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf'
if (!streamingSupported.scriptManager) { // alert userscript manager unsupported, suggest TM/SC
if (!streamingSupported.byScriptManager) { // alert userscript manager unsupported, suggest TM/SC
log.debug(`Streaming Mode unsupported in ${env.scriptManager.name}`)
const suggestAlertID = siteAlert(`${settings.controls.streamingDisabled.label} ${app.msgs.alert_unavailable}`,
`${settings.controls.streamingDisabled.label} ${app.msgs.alert_isOnlyAvailFor}`
Expand All @@ -2718,7 +2718,7 @@
)
const suggestAlert = document.getElementById(suggestAlertID).firstChild
modals.init(suggestAlert) // add classes/stars, disable wheel-scrolling, dim bg, glowup btns
} else if (!streamingSupported.browser) { // alert TM/browser unsupported, suggest SC
} else if (!streamingSupported.byBrowser) { // alert TM/browser unsupported, suggest SC
log.debug('Streaming Mode unsupported in browser')
const suggestAlertID = siteAlert(`${settings.controls.streamingDisabled.label} ${app.msgs.alert_unavailable}`,
`${settings.controls.streamingDisabled.label} ${app.msgs.alert_isUnsupportedIn} `
Expand Down

0 comments on commit c1f467e

Please sign in to comment.