This commit is contained in:
C 2023-10-10 10:49:27 +08:00
parent 1704c19331
commit 7de69b958b
5 changed files with 18 additions and 13 deletions

View File

@ -86,7 +86,7 @@ async function _initLocalization(url) {
function getLocalizationResource(localizationResource, key) {
const localizations = [];
const dict = localizationResource[key]?.["dict"];
const dict = localizationResource[key];
if (typeof dict === "object") {
for (const [k, v] of Object.entries(dict)) {
const trimmedKey = k
@ -102,7 +102,7 @@ function getLocalizationResource(localizationResource, key) {
}
async function _getJsonData(fileName, { cacheKey = "", version = null } = {}) {
url = "https://ch.citizenwiki.cn/json-files/" + fileName;
url = "https://ch.citizenwiki.cn/json-files/locales/" + fileName;
const box = await getLocalStorage();
if (cacheKey && cacheKey !== "") {
const localVersion = await getLocalData(`${cacheKey}_version`);

View File

@ -1,16 +1,7 @@
let replaceLocalesMap = { "k": "v" };
let replaceLocalesMap = {};
function InitWebLocalization() {
// init script
let scriptTimeAgo = document.createElement('script');
scriptTimeAgo.src = 'https://cdn.bootcdn.net/ajax/libs/timeago.js/4.0.2/timeago.full.min.js';
document.head.appendChild(scriptTimeAgo);
if (window.location.hostname.includes("erkul.games") || window.location.hostname.includes("ccugame.app")) {
console.log("loading JQ");
let scriptJquery = document.createElement('script');
scriptJquery.src = 'https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js';
document.head.appendChild(scriptJquery);
}
LocalizationWatchUpdate();
// load Data
_loadLocalizationData();

View File

@ -23,12 +23,23 @@
{
"matches": [
"https://robertsspaceindustries.com/*",
"https://*.robertsspaceindustries.com/*",
"https://www.erkul.games/*",
"https://uexcorp.space/*",
"https://ccugame.app/*"
],
"js": [
"core.js"
"core.js",
"thirdparty/timeago.full.min.js"
]
},
{
"matches": [
"https://www.erkul.games/*",
"https://ccugame.app/*"
],
"js": [
"thirdparty/jquery.min.js"
]
}
]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long