scripts/ajax.js
changeset 5 9b96265b5918
parent 3 e7447a6044ec
child 6 5f35ebc4f9bb
--- a/scripts/ajax.js	Sun Mar 23 22:03:57 2008 -0400
+++ b/scripts/ajax.js	Sun Mar 23 22:44:52 2008 -0400
@@ -2,13 +2,17 @@
  * AJAX functions
  * 
  * Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
  *
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  */
 
 var ajax;
-var is_playing = false, current_track = -1, current_track_length, current_track_pos, ct_advance_timeout = false, ct_counter = false, playlist_md5 = false;
+var is_playing = false, current_track = -1, current_track_length, current_track_pos, ct_advance_timeout = false, ct_counter = false, playlist_md5 = false, first_load = true;
 
 function ajaxGet(uri, f)
 {
@@ -148,6 +152,12 @@
           ct_advance_timeout = setTimeout(refresh_playlist, ( 1000 * time_remaining ));
           ct_counter = setInterval(update_clock, 1000);
         }
+        if ( first_load )
+        {
+          first_load = false;
+          var top = $('track_' + current_track).Top() - 138;
+          window.scroll(0, top);
+        }
       }
     });
 }