]> git.sesse.net Git - vlc/commitdiff
http-interface: - fixed large playlist loading failure
authorMark Hassman <mark@hassman.org>
Wed, 28 Jul 2010 16:02:23 +0000 (12:02 -0400)
committerIlkka Ollakka <ileoo@videolan.org>
Wed, 28 Jul 2010 18:00:09 +0000 (21:00 +0300)
large playlists can take >10 seconds to load. since the xmlhttp object is
common within the page, multiple /status.xml requests would occurr (1 per sec)
before the playlist was loaded cancelling the /playlist.xml request.. i moved
the xmlhttp request object to a global variable. it's now checked to see if
there are any outstanding/active requests before submitting a new request. -
improved playlist display of large playlists.

Signed-off-by: Ilkka Ollakka <ileoo@videolan.org>
share/http/js/functions.js

index fcd6c7a1677b9b7879ef6964be5802b9277c4dbe..f259542987f850146ec394491a490da4129794fe 100644 (file)
@@ -28,6 +28,7 @@
 var old_time = 0;
 var pl_cur_id;
 var albumart_id = -1;
+var req = null;
 
 /**********************************************************************
  * Slider functions
@@ -389,7 +390,10 @@ function hotkey( str )
 }
 function update_status()
 {
-    loadXMLDoc( 'requests/status.xml', parse_status );
+    if( req == null || req.readyState == 0 || req.readyState == 4 )
+    {
+        loadXMLDoc( 'requests/status.xml', parse_status );
+    }
 }
 function update_playlist()
 {
@@ -540,6 +544,8 @@ function parse_playlist()
             var answer = req.responseXML.documentElement;
             var playtree = document.getElementById( 'playtree' );
             var pos = document.createElement( "div" );
+            pos.style.height = document.body.clientHeight - 100 + "px";
+            pos.style.overflow = "auto";
             var pos_top = pos;
             var elt = answer.firstChild;