Permalink
Browse files

implemented track change and artwork change

  • Loading branch information...
1 parent 8242284 commit 9824c49e7b755da75398826d20c8937abfccca0d @IsakUlstrup committed May 23, 2011
Showing with 36 additions and 10 deletions.
  1. +1 −1 css/reset.css
  2. +19 −0 css/style.css
  3. +1 −0 info.plist
  4. +13 −9 js/script.js
  5. +2 −0 main.html
View
@@ -11,7 +11,7 @@ build: 3167
*/
html{
color:#000;
- background:#FFF;
+ /*background:#FFF;*/
}
/*
TODO remove settings on BODY since we can't namespace it.
View
@@ -0,0 +1,19 @@
+/*
+ Utility classes
+*/
+.scaleImg {
+ /* Scale image to fit parent while maintaining aspect ratio */
+ width: auto;
+ height: auto;
+ max-width: 100%;
+ max-height: 100%;
+}
+
+
+/*
+ Your styles here
+*/
+#albumArtwork {
+ /* Scale down artwork to see the meta data */
+ width: 100px;
+}
View
@@ -6,6 +6,7 @@
BTWindowWidth = 300;
BTWindowHeight = 300;
BTThemeVersion = "0.1";
+ BTWindowMode = desktop;
BTThemePreviewImage = "preview.png";
BTThemeDevice = mac;
BTMainFile = "main.html";
View
@@ -10,27 +10,31 @@ function toggleSpinwrap (obj) {
Event functions
*/
function trackChanged(theTrack) {
- /*var title = theTrack.title;
- var artist = theTrack.artist;
- var album = theTrack.album;
- var genre = theTrack.genre;
- var length = theTrack.length;*/
+ // Display track meta data
+ if (theTrack) {
+ $('#trackName').html( (theTrack.title) ? theTrack.title : 'No title' );
+ $('#artistName').html( (theTrack.artist) ? theTrack.artist : 'No artist' );
+ $('#albumName').html( (theTrack.album) ? theTrack.album : 'No album' );
+ $('#trackGenre').html( (theTrack.genre) ? theTrack.genre : 'No genre' );
+ $('#trackLength').html( (theTrack.length) ? theTrack.length : 'No length' );
+ }
}
function artworkChanged(theArtwork) {
// Display album art
// If no artwork is set or no track is playing, display a placeholder image
// #albumArtwork should be an img element
- if (theArtwork == "")
- $('#albumArtwork').attr('src', 'img/noartwork.png');
- else
+ if (theArtwork) {
$('#albumArtwork').attr('src', theArtwork);
+ } else {
+ $('#albumArtwork').attr('src', 'img/noartwork.png');
+ }
}
+
/*
Wrapper functions for convenience
*/
-
function previousTrack() {
Player.previousTrack();
return false;
View
@@ -14,5 +14,7 @@
<p id="trackName">Loading...</p>
<p id="artistName">Loading...</p>
<p id="albumName">Loading...</p>
+ <p id="trackGenre">Loading...</p>
+ <p id="trackLength">Loading...</p>
</body>
</html>

0 comments on commit 9824c49

Please sign in to comment.