Skip to content

Commit 54408ec

Browse files
committed
Playlist - Fixed bug in autoBlur - Added useStateClassSkin support.
1 parent 2216c7c commit 54408ec

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

add-on/jplayer.playlist.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* http://www.opensource.org/licenses/MIT
88
*
99
* Author: Mark J Panaghiston
10-
* Version: 2.3.1
10+
* Version: 2.3.2
1111
* Date: 8th June 2014
1212
*
1313
* Requires:
@@ -44,6 +44,9 @@
4444
self.previous();
4545
}
4646
}
47+
},
48+
stateClass: {
49+
shuffled: "jp-state-shuffled"
4750
}
4851
}, this._options, options); // Object: The jPlayer constructor options for this playlist and the playlist options
4952

@@ -94,7 +97,7 @@
9497

9598
// The blur function executes in the context of the click handler
9699
var blur = function() {
97-
if($(this.cssSelector.jPlayer).jPlayer("option", "autoBlur")) {
100+
if($(self.cssSelector.jPlayer).jPlayer("option", "autoBlur")) {
98101
$(this).blur();
99102
}
100103
};
@@ -114,7 +117,11 @@
114117

115118
$(this.cssSelector.shuffle).click(function(e) {
116119
e.preventDefault();
117-
self.shuffle(true);
120+
if(self.shuffled && $(self.cssSelector.jPlayer).jPlayer("option", "useStateClassSkin")) {
121+
self.shuffle(false);
122+
} else {
123+
self.shuffle(true);
124+
}
118125
blur.call(this);
119126
});
120127
$(this.cssSelector.shuffleOff).click(function(e) {
@@ -308,12 +315,20 @@
308315
} else {
309316
$(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).hide();
310317
}
318+
311319
if(this.shuffled) {
312-
$(this.cssSelector.shuffleOff).show();
313-
$(this.cssSelector.shuffle).hide();
320+
$(this.cssSelector.jPlayer).jPlayer("addStateClass", "shuffled");
314321
} else {
315-
$(this.cssSelector.shuffleOff).hide();
316-
$(this.cssSelector.shuffle).show();
322+
$(this.cssSelector.jPlayer).jPlayer("removeStateClass", "shuffled");
323+
}
324+
if($(this.cssSelector.shuffle).length && $(this.cssSelector.shuffleOff).length) {
325+
if(this.shuffled) {
326+
$(this.cssSelector.shuffleOff).show();
327+
$(this.cssSelector.shuffle).hide();
328+
} else {
329+
$(this.cssSelector.shuffleOff).hide();
330+
$(this.cssSelector.shuffle).show();
331+
}
317332
}
318333
},
319334
_highlight: function(index) {

0 commit comments

Comments
 (0)