Player Repeat. closes #38

This commit is contained in:
magnolia-fan 2011-04-13 01:28:46 +04:00
parent 3a40da1dbe
commit 74b4c1e04a

View File

@ -38,7 +38,7 @@ $(function(){
playPrev(); playPrev();
}).disableTextSelect(); }).disableTextSelect();
$('#player .next').click(function(){ $('#player .next').click(function(){
playNext(); playNext(false);
}).disableTextSelect(); }).disableTextSelect();
$('#player .shuffle, #player .repeat').click(function(){ $('#player .shuffle, #player .repeat').click(function(){
$(this).toggleClass('on'); $(this).toggleClass('on');
@ -53,7 +53,7 @@ function updatePlayer() {
duration = audio.duration; duration = audio.duration;
cur_time = audio.currentTime; cur_time = audio.currentTime;
if (cur_time == duration) { if (cur_time == duration) {
playNext(); playNext(true);
} }
loaded = 0; loaded = 0;
if ((audio.buffered != undefined) && (audio.buffered.length != 0)) { if ((audio.buffered != undefined) && (audio.buffered.length != 0)) {
@ -95,7 +95,9 @@ function playNext(auto) {
$('#playlist ul.list li').rand().dblclick(); $('#playlist ul.list li').rand().dblclick();
} }
if ($('#playlist ul.list li.now-playing').next().length == 0) { if ($('#playlist ul.list li.now-playing').next().length == 0) {
if ((auto && $('#player .repeat').hasClass('on')) || !auto) {
$('#playlist ul.list li:first').dblclick(); $('#playlist ul.list li:first').dblclick();
}
} else { } else {
$('#playlist ul.list li.now-playing').next().dblclick(); $('#playlist ul.list li.now-playing').next().dblclick();
} }