Skip to content

Commit

Permalink
Limited XHR request for msgs init to non-English user languages ↞ [au…
Browse files Browse the repository at this point in the history
…to-sync from `adamlui/chatgpt-apps/autoclear-chatgpt-history`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Aug 27, 2024
1 parent 59075a3 commit 801ca52
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.8.21.1
// @version 2024.8.21.2
// @license MIT
// @icon https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?a8868ef
// @icon64 https://media.autoclearchatgpt.com/images/icons/openai/black/icon64.png?a8868ef
Expand Down Expand Up @@ -279,9 +279,9 @@
// Init FETCHER
const xhr = getUserscriptManager() == 'OrangeMonkey' ? GM_xmlhttpRequest : GM.xmlHttpRequest

// Define MESSAGES
// Init MESSAGES
let msgs = {}
const msgsLoaded = new Promise(resolve => {
if (!config.userLanguage.startsWith('en')) msgs = await new Promise(resolve => {
const msgHostDir = config.assetHostURL + 'greasemonkey/_locales/',
msgLocaleDir = ( config.userLanguage ? config.userLanguage.replace('-', '_') : 'en' ) + '/'
let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0
Expand All @@ -301,7 +301,7 @@
xhr({ method: 'GET', url: msgHref, onload: onLoad })
}
}
}) ; if (!config.userLanguage.startsWith('en')) try { msgs = await msgsLoaded } catch (err) {}
})

// Init MENU objs
const menuIDs = [] // to store registered cmds for removal while preserving order
Expand Down

0 comments on commit 801ca52

Please sign in to comment.