diff --git a/preload.js b/preload.js index 80e8eb5..6f4238e 100644 --- a/preload.js +++ b/preload.js @@ -23,7 +23,7 @@ window.addEventListener("DOMContentLoaded", () => { window.location.href = "https://discord.com/invite/F25bc4RYDt"; }); electronLocalshortcut.register(currentWindow, "F3", () => { - window.location.href = "./theme.html"; + window.location.href = __dirname + "/theme.html"; }); require("./utils/capturer.js"); diff --git a/theme.html b/theme.html index 569d7dd..6533388 100644 --- a/theme.html +++ b/theme.html @@ -1,75 +1,71 @@ + + + ArmCord Theme Manager + + - .container { - position: fixed; - top: 50%; - left: 50%; - color: #fff; - transform: translate(-50%, -50%); - } - - - - - - - - - \ No newline at end of file + + +
+ + diff --git a/utils/theme.js b/utils/theme.js index d5605e6..9097ac7 100644 --- a/utils/theme.js +++ b/utils/theme.js @@ -1,14 +1,57 @@ const themeFolder = __dirname + "/themes/"; const fs = require("fs"); -const armcord = require("./armcord.js") -window.addEventListener("DOMContentLoaded", () => { -fs.readdirSync(themeFolder).forEach((file) => { - console.log(file); - try { - const style = fs.readFileSync(`${__dirname}/themes/${file}`, "utf8"); - armcord.addStyle(style) - } catch (err) { - console.error(err); +const armcord = require("./armcord.js"); +const splitRegex = /[^\S\r\n]*?\r?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/; +const escapedAtRegex = /^\\@/; +function parseMeta(fileContent) { + //https://github.com/rauenzi/BetterDiscordApp/blob/01941c1178c13e1229e39e1f1434678a39a020b8/renderer/src/modules/addonmanager.js + const block = fileContent.split("/**", 2)[1].split("*/", 1)[0]; + const out = {}; + let field = ""; + let accum = ""; + for (const line of block.split(splitRegex)) { + if (line.length === 0) continue; + if (line.charAt(0) === "@" && line.charAt(1) !== " ") { + out[field] = accum; + const l = line.indexOf(" "); + field = line.substr(1, l - 1); + accum = line.substr(l + 1); + } else { + accum += " " + line.replace("\\n", "\n").replace(escapedAtRegex, "@"); + } } + out[field] = accum.trim(); + delete out[""]; + out.format = "jsdoc"; + return out; +} +function loadPluginMenu() { + window.addEventListener("DOMContentLoaded", () => { + fs.readdirSync(themeFolder).forEach((file) => { + console.log(file); + try { + const style = fs.readFileSync(`${__dirname}/themes/${file}`, "utf8"); + document.getElementById("tm-list").appendChild( + ` +

${parseMeta(style)}

+ ` + ); + } catch (err) { + console.error(err); + } + }); + }); +} + +window.addEventListener("DOMContentLoaded", () => { + loadPluginMenu() + fs.readdirSync(themeFolder).forEach((file) => { + console.log(file); + try { + const style = fs.readFileSync(`${__dirname}/themes/${file}`, "utf8"); + armcord.addStyle(style); + } catch (err) { + console.error(err); + } + }); }); -}) diff --git a/utils/themes/revertBrand.css b/utils/themes/revertBrand.css index 104ae18..c342047 100644 --- a/utils/themes/revertBrand.css +++ b/utils/themes/revertBrand.css @@ -1 +1,9 @@ +/** + * @name Revert Rebrand + * @author GooseNest + * @description Reverts Discord's 2021 rebrand (font, colors, reactions, mentions, loading screen, home icon, reply ping color, and more) + * @invite neMncS2 + * @version 3.0 +*/ + @import url('https://Goose-Nest.github.io/GT-RevertRebrand/src/main.css'); \ No newline at end of file