# HG changeset patch # User Dan # Date 1206324237 14400 # Node ID cde92f6ec29f3b15a2f6e31765c5cb86572cd373 # Parent e7447a6044ec0021cd68f68dbf9121e2f09f9f57 Should be completely iPhone/iPod Touch-friendly now :) diff -r e7447a6044ec -r cde92f6ec29f functions.php --- a/functions.php Sun Mar 23 20:58:51 2008 -0400 +++ b/functions.php Sun Mar 23 22:03:57 2008 -0400 @@ -132,3 +132,24 @@ return "$minutes:$seconds"; } +/** + * Loads the specified theme into Smarty + * @param string Theme ID + * @return object Smarty object + */ + +function load_theme($theme_id) +{ + global $httpd; + static $smarty = array(); + if ( !isset($smarty[$theme_id]) ) + { + $smarty[$theme_id] = new Smarty(); + $smarty[$theme_id]->template_dir = "./themes/$theme_id"; + $smarty[$theme_id]->compile_dir = "./themes/$theme_id/compiled"; + $smarty[$theme_id]->cache_dir = "./cache"; + $smarty[$theme_id]->config_dir = "./config"; + $httpd->add_handler("themes/$theme_id", 'dir', "./themes/$theme_id"); + } + return $smarty[$theme_id]; +} diff -r e7447a6044ec -r cde92f6ec29f playlist.php --- a/playlist.php Sun Mar 23 20:58:51 2008 -0400 +++ b/playlist.php Sun Mar 23 22:03:57 2008 -0400 @@ -11,10 +11,18 @@ function amarok_playlist($server) { - global $smarty, $theme, $playlist, $allowcontrol; + global $theme, $playlist, $allowcontrol; + + $iphone = ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || + strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') || + strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') || + isset($_GET['m']) + ); + $theme_id = ( $iphone ) ? 'iphone' : $theme; + $smarty = load_theme($theme_id); $active = dcop_action('playlist', 'getActiveIndex'); - $smarty->assign('theme', $theme); + $smarty->assign('theme', $theme_id); $smarty->assign('playlist', $playlist); $smarty->assign('active', $active); $smarty->assign('scripts', array( diff -r e7447a6044ec -r cde92f6ec29f themes/funkymonkey/style.css --- a/themes/funkymonkey/style.css Sun Mar 23 20:58:51 2008 -0400 +++ b/themes/funkymonkey/style.css Sun Mar 23 22:03:57 2008 -0400 @@ -87,6 +87,7 @@ margin-right: 1px; background-color: #33395d; border: 1px solid #909090; + text-decoration: none; } a.volume_button_active { diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/ajax.gif Binary file themes/iphone/images/ajax.gif has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/amarok.gif Binary file themes/iphone/images/amarok.gif has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/next.png Binary file themes/iphone/images/next.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/pause.png Binary file themes/iphone/images/pause.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/play.png Binary file themes/iphone/images/play.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/playbar-shadow.gif Binary file themes/iphone/images/playbar-shadow.gif has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/playbar.gif Binary file themes/iphone/images/playbar.gif has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/prev.png Binary file themes/iphone/images/prev.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/src/playbar-shadow.xcf Binary file themes/iphone/images/src/playbar-shadow.xcf has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/src/playbar.xcf Binary file themes/iphone/images/src/playbar.xcf has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/stop.png Binary file themes/iphone/images/stop.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/images/volume.png Binary file themes/iphone/images/volume.png has changed diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/playlist.tpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/themes/iphone/playlist.tpl Sun Mar 23 22:03:57 2008 -0400 @@ -0,0 +1,85 @@ +{** + * Template file for default Funky Monkey theme + * Web control interface script for Amarok + * Written by Dan Fuhry - 2008 + * + * This script is in the public domain. Use it for good, not evil. + *} + + + + + AmaroK playlist + + + + + + + {foreach from=$scripts item=script} + + {/foreach} + + + +
+
+ + {if $allow_control} + « PrevTrk + Play + NextTrk » +
+ {/if} + --:--/--:--
+ {if $allow_control} + Volume: +             + + {/if} +
+
+
+ + + + + {foreach key=tid item=track from=$playlist} + {strip} + + + + {/strip} + {/foreach} +
Track
+ + {$track.title|escape} + +
+
+ + + + + diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/scrollfix.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/themes/iphone/scrollfix.js Sun Mar 23 22:03:57 2008 -0400 @@ -0,0 +1,26 @@ +function getScrollOffset() +{ + var position; + if (self.pageYOffset) + { + position = self.pageYOffset; + } + else if (document.documentElement && document.documentElement.scrollTop) + { + position = document.documentElement.scrollTop; + } + else if (document.body) + { + position = document.body.scrollTop; + } + return position; +} + +var fix_scroll = function() +{ + var div = document.getElementById('playbar'); + div.style.top = ( String(getScrollOffset()) ) + 'px'; +} + +window.onscroll = fix_scroll; + diff -r e7447a6044ec -r cde92f6ec29f themes/iphone/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/themes/iphone/style.css Sun Mar 23 22:03:57 2008 -0400 @@ -0,0 +1,104 @@ +/** + * Based upon the AmaroK WebControl interface by: + * Jonas Christian Drewsen ( kde at xspect dot dk ) + * André Kelpe ( fs111 at web dot de ) + * Peter C. Ndikuwera ( pndiku at gmail dot com ) + */ + +body { + font-family: sans-serif; + background-color: #9cb2cd; + color: #ffffff; + margin: 0; + padding: 0; + width: 320px; +} + +div.tblholder { + padding: 1px; + background-color: #ffffff; + border: 1px solid #000000; +} + +div.tblholder table { + background-color: #596082; +} + +tr th { + background-color: #697092; +} + +tr.row1 td { + background-color: #394062; +} + +tr.row2 td { + background-color: #202050; +} + +tr.current td { + background-color: #495072; + color: #ffff00; +} + +div#playbar { + width: 320px; + padding: 0; + margin: 0 0 10px 0; + background-image: url(images/playbar.gif); + background-repeat: repeat-x; + background-color: #383f61; + border-bottom: 1px solid #000000; + text-align: center; + position: absolute; + top: 0px; + left: 0px; +} + +div.playbar-inner { + padding: 5px; + line-height: 22px; +} + +a img { + border-width: 0; +} + +div#playlist { + margin: 138px 8px 0 8px; +} + +a.tracklink { + text-decoration: none; + color: white; +} + +div#playlist tr.current a.tracklink { + color: #ffff00; +} + +span#playmeter, span#volume_wrap { + position: relative; + top: -7px; +} + +a.volume_button { + padding-right: 18px; + margin-right: 1px; + background-color: #33395d; + border: 1px solid #909090; + text-decoration: none; +} + +a.volume_button_active { + background-color: #9090c2; + border-color: #d0d0d0; +} + +div#footer { + background-image: url(images/playbar.gif); + background-repeat: repeat-x; + text-align: center; + margin-top: 10px; + padding: 5px; +} diff -r e7447a6044ec -r cde92f6ec29f webcontrol.php --- a/webcontrol.php Sun Mar 23 20:58:51 2008 -0400 +++ b/webcontrol.php Sun Mar 23 22:03:57 2008 -0400 @@ -8,7 +8,7 @@ */ $public = true; -$allowcontrol = false; +$allowcontrol = true; $theme = 'funkymonkey'; @ini_set('display_errors', 'on');