Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist add-on: no repetitive searching in the DOM in _refresh #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions add-on/jplayer.playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,23 @@
},
_refresh: function(instant) {
/* instant: Can be undefined, true or a function.
* undefined -> use animation timings
* true -> no animation
* function -> use animation timings and excute function at half way point.
* undefined -> use animation timings
* true -> no animation
* function -> use animation timings and excute function at half way point.
*/
var self = this;
var playlist_ul = $(self.cssSelector.playlist + " ul");

if(instant && !$.isFunction(instant)) {
$(this.cssSelector.playlist + " ul").empty();

$.each(this.playlist, function(i) {
$(self.cssSelector.playlist + " ul").append(self._createListItem(self.playlist[i]));
playlist_ul.append(self._createListItem(self.playlist[i]));
});
this._updateControls();
} else {
var displayTime = $(this.cssSelector.playlist + " ul").children().length ? this.options.playlistOptions.displayTime : 0;

$(this.cssSelector.playlist + " ul").slideUp(displayTime, function() {
var displayTime = playlist_ul.children().length ? this.options.playlistOptions.displayTime : 0;
playlist_ul.slideUp(displayTime, function() {
var $this = $(this);
$(this).empty();

Expand Down