|
3 | 3 | // @description Add AI chat & product/category summaries to Amazon shopping, powered by the latest LLMs like GPT-4o! |
4 | 4 | // @author KudoAI |
5 | 5 | // @namespace https://kudoai.com |
6 | | -// @version 2026.1.27.1 |
| 6 | +// @version 2026.2.5 |
7 | 7 | // @license MIT |
8 | 8 | // @icon https://amazongpt.kudoai.com/assets/images/icons/app/black-gold-teal/icon48.png?v=8e8ed1c |
9 | 9 | // @icon64 https://amazongpt.kudoai.com/assets/images/icons/app/black-gold-teal/icon64.png?v=8e8ed1c |
|
166 | 166 | msgs: await new Promise(resolve => { |
167 | 167 | const msgHostDir = `${app.urls.resourceHost}/greasemonkey/_locales/`, |
168 | 168 | msgLocaleDir = `${ env.browser.language ? env.browser.language.replace('-', '_') : 'en' }/` |
169 | | - let msgHref = `${ msgHostDir + msgLocaleDir }messages.json`, msgXHRtries = 0 |
| 169 | + let msgHref = `${ msgHostDir + msgLocaleDir }messages.json`, msgFetchesTried = 0 |
170 | 170 | function fetchMsgs() { xhr({ method: 'GET', url: msgHref, onload: handleMsgs })} |
171 | 171 | function handleMsgs(resp) { |
172 | 172 | try { // to return localized messages.json |
|
176 | 176 | flatMsgs[key] = msgs[key].message |
177 | 177 | resolve(flatMsgs) |
178 | 178 | } catch (err) { // if bad response |
179 | | - msgXHRtries++ ; if (msgXHRtries == 3) return resolve({}) // try original/region-stripped/EN only |
180 | | - msgHref = env.browser.language.includes('-') && msgXHRtries == 1 ? // if regional lang on 1st try... |
| 179 | + msgFetchesTried++ ; if (msgFetchesTried == 3) return resolve({}) // try original/region-stripped/EN only |
| 180 | + msgHref = env.browser.language.includes('-') && msgFetchesTried == 1 ? // if regional lang on 1st try... |
181 | 181 | msgHref.replace(/(_locales\/[^_]+)_[^_]+(\/)/, '$1$2') // ...strip region before retrying |
182 | 182 | : `${msgHostDir}en/messages.json` // else use default English messages |
183 | 183 | fetchMsgs() |
|
0 commit comments