diff --git a/preload.js b/preload.js index 96a9877..69e1729 100644 --- a/preload.js +++ b/preload.js @@ -1,39 +1,32 @@ -const customTitlebar = require('custom-electron-titlebar') +const customTitlebar = require("custom-electron-titlebar"); const electronLocalshortcut = require("electron-localshortcut"); const { remote } = require("electron"); +const ArmCord = require("./utils/ArmCord.js"); -window.addEventListener('DOMContentLoaded', () => { +window.addEventListener("DOMContentLoaded", () => { new customTitlebar.Titlebar({ backgroundColor: customTitlebar.Color.fromHex("#202225"), + menu: false, }); -/** - * Utility function to add CSS in multiple passes. - * @param {string} styleString - */ - function addStyle(styleString) { - const style = document.createElement('style'); - style.textContent = styleString; - document.head.append(style); -} + const currentWindow = remote.getCurrentWindow(); + electronLocalshortcut.register(currentWindow, "F5", () => { + location.reload(); + }); + electronLocalshortcut.register(currentWindow, "F12", () => { + currentWindow.webContents.openDevTools(); + }); + electronLocalshortcut.register(currentWindow, "F1", () => { + require("shell").openExternal("https://support.discord.com/"); + }); + electronLocalshortcut.register(currentWindow, "F2", () => { + window.location.href = "https://discord.com/invite/F25bc4RYDt"; + }); + require("./utils/capturer.js"); - -const currentWindow = remote.getCurrentWindow(); -electronLocalshortcut.register(currentWindow, "F5", () => { - location.reload(); -}); -electronLocalshortcut.register(currentWindow, "F12", () => { - currentWindow.webContents.openDevTools(); -}); -electronLocalshortcut.register(currentWindow, "F1", () => { - require("shell").openExternal("https://support.discord.com/"); -}); -electronLocalshortcut.register(currentWindow, "F2", () => { - window.location.href = "https://discord.com/invite/F25bc4RYDt"; -}); -require("./utils/capturer.js") -addStyle(` + ArmCord.addStyle(` @import url("https://kckarnige.github.io/femboi_owo/discord-font.css"); + :root { --window-buttons: var(--header-secondary); --cord-color: var(--header-primary); @@ -76,13 +69,27 @@ div.menubar[role="menubar"] { transform: translate(10px, 2px) !important; } -background: #202225 !important; +.titlebar { background: var(--background-tertiary) !important; font-family: Verdana, Geneva, Tahoma, sans-serif; } + .titlebar .window-controls-container .window-icon { background: var(--window-buttons) !important; } `); -}) + ArmCord.addStyle( + `.info-1VyQPT:last-child:before { + content: "ArmCord Version: ` + + ArmCord.Version + + `"; + height: auto; + line-height: 16px; + text-align: center; + color: var(--text-muted); + font-size: 12px; + text-transform: none; +}` + ); +}); diff --git a/utils/ArmCord.js b/utils/ArmCord.js new file mode 100644 index 0000000..ce8ec2c --- /dev/null +++ b/utils/ArmCord.js @@ -0,0 +1,13 @@ +exports.Version = "2.4"; + +exports.addStyle = function (styleString) { + const style = document.createElement("style"); + style.textContent = styleString; + document.head.append(style); +}; + +exports.addScript = function (scriptString) { + var script = document.createElement("script"); + script.textContent = scriptString; + document.body.append(script); +};