From 8739fd4094af602ec21a83567158ff442b36b47e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 17 Jan 2018 14:16:52 +0100 Subject: [PATCH] Production bugs --- debian/changelog | 2 +- package.json | 2 +- pages/production/main.js | 36 +++++++++++++++--------------------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/debian/changelog b/debian/changelog index d3894bc8..0b4ff8ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.405.68) stable; urgency=low +hedera-web (1.405.69) stable; urgency=low * Initial Release. diff --git a/package.json b/package.json index 1e0bd2b3..85d529a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "1.405.68", + "version": "1.405.69", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { diff --git a/pages/production/main.js b/pages/production/main.js index c872923e..d9a26d57 100644 --- a/pages/production/main.js +++ b/pages/production/main.js @@ -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)