# HG changeset patch # User Dan # Date 1206963630 14400 # Node ID 7a1573676cc4e4076f3a8c6393c6badf77be28ee # Parent b5db2345c3970b1a45833aa6b9727131a2c907ad Added jump-to-current function in iphone theme; fixed md5('') call if unique IDs empty in playlist XML file diff -r b5db2345c397 -r 7a1573676cc4 functions.php --- 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); } diff -r b5db2345c397 -r 7a1573676cc4 scripts/ajax.js --- 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; diff -r b5db2345c397 -r 7a1573676cc4 themes/funkymonkey/playlist.tpl --- 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 @@
TrackNo | Track | diff -r b5db2345c397 -r 7a1573676cc4 themes/iphone/images/jump.png Binary file themes/iphone/images/jump.png has changed diff -r b5db2345c397 -r 7a1573676cc4 themes/iphone/playlist.tpl --- 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 @@
---|