summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorsigger <sigger@ampache>2006-01-08 18:15:09 +0000
committersigger <sigger@ampache>2006-01-08 18:15:09 +0000
commit373255aadcf56ca795c6fca0f41504ec4f468681 (patch)
tree292427d05d63d086c2790c09e3162df40008e85f /lib
parent58d139eb26220d1faf7025f303fee735e883f344 (diff)
downloadampache-373255aadcf56ca795c6fca0f41504ec4f468681.tar.gz
ampache-373255aadcf56ca795c6fca0f41504ec4f468681.tar.bz2
ampache-373255aadcf56ca795c6fca0f41504ec4f468681.zip
(mostly) fixes ajax and nowplaying JS
Diffstat (limited to 'lib')
-rw-r--r--lib/general.js35
-rw-r--r--lib/general.lib.php1
2 files changed, 19 insertions, 17 deletions
diff --git a/lib/general.js b/lib/general.js
index bfa97821..879da45a 100644
--- a/lib/general.js
+++ b/lib/general.js
@@ -2,6 +2,7 @@
var xmlHttp;
var requestType="";
+
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
@@ -48,32 +49,32 @@ function handleStateChange() {
case 'state' :
var new_state = el.firstChild.data;
-/* alert ('state = '+new_state+'; mpd_state = '+mpd_state); */
- if (mpd_state != new_state) {
- document.getElementById (mpd_state+'_button').className = "";
+/* alert ('state = '+new_state+'; player_state = '+player_state); */
+ if ((player == 'mpd') && (player_state != new_state)) {
+ document.getElementById (player_state+'_button').className = "";
document.getElementById (new_state+'_button').className = "selected_button";
- mpd_state = new_state;
- if (mpd_state == "stop" || mpd_state == "pause") {
- mpd_notstoppause = 0;
- document.getElementById ('mpd_np').className = "nodisplay";
+ player_state = new_state;
+ if (player_state == "stop" || player_state == "pause") {
+ if (player == 'mpd') document.getElementById ('mpd_np').className = "nodisplay";
/* turn off the now playing stuff */
} else
{
- mpd_notstoppause = 1;
- document.getElementById ('mpd_np').className = "";
+ if (player == 'mpd') document.getElementById ('mpd_np').className = "";
/* turn on the now playing stuff */
} // end if else
} // end if
break;
case 'now_playing' :
- mpd_song_length = el.getElementsByTagName ('songlength')[0].firstChild.data;
- mpd_songid = Math.round(el.getElementsByTagName ('songid')[0].firstChild.data);
- document.getElementById ('mpd_npinfo').firstChild.data =
- 1+mpd_songid + ". " +
- el.getElementsByTagName ('songartist')[0].firstChild.data + " - " +
- el.getElementsByTagName ('songtitle')[0].firstChild.data + " - " +
- el.getElementsByTagName ('songalbum')[0].firstChild.data + " - " +
- fmt_time(mpd_song_length);
+ if (player == 'mpd') {
+ mpd_song_length = el.getElementsByTagName ('songlength')[0].firstChild.data;
+ mpd_songid = Math.round(el.getElementsByTagName ('songid')[0].firstChild.data);
+ document.getElementById ('mpd_npinfo').firstChild.data =
+ 1+mpd_songid + ". " +
+ el.getElementsByTagName ('songartist')[0].firstChild.data + " - " +
+ el.getElementsByTagName ('songtitle')[0].firstChild.data + " - " +
+ el.getElementsByTagName ('songalbum')[0].firstChild.data + " - " +
+ fmt_time(mpd_song_length);
+ }
break;
default :
alert ('Unknown XML reply :"'+el.tagName+'"');
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 983b4c12..0a308b64 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -81,6 +81,7 @@ function int2ip($i) {
@param $template Name of Template
*/
function show_template($template) {
+global $myMpd, $user;
/* Check for a 'Theme' template */
if (is_readable(conf('prefix') . conf('theme_path') . "/templates/$template".".inc")) {