chore: prettier (#954)

some of the latest changes haven't been quite congruent with the way prettier would like things to be. this fixes those details.

Reviewed-on: OpenWF/SpaceNinjaServer#954
This commit is contained in:
Sainan 2025-02-12 18:15:07 -08:00
parent edddc80bd8
commit 7ee8252d0e
5 changed files with 1466 additions and 1452 deletions

View File

@ -1,7 +1,7 @@
// Based on http://209.141.38.3/OpenWF/Translations/src/branch/main/update.php // Based on http://209.141.38.3/OpenWF/Translations/src/branch/main/update.php
// Converted via ChatGPT-4o // Converted via ChatGPT-4o
const fs = require('fs'); const fs = require("fs");
function extractStrings(content) { function extractStrings(content) {
const regex = /([a-zA-Z_]+): `([^`]*)`,/g; const regex = /([a-zA-Z_]+): `([^`]*)`,/g;
@ -31,12 +31,12 @@ fs.readdirSync("../static/webui/translations").forEach(file => {
if (Object.keys(strings).length > 0) { if (Object.keys(strings).length > 0) {
Object.entries(strings).forEach(([key, value]) => { Object.entries(strings).forEach(([key, value]) => {
if (targetStrings.hasOwnProperty(key)) { if (targetStrings.hasOwnProperty(key)) {
fs.writeSync(fileHandle, `\t${key}: \`${targetStrings[key]}\`,\n`); fs.writeSync(fileHandle, ` ${key}: \`${targetStrings[key]}\`,\n`);
} else { } else {
fs.writeSync(fileHandle, `\t${key}: \`[UNTRANSLATED] ${value}\`,\n`); fs.writeSync(fileHandle, ` ${key}: \`[UNTRANSLATED] ${value}\`,\n`);
} }
}); });
} else { } else if (line.length) {
fs.writeSync(fileHandle, line + "\n"); fs.writeSync(fileHandle, line + "\n");
} }
}); });

View File

@ -108,8 +108,10 @@ single.on("route_load", function (event) {
function loc(tag) { function loc(tag) {
return ((window.dict ?? {})[tag] ?? tag) return ((window.dict ?? {})[tag] ?? tag)
.split("|DISPLAYNAME|").join(document.querySelector(".displayname").textContent) .split("|DISPLAYNAME|")
.split("|EMAIL|").join(localStorage.getItem("email")); .join(document.querySelector(".displayname").textContent)
.split("|EMAIL|")
.join(localStorage.getItem("email"));
} }
function updateLocElements() { function updateLocElements() {
@ -141,7 +143,8 @@ setActiveLanguage(localStorage.getItem("lang") ?? "en");
function setLanguage(lang) { function setLanguage(lang) {
setActiveLanguage(lang); setActiveLanguage(lang);
localStorage.setItem("lang", lang); localStorage.setItem("lang", lang);
if (window.authz) { // Not in prelogin state? if (window.authz) {
// Not in prelogin state?
fetchItemList(); fetchItemList();
updateInventory(); updateInventory();
} }
@ -151,7 +154,7 @@ let uniqueLevelCaps = {};
function fetchItemList() { function fetchItemList() {
window.itemListPromise = new Promise(resolve => { window.itemListPromise = new Promise(resolve => {
const req = $.get("/custom/getItemLists?lang=" + window.lang); const req = $.get("/custom/getItemLists?lang=" + window.lang);
req.done(async (data) => { req.done(async data => {
await dictPromise; await dictPromise;
window.archonCrystalUpgrades = data.archonCrystalUpgrades; window.archonCrystalUpgrades = data.archonCrystalUpgrades;
@ -173,9 +176,13 @@ function fetchItemList() {
"/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam": { name: loc("code_kitgun") }, "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam": { name: loc("code_kitgun") },
"/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun": { name: loc("code_kitgun") }, "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun": { name: loc("code_kitgun") },
"/Lotus/Weapons/Ostron/Melee/LotusModularWeapon": { name: loc("code_zaw") }, "/Lotus/Weapons/Ostron/Melee/LotusModularWeapon": { name: loc("code_zaw") },
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/OperatorTrainingAmpWeapon": { name: loc("code_moteAmp") }, "/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/OperatorTrainingAmpWeapon": {
name: loc("code_moteAmp")
},
"/Lotus/Weapons/Sentients/OperatorAmplifiers/OperatorAmpWeapon": { name: loc("code_amp") }, "/Lotus/Weapons/Sentients/OperatorAmplifiers/OperatorAmpWeapon": { name: loc("code_amp") },
"/Lotus/Weapons/Operator/Pistols/DrifterPistol/DrifterPistolPlayerWeapon": { name: loc("code_sirocco") }, "/Lotus/Weapons/Operator/Pistols/DrifterPistol/DrifterPistolPlayerWeapon": {
name: loc("code_sirocco")
},
"/Lotus/Types/Vehicles/Hoverboard/HoverboardSuit": { name: loc("code_kdrive") }, "/Lotus/Types/Vehicles/Hoverboard/HoverboardSuit": { name: loc("code_kdrive") },
// Missing in data sources // Missing in data sources
"/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser": { name: loc("code_legendaryCore") }, "/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser": { name: loc("code_legendaryCore") },
@ -227,13 +234,10 @@ function updateInventory() {
window.didInitialInventoryUpdate = true; window.didInitialInventoryUpdate = true;
// Populate inventory route // Populate inventory route
[ ["RegularCredits", "PremiumCredits", "FusionPoints", "PrimeTokens"].forEach(currency => {
"RegularCredits", document.getElementById(currency + "-owned").textContent = loc("currency_owned")
"PremiumCredits", .split("|COUNT|")
"FusionPoints", .join(data[currency].toLocaleString());
"PrimeTokens"
].forEach(currency => {
document.getElementById(currency + "-owned").textContent = loc("currency_owned").split("|COUNT|").join(data[currency].toLocaleString());
}); });
[ [
@ -366,11 +370,24 @@ function updateInventory() {
const td = document.createElement("td"); const td = document.createElement("td");
td.textContent = itemMap[fingerprint.compat]?.name ?? fingerprint.compat; td.textContent = itemMap[fingerprint.compat]?.name ?? fingerprint.compat;
td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name; td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name;
td.innerHTML += " <span title='" + loc("code_buffsNumber") + "'>▲ " + fingerprint.buffs.length + "</span>";
td.innerHTML += td.innerHTML +=
" <span title='" + loc("code_cursesNumber") + "'>▼ " + fingerprint.curses.length + "</span>"; " <span title='" +
loc("code_buffsNumber") +
"'>▲ " +
fingerprint.buffs.length +
"</span>";
td.innerHTML += td.innerHTML +=
" <span title='" + loc("code_rerollsNumber") + "'>⟳ " + parseInt(fingerprint.rerolls) + "</span>"; " <span title='" +
loc("code_cursesNumber") +
"'>▼ " +
fingerprint.curses.length +
"</span>";
td.innerHTML +=
" <span title='" +
loc("code_rerollsNumber") +
"'>⟳ " +
parseInt(fingerprint.rerolls) +
"</span>";
tr.appendChild(td); tr.appendChild(td);
} }
{ {
@ -611,10 +628,7 @@ function addMissingEquipment(categories) {
} }
}); });
}); });
if ( if (requests.length != 0 && window.confirm(loc("code_addItemsConfirm").split("|COUNT|").join(requests.length))) {
requests.length != 0 &&
window.confirm(loc("code_addItemsConfirm").split("|COUNT|").join(requests.length))
) {
dispatchAddItemsRequestsBatch(requests); dispatchAddItemsRequestsBatch(requests);
} }
} }

View File

@ -116,5 +116,5 @@ dict = {
cheats_changeButton: `Change`, cheats_changeButton: `Change`,
cheats_none: `None`, cheats_none: `None`,
import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`, import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
import_submit: `Submit`, import_submit: `Submit`
} };

View File

@ -117,5 +117,5 @@ dict = {
cheats_changeButton: `Изменить`, cheats_changeButton: `Изменить`,
cheats_none: `Отсутствует`, cheats_none: `Отсутствует`,
import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля <b>будут перезаписаны</b> в вашем аккаунте.`, import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля <b>будут перезаписаны</b> в вашем аккаунте.`,
import_submit: `Отправить`, import_submit: `Submit`
} };