diff --git a/src/ui/cm.tis b/src/ui/cm.js
similarity index 100%
rename from src/ui/cm.tis
rename to src/ui/cm.js
diff --git a/src/ui/msgbox.js b/src/ui/msgbox.js
index eb0ef8a62..da8019403 100644
--- a/src/ui/msgbox.js
+++ b/src/ui/msgbox.js
@@ -1,5 +1,7 @@
+import {$,$$} from "@sciter"; //TEST $$ import
+const view = Window.this;
var type, title, text, getParams, remember, retry, callback, contentStyle;
-var my_translate;
+var my_translate; // TEST
function updateParams(params) {
type = params.type;
@@ -11,18 +13,17 @@ function updateParams(params) {
my_translate = params.translate;
retry = params.retry;
contentStyle = params.contentStyle;
+ console.log("params",type,title,text,getParams,remember,callback,my_translate,retry,contentStyle)
try { text = translate_text(text); } catch (e) {}
if (retry > 0) {
- self.timer(retry * 1000, function() {
- view.close({ reconnect: true });
- });
+ setTimeout(()=>view.close({ reconnect: true }),retry * 1000);// TEST
}
}
function translate_text(text) {
if (text.indexOf('Failed') == 0 && text.indexOf(': ') > 0) {
- var fds = text.split(': ');
- for (var i = 0; i < fds.length; ++i) {
+ let fds = text.split(': ');
+ for (let i = 0; i < fds.length; ++i) {
fds[i] = my_translate(fds[i]);
}
text = fds.join(': ');
@@ -30,17 +31,17 @@ function translate_text(text) {
return text;
}
-var params = view.parameters;
+var params = view.parameters; // TEST
updateParams(params);
var body;
-class Body: Reactor.Component {
- function this() {
+class Body extends Element {
+ this() {
body = this;
}
- function getIcon(color) {
+ getIcon(color) {
if (type == "input-password") {
return ;
}
@@ -56,23 +57,25 @@ class Body: Reactor.Component {
return ;
}
- function getInputPasswordContent() {
+ getInputPasswordContent() {
var ts = remember ? { checked: true } : {};
- return
+ // TODO
+ return ;
}
- function getContent() {
+ getContent() {
if (type == "input-password") {
return this.getInputPasswordContent();
}
return text;
}
- function getColor() {
+ getColor() {
if (type == "input-password") {
return "#AD448E";
}
@@ -85,26 +88,25 @@ class Body: Reactor.Component {
return "#2C8CFF";
}
- function hasSkip() {
+ hasSkip() {
return type.indexOf("skip") >= 0;
}
- function render() {
- var color = this.getColor();
- var icon = this.getIcon(color);
- var content = this.getContent();
- var hasCancel = type.indexOf("error") < 0 && type != "success" && type.indexOf("nocancel") < 0;
- var hasOk = type != "connecting" && type.indexOf("nook") < 0;
- var hasClose = type.indexOf("hasclose") >= 0;
- var show_progress = type == "connecting";
- self.style.set { border: color + " solid 1px" };
- var me = this;
- self.timer(1ms, function() {
+ render() {
+ let color = this.getColor();
+ let icon = this.getIcon(color);
+ let content = this.getContent();
+ let hasCancel = type.indexOf("error") < 0 && type != "success" && type.indexOf("nocancel") < 0;
+ let hasOk = type != "connecting" && type.indexOf("nook") < 0;
+ let hasClose = type.indexOf("hasclose") >= 0;
+ let show_progress = type == "connecting";
+ this.style.setProperty("border",(color + " solid 1px"));
+ setTimeout(()=>{
if (typeof content == "string")
- me.$(#content).html = my_translate(content);
+ this.$("#content").html = my_translate(content);
else
- me.$(#content).content(content);
- });
+ this.$("#content").content(content);
+ },1);
return (
@@ -113,72 +115,110 @@ class Body: Reactor.Component {
-
-
- {hasCancel || hasRetry ?
{my_translate(hasRetry ? "OK" : "Cancel")} : ""}
- {this.hasSkip() ?
{my_translate('Skip')} : ""}
- {hasOk || hasRetry ?
{my_translate(hasRetry ? "Retry" : "OK")} : ""}
- {hasClose ?
{my_translate('Close')} : ""}
+
+
+ {hasCancel || retry ?
{my_translate(retry ? "OK" : "Cancel")} : ""}
+ {this.hasSkip() ?
{my_translate('Skip')} : ""}
+ {hasOk || retry ?
{my_translate(retry ? "Retry" : "OK")} : ""}
+ {hasClose ?
{my_translate('Close')} : ""}
);
}
- event click $(.custom-event) (_, me) {
+ // TEST
+ ["on click at .custom-event"](_, me) {
if (callback) callback(me);
}
-}
-$(body).content(