overhauled message display
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.5.33</version>
|
<version>1.5.34</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -41,10 +41,11 @@ function addClass(data){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addMessage(txt){
|
function addMessage(txt){
|
||||||
messages.unshift(txt);
|
let mid = 'm'+Date.now();
|
||||||
if (messages.length>5) messages.pop();
|
$('#messages').append($('<div/>').attr('id',mid).html(txt));
|
||||||
updateMessages();
|
setTimeout(function(){
|
||||||
setTimeout(fadeMessage,60000);
|
$('#'+mid).remove();
|
||||||
|
},10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTile(x,y){
|
function addTile(x,y){
|
||||||
@@ -189,24 +190,6 @@ function enableMove(ev){
|
|||||||
return false; // otherwise body.click would also be triggered
|
return false; // otherwise body.click would also be triggered
|
||||||
}
|
}
|
||||||
|
|
||||||
function fadeMessage(){
|
|
||||||
if (messages.length > 1) {
|
|
||||||
messages.pop();
|
|
||||||
updateMessages();
|
|
||||||
} else {
|
|
||||||
messageOpacity -= 5;
|
|
||||||
if (messageOpacity < 1) {
|
|
||||||
messages.pop();
|
|
||||||
updateMessages();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
messageTimer = setTimeout(fadeMessage,100);
|
|
||||||
var o = messageOpacity;
|
|
||||||
if (o>OPAC) o=OPAC;
|
|
||||||
$('#messages').css('opacity',o/OPAC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(key) {
|
function getCookie(key) {
|
||||||
var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
|
var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
|
||||||
return keyValue ? keyValue[2] : null;
|
return keyValue ? keyValue[2] : null;
|
||||||
@@ -330,7 +313,6 @@ function runAction(ev){
|
|||||||
function stream(ev){
|
function stream(ev){
|
||||||
var data = ev.data;
|
var data = ev.data;
|
||||||
data = data.replace(/%newline%/g,"\n");
|
data = data.replace(/%newline%/g,"\n");
|
||||||
console.log("received: ",data);
|
|
||||||
if (data.startsWith('<svg')) return place(data);
|
if (data.startsWith('<svg')) return place(data);
|
||||||
if (data.startsWith("heartbeat")) return heartbeat(data);
|
if (data.startsWith("heartbeat")) return heartbeat(data);
|
||||||
if (data.startsWith("place ")) return place(data.substring(6));
|
if (data.startsWith("place ")) return place(data.substring(6));
|
||||||
|
|||||||
Reference in New Issue
Block a user