portable-service: better prompt message

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-15 16:49:55 +08:00
parent abd665153b
commit ca8cb5a3b0
38 changed files with 131 additions and 124 deletions

View File

@@ -232,6 +232,7 @@ class ChatBox: Reactor.Component {
/******************** start of msgbox ****************************************/
var remember_password = false;
var last_msgbox_tag = "";
function msgbox(type, title, content, link="", callback=null, height=180, width=500, hasRetry=false, contentStyle="") {
$(body).scrollTo(0, 0);
if (!type) {
@@ -264,6 +265,7 @@ function msgbox(type, title, content, link="", callback=null, height=180, width=
} else if (type.indexOf("custom") < 0 && !is_port_forward && !callback) {
callback = function() { view.close(); }
}
last_msgbox_tag = type + "-" + title + "-" + content + "-" + link;
$(#msgbox).content(<MsgboxComponent width={width} height={height} auto_login={auto_login} type={type} title={title} content={content} link={link} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
}
@@ -276,6 +278,12 @@ handler.msgbox = function(type, title, text, link = "", hasRetry=false) {
self.timer(60ms, function() { msgbox(type, title, text, link, null, 180, 500, hasRetry); });
}
handler.cancel_msgbox = function(tag) {
if (last_msgbox_tag == tag) {
closeMsgbox();
}
}
var reconnectTimeout = 1000;
handler.msgbox_retry = function(type, title, text, link, hasRetry) {
handler.msgbox(type, title, text, link, hasRetry);

View File

@@ -231,7 +231,14 @@ impl InvokeUiSession for SciterHandler {
}
fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str, retry: bool) {
self.call2("msgbox_retry", &make_args!(msgtype, title, text, link, retry));
self.call2(
"msgbox_retry",
&make_args!(msgtype, title, text, link, retry),
);
}
fn cancel_msgbox(&self, tag: &str) {
self.call("cancel_msgbox", &make_args!(tag));
}
fn new_message(&self, msg: String) {