fixes for scrolling, tracks in listview

This commit is contained in:
Wouter van Wijk 2013-02-24 22:31:10 +01:00
parent 0cc9465faf
commit 79bf895c49
4 changed files with 23 additions and 17 deletions

View File

@ -79,6 +79,10 @@
.srch-breakpoint.ui-grid-a .ui-block-a, .srch-breakpoint.ui-grid-a .ui-block-b {
width: 49.5%;
}
.scroll {
overflow-y: scroll;
overflow-x: hidden;
}
}
/* phone */
@ -299,7 +303,7 @@
}
.currenttrack2 {
background-image: url('../images/icons/play_alt_8x8.png');
background-image: url('../images/icons/play_alt_12x12.png');
background-repeat: no-repeat;
background-position: 4px center;
}

View File

@ -100,26 +100,27 @@ function getAlbum(pl) {
/********************************************************
* break up results and put them in album tables
*********************************************************/
function albumTracksToTable(pl, table, uri) {
function albumTracksToTable(pl, target, uri) {
var tmp = '';
$(table).empty();
var targetmin = target.substr(1);
$(target).empty();
var child = '';
for (var i = 0; i < pl.length; i++) {
popupData[pl[i].uri] = pl[i];
child = '<li><a href="#" onclick="return popupTracks(event, \'' + uri + '\',\'' + pl[i].uri + '\');">';
child = '<li id="' + targetmin + '-' + pl[i].uri + '"><a href="#" onclick="return popupTracks(event, \'' + uri + '\',\'' + pl[i].uri + '\');">';
child += '<p style="float:right; display: inline;">' + timeFromSeconds(pl[i].length / 1000) + '</p><h1>' + pl[i].name + '</h1></a></li>';
tmp += child;
};
$(table).html(tmp);
$(table).attr('data', uri);
$(target).html(tmp);
$(target).attr('data', uri);
//set click handlers
/* $(table + ' .name').click(function() {
return playtrack(this.id, uri)
});*/
//create (for new tables)
$(table).listview().trigger("create");
$(target).listview().trigger("create");
//refresh
$(table).listview('refresh');
$(target).listview('refresh');
}
function resultsToTables(results, target, uri) {
@ -242,8 +243,6 @@ function playlisttotable(pl, target, uri) {
$(target).html(tmp);
$(target).attr('data', uri);
//create (for new tables)
// $(target).listview().trigger("create");
//refresh
$(target).listview('refresh');
}

View File

@ -83,7 +83,7 @@ function setSongInfo(data) {
$("#songlength").html(timeFromSeconds(data.length / 1000));
resizeSonginfo();
//update styles of listviews
$('#currenttable li').each(function() {
$(this).removeClass("currenttrack");
if (this.id == 'currenttable-' + data.uri) {
@ -102,15 +102,16 @@ function setSongInfo(data) {
$(this).addClass('currenttrack2');
}
});
$('#artiststable li').each(function() {
$(this).removeClass("currenttrack2");
if (this.id == 'trackresulttable-' + data.uri) {
if (this.id == 'artiststable-' + data.uri) {
$(this).addClass('currenttrack2');
}
});
$('#albumstable li').each(function() {
$(this).removeClass("currenttrack2");
if (this.id == 'trackresulttable-' + data.uri) {
if (this.id == 'albumstable-' + data.uri) {
$(this).addClass('currenttrack2');
}
});

View File

@ -40,14 +40,14 @@ function processSearchResults(resultArr) {
$(SEARCH_ARTIST_TABLE).empty();
$(SEARCH_ALBUM_TABLE).empty();
//get the right result
// 0 = older raspberry 1 = dev.
// var results = resultArr[0];
// 0 = older raspberry 1 = dev.
// var results = resultArr[0];
var results = resultArr[1];
var tracks = (results.tracks) ? results.tracks : '';
customTracklists['trackresultscache'] = tracks;
var artists = (results.artists) ? results.artists : '';
var albums = (results.albums) ? results.albums : '';
if ((tracks == '') && (artists == '') && (albums == '') ) {
if ((tracks == '') && (artists == '') && (albums == '')) {
alert('No results');
showLoading(false);
return false;
@ -150,6 +150,7 @@ function showArtist(nwuri) {
mopidy.library.lookup(nwuri).then(processArtistResults, console.error);
switchContent('artists', nwuri);
scrollToTop();
setSongInfo();
return false;
}
@ -167,7 +168,7 @@ function showAlbum(uri) {
$('#h_albumartist').html(artistname);
$('#coverpopupalbumname').html(albumname);
$('#coverpopupartist').html(artistname);
getCover(artistname, albumname, '#albumviewcover, #coverpopupimage', 'extralarge');
mopidy.library.lookup(uri).then(processAlbumResults, console.error);
} else {
@ -180,6 +181,7 @@ function showAlbum(uri) {
//show
switchContent('albums', uri);
scrollToTop();
setSongInfo();
return false;
}