From ea7b587ccfb6d498b87b7611a5a9127564545707 Mon Sep 17 00:00:00 2001 From: xkeyC <39891083+xkeyC@users.noreply.github.com> Date: Fri, 17 Nov 2023 10:45:54 +0800 Subject: [PATCH] =?UTF-8?q?dps=20=E7=8B=AC=E7=AB=8B=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StarCitizenBoxBrowserEx/background.js | 13 +++++++++---- StarCitizenBoxBrowserEx_Firefox/background.js | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/StarCitizenBoxBrowserEx/background.js b/StarCitizenBoxBrowserEx/background.js index 7b6cf77..bfc53e5 100644 --- a/StarCitizenBoxBrowserEx/background.js +++ b/StarCitizenBoxBrowserEx/background.js @@ -29,18 +29,20 @@ async function _initLocalization(url) { let v = dataVersion // TODO check version let data = {}; - data["zh-CN"] = await _getJsonData("zh-CN-rsi.json", { cacheKey: "zh-CN", version: v.rsi }); if (url.includes("robertsspaceindustries.com")) { + data["zh-CN"] = await _getJsonData("zh-CN-rsi.json", { cacheKey: "zh-CN", version: v.rsi }); data["concierge"] = await _getJsonData("concierge.json", { cacheKey: "concierge", version: v.concierge }); data["orgs"] = await _getJsonData("orgs.json", v.orgs); data["address"] = await _getJsonData("addresses.json", { cacheKey: "orgs", version: v.addresses }); data["hangar"] = await _getJsonData("hangar.json", { cacheKey: "hangar", version: v.hangar }); - } else { + } else if (url.includes("uexcorp.space")) { data["UEX"] = await _getJsonData("zh-CN-uex.json", { cacheKey: "uex", version: v.uex }); + } else if (url.includes("erkul.games")) { + data["DPS"] = await _getJsonData("zh-CN-dps.json", { cacheKey: "dps", version: "0.0" }); } // update data - let replaceWords = getLocalizationResource(data, "zh-CN"); + let replaceWords = []; function addLocalizationResource(key) { replaceWords.push(...getLocalizationResource(data, key)); @@ -54,6 +56,7 @@ async function _initLocalization(url) { const referral = "https://robertsspaceindustries.com/account/referral-program"; const address = "https://robertsspaceindustries.com/account/addresses"; const hangar = "https://robertsspaceindustries.com/account/pledges"; + addLocalizationResource("zh-CN"); if (url.startsWith(org) || url.startsWith(citizens) || url.startsWith(organization)) { replaceWords.push({ "word": 'members', "replacement": '名成员' }); addLocalizationResource("orgs"); @@ -78,8 +81,10 @@ async function _initLocalization(url) { if (url.startsWith(hangar)) { addLocalizationResource("hangar"); } - } else { + } else if (url.includes("uexcorp.space")) { addLocalizationResource("UEX"); + } else if (url.includes("erkul.games")) { + addLocalizationResource("DPS"); } return replaceWords; } diff --git a/StarCitizenBoxBrowserEx_Firefox/background.js b/StarCitizenBoxBrowserEx_Firefox/background.js index 7b6cf77..bfc53e5 100644 --- a/StarCitizenBoxBrowserEx_Firefox/background.js +++ b/StarCitizenBoxBrowserEx_Firefox/background.js @@ -29,18 +29,20 @@ async function _initLocalization(url) { let v = dataVersion // TODO check version let data = {}; - data["zh-CN"] = await _getJsonData("zh-CN-rsi.json", { cacheKey: "zh-CN", version: v.rsi }); if (url.includes("robertsspaceindustries.com")) { + data["zh-CN"] = await _getJsonData("zh-CN-rsi.json", { cacheKey: "zh-CN", version: v.rsi }); data["concierge"] = await _getJsonData("concierge.json", { cacheKey: "concierge", version: v.concierge }); data["orgs"] = await _getJsonData("orgs.json", v.orgs); data["address"] = await _getJsonData("addresses.json", { cacheKey: "orgs", version: v.addresses }); data["hangar"] = await _getJsonData("hangar.json", { cacheKey: "hangar", version: v.hangar }); - } else { + } else if (url.includes("uexcorp.space")) { data["UEX"] = await _getJsonData("zh-CN-uex.json", { cacheKey: "uex", version: v.uex }); + } else if (url.includes("erkul.games")) { + data["DPS"] = await _getJsonData("zh-CN-dps.json", { cacheKey: "dps", version: "0.0" }); } // update data - let replaceWords = getLocalizationResource(data, "zh-CN"); + let replaceWords = []; function addLocalizationResource(key) { replaceWords.push(...getLocalizationResource(data, key)); @@ -54,6 +56,7 @@ async function _initLocalization(url) { const referral = "https://robertsspaceindustries.com/account/referral-program"; const address = "https://robertsspaceindustries.com/account/addresses"; const hangar = "https://robertsspaceindustries.com/account/pledges"; + addLocalizationResource("zh-CN"); if (url.startsWith(org) || url.startsWith(citizens) || url.startsWith(organization)) { replaceWords.push({ "word": 'members', "replacement": '名成员' }); addLocalizationResource("orgs"); @@ -78,8 +81,10 @@ async function _initLocalization(url) { if (url.startsWith(hangar)) { addLocalizationResource("hangar"); } - } else { + } else if (url.includes("uexcorp.space")) { addLocalizationResource("UEX"); + } else if (url.includes("erkul.games")) { + addLocalizationResource("DPS"); } return replaceWords; }