summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-04-29 18:02:47 +0000
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-04-29 18:02:47 +0000
commit162677a55f93defc8fc124b89b137a444ab78edb (patch)
tree45c93e9f54581c473295187d462c1073da48f3f2 /javascript
parentc23da7907f180eed81032e1f63e1421f2b39cb61 (diff)
downloadvdr-plugin-live-162677a55f93defc8fc124b89b137a444ab78edb.tar.gz
vdr-plugin-live-162677a55f93defc8fc124b89b137a444ab78edb.tar.bz2
- xml version of infobox, updates only pagelements inside the box not
whole box. This circumvents the tooltip stacking problem. - updated styles for this change. - updated i18n.cpp for this change. - Changed javascript implementation for infobox. - Box doesn't change size after first update. - added some <%cpp> { </%cpp> tags to prevent newlines inserted by tntnet. See tntnet documentation about this. - Added infobox to all pages that didn't had one.
Diffstat (limited to 'javascript')
-rw-r--r--javascript/vdr_status.js89
1 files changed, 73 insertions, 16 deletions
diff --git a/javascript/vdr_status.js b/javascript/vdr_status.js
index 2a2a0d1..829b19c 100644
--- a/javascript/vdr_status.js
+++ b/javascript/vdr_status.js
@@ -8,35 +8,92 @@ var vst_timer;
var vst_boxId = null;
var vst_url = null;
-function LiveStatusAjaxRequest(url, containerid)
+function LiveStatusRequest(url, containerid)
{
if (vst_url == null)
+ {
vst_url = url;
+ }
if (vst_boxId == null)
vst_boxId = containerid;
- var status = new LiveAjaxCall("text", url);
+ var status = new LiveAjaxCall("xml", url);
status.oncomplete = function()
{
- document.getElementById(containerid).innerHTML = this.xml.responseText;
+ try {
+ LiveStatusShowInfo(this.xml.responseXML, containerid);
+ }
+ catch (e) {
+ LiveStatusReportError(e.message, containerid);
+ }
if (vst_reload)
- vst_timer = window.setTimeout("LiveStatusAjaxRequest('" + url + "', '" + containerid + "')", 1000);
+ vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "')", 1000);
}
status.onerror = function(message)
{
vst_reload = false;
- document.getElementById(containerid).innerHTML =
- '<div class="statuscontent>' +
- '<div class="st_header">' +
- '<div class="caption">ERROR</div>' +
- '<div class="now">&nbsp;<img id="statusReloadBtn" src="reload.png" alt="toggle reload on and off" onclick="LiveStatusToggleUpdate()" />&nbsp;ERROR</div>' +
- '</div>' +
- '<div class="st_content">' +
- '<div class="name">' + message + '</div>' +
- '</div>' +
- '</div>';
+ LiveStatusReportError(message, containerid);
+ }
+ status.request("update", vst_reload ? "1" : "0");
+}
+
+function LiveStatusShowInfo(xmldoc, containerId)
+{
+ var epgInfo = xmldoc.getElementsByTagName('epginfo').item(0);
+
+ for (var i = 0; i < epgInfo.childNodes.length; i++) {
+ var node = epgInfo.childNodes.item(i);
+ if (node.nodeType == 1) {
+ var textContent = "";
+ if (node.firstChild != null)
+ textContent = node.firstChild.nodeValue;
+ LiveStatusSetTextContent(containerId, node.nodeName, textContent);
}
- status.request("", "");
+ }
+}
+
+function LiveStatusReportError(message, containerId)
+{
+ LiveStatusSetTextContent(containerId, 'caption', 'ERROR');
+ LiveStatusSetTextContent(containerId, 'name', message);
+}
+
+function LiveStatusSetTextContent(containerId, nodeName, textContent)
+{
+ var docNode = document.getElementById(containerId + '_' + nodeName);
+ if (docNode != null) {
+ switch (nodeName) {
+ case "caption":
+ case "timenow":
+ case "name":
+ case "duration":
+ {
+ if (docNode.innerHTML != textContent)
+ docNode.innerHTML = textContent;
+ break;
+ }
+ case "elapsed":
+ {
+ var width = textContent + "px";
+ if (docNode.style.width != width)
+ docNode.style.width = width;
+ break;
+ }
+ case "nextchan":
+ case "prevchan":
+ {
+ if (textContent != "") {
+ docNode.href = "javascript:LiveSimpleAjaxRequest('switch_channel.xml', 'param', '" + textContent + "');";
+ docNode.style.visibility = "visible";
+ }
+ else {
+ docNode.style.visibility = "hidden";
+ }
+ }
+ default:
+ break;
+ }
+ }
}
function LiveStatusToggleUpdate()
@@ -48,7 +105,7 @@ function LiveStatusToggleUpdate()
}
else {
vst_reload = true;
- LiveStatusAjaxRequest(vst_url, vst_boxId);
+ LiveStatusRequest(vst_url, vst_boxId);
}
var img = document.getElementById('statusReloadBtn');
if (img != null) {