0
1
Fork 0

Production bugs

This commit is contained in:
Juan Ferrer Toribio 2018-01-17 14:16:52 +01:00
parent 7d484fcb7e
commit 8739fd4094
3 changed files with 17 additions and 23 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.405.68) stable; urgency=low
hedera-web (1.405.69) stable; urgency=low
* Initial Release.

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.405.68",
"version": "1.405.69",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -8,20 +8,18 @@ var requestInterval = INTERVAL;
var failedRequests = 0;
var timeoutId = null;
var request = null;
var lastText;
var lastStatus;
var lastError;
var myText;
var myStatus;
var myError;
function onBodyLoad ()
{
setText ();
setTimeout (setText, 1000);
}
function setText ()
{
lastText = null;
lastStatus = null;
lastError = null;
display (null, null, null);
updateText ();
}
@ -102,7 +100,7 @@ function onRequestChange (request)
}
catch (e)
{
display (null, null, e.message);
display (myText, myStatus, e.message);
console.error (e.message);
failedRequests++;
@ -119,20 +117,15 @@ function onRequestChange (request)
function display (text, status, error)
{
if (error)
{
text = lastText;
status = lastStatus;
}
if (text === lastText && status === lastStatus && error === lastError)
if (text === myText && status === myStatus && error === myError)
return;
var bgColor;
$('text').textContent = text;
var body = document.body;
if (error)
{
text = text ? text : 'Er';
$('error').textContent = error;
$('error').style.display = 'block';
bgColor = 'red';
@ -144,13 +137,15 @@ function display (text, status, error)
bgColor = 'green';
}
var body = document.body;
$('text').textContent = text;
body.className = status ? status : '';
body.addEventListener ('transitionend', onTransitionEnd);
body.style.backgroundColor = bgColor;
lastText = text;
lastStatus = status;
lastError = error;
myText = text;
myStatus = status;
myError = error;
}
function onTransitionEnd ()
@ -158,7 +153,6 @@ function onTransitionEnd ()
var body = document.body;
body.removeEventListener ('transitionend', onTransitionEnd);
body.style.backgroundColor = '';
body.className = lastStatus ? lastStatus : '';
}
function $ (elementId)