mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +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", // Заголовок окна
|
title: "GravitLauncher", // Заголовок окна
|
||||||
icons: ["favicon.png"], // Путь/Пути до иконки окна
|
icons: ["favicon.png"], // Путь/Пути до иконки окна
|
||||||
|
|
||||||
//*** Меню авторизации ***//
|
links: [
|
||||||
linkText: "GravitLauncher", // Текст ссылки
|
//*** Ссылки ***//
|
||||||
linkURL: new java.net.URL("https://gravit.pro"), // Ссылка
|
{
|
||||||
|
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, // Автоматический вход на выбранный сервер
|
autoEnterDefault: false, // Автоматический вход на выбранный сервер
|
||||||
|
|
|
@ -37,7 +37,6 @@ function initLoginScene() {
|
||||||
bar = pane;
|
bar = pane;
|
||||||
loginPane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
|
loginPane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
|
||||||
loginPane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
|
loginPane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
|
||||||
loginPane.lookup("#discord").setOnAction(function() { openURL(config.discord); });
|
|
||||||
|
|
||||||
var pane = loginPane.lookup("#authPane");
|
var pane = loginPane.lookup("#authPane");
|
||||||
authPane = pane;
|
authPane = pane;
|
||||||
|
@ -63,13 +62,23 @@ function initLoginScene() {
|
||||||
savePasswordBox = pane.lookup("#rememberchb");
|
savePasswordBox = pane.lookup("#rememberchb");
|
||||||
savePasswordBox.setSelected(settings.login === null || settings.rsaPassword !== null);
|
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");
|
authOptions = pane.lookup("#authOptions");
|
||||||
|
|
||||||
pane.lookup("#goAuth").setOnAction(goAuth);
|
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======== */
|
/* ======== init Menu window======== */
|
||||||
|
@ -88,7 +97,6 @@ function initMenuScene() {
|
||||||
bar = pane;
|
bar = pane;
|
||||||
pane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
|
pane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
|
||||||
pane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
|
pane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
|
||||||
pane.lookup("#discord").setOnAction(function() { openURL(config.discord); });
|
|
||||||
pane.lookup("#settings").setOnAction(goSettings);
|
pane.lookup("#settings").setOnAction(goSettings);
|
||||||
pane.lookup("#goConsole").setOnAction(goConsole);
|
pane.lookup("#goConsole").setOnAction(goConsole);
|
||||||
|
|
||||||
|
@ -112,6 +120,19 @@ function initMenuScene() {
|
||||||
setCurrentScene(loginScene);
|
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======== */
|
/* ======== init Console window======== */
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<String fx:value="combologin-popup" />
|
<String fx:value="combologin-popup" />
|
||||||
</styleClass>
|
</styleClass>
|
||||||
</ComboBox>
|
</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>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
<Pane fx:id="news" prefHeight="432.0" prefWidth="423.0" styleClass="news" />
|
<Pane fx:id="news" prefHeight="432.0" prefWidth="423.0" styleClass="news" />
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
</image>
|
</image>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</graphic></Button>
|
</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>
|
<graphic>
|
||||||
<ImageView>
|
<ImageView>
|
||||||
<image>
|
<image>
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
</image>
|
</image>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</graphic></Button>
|
</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>
|
<graphic>
|
||||||
<ImageView>
|
<ImageView>
|
||||||
<image>
|
<image>
|
||||||
|
|
|
@ -129,7 +129,7 @@ #hide,
|
||||||
#back,
|
#back,
|
||||||
#goConsole,
|
#goConsole,
|
||||||
#settings,
|
#settings,
|
||||||
#discord {
|
#link_discord {
|
||||||
-fx-background-position: center;
|
-fx-background-position: center;
|
||||||
-fx-background-radius: 0;
|
-fx-background-radius: 0;
|
||||||
-fx-pref-width: 46px;
|
-fx-pref-width: 46px;
|
||||||
|
@ -218,7 +218,7 @@ .text-input {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hyperlink **/
|
/** Hyperlink **/
|
||||||
#link {
|
#link_link {
|
||||||
-fx-font-weight: bold;
|
-fx-font-weight: bold;
|
||||||
-fx-font-size: 7pt;
|
-fx-font-size: 7pt;
|
||||||
-fx-opacity: 0.5;
|
-fx-opacity: 0.5;
|
||||||
|
@ -227,8 +227,8 @@ #link {
|
||||||
-fx-pref-height: 17px;
|
-fx-pref-height: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#link:hover,
|
#link_link:hover,
|
||||||
#link:pressed {
|
#link_link:pressed {
|
||||||
-fx-opacity: 0.8;
|
-fx-opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue