scripts/ajax.js
changeset 3 e7447a6044ec
parent 2 860ba7141641
child 5 9b96265b5918
--- a/scripts/ajax.js	Sun Mar 23 20:24:33 2008 -0400
+++ b/scripts/ajax.js	Sun Mar 23 20:58:51 2008 -0400
@@ -66,11 +66,13 @@
 function setAjaxLoading()
 {
   $('ajax_status').object.src = img_ajax;
+  $('ajax_status').object.style.display = 'block';
 }
 
 function unsetAjaxLoading()
 {
   $('ajax_status').object.src = 'about:blank';
+  $('ajax_status').object.style.display = 'none';
 }
 
 var refresh_playlist = function()
@@ -111,15 +113,18 @@
           }
         }
         // update playing status
-        var img = $('btn_playpause').object.getElementsByTagName('img')[0];
         is_playing = response.is_playing;
-        if ( is_playing )
+        if ( allow_control )
         {
-          img.src = img_pause;
-        }
-        else
-        {
-          img.src = img_play;
+          var img = $('btn_playpause').object.getElementsByTagName('img')[0];
+          if ( is_playing )
+          {
+            img.src = img_pause;
+          }
+          else
+          {
+            img.src = img_play;
+          }
         }
         // update volume
         if ( response.volume != current_volume )
@@ -166,6 +171,8 @@
   setAjaxLoading();
   if ( tid == current_track )
     return false;
+  if ( !allow_control )
+    return false;
   ajaxGet('/action.json/jump/' + tid, function()
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )