X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b940617257217a8d25cc501ab31f134dea65a0e3..0c502550a4f04aa016df8729af2ae2f85c0b495a:/src/catalogue/static/player/player.js diff --git a/src/catalogue/static/player/player.js b/src/catalogue/static/player/player.js index 639937930..69870bb34 100644 --- a/src/catalogue/static/player/player.js +++ b/src/catalogue/static/player/player.js @@ -24,11 +24,12 @@ $(".title", $root).html(li.html()); player.jPlayer("setMedia", media); player.jPlayer("pause", time); + return player; }; $('.play-next', $root).click(function() { var next = parseInt($number.text()) + 1; - var p = $('.play:eq(' + next + ')', $root); + var p = $('.jp-playlist .play:eq(' + (next - 1) + ')', $root); if (p.length) { setMedia(p).jPlayer("play"); $number.text(next) @@ -38,12 +39,12 @@ var next = parseInt($number.text()) - 1; if (next < 1) return; - var p = $('.play:eq(' + next + ')', $root); + var p = $('.jp-playlist .play:eq(' + (next - 1) + ')', $root); setMedia(p).jPlayer("play"); $number.text(next) }); - var initialElem = $('.play', $root).first(); + var initialElem = $('.jp-playlist .play', $root).first(); var initialTime = 0; if (Modernizr.localstorage) { try { @@ -60,6 +61,7 @@ if (last) { initialElem = $('[data-media-id="' + last[1] + '"] .play', $root).first(); initialTime = last[2]; + $number.text($(".jp-playlist .play", $root).index(initialElem) + 1); } } setMedia(initialElem, initialTime);