From ab60e43bf14e286f4a5e590f790867045fa60a65 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Sun, 14 May 2023 13:51:11 +0200 Subject: [PATCH] lint --- src/themeManager/main.ts | 12 ++++++------ src/themeManager/preload.ts | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/themeManager/main.ts b/src/themeManager/main.ts index cf82fc3..89feb66 100644 --- a/src/themeManager/main.ts +++ b/src/themeManager/main.ts @@ -1,4 +1,4 @@ -import {BrowserWindow, app, ipcMain, shell, dialog} from "electron"; +import {BrowserWindow, app, dialog, ipcMain, shell} from "electron"; import {sleep} from "../utils"; import path from "path"; import fs from "fs"; @@ -141,22 +141,22 @@ export function createTManagerWindow(): void { mainWindow.webContents.reload(); }); ipcMain.on("addToDisabled", async (_event, name: string) => { - fs.appendFileSync(path.join(userDataPath, "/disabled.txt"), name + "\n"); + fs.appendFileSync(path.join(userDataPath, "/disabled.txt"), `${name}\n`); sleep(1000); }); ipcMain.on("disabled", async (e) => { e.returnValue = fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString(); }); ipcMain.on("removeFromDisabled", async (_event, name: string) => { - var e = await fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString(); + let e = await fs.readFileSync(path.join(userDataPath, "/disabled.txt")).toString(); fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), e.replace(name, "")); sleep(1000); }); ipcMain.on("installBDTheme", async (_event, link: string) => { try { - var code = await (await fetch(link)).text(); - var manifest = parseBDManifest(code); - var themePath = path.join(themesFolder, manifest.name?.replace(" ", "-") + "-BD"); + let code = await (await fetch(link)).text(); + let manifest = parseBDManifest(code); + let themePath = path.join(themesFolder, `${manifest.name?.replace(" ", "-")}-BD`); if (!fs.existsSync(themePath)) { fs.mkdirSync(themePath); console.log(`Created ${manifest.name} folder`); diff --git a/src/themeManager/preload.ts b/src/themeManager/preload.ts index 09016e3..e7ca51b 100644 --- a/src/themeManager/preload.ts +++ b/src/themeManager/preload.ts @@ -1,17 +1,17 @@ import {ipcRenderer} from "electron"; import {sleep} from "../utils"; ipcRenderer.on("themeManifest", (_event, json) => { - var manifest = JSON.parse(json); + let manifest = JSON.parse(json); console.log(manifest); sleep(1000); - var e = document.getElementById("cardBox"); - var id = manifest.name.replace(" ", "-"); + let e = document.getElementById("cardBox"); + let id = manifest.name.replace(" ", "-"); e?.insertAdjacentHTML( "beforeend", `
-

${manifest.name}

+

${manifest.name}

@@ -20,10 +20,10 @@ ipcRenderer.on("themeManifest", (_event, json) => {
` ); - document.getElementById(id + "header")!.addEventListener("click", () => { + document.getElementById(`${id}header`)!.addEventListener("click", () => { document.getElementById("themeInfoModal")!.style.display = "block"; document.getElementById("themeInfoName")!.textContent = `${manifest.name} by ${manifest.author}`; - document.getElementById("themeInfoDesc")!.textContent = manifest.description + "\n\n" + manifest.version; + document.getElementById("themeInfoDesc")!.textContent = `${manifest.description}\n\n${manifest.version}`; if (manifest.source != undefined) document.getElementById( "themeInfoButtons" @@ -33,14 +33,14 @@ ipcRenderer.on("themeManifest", (_event, json) => { "themeInfoButtons" )!.innerHTML += `Website`; if (manifest.invite != undefined) - document.getElementById("themeInfoButtons")!.innerHTML += `Support Discord`; + document.getElementById( + "themeInfoButtons" + )!.innerHTML += `Support Discord`; }); if (!ipcRenderer.sendSync("disabled").includes(id)) { - (document.getElementById(id)).checked = true; + (document.getElementById(id) as HTMLInputElement).checked = true; } - (document.getElementById(id))!.addEventListener("input", function (evt) { + (document.getElementById(id) as HTMLInputElement)!.addEventListener("input", function (evt) { ipcRenderer.send("reloadMain"); if (this.checked) { ipcRenderer.send("removeFromDisabled", id); @@ -55,6 +55,6 @@ document.addEventListener("DOMContentLoaded", () => { document.getElementById("themeInfoButtons")!.innerHTML = ""; }); document.getElementById("download")!.addEventListener("click", () => { - ipcRenderer.send("installBDTheme", (document.getElementById("themeLink"))!.value); + ipcRenderer.send("installBDTheme", (document.getElementById("themeLink") as HTMLInputElement)!.value); }); });