2.1 Moved ratings to stars

This commit is contained in:
Trevor Squillario 2012-09-30 20:02:04 -04:00
parent 94bfd67946
commit 549fe25b7f
7 changed files with 173 additions and 39 deletions

View file

@ -1,15 +1,14 @@
function generateRowHTML(child, appendto, rowcolor) {
var albumhtml;
var isDir;
var i;
var albumhtml, isDir, starred, i;
isDir = child.isDir;
if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (isDir === true) {
albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating);
albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating, starred);
} else {
var track;
if (child.track === undefined) { track = " "; } else { track = child.track; }
var time = secondsToTime(child.duration);
albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, child.artist, child.album, child.coverArt, child.userRating, time);
albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, child.artist, child.album, child.coverArt, child.userRating, starred, time);
}
return albumhtml;
}
@ -18,13 +17,13 @@ function generateAlbumHeaderHTML() {
html = '<tr><th></th><th></th><th>Album</th><th>Artist</th></tr>';
return html;
}
function generateAlbumHTML(rowcolor, childid, parentid, coverart, title, artist, rating) {
function generateAlbumHTML(rowcolor, childid, parentid, coverart, title, artist, rating, starred) {
var html;
html = '<tr class=\"album ' + rowcolor + '\" childid=\"' + childid + '\" parentid=\"' + parentid + '\" userrating=\"' + rating + '\">';
html += '<td class=\"itemactions\"><a class=\"add\" href=\"\" title=\"Add To Current Playlist\"></a>';
html += '<a class=\"play\" href=\"\" title=\"Play\"></a>';
html += '<a class=\"download\" href=\"\" title=\"Download\"></a>';
if (rating === 5) {
if (starred) {
html += '<a class=\"favorite\" href=\"\" title=\"Favorite\"></a>';
} else {
html += '<a class=\"rate\" href=\"\" title=\"Add To Favorites\"></a>';
@ -45,14 +44,14 @@ function generateSongHeaderHTML() {
html = '<tr><th></th><th>Track</th><th>Title</th><th>Artist</th><th>Album</th><th class=\"alignright\">Time</th></tr>';
return html;
}
function generateSongHTML(rowcolor, childid, parentid, track, title, artist, album, coverart, rating, time) {
function generateSongHTML(rowcolor, childid, parentid, track, title, artist, album, coverart, rating, starred, time) {
var html;
html = '<tr class=\"song ' + rowcolor + '\" childid=\"' + childid + '\" parentid=\"' + parentid + '\" userrating=\"' + rating + '\">';
html += '<td class=\"itemactions\"><a class=\"add\" href=\"\" title=\"Add To Current Playlist\"></a>';
html += '<a class=\"remove\" href=\"\" title=\"Remove\"></a>';
html += '<a class=\"play\" href=\"\" title=\"Play\"></a>';
html += '<a class=\"download\" href=\"\" title=\"Download\"></a>';
if (rating === 5) {
if (starred) {
html += '<a class=\"favorite\" href=\"\" title=\"Favorite\"></a>';
} else {
html += '<a class=\"rate\" href=\"\" title=\"Add To Favorites\"></a>';