summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-22 21:38:45 +0000
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-22 21:38:45 +0000
commitd9e1b706df7ebcb0fa7e7e716291f9c88aad6a24 (patch)
treecc8464e145ca39021d2dbc81bb8d5969b47ed947 /javascript
parent14141f08e8ae6fddb8215de51ce56972dfbb6ff4 (diff)
downloadvdr-plugin-live-d9e1b706df7ebcb0fa7e7e716291f9c88aad6a24.tar.gz
vdr-plugin-live-d9e1b706df7ebcb0fa7e7e716291f9c88aad6a24.tar.bz2
- Introducing Mootools as base javascript library.
- ported Infobox javascript code to this library. - LiveSimpleAjaxRequest uses Ajax-Object from mootools. - Start of distribution of javascript in source form (not compiled into the live binary).
Diffstat (limited to 'javascript')
-rw-r--r--javascript/Makefile2
-rw-r--r--javascript/vdr_status.js156
2 files changed, 1 insertions, 157 deletions
diff --git a/javascript/Makefile b/javascript/Makefile
index 36582e6..648361c 100644
--- a/javascript/Makefile
+++ b/javascript/Makefile
@@ -16,7 +16,7 @@ VDRDIR ?= ../../../..
### The object files (add further files here):
OBJS = alphaAPI.o domLib.o domTT_drag.o domTT.o fadomatic.o \
- treeview.o ajax.o vdr_status.o
+ treeview.o
### Default rules:
diff --git a/javascript/vdr_status.js b/javascript/vdr_status.js
deleted file mode 100644
index 2fabed6..0000000
--- a/javascript/vdr_status.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Javascript functions for the status update box.
- * This file needs 'ajax.js' to be included on the pages.
- */
-
-var vst_reload = true;
-var vst_timer;
-var vst_boxId = null;
-var vst_url = null;
-
-function LiveStatusShowInfo(xmldoc, containerId)
-{
- var infoType = xmldoc.getElementsByTagName('type').item(0);
-
- var channel = document.getElementById(containerId + '_channel_buttons');
- var playback = document.getElementById(containerId + '_recording_buttons');
-
- if (infoType.firstChild.nodeValue != "channel") {
- channel.style.display = 'none';
- playback.style.display = 'block';
- LiveStatusSetTextContent(containerId, 'pause', infoType.firstChild.nodeValue);
- LiveStatusSetTextContent(containerId, 'play', infoType.firstChild.nodeValue);
- LiveStatusSetTextContent(containerId, 'rwd', infoType.firstChild.nodeValue);
- LiveStatusSetTextContent(containerId, 'ffw', infoType.firstChild.nodeValue);
- LiveStatusSetTextContent(containerId, 'stop', infoType.firstChild.nodeValue);
- }
- else {
- playback.style.display = 'none';
- channel.style.display = 'block';
- }
-
- 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);
- }
- }
-
- /* 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)
-{
- 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";
- }
- break;
- }
- case "pause":
- case "play":
- case "rwd":
- case "ffw":
- case "stop":
- {
- if (textContent != "") {
- docNode.href = "javascript:LiveSimpleAjaxRequest('" + nodeName + "_recording.xml', 'param', '" + textContent + "');";
- docNode.style.visibility = "visible";
- }
- else {
- docNode.style.visibility = "hidden";
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-function LiveStatusToggleUpdate()
-{
- if (vst_reload) {
- if (vst_timer != null)
- window.clearTimeout(vst_timer);
- }
- LiveStatusRequest(vst_url, vst_boxId, !vst_reload);
-}
-
-function LiveStatusRequest(url, containerid, update)
-{
- if (vst_url == null)
- {
- vst_url = url;
- }
- if (vst_boxId == null)
- vst_boxId = containerid;
-
- var status = new LiveAjaxCall("xml", url);
- status.oncomplete = function()
- {
- try {
- LiveStatusShowInfo(this.xml.responseXML, containerid);
- }
- catch (e) {
- var updateMsg = document.getElementById("__infobox_update_err").firstChild.nodeValue;
- LiveStatusReportError(updateMsg, containerid);
- }
- if (vst_reload)
- vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "', true)", 1000);
- }
- status.onerror = function(message)
- {
- var requestMsg = document.getElementById("__infobox_request_err").firstChild.nodeValue;
- LiveStatusToggleUpdate();
- LiveStatusReportError(requestMsg, containerid);
- }
- status.request("update", update ? "1" : "0");
-}