aboutsummaryrefslogtreecommitdiff
path: root/views/script
diff options
context:
space:
mode:
authorMinteck <46352972+Minteck@users.noreply.github.com>2021-07-07 17:01:51 +0200
committerMinteck <46352972+Minteck@users.noreply.github.com>2021-07-07 17:01:51 +0200
commitadabd5f0b2d7326958126dc960bf4ef09c9a4e4f (patch)
treecce44ad2c805c5c05a5e89f0aa63ca64b2c9fc30 /views/script
parentce99cfa3de0a74c8ab09c47d9a5295212021d769 (diff)
downloadkartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.tar.gz
kartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.tar.bz2
kartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.zip
Update!
Diffstat (limited to 'views/script')
-rw-r--r--views/script/core_chart.js19
-rw-r--r--views/script/core_compatlayer.js89
-rw-r--r--views/script/core_music.js1
-rw-r--r--views/script/global_compatlayer.js89
-rw-r--r--views/script/menu_gpuinfo.js115
5 files changed, 295 insertions, 18 deletions
diff --git a/views/script/core_chart.js b/views/script/core_chart.js
index d34ce21..059c818 100644
--- a/views/script/core_chart.js
+++ b/views/script/core_chart.js
@@ -62,24 +62,9 @@ setInterval(() => {
}
if (require('./package.json').channel === "git") {
- 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>";
+ document.title="Kartik Trunk " +require('./package.json').version;
} else {
- if (require('./package.json').channel !== "stable") {
- 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;
- }
+ document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid;
}
} catch (e) {}
}, 1000) \ No newline at end of file
diff --git a/views/script/core_compatlayer.js b/views/script/core_compatlayer.js
new file mode 100644
index 0000000..206aa28
--- /dev/null
+++ b/views/script/core_compatlayer.js
@@ -0,0 +1,89 @@
+window.addEventListener("load", () => {
+ if (require('os').platform !== "darwin") {
+ gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
+ gpuscore = 0;
+ maxscore = 10;
+ if (gpuinfo['2d_canvas'].startsWith("enabled")) {
+ if (gpuinfo['2d_canvas'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['gpu_compositing'].startsWith("enabled")) {
+ if (gpuinfo['gpu_compositing'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['video_decode'].startsWith("enabled")) {
+ if (gpuinfo['video_decode'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) {
+ if (gpuinfo['multiple_raster_threads'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['oop_rasterization'].startsWith("enabled")) {
+ if (gpuinfo['oop_rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['rasterization'].startsWith("enabled")) {
+ if (gpuinfo['rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['opengl'].startsWith("enabled")) {
+ if (gpuinfo['opengl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['skia_renderer'].startsWith("enabled")) {
+ if (gpuinfo['skia_renderer'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['vulkan'].startsWith("enabled")) {
+ if (gpuinfo['vulkan'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['webgl'].startsWith("enabled")) {
+ if (gpuinfo['webgl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+
+ gpuperct = (gpuscore / maxscore) * 100;
+
+ if (gpuperct < 50) {
+ console.warn("Bad GPU support, disabling GPU-accelerated content");
+ var head = document.getElementsByTagName('HEAD')[0];
+ var link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.type = 'text/css';
+ link.href = './views/common/compatibilityMode.css';
+ head.appendChild(link);
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/core_music.js b/views/script/core_music.js
index a35d329..464fc85 100644
--- a/views/script/core_music.js
+++ b/views/script/core_music.js
@@ -9,6 +9,7 @@ musicIpc.on('setmusic', (event, args) => {
musicElement.src = args;
musicElement.play();
musicElement.volume = 1;
+ musicElement.loop = true;
/*if (!musicElement.paused) {
csi1 = setInterval(() => {
if (musicElement.volume <= 0.05) {
diff --git a/views/script/global_compatlayer.js b/views/script/global_compatlayer.js
new file mode 100644
index 0000000..8545a29
--- /dev/null
+++ b/views/script/global_compatlayer.js
@@ -0,0 +1,89 @@
+window.addEventListener("load", () => {
+ if (require('os').platform !== "darwin") {
+ gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
+ gpuscore = 0;
+ maxscore = 10;
+ if (gpuinfo['2d_canvas'].startsWith("enabled")) {
+ if (gpuinfo['2d_canvas'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['gpu_compositing'].startsWith("enabled")) {
+ if (gpuinfo['gpu_compositing'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['video_decode'].startsWith("enabled")) {
+ if (gpuinfo['video_decode'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) {
+ if (gpuinfo['multiple_raster_threads'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['oop_rasterization'].startsWith("enabled")) {
+ if (gpuinfo['oop_rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['rasterization'].startsWith("enabled")) {
+ if (gpuinfo['rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['opengl'].startsWith("enabled")) {
+ if (gpuinfo['opengl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['skia_renderer'].startsWith("enabled")) {
+ if (gpuinfo['skia_renderer'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['vulkan'].startsWith("enabled")) {
+ if (gpuinfo['vulkan'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['webgl'].startsWith("enabled")) {
+ if (gpuinfo['webgl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+
+ gpuperct = (gpuscore / maxscore) * 100;
+
+ if (gpuperct < 50) {
+ console.warn("Bad GPU support, disabling GPU-accelerated content");
+ var head = document.getElementsByTagName('HEAD')[0];
+ var link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.type = 'text/css';
+ link.href = './common/compatibilityMode.css';
+ head.appendChild(link);
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/menu_gpuinfo.js b/views/script/menu_gpuinfo.js
index 4177cfc..accf318 100644
--- a/views/script/menu_gpuinfo.js
+++ b/views/script/menu_gpuinfo.js
@@ -1,3 +1,95 @@
+if (require('os').platform === "darwin") {
+ document.getElementById("gpuinfo").style.display = "none";
+}
+
+if (require('os').platform !== "darwin") {
+ gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
+ gpuscore = 0;
+ maxscore = 10;
+ if (gpuinfo['2d_canvas'].startsWith("enabled")) {
+ if (gpuinfo['2d_canvas'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['gpu_compositing'].startsWith("enabled")) {
+ if (gpuinfo['gpu_compositing'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['video_decode'].startsWith("enabled")) {
+ if (gpuinfo['video_decode'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) {
+ if (gpuinfo['multiple_raster_threads'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['oop_rasterization'].startsWith("enabled")) {
+ if (gpuinfo['oop_rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['rasterization'].startsWith("enabled")) {
+ if (gpuinfo['rasterization'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['opengl'].startsWith("enabled")) {
+ if (gpuinfo['opengl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['skia_renderer'].startsWith("enabled")) {
+ if (gpuinfo['skia_renderer'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['vulkan'].startsWith("enabled")) {
+ if (gpuinfo['vulkan'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+ if (gpuinfo['webgl'].startsWith("enabled")) {
+ if (gpuinfo['webgl'] === "enabled") {
+ gpuscore++;
+ } else {
+ gpuscore += 0.5;
+ }
+ }
+
+ gpuperct = (gpuscore/maxscore)*100;
+ document.getElementById("gpusupportperc").innerText = gpuperct + "%";
+
+ document.getElementById("gpuinfo_progressbar").style.width = gpuperct + "%";
+ if (gpuperct < 50) {
+ document.getElementById("gpuinfo_progressbar").style.background = "rgba(128, 0, 0, .5)";
+ } else if (gpuperct < 75) {
+ document.getElementById("gpuinfo_progressbar").style.background = "rgba(128, 128, 0, .5)";
+ } else {
+ document.getElementById("gpuinfo_progressbar").style.background = "rgba(0, 128, 0, .5)";
+ }
+}
+
if (require('os').platform !== "darwin") {
gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
document.write("kartik<br>");
@@ -39,6 +131,11 @@ if (require('os').platform !== "darwin") {
} else {
document.write(" &nbsp;├ <span style='color:lightcoral;'>kartik.renderer.OpenGL</span><br>");
}
+ if (gpuinfo['webgl'].startsWith("enabled")) {
+ document.write(" &nbsp;├ <span style='color:lightgreen;'>kartik.renderer.WebGL</span><br>");
+ } else {
+ document.write(" &nbsp;├ <span style='color:lightcoral;'>kartik.renderer.WebGL</span><br>");
+ }
if (gpuinfo['skia_renderer'].startsWith("enabled")) {
document.write(" &nbsp;├ <span style='color:lightgreen;'>kartik.renderer.Skia</span><br>");
} else {
@@ -56,14 +153,30 @@ if (require('os').platform !== "darwin") {
document.onkeydown = (e) => {
if (e.shiftKey) {
document.getElementById('gpuinfo-inner').style.opacity = "1";
+ document.getElementById('gpuinfo-inner').style.height = "max-content";
document.getElementById('gpuinfo-outer').style.display = "none";
} else {
document.getElementById('gpuinfo-inner').style.opacity = "0";
+ document.getElementById('gpuinfo-inner').style.height = "0";
document.getElementById('gpuinfo-outer').style.display = "";
}
}
document.onkeyup = (e) => {
document.getElementById('gpuinfo-inner').style.opacity = "0";
+ document.getElementById('gpuinfo-inner').style.height = "0";
document.getElementById('gpuinfo-outer').style.display = "";
-} \ No newline at end of file
+}
+
+require('systeminformation').graphics().then((data) => {
+ document.getElementById("gpuinfo-model").innerText = data.controllers[0].model;
+ vram = data.controllers[0].vram;
+
+ if (vram > 1024) {
+ vrams = (vram/1024).toFixed(1) + " GiB";
+ } else {
+ vrams = (vram).toFixed(1) + " MiB";
+ }
+
+ document.getElementById("gpuinfo-vram").innerText = vrams + " VRAM";
+}) \ No newline at end of file