diff options
author | Alystrasz <contact@remyraes.com> | 2021-12-29 23:07:14 +0100 |
---|---|---|
committer | Alystrasz <contact@remyraes.com> | 2021-12-29 23:07:14 +0100 |
commit | a9744a0c5c6eaa9e17682c18e398ff9c5cf7e0fe (patch) | |
tree | 63ca1cdcd43a449b1c726bfd7b0f5c809ef2b58e | |
parent | 220e890af373daa5765026f7b2e60e66b38fb189 (diff) | |
parent | 474f2ae54000463a0a2dfc84ad678a7620cc3d44 (diff) | |
download | Viper-a9744a0c5c6eaa9e17682c18e398ff9c5cf7e0fe.tar.gz Viper-a9744a0c5c6eaa9e17682c18e398ff9c5cf7e0fe.zip |
Merge branch 'main' into chore/french-translation
-rw-r--r-- | src/app/index.html | 2 | ||||
-rw-r--r-- | src/app/lang.js | 16 | ||||
-rw-r--r-- | src/app/main.css | 5 | ||||
-rw-r--r-- | src/app/main.js | 5 | ||||
-rw-r--r-- | src/index.js | 12 |
5 files changed, 29 insertions, 11 deletions
diff --git a/src/app/index.html b/src/app/index.html index 1c34360..426b4c5 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -22,7 +22,7 @@ </div> </div> - <script src="main.js"></script> <script src="lang.js"></script> + <script src="main.js"></script> </body> </html> diff --git a/src/app/lang.js b/src/app/lang.js index 8cf3d4b..5cc9708 100644 --- a/src/app/lang.js +++ b/src/app/lang.js @@ -1,10 +1,12 @@ -html = document.body.innerHTML.split("%%"); +function setlang() { + html = document.body.innerHTML.split("%%"); -for (let i = 0; i < html.length; i++) { - if (html[i][0] != " " && - html[i][html[i].length - 1] != " ") { - html[i] = lang(html[i]) + for (let i = 0; i < html.length; i++) { + if (html[i][0] != " " && + html[i][html[i].length - 1] != " ") { + html[i] = lang(html[i]) + } } -} -document.body.innerHTML = html.join(""); + document.body.innerHTML = html.join(""); +} diff --git a/src/app/main.css b/src/app/main.css index 854c47a..c9c62fb 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -34,10 +34,14 @@ body, button, input { } .buttons { + text-align: right; margin-left: auto; margin-right: 7px; } +.text {max-width: 38vw} +.buttons {max-width: 55vw} + button, .text { border: none; outline: none; @@ -47,6 +51,7 @@ button, .text { } button { + margin-bottom: 10px; color: var(--btnforeground); -webkit-app-region: no-drag; } diff --git a/src/app/main.js b/src/app/main.js index 579f785..0118b0c 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -34,3 +34,8 @@ function launchVanilla() {ipcRenderer.send("launchVanilla")} ipcRenderer.on("newpath", (event, newpath) => { settings.gamepath = newpath; }) + +setlang(); +setInterval(() => { + ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 25); +}, 150) diff --git a/src/index.js b/src/index.js index fead15b..74f776c 100644 --- a/src/index.js +++ b/src/index.js @@ -9,9 +9,10 @@ const utils = require("./utils"); const cli = require("./cli"); function start() { + let width = 115; win = new BrowserWindow({ width: 600, - height: 115, + height: width, show: false, title: "Viper", resizable: false, @@ -26,10 +27,15 @@ function start() { win.removeMenu(); win.loadFile(__dirname + "/app/index.html"); - win.webContents.once("dom-ready", () => {win.show()}); - ipcMain.on("setpath", (event) => {utils.setpath(win)}) ipcMain.on("exit", (event) => {process.exit(0)}) + ipcMain.on("setpath", (event) => {utils.setpath(win)}) + ipcMain.on("setsize", (event, height) => { + win.setSize(width, height); + if (! win.isVisible()) { + win.show(); + } + }) } ipcMain.on("launch", (event) => {utils.launch()}) |