mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-19 14:33:04 +03:00
[FEATURE] Простое добавление ссылок без модификации js
This commit is contained in:
parent
7755891139
commit
a0b9786a25
2 changed files with 41 additions and 12 deletions
|
@ -4,12 +4,20 @@ var config = {
|
|||
title: "GravitLauncher", // Заголовок окна
|
||||
icons: ["favicon.png"], // Путь/Пути до иконки окна
|
||||
|
||||
//*** Меню авторизации ***//
|
||||
linkText: "GravitLauncher", // Текст ссылки
|
||||
linkURL: new java.net.URL("https://gravit.pro"), // Ссылка
|
||||
links: [
|
||||
//*** Ссылки ***//
|
||||
{
|
||||
id: "link",
|
||||
text: "GravitLauncher",
|
||||
url: "https://gravit.pro",
|
||||
},
|
||||
|
||||
//*** Меню выбора серверов ***//
|
||||
discord: new java.net.URL("https://discord.gg/aJK6nMN"), // Ссылка
|
||||
{
|
||||
id: "discord",
|
||||
text: "",
|
||||
url: "https://discord.gg/aJK6nMN",
|
||||
}
|
||||
],
|
||||
|
||||
//*** Стандартные настройки клиента ***//
|
||||
autoEnterDefault: false, // Автоматический вход на выбранный сервер
|
||||
|
|
|
@ -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.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.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======== */
|
||||
|
|
Loading…
Reference in a new issue