i have no idea what i am doing

This commit is contained in:
smartfridge 2021-05-14 21:47:01 +02:00
parent 41306d6cde
commit 8d3b5f523a
4 changed files with 121 additions and 74 deletions

View File

@ -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");

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ArmCord Theme Manager</title>
@ -49,12 +48,10 @@
}
.logo {
display: block;
margin-left: auto;
margin-right: auto;
max-height: 204px;
max-width: 204px;
transform: translateY(5%);
color: #ffffff;
font-weight: normal;
font-family: Discordinated;
font-size: 32px;
}
.container {
@ -68,8 +65,7 @@
</head>
<body>
<p class="logo">Theme Manager</p>
<div id="tm-list"></div>
</body>
</html>

View File

@ -1,14 +1,57 @@
const themeFolder = __dirname + "/themes/";
const fs = require("fs");
const armcord = require("./armcord.js")
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");
armcord.addStyle(style)
document.getElementById("tm-list").appendChild(
`
<p>${parseMeta(style)}</p>
`
);
} 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);
}
});
});

View File

@ -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');