This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BotWindow.html
105 lines (98 loc) · 4.15 KB
/
BotWindow.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<html>
<link rel="stylesheet" href="main.css" />
<meta charset="utf8" />
<div
style="
width: 100vw;
height: 90vh;
margin-top: -8px;
color: #ffffff;
overflow: auto;
"
>
<div
id="console"
style="
font-family: Consolas, 'Courier New', monospace;
font-size: 14px;
margin: auto;
text-align: left;
margin-top: 2vh;
user-select: text;
margin-left: 1vw;
"
>
</div>
</div>
<div id="selectorMenu" class="flexbox" style="-webkit-app-region: drag; margin-left: -8px; justify-content: left; width: 100vw; background-color: #FFFFFF08;">
<div id="buttonsContainer" class="flexbox" style="width: 100vw; height: 10vh; transition: scale 5.3s ease;">
<div class="barbuttontexta" id="permissions-name"></div>
<div class="barbuttonshift flexbox" style="margin-right: 1vw; -webkit-app-region: none; width: 23vw; margin-left: auto;" onclick="ipcRenderer.send('shutdownBot')">
<div class="image add" style="width: 30% !important; rotate: 45deg; height: 30px !important; margin: auto !important;"></div>
<div style="margin: auto;">
<div class="barbuttontexta">Turn Bot Off</div>
<div class="smalltext" style="opacity: 50%; font-size: 8px;">Closes This Window</div>
</div>
</div>
<div class="barbuttonshift flexbox" style="margin-right: 1vw; -webkit-app-region: none; width: 19vw;" onclick="ipcRenderer.send('hideBotWindow')">
<div class="image add" style="width: 30% !important; rotate: 45deg; height: 30px !important; margin: auto !important;"></div>
<div style="margin: auto;">
<div class="barbuttontexta">Close Log</div>
<div class="smalltext" style="opacity: 50%; font-size: 8px;">Hides This Window</div>
</div>
</div>
</div>
</div>
<script>
var datjson = JSON.parse(require('fs').readFileSync("./AppData/data.json"));
let themeColor = datjson.color;
document.body.style.background = `linear-gradient(45deg, ${themeColor} 0%, #121212)`;
const { app, ipcRenderer } = require("electron");
function ansiToHtml(text) {
const escapeCodeRegex = /\u001b\[([\d;]+)m/g; // Regex pattern to match ANSI escape codes
const ansiToHtmlCodes = {
0: "color: #FFFFFF60;", // Reset / Normal
1: "font-weight: bold", // Bold
3: "font-style: italic", // Italic
4: "text-decoration: underline", // Underline
30: "color: #ffffff80", // Black
31: "color: red", // Red
32: "color: #13a10e", // Green
33: "color: yellow", // Yellow
34: "color: blue", // Blue
35: "color: magenta", // Magenta
36: "color: #113f45", // Cyan
37: "color: #ffffff00", // White
90: "color: #cccccc", // Gray
40: "color: #ffffff80", // Background: Black
41: "color: red", // Background: Red
42: "color: green", // Background: Green
43: "color: yellow", // Background: Yellow
44: "color: blue", // Background: Blue
45: "color: magenta", // Background: Magenta
46: "color: cyan", // Background: Cyan
47: "color: ffffff80", // Background: White
100: "padding: 6px; border-radius: 9px; background-color: #cccccc", // Background: Gray
};
return text.replace(escapeCodeRegex, (match, codes) => {
const styles = codes.split(";").map((code) => ansiToHtmlCodes[code]);
const style = styles.join(";");
return style ? `<span style="${style}; width: 100%;">` : "</span>";
});
}
console.log = (log) => {
document.getElementById(
"console",
).innerHTML += `<span class="fade" style="margin: auto; margin-top: 6px;">${ansiToHtml(
log,
)}</span>`;
};
document.body.style.padding = "0px !important";
document.body.style.paddingTop = "0px !important";
document.body.style.paddingBottom = "0px !important";
document.body.style.paddingLeft = "0px !important";
document.body.style.paddingRight = "0px !important";
document.body.style.borderRadius = "12px";
</script>
<script src="./AppData/Toolkit/botInit.js"></script>
</html>