msgbox & translations

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-10-14 11:19:49 +08:00
parent 5ddb10366e
commit 77de0d05f9
42 changed files with 271 additions and 64 deletions

View File

@@ -1,3 +1,5 @@
import * as env from "@env";
function translate_text(text) {
if (text.indexOf('Failed') == 0 && text.indexOf(': ') > 0) {
var fds = text.split(': ');
@@ -22,6 +24,7 @@ class MsgboxComponent: Reactor.Component {
this.type = params.type;
this.title = params.title;
this.content = params.content;
this.link = params.link;
this.remember = params.remember;
this.callback = params.callback;
this.hasRetry = params.hasRetry;
@@ -93,6 +96,7 @@ class MsgboxComponent: Reactor.Component {
var content = this.getContent();
var hasCancel = this.type.indexOf("error") < 0 && this.type.indexOf("nocancel") < 0 && this.type != "restarting";
var hasOk = this.type != "connecting" && this.type != "success" && this.type.indexOf("nook") < 0;
var hasLink = this.link != "";
var hasClose = this.type.indexOf("hasclose") >= 0;
var show_progress = this.type == "connecting";
var me = this;
@@ -121,6 +125,7 @@ class MsgboxComponent: Reactor.Component {
{hasCancel || this.hasRetry ? <button .button #cancel .outline>{translate(this.hasRetry ? "OK" : "Cancel")}</button> : ""}
{this.hasSkip() ? <button .button #skip .outline>{translate('Skip')}</button> : ""}
{hasOk || this.hasRetry ? <button .button #submit>{translate(this.hasRetry ? "Retry" : "OK")}</button> : ""}
{hasLink ? <button .button #jumplink .outline>{translate('JumpLink')}</button> : ""}
{hasClose ? <button .button #cancel .outline>{translate('Close')}</button> : ""}
</div>
</div>
@@ -155,6 +160,13 @@ class MsgboxComponent: Reactor.Component {
if (this.callback) this.callback(values);
if (this.close) this.close();
}
event click $(button#jumplink) {
stdout.println("REMOVE ME ================================= jump link" + this.link);
if (this.link.indexOf("http") == 0) {
env.launch(this.link);
}
}
event click $(button#submit) {
if (this.type == "error") {