armcord/preload.js

100 lines
2.7 KiB
JavaScript
Raw Normal View History

const { remote } = require("electron");
const currentWindow = remote.getCurrentWindow();
2021-05-09 19:38:06 +00:00
const customTitlebar = require("custom-electron-titlebar");
2021-05-04 10:08:30 +00:00
const electronLocalshortcut = require("electron-localshortcut");
2021-05-09 19:38:06 +00:00
const ArmCord = require("./utils/ArmCord.js");
2021-05-21 17:27:32 +00:00
require("./utils/theme.js");
2021-11-01 10:47:32 +00:00
require("./utils/bridge.js")
2021-05-09 19:38:06 +00:00
window.addEventListener("DOMContentLoaded", () => {
2021-07-17 15:33:21 +00:00
if (require("./utils/ArmCord.js").Titlebar === "native") {console.log("Using native titlebar")} else {
2021-05-01 12:41:12 +00:00
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex("#202225"),
2021-05-09 19:38:06 +00:00
menu: false,
2021-07-17 15:33:21 +00:00
});}
2021-05-09 19:38:06 +00:00
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", () => {
2021-11-01 10:47:32 +00:00
window.location.href = "https://discord.gg/invite/F25bc4RYDt";
2021-05-09 19:38:06 +00:00
});
2021-05-21 17:33:11 +00:00
electronLocalshortcut.register(currentWindow, "F4", () => {
currentWindow.loadFile("./manager.html");
2021-05-21 17:33:11 +00:00
});
2021-05-09 19:38:06 +00:00
require("./utils/capturer.js");
2021-05-01 12:41:12 +00:00
2021-05-09 19:38:06 +00:00
ArmCord.addStyle(`
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
--window-buttons: var(--header-secondary);
--cord-color: var(--header-primary);
--armcord-color: #7289da;
2021-05-25 10:24:42 +00:00
--titlebar-color: var(--background-tertiary);
}
.base-3dtUhz, .sidebar-2K8pFh {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
overflow: hidden;
border-top-left-radius: 8px;
}
div.menubar[role="menubar"] {
width: 0px;
}
.window-title:after {
content: "Cord";
color: var(--cord-color) !important;
font-weight: normal;
2021-05-05 03:36:28 +00:00
font-size: 14px;
font-family: Discordinated;
}
.window-title:before {
content: "ARM";
color: var(--armcord-color);
font-weight: normal;
2021-05-05 03:36:28 +00:00
font-size: 14px;
font-family: Helvetica, sans-serif;
}
.window-title {
font-size: 0px !important;
margin-left: initial !important;
2021-05-25 10:24:42 +00:00
transform: translate(10px, 2px);
}
2021-05-09 19:38:06 +00:00
.titlebar {
2021-05-25 10:24:42 +00:00
background: var(--titlebar-color) !important;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.titlebar .window-controls-container .window-icon {
background: var(--window-buttons) !important;
}
2021-05-22 15:28:29 +00:00
.notice-3bPHh-.colorDefault-22HBa0 {
display: none;
}
`);
2021-05-04 15:44:45 +00:00
ArmCord.addStyle(
`.info-1VyQPT:last-child:before {
content: "ArmCord Version: ` +
ArmCord.Version +
`";
2021-05-09 19:38:06 +00:00
height: auto;
line-height: 16px;
text-align: center;
color: var(--text-muted);
font-size: 12px;
text-transform: none;
}`
);
2021-05-28 16:00:30 +00:00
document.getElementById("ac-channel").innerHTML = ArmCord.Channel;
});