aboutsummaryrefslogtreecommitdiff
path: root/views/script/core_chart.js
diff options
context:
space:
mode:
Diffstat (limited to 'views/script/core_chart.js')
-rw-r--r--views/script/core_chart.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/views/script/core_chart.js b/views/script/core_chart.js
new file mode 100644
index 0000000..179dd82
--- /dev/null
+++ b/views/script/core_chart.js
@@ -0,0 +1,67 @@
+setInterval(() => {
+ try {
+ currentMemory = process.memoryUsage().rss;
+ currentMemoryMib = (((currentMemory)/1024)/1024).toFixed(2);
+ if ((((currentMemory)/1024)/1024) > 250) {
+ throw new Error("Out of memory");
+ }
+
+ file = webview.getURL().split("/")[webview.getURL().split("/").length - 1];
+ activity = lang.discord.game[0];
+ enableActivity = true;
+ eaid = "";
+
+ switch (file) {
+ case "game.html?online":
+ activity = lang.online.discord;
+ break;
+ case "game.html?sp":
+ activity = lang.discord.game[1];
+ break;
+ case "game.html":
+ activity = lang.discord.game[2];
+ break;
+ case "intro.html":
+ activity = lang.discord.intro[1];
+ break;
+ case "settings.html":
+ activity = lang.discord.settings[1];
+ break;
+ case "credits.html":
+ activity = lang.discord.credits[1];
+ break;
+ case "online.html":
+ activity = lang.online.discord2;
+ break;
+ case "menu.html":
+ case "win.html":
+ activity = lang.discord.credits[0];
+ break;
+ case "loader.html":
+ enableActivity = false;
+ break;
+ }
+
+ if (file.includes("online.html")) {
+ activity = lang.online.discord2;
+ }
+
+ if (enableActivity) {
+ eaid = " - " + activity;
+ } else {
+ eaid = "";
+ }
+
+ if (require('./package.json').channel === "git") {
+ document.getElementById('experimental-ramusage').innerText = currentMemoryMib;
+ document.title="Kartik Trunk " +require('./package.json').version + eaid;
+ } else {
+ if (require('./package.json').channel !== "stable") {
+ document.getElementById('experimental-ramusage').innerText = currentMemoryMib;
+ document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid;
+ } else {
+ document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid;
+ }
+ }
+ } catch (e) {}
+}, 1000) \ No newline at end of file