mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Простое добавление ссылок без модификации js (#329)
* [FEATURE] Простое добавление ссылок без модификации js * [ANY] Angelok support * [FIX] Замена id в styles.css
This commit is contained in:
parent
581b971cc3
commit
ebda41bbd5
5 changed files with 48 additions and 19 deletions
|
@ -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, // Автоматический вход на выбранный сервер
|
||||
|
|
|
@ -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======== */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<String fx:value="combologin-popup" />
|
||||
</styleClass>
|
||||
</ComboBox>
|
||||
<Hyperlink id="link" fx:id="link" layoutX="94.0" layoutY="422.0" prefHeight="19.0" prefWidth="81.0" textAlignment="CENTER" />
|
||||
<Hyperlink id="link_link" fx:id="link" layoutX="94.0" layoutY="422.0" prefHeight="19.0" prefWidth="81.0" textAlignment="CENTER" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane fx:id="news" prefHeight="432.0" prefWidth="423.0" styleClass="news" />
|
||||
|
@ -57,7 +57,7 @@
|
|||
</image>
|
||||
</ImageView>
|
||||
</graphic></Button>
|
||||
<Button id="discord" alignment="CENTER" contentDisplay="CENTER" layoutY="370.0" minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
|
||||
<Button id="link_discord" alignment="CENTER" contentDisplay="CENTER" layoutY="370.0" minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
|
||||
<graphic>
|
||||
<ImageView>
|
||||
<image>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</image>
|
||||
</ImageView>
|
||||
</graphic></Button>
|
||||
<Button id="discord" alignment="CENTER" contentDisplay="CENTER" layoutY="380.0" minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
|
||||
<Button id="link_discord" alignment="CENTER" contentDisplay="CENTER" layoutY="380.0" minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
|
||||
<graphic>
|
||||
<ImageView>
|
||||
<image>
|
||||
|
|
|
@ -129,7 +129,7 @@ #hide,
|
|||
#back,
|
||||
#goConsole,
|
||||
#settings,
|
||||
#discord {
|
||||
#link_discord {
|
||||
-fx-background-position: center;
|
||||
-fx-background-radius: 0;
|
||||
-fx-pref-width: 46px;
|
||||
|
@ -218,7 +218,7 @@ .text-input {
|
|||
}
|
||||
|
||||
/** Hyperlink **/
|
||||
#link {
|
||||
#link_link {
|
||||
-fx-font-weight: bold;
|
||||
-fx-font-size: 7pt;
|
||||
-fx-opacity: 0.5;
|
||||
|
@ -227,8 +227,8 @@ #link {
|
|||
-fx-pref-height: 17px;
|
||||
}
|
||||
|
||||
#link:hover,
|
||||
#link:pressed {
|
||||
#link_link:hover,
|
||||
#link_link:pressed {
|
||||
-fx-opacity: 0.8;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue