small updates/bugs

This commit is contained in:
woutervanwijk 2013-11-16 11:00:05 +01:00
parent 6903cc4237
commit ad09970695
5 changed files with 35 additions and 40 deletions

View File

@ -51,7 +51,7 @@
<body>
<div data-role="page" id="page" class="ui-responsive-panel" data-theme="c">
<div data-role="panel" id="panel" data-position="left" data-theme="a" data-display="push" data-position-fixed="true">
<div data-role="panel" id="panel" data-position="left" data-theme="a" data-display="reveal" data-position-fixed="true">
<ul class="ui-listview mainNav" data-role="listview" data-theme="a">
@ -322,7 +322,7 @@
<div data-role="footer" data-tap-toggle="false" data-position="fixed" id="normalFooter">
<div id="songinfo" class="">
<img id="infocover" src="images/icons/cd_32x32.png" width="36" height="36"/>
<a href="#"><img id="infocover" src="images/icons/cd_32x32.png" width="36" height="36"/></a>
<div class="songinfo-text">
<div id="infoname"></div>

View File

@ -65,7 +65,7 @@ function playTrack(addtoqueue) {
}
mopidy.playback.play(); //tracks[selected]);
console.log(selected);
//console.log(selected);
return false;
}
@ -75,6 +75,7 @@ function playTrack(addtoqueue) {
* @returns {boolean}
*/
function playTrackByUri(uri, playlisturi){
//console.log('playuri');
//stop directly, for user feedback
mopidy.playback.stop(true);
mopidy.tracklist.clear();
@ -111,7 +112,7 @@ function playTrackByUri(uri, playlisturi){
}
mopidy.playback.play(); //tracks[selected]);
console.log(selected);
// console.log(selected);
return false;
}
@ -126,6 +127,7 @@ function playTrackByUri(uri, playlisturi){
* @returns {boolean}
*/
function playTrackQueueByUri(uri, playlisturi){
//console.log('playqu');
//stop directly, for user feedback
//console.log('qu');
mopidy.playback.stop(true);
@ -144,7 +146,7 @@ function playTrackQueueByUri(uri, playlisturi){
}
mopidy.playback.play(); //currentplaylist[track]);
console.log(track, currentplaylist[track]);
//console.log(track, currentplaylist[track]);
return false;
}

View File

@ -135,7 +135,7 @@ function albumTracksToTable(pl, target, uri) {
for (var i = 0; i < pl.length; i++) {
popupData[pl[i].uri] = pl[i];
liID = targetmin + '-' + pl[i].uri;
tmp += renderSongLi(pl[i], liID, uri);
tmp += renderSongLi(pl[i], liID, uri, target);
//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>';
@ -146,19 +146,7 @@ function albumTracksToTable(pl, target, uri) {
$(target).attr('data', uri);
}
function renderSongLi(song, liID, uri){
var hash = document.location.hash.split('?');
//this is so dirty... ... ...
var playlistType = '';
var divid = hash[0].substr(1);
if (divid == 'current') {
playlistType = 'playTrackQueueByUri';
} else {
playlistType = 'playTrackByUri';
}
// console.log(playlistType);
// songLi = '';
function renderSongLi(song, liID, uri, playlistType){
songLi = '<li class="song albumli" id="' + liID + '">' +
'<a href="#" class="moreBtn" onclick="return popupTracks(event, \'' + uri + '\',\'' + song.uri + '\');">' +
'<i class="fa fa-ellipsis-vertical"></i>' +
@ -171,14 +159,12 @@ function renderSongLi(song, liID, uri){
}
function resultsToTables(results, target, uri) {
var hash = document.location.hash.split('?');
var divid = hash[0].substr(1), playlistType;
if (divid == 'current') {
// console.log(target);
if (target == '#currenttable') {
playlistType = 'playTrackQueueByUri';
} else {
playlistType = 'playTrackByUri';
}
// console.log(playlistType);
var newalbum = [];
var nexturi = '';
@ -257,7 +243,7 @@ function resultsToTables(results, target, uri) {
//hERE!
var liID = targetmin + '-' + newalbum[j].uri;
html+= renderSongLi(newalbum[j], liID, uri);
html+= renderSongLi(newalbum[j], liID, uri, playlistType);
//html += '<li class="albumli" id="' + targetmin + '-' + newalbum[j].uri + '"><a href="#" onclick="return popupTracks(event, \'' + uri + '\',\'' + newalbum[j].uri + '\');">';
//html += '<p class="pright">' + timeFromSeconds(newalbum[j].length / 1000) + '</p><h1>' + newalbum[j].name + '</h1></a></li>';

View File

@ -505,16 +505,12 @@ $(document).ready(function(event) {
//navigation temporary, rewrite this!
$('#normalFooter').click(
function() {
if(!$(event.target).is("#playimg"))
{return switchContent('nowPlaying')} }
);
$('#nowPlayingpane, #nowPlayingFooter, #controlspopupimage').click(
$('#songinfo').click(
function()
{return switchContent('nowPlaying')} );
$('#controlspopupimage').click(
function() {
if(!$(event.target).is("#trackslider"))
return switchContent('current')}
);
return switchContent('current')} );
$('#navEnterFullscreen').click(function(){
enterFullscreen();
});
@ -557,7 +553,7 @@ $(document).ready(function(event) {
$('#navExitFullscreen').hide();
}
$.event.special.swipe.horizontalDistanceThreshold = 150; // (default: 30px) Swipe horizontal displacement must be more than this.
$.event.special.swipe.horizontalDistanceThreshold = 125; // (default: 30px) Swipe horizontal displacement must be more than this.
$.event.special.swipe.verticalDistanceThreshold = 50; // (default: 75px) Swipe vertical displacement must be less than this.
// $.event.special.swipe.scrollSupressionThreshold = 20;
$.event.special.swipe.durationThreshold = 500;
@ -566,13 +562,13 @@ $(document).ready(function(event) {
$( "#normalFooter, #nowPlayingFooter" ).on( "swiperight", doPrevious );
$( "#normalFooter, #nowPlayingFooter" ).on( "swipeleft", doNext );
$( "#nowPlayingpane, .ui-body-c, #header, #panel, .pane" ).on( "swiperight", function() {
if(!$(event.target).is("#normalFooter") && !$(event.target).is("#nowPlayingFooter"))
if(!$(event.target).is("#normalFooter") && !$(event.target).is("#nowPlayingFooter")) {
$("#panel").panel("open");
event.stopImmediatePropagation();
event.stopImmediatePropagation(); }
} );
$( "#nowPlayingpane, .ui-body-c, #header, #panel, .pane" ).on( "swipeleft", function() {
if(!$(event.target).is("#normalFooter") && !$(event.target).is("#nowPlayingFooter"))
$("#panel").panel("close");
event.stopImmediatePropagation();
if(!$(event.target).is("#normalFooter") && !$(event.target).is("#nowPlayingFooter")) {
$("#panel").panel("close");
event.stopImmediatePropagation(); }
} );
});

View File

@ -45,8 +45,18 @@ function playTrack(addtoqueue) {
return false;
}
// first add track to be played, then the other tracks
mopidy.tracklist.add(tracks);
for (var i = 0; i <= selected; i++) {
mopidy.playback.next();
}
mopidy.playback.play();
// first add track to be played, then the other tracks
/*
// mopidy.tracklist.add(null, 0, playlisturi);
mopidy.tracklist.add( tracks.slice(selected, selected + 1) );
//wait .5 second before adding the rest to give server the time to start playing
@ -64,6 +74,7 @@ function playTrack(addtoqueue) {
}
mopidy.playback.play(); //tracks[selected]);
*/
console.log(selected);
return false;
}