summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-14 20:45:47 +0000
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-14 20:45:47 +0000
commit3cf762e06f46d1f69e06030b95ffaed3b951b46d (patch)
treec098d96af743ecb620dbdedf6c6cd5eb97511ee8 /javascript
parentfd959f0313ff97305681e09693b7207d20ced2a6 (diff)
downloadvdr-plugin-live-3cf762e06f46d1f69e06030b95ffaed3b951b46d.tar.gz
vdr-plugin-live-3cf762e06f46d1f69e06030b95ffaed3b951b46d.tar.bz2
- Infobox status update state is remembered in session. Fixes #313
Diffstat (limited to 'javascript')
-rw-r--r--javascript/vdr_status.js30
1 files changed, 17 insertions, 13 deletions
diff --git a/javascript/vdr_status.js b/javascript/vdr_status.js
index 73a20dd..2fabed6 100644
--- a/javascript/vdr_status.js
+++ b/javascript/vdr_status.js
@@ -40,6 +40,19 @@ function LiveStatusShowInfo(xmldoc, containerId)
LiveStatusSetTextContent(containerId, node.nodeName, textContent);
}
}
+
+ /* check if we still need to update the status */
+ var update = xmldoc.getElementsByTagName('update').item(0);
+ var reload = (update.firstChild.nodeValue == "1");
+
+ if (reload != vst_reload) {
+ vst_reload = reload;
+ var img = document.getElementById('statusReloadBtn');
+ if (img != null) {
+ // change image according to state.
+ img.src = vst_reload ? 'stop_update.png' : 'reload.png';
+ }
+ }
}
function LiveStatusReportError(message, containerId)
@@ -105,22 +118,13 @@ function LiveStatusSetTextContent(containerId, nodeName, textContent)
function LiveStatusToggleUpdate()
{
if (vst_reload) {
- vst_reload = false;
if (vst_timer != null)
window.clearTimeout(vst_timer);
}
- else {
- vst_reload = true;
- LiveStatusRequest(vst_url, vst_boxId);
- }
- var img = document.getElementById('statusReloadBtn');
- if (img != null) {
- // change image according to state.
- img.src = vst_reload ? 'stop_update.png' : 'reload.png';
- }
+ LiveStatusRequest(vst_url, vst_boxId, !vst_reload);
}
-function LiveStatusRequest(url, containerid)
+function LiveStatusRequest(url, containerid, update)
{
if (vst_url == null)
{
@@ -140,7 +144,7 @@ function LiveStatusRequest(url, containerid)
LiveStatusReportError(updateMsg, containerid);
}
if (vst_reload)
- vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "')", 1000);
+ vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "', true)", 1000);
}
status.onerror = function(message)
{
@@ -148,5 +152,5 @@ function LiveStatusRequest(url, containerid)
LiveStatusToggleUpdate();
LiveStatusReportError(requestMsg, containerid);
}
- status.request("update", vst_reload ? "1" : "0");
+ status.request("update", update ? "1" : "0");
}