Added jump-to-current function in iphone theme; fixed md5('') call if unique IDs empty in playlist XML file
authorDan
Mon, 31 Mar 2008 07:40:30 -0400
changeset 14 7a1573676cc4
parent 13 b5db2345c397
child 15 2adca0f363fd
Added jump-to-current function in iphone theme; fixed md5('') call if unique IDs empty in playlist XML file
functions.php
scripts/ajax.js
themes/funkymonkey/playlist.tpl
themes/iphone/images/jump.png
themes/iphone/playlist.tpl
--- a/functions.php	Wed Mar 26 11:10:20 2008 -0400
+++ b/functions.php	Mon Mar 31 07:40:30 2008 -0400
@@ -103,6 +103,7 @@
   {
     return true;
   }
+  status('Rebuilding playlist cache');
   $playlist_last_md5 = $effective_md5;
   // start XML parser
   try
@@ -148,6 +149,12 @@
     return false;
   $count = preg_match_all('/uniqueid="([a-fA-F0-9]+?)"/', $contents, $matches);
   $matches = implode("", $matches[1]);
+  if ( empty($matches) )
+  {
+    // sometimes current.xml has blank unique IDs
+    $count = preg_match_all('/url="([^"]+?)"/', $contents, $matches);
+    $matches = implode("", $matches[1]);
+  }
   return md5($matches);
 }
 
--- a/scripts/ajax.js	Wed Mar 26 11:10:20 2008 -0400
+++ b/scripts/ajax.js	Mon Mar 31 07:40:30 2008 -0400
@@ -189,8 +189,7 @@
         if ( first_load )
         {
           first_load = false;
-          var top = $('track_' + current_track).Top() - 138;
-          window.scroll(0, top);
+          jump_current_track();
         }
       }
     });
@@ -323,6 +322,17 @@
 
 addOnloadHook(refresh_playlist);
 
+// scroll to the current track
+function jump_current_track()
+{
+  var top = $('track_' + current_track).Top() - 138;
+  window.scroll(0, top);
+  if ( typeof(fix_scroll) == 'function' )
+  {
+    fix_scroll();
+  }
+}
+
 // pulse the current track
 var pulsar_current = 0, pulsar_tdlist = [], pulsar_direction = 1;
 
--- a/themes/funkymonkey/playlist.tpl	Wed Mar 26 11:10:20 2008 -0400
+++ b/themes/funkymonkey/playlist.tpl	Mon Mar 31 07:40:30 2008 -0400
@@ -59,7 +59,7 @@
       </div>
     </div>
     <div class="tblholder" id="playlist">
-      <table border="0" cellspacing="1" cellpadding="4">
+      <table border="0" cellspacing="1" cellpadding="4" style="width: 100%;">
         <tr>
           <th>TrackNo</th>
           <th>Track</th>
Binary file themes/iphone/images/jump.png has changed
--- a/themes/iphone/playlist.tpl	Wed Mar 26 11:10:20 2008 -0400
+++ b/themes/iphone/playlist.tpl	Mon Mar 31 07:40:30 2008 -0400
@@ -33,7 +33,7 @@
       <div class="playbar-inner">
         <img alt=" " id="ajax_status" style="display: none; position: absolute; top: 5px; right: 5px;" src="about:blank" />
         {if $allow_control}
-        <a href="#action:_nil" onclick="                       return false;"><img alt=" " src="/themes/{$theme|escape}/images/blank.png" /></a>
+        <a href="#action:jump" onclick="jump_current_track();  return false;"><img alt=" " src="/themes/{$theme|escape}/images/jump.png" style="position: relative; top: -8px; border-right: 1px solid #a0a0a0" /></a>
         <a href="#action:prev" onclick="player_action('prev'); return false;"><img alt="&laquo; PrevTrk" src="/themes/{$theme|escape}/images/prev.png" style="position: relative; top: -8px;" /></a>
         <a href="#action:play" onclick="player_action('play'); return false;" id="btn_playpause"><img alt="Play" src="/themes/{$theme|escape}/images/play.png" /></a>
         <a href="#action:next" onclick="player_action('next'); return false;"><img alt="NextTrk &raquo;" src="/themes/{$theme|escape}/images/next.png" style="position: relative; top: -8px;" /></a>