aboutsummaryrefslogtreecommitdiff
path: root/views/script
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-06-05 19:27:48 +0200
committerMinteck <nekostarfan@gmail.com>2021-06-05 19:27:48 +0200
commit8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6 (patch)
tree7096b67b189c0220826123c7d5b121752545d140 /views/script
downloadkartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.gz
kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.bz2
kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.zip
Presque sortie du jeu
Diffstat (limited to 'views/script')
-rw-r--r--views/script/client_fullscreen.js9
-rw-r--r--views/script/core_chart.js67
-rw-r--r--views/script/core_fullscreen.js9
-rw-r--r--views/script/core_head.js31
-rw-r--r--views/script/core_music.js109
-rw-r--r--views/script/core_stats.js47
-rw-r--r--views/script/core_viewer.js23
-rw-r--r--views/script/credits_global.js54
-rw-r--r--views/script/credits_libs.js15
-rw-r--r--views/script/credits_music.js4
-rw-r--r--views/script/credits_technical.js9
-rw-r--r--views/script/game_global.js45
-rw-r--r--views/script/game_music.js10
-rw-r--r--views/script/game_online.js9
-rw-r--r--views/script/game_select.js131
-rw-r--r--views/script/intro_global.js21
-rw-r--r--views/script/intro_media.js4
-rw-r--r--views/script/intro_message.js7
-rw-r--r--views/script/loader_global.js85
-rw-r--r--views/script/menu_copyright.js5
-rw-r--r--views/script/menu_global.js113
-rw-r--r--views/script/menu_gpuinfo.js69
-rw-r--r--views/script/menu_music.js5
-rw-r--r--views/script/menu_system.js33
-rw-r--r--views/script/online_play.js2
-rw-r--r--views/script/settings_global.js226
-rw-r--r--views/script/settings_load.js25
-rw-r--r--views/script/win_global.js22
-rw-r--r--views/script/win_message.js9
-rw-r--r--views/script/win_music.js4
-rw-r--r--views/script/win_play.js12
-rw-r--r--views/script/win_quit.js7
32 files changed, 1221 insertions, 0 deletions
diff --git a/views/script/client_fullscreen.js b/views/script/client_fullscreen.js
new file mode 100644
index 0000000..80d745c
--- /dev/null
+++ b/views/script/client_fullscreen.js
@@ -0,0 +1,9 @@
+document.addEventListener('keydown', function(e) {
+ if (e.key === "F1" || e.key === "F10" || e.key === "F11") { // F11/F1/F10
+ if (!require('@electron/remote').getCurrentWindow().fullScreen && require('@electron/remote').getCurrentWindow().fullScreenable) {
+ require('@electron/remote').getCurrentWindow().setFullScreen(true);
+ } else {
+ require('@electron/remote').getCurrentWindow().setFullScreen(false);
+ }
+ }
+}) \ No newline at end of file
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
diff --git a/views/script/core_fullscreen.js b/views/script/core_fullscreen.js
new file mode 100644
index 0000000..69f9e45
--- /dev/null
+++ b/views/script/core_fullscreen.js
@@ -0,0 +1,9 @@
+$(document).keydown(function(e) {
+ if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { // F11/F1/F10
+ if (!require('@electron/remote').getCurrentWindow().fullScreen && require('@electron/remote').getCurrentWindow().fullScreenable) {
+ require('@electron/remote').getCurrentWindow().setFullScreen(true);
+ } else {
+ require('@electron/remote').getCurrentWindow().setFullScreen(false);
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/core_head.js b/views/script/core_head.js
new file mode 100644
index 0000000..be27c87
--- /dev/null
+++ b/views/script/core_head.js
@@ -0,0 +1,31 @@
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = './webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+
+if (native && require('@electron/remote').getCurrentWindow().debug) {
+ document.write('<link rel="stylesheet" href="' + atob("Li92aWV3cy9jb21tb24vZGVidWcuY3Nz") + '">');
+}
+
+if (native) {
+ var ipcRenderer = require('electron').ipcRenderer;
+ ipcRenderer.on('scenario', function (event,obj) {
+ try {
+ console.log(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3");
+ a = new Audio(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3");
+ a.onended = () => {
+ setTimeout(() => {
+ $("#message").fadeOut(200);
+ if (typeof obj.cb == "function") {
+ obj.cb();
+ }
+ }, 3000)
+ }
+ a.play();
+ } catch (e) {
+ console.error(e);
+ obj.cb();
+ }
+
+ document.getElementById('message-text').innerText = obj.message;
+ document.getElementById('message-character-inner').src = kresources.scenario.averi[obj.emote];
+ $("#message").fadeIn(200);
+ });
+}
diff --git a/views/script/core_music.js b/views/script/core_music.js
new file mode 100644
index 0000000..d1e8619
--- /dev/null
+++ b/views/script/core_music.js
@@ -0,0 +1,109 @@
+global.csng = null;
+global.csp1 = null;
+global.csp2 = null;
+global.cspn = 1;
+const musicIpc = require('electron').ipcRenderer;
+
+musicIpc.on('setmusic', (event, args) => {
+ song = args;
+
+ if (song !== null && song !== "" && csng !== song) {
+ if (cspn === 1) {
+ if (csp1 !== null) {
+ csi1 = setInterval(() => {
+ if (csp1.volume <= 0.05) {
+ csp1.pause();
+ clearInterval(csi1);
+ return;
+ }
+ csp1.volume = csp1.volume - 0.05;
+ }, 100)
+ }
+ csp2 = new Audio(song);
+ csp2.volume = 0;
+ csp2.loop = true;
+ csp2.play();
+ csi2 = setInterval(() => {
+ if (csp2.volume >= 0.95) {
+ clearInterval(csi2);
+ return;
+ }
+ csp2.volume = csp2.volume + 0.05;
+ }, 100)
+ csng = song;
+ cspn = 2;
+ } else {
+ if (csp2 !== null) {
+ csi2 = setInterval(() => {
+ if (csp2.volume <= 0.05) {
+ csp2.pause();
+ clearInterval(csi2);
+ return;
+ }
+ csp2.volume = csp2.volume - 0.05;
+ }, 100)
+ }
+ csp1 = new Audio(song);
+ csp1.volume = 0;
+ csp1.loop = true;
+ csp1.play();
+ csi1 = setInterval(() => {
+ if (csp1.volume >= 0.95) {
+ clearInterval(csi1);
+ return;
+ }
+ csp1.volume = csp1.volume + 0.05;
+ }, 100)
+ csng = song;
+ cspn = 1;
+ }
+ }
+})
+
+musicIpc.on('fademusic', (event) => {
+ if (cspn === 1) {
+ if (csp1 !== null) {
+ csi1 = setInterval(() => {
+ if (csp1.volume <= 0.5) {
+ clearInterval(csi1);
+ return;
+ }
+ csp1.volume = csp1.volume - 0.05;
+ }, 100)
+ }
+ } else {
+ if (csp2 !== null) {
+ csi2 = setInterval(() => {
+ if (csp2.volume <= 0.5) {
+ clearInterval(csi2);
+ return;
+ }
+ csp2.volume = csp2.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)
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/core_stats.js b/views/script/core_stats.js
new file mode 100644
index 0000000..5c7314f
--- /dev/null
+++ b/views/script/core_stats.js
@@ -0,0 +1,47 @@
+const fs = require('fs');
+const homedir = require('@electron/remote').getCurrentWindow().homedir;
+const defaultStats = {
+ times: {
+ game: 0,
+ single: 0,
+ local: 0,
+ online: 0
+ },
+ results: {
+ wins: 0,
+ loses: 0
+ },
+ ingame: {
+ walls: 0,
+ laps: 0,
+ turns: 0
+ }
+}
+
+if (!fs.existsSync(homedir + "/.kartik/stats.json")) {
+ fs.writeFileSync(homedir + "/.kartik/stats.json", JSON.stringify(defaultStats));
+} else {
+ try {
+ JSON.parse(fs.readFileSync(homedir + "/.kartik/stats.json").toString());
+ } catch (e) {
+ fs.writeFileSync(homedir + "/.kartik/stats.json", JSON.stringify(defaultStats));
+ }
+}
+
+class Stats {
+ static add(category, counter, quantity) {
+ try {
+ let current = JSON.parse(fs.readFileSync(homedir + "/.kartik/stats.json").toString());
+ current[category][counter] = current[category][counter] + quantity;
+ fs.writeFileSync(homedir + "/.kartik/stats.json", JSON.stringify(current));
+ } catch (e) {}
+ }
+
+ static set(category, counter, value) {
+ try {
+ let current = JSON.parse(fs.readFileSync(homedir + "/.kartik/stats.json").toString());
+ current[category][counter] = value;
+ fs.writeFileSync(homedir + "/.kartik/stats.json", JSON.stringify(current));
+ } catch (e) {}
+ }
+} \ No newline at end of file
diff --git a/views/script/core_viewer.js b/views/script/core_viewer.js
new file mode 100644
index 0000000..d22ada9
--- /dev/null
+++ b/views/script/core_viewer.js
@@ -0,0 +1,23 @@
+const webview = document.getElementById('wb');
+
+webview.addEventListener('dom-ready', () => {
+ require('@electron/remote').getCurrentWindow().log(" * " + webview.getURL());
+ try {
+ if (require('@electron/remote').getCurrentWindow().debug) {
+ info("MainWindow", "Opening debugging tools...");
+ webview.openDevTools();
+ }
+ } catch (e) {}
+})
+
+webview.addEventListener('dom-ready', () => {
+ setInterval(() => {
+ try {
+ if (webview.isCrashed()) {
+ require('@electron/remote').getCurrentWindow().log(" * Compositing engine crashed!");
+ error("MainWindow", "Subcontainer crashed");
+ crash(new Error("Webview crashed"));
+ }
+ } catch (e) {}
+ }, 2000)
+}) \ No newline at end of file
diff --git a/views/script/credits_global.js b/views/script/credits_global.js
new file mode 100644
index 0000000..58946ff
--- /dev/null
+++ b/views/script/credits_global.js
@@ -0,0 +1,54 @@
+let menuOpen = true;
+
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+
+keysEnabled = true;
+$(document).keydown(function(e) {
+ if (keysEnabled) {
+ if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc
+ keysEnabled = false;
+ Sound.click();
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("GWinWindow", "Switching control to MenuWindow");
+ location.href = "settings.html?credits";
+ }, 1000)
+ }
+ }
+})
+
+var currentpos=0,alt=1,curpos1=0,curpos2=-1
+function initialize(){
+ $("#box").fadeIn(500);
+ startit()
+}
+function scrollwindow(){
+ if (document.all)
+ temp=document.body.scrollTop
+ else
+ temp=window.pageYOffset
+ if (alt===0)
+ alt=1
+ else
+ alt=0
+ if (alt===0)
+ curpos1=temp
+ else
+ curpos2=temp
+ if (curpos1!==curpos2){
+ if (document.all)
+ currentpos=document.body.scrollTop+1
+ else
+ currentpos=window.pageYOffset+1
+ window.scroll(0,currentpos)
+ }
+ else{
+ currentpos=0
+ window.scroll(0,currentpos)
+ }
+}
+function startit(){
+ setInterval("scrollwindow()",20)
+}
+window.onload=initialize
diff --git a/views/script/credits_libs.js b/views/script/credits_libs.js
new file mode 100644
index 0000000..9e2f21a
--- /dev/null
+++ b/views/script/credits_libs.js
@@ -0,0 +1,15 @@
+Object.keys(process.versions).forEach((e) => {
+ v = process.versions[e];
+ document.write(e.substr(0, 1).toUpperCase() + e.substr(1) + " contributors<br>");
+})
+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>");
+ } else {
+ document.write(j.name.substr(0, 1).toUpperCase() + j.name.substr(1) + " authors<br>");
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/credits_music.js b/views/script/credits_music.js
new file mode 100644
index 0000000..7a4883b
--- /dev/null
+++ b/views/script/credits_music.js
@@ -0,0 +1,4 @@
+if (require('@electron/remote').getCurrentWindow().music) {
+ info("MusicMgr", "Playing settings.mp3");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['credits'].file);
+} \ No newline at end of file
diff --git a/views/script/credits_technical.js b/views/script/credits_technical.js
new file mode 100644
index 0000000..8193167
--- /dev/null
+++ b/views/script/credits_technical.js
@@ -0,0 +1,9 @@
+document.write("Kartik"+require('@electron/remote').getCurrentWindow().channel + " (" + require('../package.json').name + ") " +require('../package.json').version);
+document.write(" on " + require('os').type() + " (" + require('os').version() + ", " + require('os').arch() +") version " + require('os').release() + "<br>")
+cores = require('os').cpus()
+if (cores.length > 1) {
+ document.write(cores.length + " processors<br>");
+} else {
+ document.write(cores.length + " processor<br>");
+}
+document.write(((process.memoryUsage().heapUsed/1024)/1024).toFixed(2) + " MB heap memory used, " + ((process.memoryUsage().heapTotal/1024)/1024).toFixed(2) + " MB heap memory total, " + ((process.memoryUsage().rss/1024)/1024).toFixed(2) + " MB virtual memory"); \ No newline at end of file
diff --git a/views/script/game_global.js b/views/script/game_global.js
new file mode 100644
index 0000000..4e6de21
--- /dev/null
+++ b/views/script/game_global.js
@@ -0,0 +1,45 @@
+$("#box").fadeOut(0);
+$("#bg").fadeOut(0);
+setTimeout(() => {
+ $("#box").fadeIn(500);
+ $("#bg").fadeIn(500);
+}, 200)
+
+global.startgame = () => {
+ keysEnabled = true;
+ $("#credits").fadeOut(200)
+ Sound.intro();
+
+ setTimeout(() => {
+ started = true;
+ }, 1700)
+
+ setTimeout(() => {
+ if (location.search === "?sp") {
+ enableAI();
+ }
+ }, 1200)
+}
+
+startHooks.push(() => {
+ global.hitshow = false;
+ global.started = false;
+ keysEnabled = false;
+
+ $("body").focus();
+
+ if (!online) {
+ setTimeout(startgame, 7000)
+ }
+
+ if (online && role === "host") {
+ setTimeout(() => {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "gameIsReady",
+ message: null
+ }) + "|")
+ startgame();
+ }, 7000)
+ }
+}) \ No newline at end of file
diff --git a/views/script/game_music.js b/views/script/game_music.js
new file mode 100644
index 0000000..29b00da
--- /dev/null
+++ b/views/script/game_music.js
@@ -0,0 +1,10 @@
+startHooks.push(() => {
+ if (require('@electron/remote').getCurrentWindow().music) {
+ info("MusicMgr", "Playing game" + i + ".mp3");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['game' + i].file);
+ }
+})
+
+if (location.search === "?online") {
+ require('electron').ipcRenderer.send('newmusic', kresources.music['prepare'].file);
+} \ No newline at end of file
diff --git a/views/script/game_online.js b/views/script/game_online.js
new file mode 100644
index 0000000..e379708
--- /dev/null
+++ b/views/script/game_online.js
@@ -0,0 +1,9 @@
+if (location.search === "?online") {
+ document.getElementById('online-login').style.display = "";
+ document.write(`<` + `script src="../online/global.js"></` + `script>`);
+} else {
+ startHooks.forEach((hook) => {
+ hook(this);
+ })
+ document.getElementById('ping').style.display = "none";
+} \ No newline at end of file
diff --git a/views/script/game_select.js b/views/script/game_select.js
new file mode 100644
index 0000000..7857101
--- /dev/null
+++ b/views/script/game_select.js
@@ -0,0 +1,131 @@
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+
+startHooks.push(() => {
+ function ranint(min, max) { // min and max included
+ return Math.floor(Math.random() * (max - min + 1) + min);
+ }
+
+ circuits = Object.keys(kresources.races);
+ rand = circuits[Math.floor(Math.random()*circuits.length)];
+
+ if (online && role === "host") {
+ setInterval(() => {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "RaceData:circuit",
+ message: rand
+ }) + "|");
+ }, 100)
+ }
+
+ if (online && role === "guest") {
+ rand = guestInfo.circuit;
+ }
+
+ info("GameWindow", "Selected circuit " + rand);
+ document.getElementById('circuit').style.backgroundImage = "url('." + kresources.races[rand].substr(0, kresources.races[rand].length - 5).split("'").join("\\'") + ".png')";
+ document.getElementById('circuit').innerHTML = require('fs').readFileSync(kresources.races[rand]).toString();
+
+ inf = JSON.parse(document.getElementsByTagName("circuit")[0].innerText);
+ if (typeof inf.name[lp] === "undefined") {
+ document.getElementById('race-title').innerText = inf.name.en;
+ } else {
+ document.getElementById('race-title').innerText = inf.name[lp];
+ }
+ document.getElementById('race-author').innerText = inf.author;
+
+ i = ranint(1, 9);
+
+ if (online && role === "host") {
+ setInterval(() => {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "RaceData:music",
+ message: i
+ }) + "|");
+ }, 200)
+ }
+
+ if (online && role === "guest") {
+ i = guestInfo.music;
+ }
+
+ global.spreadOil = (oil) => {
+ rx = ranint(0, 680);
+ ry = ranint(0, 490);
+ rd = ranint(0, 360);
+ rh = ranint(0, 360);
+
+ oil.style.top = ry + "px";
+ oil.style.left = rx + "px";
+ oil.style.transform = "rotate(" + rd + "deg)";
+ oil.style.filter = "hue-rotate(" + rd + "deg)";
+ }
+
+ Array.from(document.getElementById('oil').children).forEach((item) => {
+ spreadOil(item);
+ })
+
+ modelsAvailable = Object.keys(kresources.cars);
+
+ selectedModel0I = Math.floor(Math.random() * modelsAvailable.length);
+ selectedModel0 = modelsAvailable[selectedModel0I];
+ modelsAvailable.splice(selectedModel0I, 1);
+
+ selectedModel1I = Math.floor(Math.random() * modelsAvailable.length);
+ selectedModel1 = modelsAvailable[selectedModel1I];
+
+ if (online && role === "host") {
+ setInterval(() => {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "RaceData:hostCar",
+ message: selectedModel0
+ }) + "|");
+ }, 300)
+ setInterval(() => {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "RaceData:guestCar",
+ message: selectedModel1
+ }) + "|");
+ }, 400)
+ }
+
+ if (online && role === "guest") {
+ selectedModel0 = guestInfo.guestCar;
+ selectedModel1 = guestInfo.hostCar;
+ }
+
+ document.getElementById("car0-img").src = kresources.cars[selectedModel0];
+ document.getElementById("cars-p1-inner").src = kresources.cars[selectedModel0];
+ document.getElementById("car1-img").src = kresources.cars[selectedModel1];
+ document.getElementById("cars-p2-inner").src = kresources.cars[selectedModel1];
+})
+
+startHooks.push(() => {
+ setInterval(() => {
+ if (online) {
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "posTop",
+ message: document.getElementById("car0").style.top
+ }) + "|")
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "posLeft",
+ message: document.getElementById("car0").style.left
+ }) + "|")
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "posRot",
+ message: document.getElementById("car0").style.transform
+ }) + "|")
+ clientWriter(JSON.stringify({
+ _type: "ipc",
+ action: "progressLaps",
+ message: document.getElementById("laps-car0").innerText
+ }) + "|")
+ }
+ }, 50)
+})
diff --git a/views/script/intro_global.js b/views/script/intro_global.js
new file mode 100644
index 0000000..b6bf033
--- /dev/null
+++ b/views/script/intro_global.js
@@ -0,0 +1,21 @@
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+$("#box").fadeOut(0);
+window.addEventListener('load', () => {
+ setTimeout(() => {
+ $("#box").fadeIn(500);
+ }, 1000)
+})
+
+keysEnabled = true;
+$(document).keydown(function(e) {
+ if (keysEnabled) {
+ if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc
+ kesyEnabled = false;
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("GWinWindow", "Switching control to MenuWindow");
+ location.href = "menu.html?noreset";
+ }, 1000)
+ }
+ }
+}) \ No newline at end of file
diff --git a/views/script/intro_media.js b/views/script/intro_media.js
new file mode 100644
index 0000000..87600b9
--- /dev/null
+++ b/views/script/intro_media.js
@@ -0,0 +1,4 @@
+if (require('@electron/remote').getCurrentWindow().music) {
+ info("MusicMgr", "Playing title.mp3");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['title'].file);
+} \ No newline at end of file
diff --git a/views/script/intro_message.js b/views/script/intro_message.js
new file mode 100644
index 0000000..6ab8d95
--- /dev/null
+++ b/views/script/intro_message.js
@@ -0,0 +1,7 @@
+setInterval(() => {
+ if (require('@electron/remote').getCurrentWindow().controllerAttached) {
+ document.getElementById('progress').innerText = lang.intro[1];
+ } else {
+ document.getElementById('progress').innerText = lang.intro[0];
+ }
+}, 100) \ No newline at end of file
diff --git a/views/script/loader_global.js b/views/script/loader_global.js
new file mode 100644
index 0000000..67016d9
--- /dev/null
+++ b/views/script/loader_global.js
@@ -0,0 +1,85 @@
+window.addEventListener('load', () => {
+ setTimeout(() => {
+ if (native) {
+ setTimeout(() => {
+ document.getElementById('vendor').style.transform = "scale(3)";
+ new Audio("../sfx/intro.mp3").play();
+ setTimeout(() => {
+ if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+ $("#progress").fadeOut(500);
+ setTimeout(() => {
+ window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => {
+ data.blob().then((a) => {
+ a.text().then((b) => {
+ if (require('@electron/remote').getCurrentWindow().update == "git") {
+ document.getElementById('updates').style.backgroundColor = "lightsalmon";
+ document.getElementById('updates').innerText = lang.updates.git;
+ } else {
+ console.log(b);
+ console.log(require('../package.json').version);
+ if (b == require('../package.json').version) {
+ document.getElementById('updates').style.backgroundColor = "lightgreen";
+ document.getElementById('updates').innerText = lang.updates.ok;
+ } else {
+ document.getElementById('warning').style.opacity = "1";
+ document.getElementById('updates').style.backgroundColor = "lightyellow";
+ document.getElementById('updates').innerText = lang.updates.available;
+ }
+ }
+ setTimeout(() => {
+ $("body").fadeOut(500);
+ setTimeout(() => {
+ info("LoadWindow", "Switching control to MenuWindow");
+ location.href = "intro.html";
+ }, 1000)
+ }, 3000);
+ }).catch((e) => {
+ console.warn(e);
+ document.getElementById('updates').style.backgroundColor = "lightcoral";
+ document.getElementById('updates').innerText = lang.updates.error;
+ setTimeout(() => {
+ $("body").fadeOut(500);
+ setTimeout(() => {
+ info("LoadWindow", "Switching control to MenuWindow");
+ location.href = "intro.html";
+ }, 1000)
+ }, 3000);
+ });
+ }).catch((e) => {
+ console.warn(e);
+ document.getElementById('updates').style.backgroundColor = "lightcoral";
+ document.getElementById('updates').innerText = lang.updates.error;
+ setTimeout(() => {
+ $("body").fadeOut(500);
+ setTimeout(() => {
+ info("LoadWindow", "Switching control to MenuWindow");
+ location.href = "intro.html";
+ }, 1000)
+ }, 3000);
+ });
+ }).catch((e) => {
+ console.warn(e);
+ document.getElementById('updates').style.backgroundColor = "lightcoral";
+ document.getElementById('updates').innerText = lang.updates.error;
+ setTimeout(() => {
+ setTimeout(() => {
+ info("LoadWindow", "Switching control to MenuWindow");
+ location.href = "intro.html";
+ }, 1000)
+ }, 3000);
+ });
+ }, 2000)
+ }, 3000)
+ }, 1000)
+ } else {
+ if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+ setTimeout(() => {
+ $("body").fadeOut(500);
+ setTimeout(() => {
+ info("LoadWindow", "Switching control to MenuWindow");
+ location.href = "intro.html";
+ }, 1000)
+ }, 8000);
+ }
+ }, 2000)
+})
diff --git a/views/script/menu_copyright.js b/views/script/menu_copyright.js
new file mode 100644
index 0000000..35b322a
--- /dev/null
+++ b/views/script/menu_copyright.js
@@ -0,0 +1,5 @@
+if (new Date().getFullYear() === 2021) {
+ document.write(new Date().getFullYear() + " Minteck Projects");
+} else {
+ document.write("2021-" + new Date().getFullYear() + " Minteck Projects");
+} \ No newline at end of file
diff --git a/views/script/menu_global.js b/views/script/menu_global.js
new file mode 100644
index 0000000..43937f4
--- /dev/null
+++ b/views/script/menu_global.js
@@ -0,0 +1,113 @@
+let menuOpen = true;
+
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+$("#box").fadeOut(0);
+window.addEventListener('load', () => {
+ setTimeout(() => {
+ $("#box").fadeIn(500);
+ }, 1000)
+})
+
+$("body").focus();
+keysEnabled = true;
+$(document).keydown(function(e) {
+ if (keysEnabled) {
+ if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter
+ if ($(".services").is(":visible")) {
+ selectOption();
+ } else {
+ $(".services").show();
+ }
+ menuOpen = !menuOpen;
+ }
+ if (e.keyCode === 38 || e.keyCode === 90) { // up
+ Sound.menu();
+ var selected = $(".selected");
+ $(".services li").removeClass("selected");
+ if (selected.prev().length === 0) {
+ selected.siblings().last().addClass("selected");
+ } else {
+ selected.prev().addClass("selected");
+ }
+ }
+ if (e.keyCode === 40 || e.keyCode === 83) { // down
+ Sound.menu();
+ var selected = $(".selected");
+ $(".services li").removeClass("selected");
+ if (selected.next().length === 0) {
+ selected.siblings().first().addClass("selected");
+ } else {
+ selected.next().addClass("selected");
+ }
+ }
+ if (e.keyCode === 27 || e.keyCode === 8) { // esc
+ keysEnabled = false;
+ Sound.click();
+ setTimeout(() => {
+ require('@electron/remote').getCurrentWindow().close();
+ }, 250)
+ }
+ }
+});
+
+function selectOption() {
+ item = document.querySelector(".selected a").id;
+ Sound.click();
+
+ switch (item) {
+ case 'single':
+ scenar("start", "happy");
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to GameWindow");
+ location.href = "game.html?sp";
+ }, 1000)
+ break;
+ case 'online':
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to GameWindow");
+ location.href = "game.html?online";
+ }, 1000)
+ break;
+ case 'play':
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to GameWindow");
+ location.href = "game.html";
+ }, 1000)
+ break;
+ case 'settings':
+ keysEnabled = false;
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to OptnWindow");
+ location.href = "settings.html";
+ }, 1000)
+ break;
+ case 'credits':
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to OptnWindow");
+ location.href = "credits.html";
+ }, 1000)
+ break;
+ case 'quit':
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ info("MenuWindow", "Quitting game");
+ Sound.click();
+ setTimeout(() => {
+ require('@electron/remote').getCurrentWindow().close();
+ }, 250)
+ break;
+ }
+} \ No newline at end of file
diff --git a/views/script/menu_gpuinfo.js b/views/script/menu_gpuinfo.js
new file mode 100644
index 0000000..4177cfc
--- /dev/null
+++ b/views/script/menu_gpuinfo.js
@@ -0,0 +1,69 @@
+if (require('os').platform !== "darwin") {
+ gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
+ document.write("kartik<br>");
+ document.write("├ kartik.accel<br>");
+ if (gpuinfo['2d_canvas'].startsWith("enabled")) {
+ document.write("│ ├ <span style='color:lightgreen;'>kartik.accel.Canvas</span><br>");
+ } else {
+ document.write("│ ├ <span style='color:lightcoral;'>kartik.accel.Canvas</span><br>");
+ }
+ if (gpuinfo['gpu_compositing'].startsWith("enabled")) {
+ document.write("│ ├ <span style='color:lightgreen;'>kartik.accel.Compositing</span><br>");
+ } else {
+ document.write("│ ├ <span style='color:lightcoral;'>kartik.accel.Compositing</span><br>");
+ }
+ if (gpuinfo['video_decode'].startsWith("enabled")) {
+ document.write("│ └ <span style='color:lightgreen;'>kartik.accel.VideoDecode</span><br>");
+ } else {
+ document.write("│ └ <span style='color:lightcoral;'>kartik.accel.VideoDecode</span><br>");
+ }
+ document.write("├ kartik.raster<br>");
+ if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) {
+ document.write("│ ├ <span style='color:lightgreen;'>kartik.raster.Threaded</span><br>");
+ } else {
+ document.write("│ ├ <span style='color:lightcoral;'>kartik.raster.Threaded</span><br>");
+ }
+ if (gpuinfo['oop_rasterization'].startsWith("enabled")) {
+ document.write("│ ├ <span style='color:lightgreen;'>kartik.raster.ObjectOP</span><br>");
+ } else {
+ document.write("│ ├ <span style='color:lightcoral;'>kartik.raster.ObjectOP</span><br>");
+ }
+ if (gpuinfo['rasterization'].startsWith("enabled")) {
+ document.write("│ └ <span style='color:lightgreen;'>kartik.raster.Common</span><br>");
+ } else {
+ document.write("│ └ <span style='color:lightcoral;'>kartik.raster.Common</span><br>");
+ }
+ document.write("└ kartik.renderer<br>");
+ if (gpuinfo['opengl'].startsWith("enabled")) {
+ document.write(" &nbsp;├ <span style='color:lightgreen;'>kartik.renderer.OpenGL</span><br>");
+ } else {
+ document.write(" &nbsp;├ <span style='color:lightcoral;'>kartik.renderer.OpenGL</span><br>");
+ }
+ if (gpuinfo['skia_renderer'].startsWith("enabled")) {
+ document.write(" &nbsp;├ <span style='color:lightgreen;'>kartik.renderer.Skia</span><br>");
+ } else {
+ document.write(" &nbsp;├ <span style='color:lightcoral;'>kartik.renderer.Skia</span><br>");
+ }
+ if (gpuinfo['vulkan'].startsWith("enabled")) {
+ document.write(" &nbsp;└ <span style='color:lightgreen;'>kartik.renderer.Vulkan</span><br>");
+ } else {
+ document.write(" &nbsp;└ <span style='color:lightcoral;'>kartik.renderer.Vulkan</span></span><br>");
+ }
+} else {
+ document.write("You are using macOS<br><br>Kartik can't detect GPU info<br>for Apple macOS.");
+}
+
+document.onkeydown = (e) => {
+ if (e.shiftKey) {
+ document.getElementById('gpuinfo-inner').style.opacity = "1";
+ document.getElementById('gpuinfo-outer').style.display = "none";
+ } else {
+ document.getElementById('gpuinfo-inner').style.opacity = "0";
+ document.getElementById('gpuinfo-outer').style.display = "";
+ }
+}
+
+document.onkeyup = (e) => {
+ document.getElementById('gpuinfo-inner').style.opacity = "0";
+ document.getElementById('gpuinfo-outer').style.display = "";
+} \ No newline at end of file
diff --git a/views/script/menu_music.js b/views/script/menu_music.js
new file mode 100644
index 0000000..f1d23f9
--- /dev/null
+++ b/views/script/menu_music.js
@@ -0,0 +1,5 @@
+if (location.search !== "?noreset") {
+ console.log("back");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['title'].file);
+}
+info("MenuWindow", "Menu opened");
diff --git a/views/script/menu_system.js b/views/script/menu_system.js
new file mode 100644
index 0000000..947699f
--- /dev/null
+++ b/views/script/menu_system.js
@@ -0,0 +1,33 @@
+
+switch (require('os').platform()) {
+ case "win32":
+ document.write("Windows");
+ break
+ case "aix":
+ document.write("AIX");
+ break
+ case "android":
+ document.write("Android");
+ break
+ case "cygwin":
+ document.write("Cygwin");
+ break
+ case "darwin":
+ document.write("macOS");
+ break
+ case "freebsd":
+ document.write("FreeBSD");
+ break
+ case "linux":
+ document.write("GNU/Linux");
+ break
+ case "netbsd":
+ document.write("NetBSD");
+ break
+ case "openbsd":
+ document.write("OpenBSD");
+ break
+ case "sunos":
+ document.write("Solaris");
+ break
+}
diff --git a/views/script/online_play.js b/views/script/online_play.js
new file mode 100644
index 0000000..0c1eb91
--- /dev/null
+++ b/views/script/online_play.js
@@ -0,0 +1,2 @@
+require('@electron/remote').getCurrentWindow().dstate = lang.online.discord2;
+require('@electron/remote').getCurrentWindow().ddetails = lang.online.discord; \ No newline at end of file
diff --git a/views/script/settings_global.js b/views/script/settings_global.js
new file mode 100644
index 0000000..41332c5
--- /dev/null
+++ b/views/script/settings_global.js
@@ -0,0 +1,226 @@
+let menuOpen = true;
+
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+$("#box").fadeOut(0);
+setTimeout(() => {
+ $("#box").fadeIn(500);
+}, 200)
+
+$("body").focus();
+keysEnabled = true;
+$(document).keydown(function(e) {
+ if (keysEnabled) {
+ if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter
+ if ($(".services").is(":visible")) {
+ selectOption();
+ } else {
+ $(".services").show();
+ }
+ }
+ if (e.keyCode === 38 || e.keyCode === 90) { // up
+ Sound.menu();
+ var selected = $(".selected");
+ $(".services li").removeClass("selected");
+ if (selected.prev().length === 0) {
+ selected.siblings().last().addClass("selected");
+ } else {
+ selected.prev().addClass("selected");
+ }
+ }
+ if (e.keyCode === 40 || e.keyCode === 83) { // down
+ Sound.menu();
+ var selected = $(".selected");
+ $(".services li").removeClass("selected");
+ if (selected.next().length === 0) {
+ selected.siblings().first().addClass("selected");
+ } else {
+ selected.next().addClass("selected");
+ }
+ }
+ if (e.keyCode === 68 || e.keyCode === 39 || e.keyCode === 81 || e.keyCode === 37) { // right/left
+ Sound.menu();
+ var selected = $(".selected");
+ var id = $(".selected")[0].children[0].children[0].id;
+
+ if (id === "musicb") {
+ if (document.getElementById("setting-music").innerText === lang.settings.yes) {
+ document.getElementById("setting-music").innerText = lang.settings.no;
+ require('fs').writeFileSync(homedir + "/.kartik/config/music.txt", "0");
+ } else {
+ document.getElementById("setting-music").innerText = lang.settings.yes;
+ require('fs').writeFileSync(homedir + "/.kartik/config/music.txt", "1");
+ }
+ }
+ if (id === "voice") {
+ if (document.getElementById("setting-voice").innerText === lang.settings.yes) {
+ document.getElementById("setting-voice").innerText = lang.settings.no;
+ require('fs').writeFileSync(homedir + "/.kartik/config/voice.txt", "0");
+ } else {
+ document.getElementById("setting-voice").innerText = lang.settings.yes;
+ require('fs').writeFileSync(homedir + "/.kartik/config/voice.txt", "2");
+ }
+ }
+ if (id === "zoom") {
+ zoom = document.getElementById("setting-zoom").innerText;
+
+ switch (zoom) {
+ case "0.9":
+ document.getElementById("setting-zoom").innerText = "1";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1");
+ break;
+ case "1":
+ document.getElementById("setting-zoom").innerText = "1.1";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.1");
+ break;
+ case "1.1":
+ document.getElementById("setting-zoom").innerText = "1.2";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.2");
+ break;
+ case "1.2":
+ document.getElementById("setting-zoom").innerText = "1.3";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.3");
+ break;
+ case "1.3":
+ document.getElementById("setting-zoom").innerText = "1.4";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.4");
+ break;
+ case "1.4":
+ document.getElementById("setting-zoom").innerText = "1.5";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.5");
+ break;
+ case "1.5":
+ document.getElementById("setting-zoom").innerText = "1.6";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.6");
+ break;
+ case "1.6":
+ document.getElementById("setting-zoom").innerText = "1.7";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.7");
+ break;
+ case "1.7":
+ document.getElementById("setting-zoom").innerText = "1.8";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.8");
+ break;
+ case "1.8":
+ document.getElementById("setting-zoom").innerText = "1.9";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "1.9");
+ break;
+ case "1.9":
+ document.getElementById("setting-zoom").innerText = "2";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "2");
+ break;
+ case "2":
+ document.getElementById("setting-zoom").innerText = "0.9";
+ require('fs').writeFileSync(homedir + "/.kartik/config/scale.txt", "0.9");
+ break;
+ }
+ }
+ if (id === "lang") {
+ lang = document.getElementById("setting-lang").innerText;
+ slng = require('../lang/languages.json');
+ slst = Object.keys(slng);
+ maxl = slst.length - 1;
+
+ ci = -1;
+ ni = -1;
+ slst.forEach((key, index) => {
+ if (slng[key] === lang) {
+ ci = index;
+ if (index + 1 > maxl) {
+ ni = 0;
+ } else {
+ ni = index + 1;
+ }
+ }
+ })
+
+ if (ci !== -1 && ni !== -1) {
+ document.getElementById("setting-lang").innerText = slng[slst[ni]];
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", slst[ni]);
+ require('@electron/remote').getCurrentWindow().lp = slst[ni];
+ }
+
+ /*switch (lang) {
+ case "Français":
+ document.getElementById("setting-lang").innerText = "English";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "en");
+ require('@electron/remote').getCurrentWindow().lp = "en";
+ break;
+
+ case "English":
+ document.getElementById("setting-lang").innerText = "Español";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "es");
+ require('@electron/remote').getCurrentWindow().lp = "es";
+ break;
+
+ case "Español":
+ document.getElementById("setting-lang").innerText = "中国人";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "zh");
+ require('@electron/remote').getCurrentWindow().lp = "zh";
+ break;
+
+ case "中国人":
+ document.getElementById("setting-lang").innerText = "日本語";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "jp");
+ require('@electron/remote').getCurrentWindow().lp = "jp";
+ break;
+
+ case "日本語":
+ document.getElementById("setting-lang").innerText = "русский";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "ru");
+ require('@electron/remote').getCurrentWindow().lp = "ru";
+ break;
+
+ case "русский":
+ document.getElementById("setting-lang").innerText = "Deutsche";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "de");
+ require('@electron/remote').getCurrentWindow().lp = "de";
+ break;
+
+ case "Deutsche":
+ document.getElementById("setting-lang").innerText = "Nederlands";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "nl");
+ require('@electron/remote').getCurrentWindow().lp = "nl";
+ break;
+
+ case "Nederlands":
+ document.getElementById("setting-lang").innerText = "Français";
+ require('fs').writeFileSync(homedir + "/.kartik/config/lang.txt", "fr");
+ require('@electron/remote').getCurrentWindow().lp = "fr";
+ break;
+ }*/
+ }
+ }
+ if (e.keyCode === 27 || e.keyCode === 8) { // esc
+ keysEnabled = false;
+ Sound.click();
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("OptnWindow", "Switching control to MenuWindow");
+ location.href = "menu.html";
+ }, 1000)
+ }
+ }
+});
+
+function selectOption() {
+ item = document.querySelector(".selected a").id;
+ Sound.click();
+
+ switch (item) {
+ case 'back':
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("OptnWindow", "Switching control to MenuWindow");
+ location.href = "menu.html?noreset";
+ }, 1000)
+ break;
+ case 'credits':
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("OptnWindow", "Switching control to MenuWindow");
+ location.href = "credits.html";
+ }, 1000)
+ break;
+ }
+}
diff --git a/views/script/settings_load.js b/views/script/settings_load.js
new file mode 100644
index 0000000..358f9b1
--- /dev/null
+++ b/views/script/settings_load.js
@@ -0,0 +1,25 @@
+info("OptnWindow", "Restoring settings...");
+
+if (require('@electron/remote').getCurrentWindow().music) {
+ if (location.search === "?credits") {
+ require('electron').ipcRenderer.send('newmusic', kresources.music['title'].file);
+ }
+ document.getElementById("setting-music").innerText = lang.settings.yes;
+} else {
+ document.getElementById("setting-music").innerText = lang.settings.no;
+}
+
+if (require('@electron/remote').getCurrentWindow().voice) {
+ document.getElementById("setting-voice").innerText = lang.settings.yes;
+} else {
+ document.getElementById("setting-voice").innerText = lang.settings.no;
+}
+
+slang = require('@electron/remote').getCurrentWindow().lp;
+langs = require('../lang/languages.json');
+
+if (Object.keys(langs).includes(slang)) {
+ document.getElementById("setting-lang").innerText = langs[slang];
+} else {
+ document.getElementById("setting-lang").innerText = slang;
+} \ No newline at end of file
diff --git a/views/script/win_global.js b/views/script/win_global.js
new file mode 100644
index 0000000..3609af7
--- /dev/null
+++ b/views/script/win_global.js
@@ -0,0 +1,22 @@
+if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);}
+$("#box").fadeOut(0);
+setTimeout(() => {
+ $("#box").fadeIn(500);
+}, 200)
+
+keysEnabled = true;
+$(document).keydown(function(e) {
+ if (keysEnabled) {
+ if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc
+ Sound.click();
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("GWinWindow", "Switching control to MenuWindow");
+ location.href = "menu.html";
+ }, 3000)
+ }
+ }
+})
+
+info("GWinWindow", "Rendered!"); \ No newline at end of file
diff --git a/views/script/win_message.js b/views/script/win_message.js
new file mode 100644
index 0000000..fd01c22
--- /dev/null
+++ b/views/script/win_message.js
@@ -0,0 +1,9 @@
+if (location.search === "?sp") {
+ if ((location.hash.substr(4) - 1 + 2) == 1) {
+ document.write(lang.win.solo.win);
+ } else {
+ document.write(lang.win.solo.lose);
+ }
+} else {
+ document.write(lang.win.versus.replace("0", (location.hash.substr(4) - 1 + 2)));
+} \ No newline at end of file
diff --git a/views/script/win_music.js b/views/script/win_music.js
new file mode 100644
index 0000000..b6169f6
--- /dev/null
+++ b/views/script/win_music.js
@@ -0,0 +1,4 @@
+if (require('@electron/remote').getCurrentWindow().music) {
+ info("MusicMgr", "Playing win.mp3");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['win'].file);
+} \ No newline at end of file
diff --git a/views/script/win_play.js b/views/script/win_play.js
new file mode 100644
index 0000000..848b625
--- /dev/null
+++ b/views/script/win_play.js
@@ -0,0 +1,12 @@
+if (location.search === "?sp") {
+ if ((location.hash.substr(4) - 1 + 2) == 1) {
+ require('@electron/remote').getCurrentWindow().dstate = lang.discord.win[0];
+ require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[1];
+ } else {
+ require('@electron/remote').getCurrentWindow().dstate = lang.discord.win[1];
+ require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[1];
+ }
+} else {
+ require('@electron/remote').getCurrentWindow().dstate = lang.discord.win[0];
+ require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[2];
+} \ No newline at end of file
diff --git a/views/script/win_quit.js b/views/script/win_quit.js
new file mode 100644
index 0000000..c8d1af1
--- /dev/null
+++ b/views/script/win_quit.js
@@ -0,0 +1,7 @@
+setInterval(() => {
+ if (require('@electron/remote').getCurrentWindow().controllerAttached) {
+ document.getElementById('progress').innerText = lang.win.quit[1];
+ } else {
+ document.getElementById('progress').innerText = lang.win.quit[0];
+ }
+}, 100) \ No newline at end of file