You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.8 KiB
HTML
111 lines
2.8 KiB
HTML
|
|
<html window-icon="themepicsingle:rnq">
|
|
<head>
|
|
<include src="common.htm" />
|
|
<style>
|
|
@import url(alert.css);
|
|
</style>
|
|
<script type="text/tiscript">
|
|
const MainNative = View.MainNative;
|
|
|
|
var messages = $(#messages),
|
|
okBtn = $(#ok),
|
|
countdown = $(#countdown),
|
|
timeLeft = 0;
|
|
|
|
view.windowMinSize = (200, 100);
|
|
|
|
function countToClose() {
|
|
timeLeft--;
|
|
if (timeLeft == 0) {
|
|
view.close();
|
|
return false;
|
|
} else {
|
|
countdown.text = "(" + timeLeft + ")";
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function addMessage(msgobj) {
|
|
var caption, icon;
|
|
switch (msgobj.type) {
|
|
case #info:
|
|
case 2:
|
|
caption = "Information";
|
|
icon = "asterisk";
|
|
timeLeft = 30;
|
|
break;
|
|
case #warning:
|
|
case 0:
|
|
caption = "Warning";
|
|
icon = "exclamation";
|
|
timeLeft = 60;
|
|
break;
|
|
case #error:
|
|
case 1:
|
|
caption = "Error";
|
|
icon = "hand";
|
|
timeLeft = 99;
|
|
break;
|
|
case #confirm:
|
|
case 3:
|
|
caption = "Confirm";
|
|
icon = "question";
|
|
timeLeft = 60;
|
|
break;
|
|
case #buzz:
|
|
case 4:
|
|
caption = "Buzz";
|
|
icon = "asterisk";
|
|
timeLeft = 15;
|
|
break;
|
|
case #custom:
|
|
case 5:
|
|
caption = "";
|
|
icon = "";
|
|
break;
|
|
}
|
|
var user = CommonNative.GetCurrentUserName();
|
|
view.windowCaption = CommonNative.GetTranslation(caption) + (user != "" ? " (" + CommonNative.GetCurrentUserName() + ")" : "");
|
|
if (View.commonSettings.alertTopMost) view.windowTopmost = true;
|
|
//view.activate(#toFront);
|
|
var time = new Date();
|
|
msgobj.message = time.toString("%d.%m.%Y %H:%M:%S") + "\n" + msgobj.message;
|
|
var current = messages.$(option:current);
|
|
var index = current ? current.index : 0;
|
|
messages.$prepend(<option as="string" value={time.valueOf().toString()}><div auto pic={icon}></div><div class="msg">{msgobj.message}</div></option>);
|
|
if (index == 0) messages[0].execCommand("set-current");
|
|
if (messages.length == 1) {
|
|
messages[0].post(:{
|
|
this.state.expanded = true;
|
|
this.update();
|
|
});
|
|
} else {
|
|
messages[0].state.collapsed = true
|
|
messages[0].update();
|
|
}
|
|
self.timer(1s, countToClose);
|
|
countToClose();
|
|
}
|
|
|
|
function self.ready() {
|
|
translateWindow("span");
|
|
|
|
okBtn.on("click", :e {
|
|
view.close();
|
|
});
|
|
okBtn.state.focus = true;
|
|
|
|
self.subscribe(:e {
|
|
if (e.keyCode == Event.VK_ESCAPE || (e.ctrlKey && e.keyCode == Event.VK_W)) view.close();
|
|
else if (e.keyCode == Event.VK_RETURN && e.target.tag != "button") view.close();
|
|
else if (e.ctrlKey && e.keyCode == Event.VK_C) view.clipboard(#put, messages.$(option:current > div.msg).text);
|
|
}, Event.KEY, Event.KEY_DOWN);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<select type="list" id="messages"></select>
|
|
<button uwp wide id="ok"><div><span>OK</span><span id="countdown"></span></div></button>
|
|
</body>
|
|
</html> |