From d5a620cf09b835db2bccd99556525c90b458719f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 5 Aug 2021 17:21:23 +0200 Subject: i18n for 21.08 --- views/script/core_stats.js | 100 ++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'views/script/core_stats.js') diff --git a/views/script/core_stats.js b/views/script/core_stats.js index 930c776..124f5fe 100644 --- a/views/script/core_stats.js +++ b/views/script/core_stats.js @@ -1,51 +1,51 @@ -const fs = require('fs'); -const homedir = require('@electron/remote').getCurrentWindow().homedir; - -session = null; -timer = null; -current = null; - -webview.addEventListener('dom-ready', () => { - try { - if (webview.getURL() !== current) { - if (session !== null) { - require('electron').ipcRenderer.send('addstats', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); - - session = null; - timer = null; - current = null; - } - } - - if (webview.getURL().endsWith("game.html")) { // Local - session = "local"; - timer = new Date(); - current = webview.getURL(); - } - if (webview.getURL().endsWith("game.html?sp")) { // Singleplayer - session = "single"; - timer = new Date(); - current = webview.getURL(); - } - if (webview.getURL().endsWith("game.html?online")) { // Online - session = "online"; - timer = new Date(); - current = webview.getURL(); - } - } catch (e) {} -}) - -window.addEventListener("beforeunload", function(e){ - try { - if (session !== null) { - require('electron').ipcRenderer.send('addstatsandclose', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); - - session = null; - timer = null; - current = null; - - e.preventDefault(); - return false; - } - } catch (e) {} +const fs = require('fs'); +const homedir = require('@electron/remote').getCurrentWindow().homedir; + +session = null; +timer = null; +current = null; + +webview.addEventListener('dom-ready', () => { + try { + if (webview.getURL() !== current) { + if (session !== null) { + require('electron').ipcRenderer.send('addstats', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); + + session = null; + timer = null; + current = null; + } + } + + if (webview.getURL().endsWith("game.html")) { // Local + session = "local"; + timer = new Date(); + current = webview.getURL(); + } + if (webview.getURL().endsWith("game.html?sp")) { // Singleplayer + session = "single"; + timer = new Date(); + current = webview.getURL(); + } + if (webview.getURL().endsWith("game.html?online")) { // Online + session = "online"; + timer = new Date(); + current = webview.getURL(); + } + } catch (e) {} +}) + +window.addEventListener("beforeunload", function(e){ + try { + if (session !== null) { + require('electron').ipcRenderer.send('addstatsandclose', { catalog: "times", key: session, add: Math.floor((new Date() - timer)/1000) }); + + session = null; + timer = null; + current = null; + + e.preventDefault(); + return false; + } + } catch (e) {} }, false); \ No newline at end of file -- cgit