From ebda41bbd585eb9c80bc58d3c0336c80bda8edd5 Mon Sep 17 00:00:00 2001 From: LoomeL <44950511+LoomeL@users.noreply.github.com> Date: Wed, 4 Sep 2019 19:16:16 +0600 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9F=D1=80=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=81=D1=81=D1=8B=D0=BB=D0=BE=D0=BA=20=D0=B1?= =?UTF-8?q?=D0=B5=D0=B7=20=D0=BC=D0=BE=D0=B4=D0=B8=D1=84=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20js=20(#329)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FEATURE] Простое добавление ссылок без модификации js * [ANY] Angelok support * [FIX] Замена id в styles.css --- Launcher/runtime/config.js | 20 +++++++---- Launcher/runtime/dialog/dialog.js | 33 +++++++++++++++---- .../runtime/dialog/scenes/login/login.fxml | 4 +-- .../dialog/scenes/mainmenu/mainmenu.fxml | 2 +- Launcher/runtime/dialog/styles.css | 8 ++--- 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/Launcher/runtime/config.js b/Launcher/runtime/config.js index 28f92dba..1f1f81b4 100644 --- a/Launcher/runtime/config.js +++ b/Launcher/runtime/config.js @@ -4,12 +4,20 @@ var config = { title: "GravitLauncher", // Заголовок окна icons: ["favicon.png"], // Путь/Пути до иконки окна - //*** Меню авторизации ***// - linkText: "GravitLauncher", // Текст ссылки - linkURL: new java.net.URL("https://gravit.pro"), // Ссылка - - //*** Меню выбора серверов ***// - discord: new java.net.URL("https://discord.gg/aJK6nMN"), // Ссылка + links: [ + //*** Ссылки ***// + { + id: "link", + text: "GravitLauncher", + url: "https://gravit.pro", + }, + + { + id: "discord", + text: "", + url: "https://discord.gg/aJK6nMN", + } + ], //*** Стандартные настройки клиента ***// autoEnterDefault: false, // Автоматический вход на выбранный сервер diff --git a/Launcher/runtime/dialog/dialog.js b/Launcher/runtime/dialog/dialog.js index 1173456b..cb99d0a0 100644 --- a/Launcher/runtime/dialog/dialog.js +++ b/Launcher/runtime/dialog/dialog.js @@ -37,7 +37,6 @@ function initLoginScene() { bar = pane; loginPane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() }); loginPane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) }); - loginPane.lookup("#discord").setOnAction(function() { openURL(config.discord); }); var pane = loginPane.lookup("#authPane"); authPane = pane; @@ -63,13 +62,23 @@ function initLoginScene() { savePasswordBox = pane.lookup("#rememberchb"); savePasswordBox.setSelected(settings.login === null || settings.rsaPassword !== null); - var link = pane.lookup("#link"); - link.setText(config.linkText); - link.setOnAction(function(event) app.getHostServices().showDocument(config.linkURL.toURI())); - authOptions = pane.lookup("#authOptions"); pane.lookup("#goAuth").setOnAction(goAuth); + + var pane = loginPane; + config.links.forEach(function(link) { + var el = pane.lookup("#link_" + link.id); + if (el === null) return; + + el.setOnAction(function() { + openURL(new java.net.URL(link.url)); + }); + + if (link.text === "") return; + + el.setText(link.text); + }); } /* ======== init Menu window======== */ @@ -88,7 +97,6 @@ function initMenuScene() { bar = pane; pane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() }); pane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) }); - pane.lookup("#discord").setOnAction(function() { openURL(config.discord); }); pane.lookup("#settings").setOnAction(goSettings); pane.lookup("#goConsole").setOnAction(goConsole); @@ -112,6 +120,19 @@ function initMenuScene() { setCurrentScene(loginScene); }); + var pane = menuPane; + config.links.forEach(function(link) { + var el = pane.lookup("#link_" + link.id); + if (el === null) return; + + el.setOnAction(function() { + openURL(new java.net.URL(link.url)); + }); + + if (link.text === "") return; + + el.setText(link.text); + }); } /* ======== init Console window======== */ diff --git a/Launcher/runtime/dialog/scenes/login/login.fxml b/Launcher/runtime/dialog/scenes/login/login.fxml index b1e94c9e..43f83937 100644 --- a/Launcher/runtime/dialog/scenes/login/login.fxml +++ b/Launcher/runtime/dialog/scenes/login/login.fxml @@ -32,7 +32,7 @@ - + @@ -57,7 +57,7 @@ - -