Skip to content

Commit

Permalink
Fixed Reply Language setting stopped persisting (https://greasyfork.o…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jan 13, 2025
1 parent 3a25755 commit 01cdfc2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
16 changes: 8 additions & 8 deletions amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.12.1
// @version 2025.1.12.2
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -385,7 +385,7 @@
}})
Object.assign(config, { minFontSize: 11, maxFontSize: 24, lineHeightRatio: 1.28 })
settings.load([...Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized'])
if (!config.replyLanguage) settings.save('replyLanguage', env.browser.language) // init reply language if unset
if (!config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', 14) // init reply font size if unset
if (!env.streamingSupported.byBrowser || !env.streamingSupported.byScriptManager)
settings.save('streamingDisabled', true) // disable Streaming in unspported env
Expand Down Expand Up @@ -1005,15 +1005,15 @@
log.caller = 'modals.replyLang()'
while (true) {
let replyLang = prompt(
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLanguage)
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLang)
if (replyLang == null) break // user cancelled so do nothing
else if (!/\d/.test(replyLang)) {
replyLang = ( // auto-case for menu/alert aesthetics
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
: replyLang.charAt(0).toUpperCase() + replyLang.slice(1).toLowerCase() )
log.debug('Saving reply language...')
settings.save('replyLanguage', replyLang || env.browser.language)
log.debug(`Success! config.replyLanguage = ${config.replyLanguage}`)
settings.save('replyLang', replyLang || env.browser.language)
log.debug(`Success! config.replyLang = ${config.replyLang}`)
modals.alert(`${app.msgs.alert_langUpdated}!`, // title
`${app.name} ${app.msgs.alert_willReplyIn} ` // msg
+ ( replyLang || app.msgs.alert_yourSysLang ) + '.',
Expand Down Expand Up @@ -1242,7 +1242,7 @@
configStatusSpan.style.cssText = 'float: right ; font-size: 11px ; margin-top: 3px ;'
+ ( !key.includes('about') ? 'text-transform: uppercase !important' : '' )
if (key.includes('replyLang')) {
configStatusSpan.textContent = config.replyLanguage
configStatusSpan.textContent = config.replyLang
settingItem.onclick = () => modals.open('replyLang')
} else if (key.includes('scheme')) {
modals.settings.updateSchemeStatus(configStatusSpan)
Expand Down Expand Up @@ -2038,7 +2038,7 @@
{ code: 'zh-CHS', regex: /^(chi(nese)?|zh|中[国國])/i, rate: 2 }
]
const sgtReplyDialect = sgtDialectMap.find(entry =>
entry.regex.test(config.replyLanguage)) || sgtDialectMap[0]
entry.regex.test(config.replyLang)) || sgtDialectMap[0]
const payload = {
text: wholeAnswer, curTime: Date.now(), spokenDialect: sgtReplyDialect.code,
rate: sgtReplyDialect.rate.toString()
Expand Down Expand Up @@ -2589,7 +2589,7 @@

// Define QUERY AUGMENT functions

function augmentQuery(query) { return query + ` (reply in ${config.replyLanguage})` }
function augmentQuery(query) { return query + ` (reply in ${config.replyLang})` }

function stripQueryAugments(msgChain) {
const augmentCnt = augmentQuery.toString().match(/\+/g).length
Expand Down
18 changes: 9 additions & 9 deletions bravegpt/greasemonkey/bravegpt.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-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.12.1
// @version 2025.1.12.2
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -562,7 +562,7 @@
}})
Object.assign(config, { minFontSize: 11, maxFontSize: 24, lineHeightRatio: 1.313 })
settings.load([...Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized'])
if (!config.replyLanguage) settings.save('replyLanguage', env.browser.language) // init reply language if unset
if (!config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', 16) // init reply font size if unset
if (!env.streamingSupported.byBrowser || !env.streamingSupported.byScriptManager)
settings.save('streamingDisabled', true) // disable Streaming in unspported env
Expand Down Expand Up @@ -1179,15 +1179,15 @@
log.caller = 'modals.replyLang()'
while (true) {
let replyLang = prompt(
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLanguage)
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLang)
if (replyLang == null) break // user cancelled so do nothing
else if (!/\d/.test(replyLang)) {
replyLang = ( // auto-case for menu/alert aesthetics
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
: replyLang.charAt(0).toUpperCase() + replyLang.slice(1).toLowerCase() )
log.debug('Saving reply language...')
settings.save('replyLanguage', replyLang || env.browser.language)
log.debug(`Success! config.replyLanguage = ${config.replyLanguage}`)
settings.save('replyLang', replyLang || env.browser.language)
log.debug(`Success! config.replyLang = ${config.replyLang}`)
modals.alert(`${app.msgs.alert_langUpdated}!`, // title
`${app.name} ${app.msgs.alert_willReplyIn} ` // msg
+ ( replyLang || app.msgs.alert_yourSysLang ) + '.',
Expand Down Expand Up @@ -1428,7 +1428,7 @@
configStatusSpan.style.cssText = 'float: right ; font-size: 11px ; margin-top: 3px ;'
+ ( !key.includes('about') ? 'text-transform: uppercase !important' : '' )
if (key.includes('replyLang')) {
configStatusSpan.textContent = config.replyLanguage
configStatusSpan.textContent = config.replyLang
settingItem.onclick = () => modals.open('replyLang')
} else if (key.includes('scheme')) {
modals.settings.updateSchemeStatus(configStatusSpan)
Expand Down Expand Up @@ -2593,7 +2593,7 @@
{ code: 'zh-CHS', regex: /^(chi(nese)?|zh|中[国國])/i, rate: 2 }
]
const sgtReplyDialect = sgtDialectMap.find(entry =>
entry.regex.test(config.replyLanguage)) || sgtDialectMap[0]
entry.regex.test(config.replyLang)) || sgtDialectMap[0]
const payload = {
text: wholeAnswer, curTime: Date.now(), spokenDialect: sgtReplyDialect.code,
rate: sgtReplyDialect.rate.toString()
Expand Down Expand Up @@ -3240,7 +3240,7 @@

// Define QUERY AUGMENT functions

function augmentQuery(query) { return query + ` (reply in ${config.replyLanguage})` }
function augmentQuery(query) { return query + ` (reply in ${config.replyLang})` }

function stripQueryAugments(msgChain) {
const augmentCnt = augmentQuery.toString().match(/\+/g).length
Expand Down Expand Up @@ -3355,7 +3355,7 @@
+ 'But the key is variety. Do not be repetitive. '
+ ' You must entice user to want to ask one of your related queries.' ))

+ ` Reply in ${config.replyLanguage}`
+ ` Reply in ${config.replyLang}`

// Try diff API after 7s of no response
const iniAPI = get.related.api
Expand Down
18 changes: 9 additions & 9 deletions duckduckgpt/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 2025.1.12.1
// @version 2025.1.12.2
// @license MIT
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
Expand Down Expand Up @@ -562,7 +562,7 @@
}})
Object.assign(config, { minFontSize: 11, maxFontSize: 24, lineHeightRatio: 1.28 })
settings.load([...Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized', 'notFirstRun'])
if (!config.replyLanguage) settings.save('replyLanguage', env.browser.language) // init reply language if unset
if (!config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', 14) // init reply font size if unset
if (!env.streamingSupported.byBrowser || !env.streamingSupported.byScriptManager)
settings.save('streamingDisabled', true) // disable Streaming in unspported env
Expand Down Expand Up @@ -1189,15 +1189,15 @@
log.caller = 'modals.replyLang()'
while (true) {
let replyLang = prompt(
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLanguage)
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLang)
if (replyLang == null) break // user cancelled so do nothing
else if (!/\d/.test(replyLang)) {
replyLang = ( // auto-case for menu/alert aesthetics
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
: replyLang.charAt(0).toUpperCase() + replyLang.slice(1).toLowerCase() )
log.debug('Saving reply language...')
settings.save('replyLanguage', replyLang || env.browser.language)
log.debug(`Success! config.replyLanguage = ${config.replyLanguage}`)
settings.save('replyLang', replyLang || env.browser.language)
log.debug(`Success! config.replyLang = ${config.replyLang}`)
modals.alert(`${app.msgs.alert_langUpdated}!`, // title
`${app.name} ${app.msgs.alert_willReplyIn} ` // msg
+ ( replyLang || app.msgs.alert_yourSysLang ) + '.',
Expand Down Expand Up @@ -1436,7 +1436,7 @@
configStatusSpan.style.cssText = 'float: right ; font-size: 11px ; margin-top: 3px ;'
+ ( !key.includes('about') ? 'text-transform: uppercase !important' : '' )
if (key.includes('replyLang')) {
configStatusSpan.textContent = config.replyLanguage
configStatusSpan.textContent = config.replyLang
settingItem.onclick = () => modals.open('replyLang')
} else if (key.includes('scheme')) {
modals.settings.updateSchemeStatus(configStatusSpan)
Expand Down Expand Up @@ -2478,7 +2478,7 @@
{ code: 'zh-CHS', regex: /^(chi(nese)?|zh|中[国國])/i, rate: 2 }
]
const sgtReplyDialect = sgtDialectMap.find(entry =>
entry.regex.test(config.replyLanguage)) || sgtDialectMap[0]
entry.regex.test(config.replyLang)) || sgtDialectMap[0]
const payload = {
text: wholeAnswer, curTime: Date.now(), spokenDialect: sgtReplyDialect.code,
rate: sgtReplyDialect.rate.toString()
Expand Down Expand Up @@ -3126,7 +3126,7 @@

// Define QUERY AUGMENT functions

function augmentQuery(query) { return query + ` (reply in ${config.replyLanguage})` }
function augmentQuery(query) { return query + ` (reply in ${config.replyLang})` }

function stripQueryAugments(msgChain) {
const augmentCnt = augmentQuery.toString().match(/\+/g).length
Expand Down Expand Up @@ -3239,7 +3239,7 @@
+ 'But the key is variety. Do not be repetitive. '
+ ' You must entice user to want to ask one of your related queries.' ))

+ ` Reply in ${config.replyLanguage}`
+ ` Reply in ${config.replyLang}`

// Try diff API after 7s of no response
const iniAPI = get.related.api
Expand Down
18 changes: 9 additions & 9 deletions googlegpt/greasemonkey/googlegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.12.1
// @version 2025.1.12.2
// @license MIT
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
Expand Down Expand Up @@ -750,7 +750,7 @@
}})
Object.assign(config, { minFontSize: 11, maxFontSize: 24, lineHeightRatio: env.browser.isMobile ? 1.357 : 1.375 })
settings.load([...Object.keys(settings.controls), 'expanded', 'fontSize', 'minimized', 'notFirstRun'])
if (!config.replyLanguage) settings.save('replyLanguage', env.browser.language) // init reply language if unset
if (!config.replyLang) settings.save('replyLang', env.browser.language) // init reply language if unset
if (!config.fontSize) settings.save('fontSize', env.browser.isMobile ? 14 : 16.55) // init reply font size if unset
if (!env.streamingSupported.byBrowser || !env.streamingSupported.byScriptManager)
settings.save('streamingDisabled', true) // disable Streaming in unspported env
Expand Down Expand Up @@ -1372,15 +1372,15 @@
log.caller = 'modals.replyLang()'
while (true) {
let replyLang = prompt(
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLanguage)
( app.msgs.prompt_updateReplyLang ) + ':', config.replyLang)
if (replyLang == null) break // user cancelled so do nothing
else if (!/\d/.test(replyLang)) {
replyLang = ( // auto-case for menu/alert aesthetics
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
: replyLang.charAt(0).toUpperCase() + replyLang.slice(1).toLowerCase() )
log.debug('Saving reply language...')
settings.save('replyLanguage', replyLang || env.browser.language)
log.debug(`Success! config.replyLanguage = ${config.replyLanguage}`)
settings.save('replyLang', replyLang || env.browser.language)
log.debug(`Success! config.replyLang = ${config.replyLang}`)
modals.alert(`${app.msgs.alert_langUpdated}!`, // title
`${app.name} ${app.msgs.alert_willReplyIn} ` // msg
+ ( replyLang || app.msgs.alert_yourSysLang ) + '.',
Expand Down Expand Up @@ -1618,7 +1618,7 @@
configStatusSpan.style.cssText = 'float: right ; font-size: 11px ; margin-top: '
+ ( key.includes('about') ? '5px' : '3px ; text-transform: uppercase !important')
if (key.includes('replyLang')) {
configStatusSpan.textContent = config.replyLanguage
configStatusSpan.textContent = config.replyLang
settingItem.onclick = () => modals.open('replyLang')
} else if (key.includes('scheme')) {
modals.settings.updateSchemeStatus(configStatusSpan)
Expand Down Expand Up @@ -2804,7 +2804,7 @@
{ code: 'zh-CHS', regex: /^(chi(nese)?|zh|中[国國])/i, rate: 2 }
]
const sgtReplyDialect = sgtDialectMap.find(entry =>
entry.regex.test(config.replyLanguage)) || sgtDialectMap[0]
entry.regex.test(config.replyLang)) || sgtDialectMap[0]
const payload = {
text: wholeAnswer, curTime: Date.now(), spokenDialect: sgtReplyDialect.code,
rate: sgtReplyDialect.rate.toString()
Expand Down Expand Up @@ -3461,7 +3461,7 @@

// Define QUERY AUGMENT functions

function augmentQuery(query) { return query + ` (reply in ${config.replyLanguage})` }
function augmentQuery(query) { return query + ` (reply in ${config.replyLang})` }

function stripQueryAugments(msgChain) {
const augmentCnt = augmentQuery.toString().match(/\+/g).length
Expand Down Expand Up @@ -3576,7 +3576,7 @@
+ 'But the key is variety. Do not be repetitive. '
+ ' You must entice user to want to ask one of your related queries.' ))

+ ` Reply in ${config.replyLanguage}`
+ ` Reply in ${config.replyLang}`

// Try diff API after 7s of no response
const iniAPI = get.related.api
Expand Down

0 comments on commit 01cdfc2

Please sign in to comment.