aboutsummaryrefslogtreecommitdiff
path: root/views/script
diff options
context:
space:
mode:
Diffstat (limited to 'views/script')
-rw-r--r--views/script/core_chart.js26
-rw-r--r--views/script/core_music.js89
-rw-r--r--views/script/credits_libs.js6
3 files changed, 69 insertions, 52 deletions
diff --git a/views/script/core_chart.js b/views/script/core_chart.js
index 179dd82..d34ce21 100644
--- a/views/script/core_chart.js
+++ b/views/script/core_chart.js
@@ -8,33 +8,42 @@ setInterval(() => {
file = webview.getURL().split("/")[webview.getURL().split("/").length - 1];
activity = lang.discord.game[0];
- enableActivity = true;
+ enableActivity = false;
eaid = "";
switch (file) {
case "game.html?online":
+ enableActivity = true;
activity = lang.online.discord;
break;
case "game.html?sp":
+ enableActivity = true;
activity = lang.discord.game[1];
break;
case "game.html":
+ enableActivity = true;
activity = lang.discord.game[2];
break;
case "intro.html":
+ enableActivity = true;
activity = lang.discord.intro[1];
break;
case "settings.html":
+ case "stats.html":
+ enableActivity = true;
activity = lang.discord.settings[1];
break;
case "credits.html":
+ enableActivity = true;
activity = lang.discord.credits[1];
break;
case "online.html":
+ enableActivity = true;
activity = lang.online.discord2;
break;
case "menu.html":
case "win.html":
+ enableActivity = true;
activity = lang.discord.credits[0];
break;
case "loader.html":
@@ -53,11 +62,20 @@ setInterval(() => {
}
if (require('./package.json').channel === "git") {
- document.getElementById('experimental-ramusage').innerText = currentMemoryMib;
- document.title="Kartik Trunk " +require('./package.json').version + eaid;
+ if (currentMemory < 100) {
+ document.getElementById('experimental-ramusage').innerText = "0" + currentMemoryMib;
+ } else {
+ document.getElementById('experimental-ramusage').innerText = currentMemoryMib;
+ }
+ buff = Buffer.from(activity, 'utf-8').toString("hex");
+ document.title="Kartik Trunk " +require('./package.json').version + "-" + require('./package.json').serial.toLowerCase() + "-debugkeys - <Debugging On>";
} else {
if (require('./package.json').channel !== "stable") {
- document.getElementById('experimental-ramusage').innerText = currentMemoryMib;
+ if (currentMemory < 100) {
+ document.getElementById('experimental-ramusage').innerText = "0" + currentMemoryMib;
+ } else {
+ 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;
diff --git a/views/script/core_music.js b/views/script/core_music.js
index adb0ae2..4b85ebb 100644
--- a/views/script/core_music.js
+++ b/views/script/core_music.js
@@ -1,11 +1,34 @@
-global.csng = null;
+/*global.csng = null;
global.csp1 = null;
global.csp2 = null;
-global.cspn = 1;
+global.cspn = 1;*/
+global.musicElement = new Audio();
const musicIpc = require('electron').ipcRenderer;
musicIpc.on('setmusic', (event, args) => {
- try { csp1.volume = 0; } catch (e) {}
+ if (!musicElement.paused) {
+ csi1 = setInterval(() => {
+ if (musicElement.volume <= 0.05) {
+ clearInterval(csi1);
+ musicElement.src = args;
+ musicElement.play();
+ musicElement.volume = 0;
+ csi2 = setInterval(() => {
+ if (musicElement.volume >= 0.95) {
+ clearInterval(csi2);
+ return;
+ }
+ musicElement.volume = musicElement.volume + 0.05;
+ }, 100)
+ return;
+ }
+ musicElement.volume = musicElement.volume - 0.05;
+ }, 100)
+ } else {
+ musicElement.src = args;
+ musicElement.play();
+ }
+ /*try { csp1.volume = 0; } catch (e) {}
try { csp2.volume = 0; } catch (e) {}
song = args;
@@ -61,53 +84,29 @@ musicIpc.on('setmusic', (event, args) => {
csng = song;
cspn = 1;
}
- }
+ }*/
})
musicIpc.on('fademusic', (event) => {
- if (cspn === 1) {
- if (csp1 !== null) {
- csi1 = setInterval(() => {
- if (csp1.volume <= 0.05) {
- clearInterval(csi1);
- return;
- }
- csp1.volume = csp1.volume - 0.05;
- }, 100)
- }
- } else {
- if (csp2 !== null) {
- csi2 = setInterval(() => {
- if (csp2.volume <= 0.05) {
- clearInterval(csi2);
- return;
- }
- csp2.volume = csp2.volume - 0.05;
- }, 100)
- }
+ if (!musicElement.paused) {
+ csi1 = setInterval(() => {
+ if (musicElement.volume <= 0.3) {
+ clearInterval(csi1);
+ return;
+ }
+ musicElement.volume = musicElement.volume - 0.05;
+ }, 100)
}
})
musicIpc.on('unfademusic', (event) => {
- if (cspn === 1) {
- if (csp1 !== null) {
- csi1 = setInterval(() => {
- if (csp1.volume >= 0.95) {
- clearInterval(csi1);
- return;
- }
- csp1.volume = csp1.volume + 0.05;
- }, 100)
- }
- } else {
- if (csp2 !== null) {
- csi2 = setInterval(() => {
- if (csp2.volume >= 0.95) {
- clearInterval(csi2);
- return;
- }
- csp2.volume = csp2.volume + 0.05;
- }, 100)
- }
+ if (!musicElement.paused) {
+ csi1 = setInterval(() => {
+ if (musicElement.volume >= 0.95) {
+ clearInterval(csi1);
+ return;
+ }
+ musicElement.volume = musicElement.volume + 0.05;
+ }, 100)
}
-}) \ No newline at end of file
+})
diff --git a/views/script/credits_libs.js b/views/script/credits_libs.js
index 9e2f21a..26ee36b 100644
--- a/views/script/credits_libs.js
+++ b/views/script/credits_libs.js
@@ -1,15 +1,15 @@
Object.keys(process.versions).forEach((e) => {
v = process.versions[e];
- document.write(e.substr(0, 1).toUpperCase() + e.substr(1) + " contributors<br>");
+ document.write("<div>" + e.substr(0, 1).toUpperCase() + e.substr(1) + " contributors</div>");
})
dirs = require('fs').readdirSync("./node_modules");
dirs.forEach((dir) => {
if (!dir.startsWith(".") && !dir.startsWith("@") && dir !== "electron") {
j = JSON.parse(require('fs').readFileSync("./node_modules/" + dir + "/package.json").toString());
if (typeof j.author === "string") {
- document.write(j.author + "<br>");
+ document.write("<div>" + j.author + "</div>");
} else {
- document.write(j.name.substr(0, 1).toUpperCase() + j.name.substr(1) + " authors<br>");
+ document.write("<div>" + j.name.substr(0, 1).toUpperCase() + j.name.substr(1) + " authors</div>");
}
}
}) \ No newline at end of file