Вход Регистрация
Файл: jscript/jplayer.playlist.min.js
Строк: 387
<?php
/*
 * Playlist Object for the jPlayer Plugin
 * http://www.jplayer.org
 *
 * Copyright (c) 2009 - 2013 Happyworm Ltd
 * Dual licensed under the MIT and GPL licenses.
 *  - http://www.opensource.org/licenses/mit-license.php
 *  - http://www.gnu.org/copyleft/gpl.html
 *
 * Author: Mark J Panaghiston
 * Version: 2.3.0
 * Date: 20th April 2013
 *
 * Requires:
 *  - jQuery 1.7.0+
 *  - jPlayer 2.3.0+
 */
(function (bf) {
    
jPlayerPlaylist = function (acd) {
        var 
this;
        
this.current 0;
        
this.removing this.shuffled this.loop = !1;
        
this.cssSelector b.extend({}, this._cssSelectora);
        
this.options b.extend(!0, {
            
keyBindings: {
                
next: {
                    
key39,
                    fn: function () {
                        
e.next()
                    }
                },
                
previous: {
                    
key37,
                    fn: function () {
                        
e.previous()
                    }
                }
            }
        }, 
this._optionsd);
        
this.playlist = [];
        
this.original = [];
        
this._initPlaylist(c);
        
this.cssSelector.title this.cssSelector.cssSelectorAncestor " .jp-title";
        
this.cssSelector.playlist this.cssSelector.cssSelectorAncestor " .jp-playlist";
        
this.cssSelector.next this.cssSelector.cssSelectorAncestor " .jp-next";
        
this.cssSelector.previous this.cssSelector.cssSelectorAncestor " .jp-previous";
        
this.cssSelector.shuffle this.cssSelector.cssSelectorAncestor " .jp-shuffle";
        
this.cssSelector.shuffleOff this.cssSelector.cssSelectorAncestor " .jp-shuffle-off";
        
this.options.cssSelectorAncestor this.cssSelector.cssSelectorAncestor;
        
this.options.repeat = function (a) {
            
e.loop a.jPlayer.options.loop
        
};
        
b(this.cssSelector.jPlayer).bind(b.jPlayer.event.ready, function () {
            
e._init()
        });
        
b(this.cssSelector.jPlayer).bind(b.jPlayer.event.ended, function () {
            
e.next()
        });
        
b(this.cssSelector.jPlayer).bind(b.jPlayer.event.play, function () {
            
b(this).jPlayer("pauseOthers")
        });
        
b(this.cssSelector.jPlayer).bind(b.jPlayer.event.resize, function (a) {
            
a.jPlayer.options.fullScreen b(e.cssSelector.title).show() : b(e.cssSelector.title).hide()
        });
        
b(this.cssSelector.previous).click(function () {
            
e.previous();
            
b(this).blur();
            return !
1
        
});
        
b(this.cssSelector.next).click(function () {
            
e.next();
            
b(this).blur();
            return !
1
        
});
        
b(this.cssSelector.shuffle).click(function () {
            
e.shuffle(!0);
            return !
1
        
});
        
b(this.cssSelector.shuffleOff).click(function () {
            
e.shuffle(!1);
            return !
1
        
}).hide();
        
this.options.fullScreen || b(this.cssSelector.title).hide();
        
b(this.cssSelector.playlist " ul").empty();
        
this._createItemHandlers();
        
b(this.cssSelector.jPlayer).jPlayer(this.options)


    };
    
jPlayerPlaylist.prototype = {
        
_cssSelector: {
            
jPlayer"#jquery_jplayer_1",
            
cssSelectorAncestor"#jp_container_1"
        
},
        
_options: {
            
playlistOptions: {
                
autoPlay: !1,
                
loopOnPrevious: !1,
                
shuffleOnLoop: !0,
                
enableRemoveControls: !1,
                
displayTime"slow",
                
addTime"fast",
                
removeTime"fast",
                
shuffleTime"slow",
                
itemClass"jp-playlist-item",
                
freeGroupClass"jp-free-media",
                
freeItemClass"jp-playlist-item-free",
                
removeItemClass"jp-playlist-item-remove"
            
}
        },
        
option: function (ab) {
            if (
=== f) return this.options.playlistOptions[a];
            
this.options.playlistOptions[a] = b;
            switch (
a) {
            case 
"enableRemoveControls":
                
this._updateControls();
                break;
            case 
"itemClass":
            case 
"freeGroupClass":
            case 
"freeItemClass":
            case 
"removeItemClass":
                
this._refresh(!0), this._createItemHandlers()
            }
            return 
this
        
},
        
_init: function () {
            var 
this;
            
this._refresh(function () {
                
a.options.playlistOptions.autoPlay a.play(a.current) : a.select(a.current)
            })
             $(
'#jp_container_1 .jp-interface a').click(function() {

                if ($(
'a.jp-playlist-current').html() != undefined)
                    $(
'#name-of-the-song-that-plays').html($('a.jp-playlist-current').html());
            });
             $(
'#jp_container_1 li a.jp-playlist-item').click(function() {
                if ($(
this).html() != undefined)
                    $(
'#name-of-the-song-that-plays').html($(this).html().substr(0,65));
            });
        },
        
_initPlaylist: function (a) {
            
this.current 0;
            
this.removing this.shuffled = !1;
            
this.original b.extend(!0, [], a);
            
this._originalPlaylist()
        },
        
_originalPlaylist: function () {
            var 
this;
            
this.playlist = [];
            
b.each(this.original, function (b) {
                
a.playlist[b] = a.original[b]
            })
        },
        
_refresh: function (a) {
            var 
this;
            if (
&& !b.isFunction(a)) b(this.cssSelector.playlist " ul").empty(), b.each(this.playlist, function (a) {
                
b(c.cssSelector.playlist " ul").append(c._createListItem(c.playlist[a]))
            }), 
this._updateControls();
            else {
                var 
b(this.cssSelector.playlist " ul").children().length this.options.playlistOptions.displayTime 0;
                
b(this.cssSelector.playlist " ul").slideUp(d, function () {
                    var 
b(this);
                    
b(this).empty();
                    
b.each(c.playlist, function (a) {
                        
d.append(c._createListItem(c.playlist[a]))
                    });
                    
c._updateControls();
                    
b.isFunction(a) && a();
                    
c.playlist.length b(this).slideDown(c.options.playlistOptions.displayTime) : b(this).show()
                })
            }
        },
        
_createListItem: function (a) {
            var 
this,
                
"<li><div>",
                
+ ("<a href='javascript:;' class='" this.options.playlistOptions.removeItemClass "'>&times;</a>");
            if (
a.free) {
                var 
= !0,
                    
+ ("<span class='" this.options.playlistOptions.freeGroupClass "'>(");
                
b.each(a, function (af) {
                    
b.jPlayer.prototype.format[a] && (= !+= " | "+= "<a class='" c.options.playlistOptions.freeItemClass "' href='" "' tabindex='1'>" "</a>")
                });
                
+= ")</span>"
            
}
            var 
name a.title;
            if (
a.author.length != 0)
                
name '<strong>' a.author '</strong> - ' name;
            
+= "<a href='javascript:;' onclick='$(" '"#name-of-the-song-that-plays"' +").html($(this).html().substr(0,65))' class='" this.options.playlistOptions.itemClass "' tabindex='1'>" name + (a.artist " <span class='jp-artist'>by " a.artist "</span>" "") + "</a>";
            
+= "<p class='discription'>" a.discription "</p>"
            
return += "</div></li>"
        
},
        
_createItemHandlers: function () {
            var 
this;
            
b(this.cssSelector.playlist).off("click""a." this.options.playlistOptions.itemClass).on("click""a." this.options.playlistOptions.itemClass, function () {
                var 
b(this).parent().parent().index();
                
a.current !== a.play(c) : b(a.cssSelector.jPlayer).jPlayer("play");
                
b(this).blur();
                return !
1
            
});
            
b(this.cssSelector.playlist).off("click""a." this.options.playlistOptions.freeItemClass).on("click""a." this.options.playlistOptions.freeItemClass, function () {
                
b(this).parent().parent().find("." a.options.playlistOptions.itemClass).click();
                
b(this).blur();
                return !
1
            
});
            
b(this.cssSelector.playlist).off("click""a." this.options.playlistOptions.removeItemClass).on("click""a." this.options.playlistOptions.removeItemClass, function () {
                var 
b(this).parent().parent().index();
                
a.remove(c);
                
b(this).blur();
                return !
1
            
})
        },
        
_updateControls: function () {
            
this.options.playlistOptions.enableRemoveControls b(this.cssSelector.playlist " ." this.options.playlistOptions.removeItemClass).show() : b(this.cssSelector.playlist " ." this.options.playlistOptions.removeItemClass).hide();
            
this.shuffled ? (b(this.cssSelector.shuffleOff).show(), b(this.cssSelector.shuffle).hide()) : (b(this.cssSelector.shuffleOff).hide(), b(this.cssSelector.shuffle).show())
            if ($(
'a.jp-playlist-current').html() != undefined)
                $(
'#name-of-the-song-that-plays').html($('a.jp-playlist-current').html());
        },
        
_highlight: function (a) {
            
this.playlist.length && !== && (b(this.cssSelector.playlist " .jp-playlist-current").removeClass("jp-playlist-current"), b(this.cssSelector.playlist " li:nth-child(" + (1) + ")").addClass("jp-playlist-current").find(".jp-playlist-item").addClass("jp-playlist-current"), b(this.cssSelector.title " li").html(this.playlist[a].title + (this.playlist[a].artist " <span class='jp-artist'>by " this.playlist[a].artist "</span>" "")))
        },
        
setPlaylist: function (a) {
            
this._initPlaylist(a);
            
this._init()
        },
        
add: function (ac) {
            
b(this.cssSelector.playlist " ul").append(this._createListItem(a)).find("li:last-child").hide().slideDown(this.options.playlistOptions.addTime);
            
this._updateControls();
            
this.original.push(a);
            
this.playlist.push(a);
            
this.play(this.playlist.length 1) : === this.original.length && this.select(0)
        },
        
remove: function (a) {
            var 
this;
            if (
=== f) return this._initPlaylist([]), this._refresh(function () {
                
b(c.cssSelector.jPlayer).jPlayer("clearMedia")
            }), !
0;
            if (
this.removing) return !1;
            
c.original.length a;
            
<= && this.playlist.length && (this.removing = !0b(this.cssSelector.playlist " li:nth-child(" + (1) + ")").slideUp(this.options.playlistOptions.removeTime, function () {
                
b(this).remove();
                if (
c.shuffled) {
                    var 
c.playlist[a];
                    
b.each(c.original, function (a) {
                        if (
c.original[a] === d) return c.original.splice(a1), !1
                    
})
                } else 
c.original.splice(a1);
                
c.playlist.splice(a1);
                
c.original.length === c.current ? (c.current c.original.length c.current c.original.length 1c.select(c.current)) : c.current && c.current-- : (b(c.cssSelector.jPlayer).jPlayer("clearMedia"), c.current 0c.shuffled = !1c._updateControls());
                
c.removing = !1
            
}));
            return !
0
        
},
        
select: function (a) {
            
this.original.length a;
            
<= && this.playlist.length ? (this.current athis._highlight(a), b(this.cssSelector.jPlayer).jPlayer("setMedia"this.playlist[this.current])) : this.current 0
        
},
        
play: function (a) {
            
this.original.length a;
            
<= && this.playlist.length this.playlist.length && (this.select(a), b(this.cssSelector.jPlayer).jPlayer("play")) : === && b(this.cssSelector.jPlayer).jPlayer("play")
        },
        
pause: function () {
            
b(this.cssSelector.jPlayer).jPlayer("pause")
        },
        
next: function () {
            var 
this.current this.playlist.length this.current 0;
            
this.loop === && this.shuffled && this.options.playlistOptions.shuffleOnLoop && this.playlist.length this.shuffle(!0, !0) : this.play(a) : && this.play(a)
            if ($(
'a.jp-playlist-current').html() != undefined)
                $(
'#name-of-the-song-that-plays').html($('a.jp-playlist-current').html());
        },
        
previous: function () {
            var 
<= this.current this.current this.playlist.length 1;
            (
this.loop && this.options.playlistOptions.loopOnPrevious || this.playlist.length 1) && this.play(a)
        },
        
shuffle: function (ac) {
            var 
this;
            
=== && (= !this.shuffled);
            (
|| !== this.shuffled) && b(this.cssSelector.playlist " ul").slideUp(this.options.playlistOptions.shuffleTime, function () {
                (
d.shuffled a) ? d.playlist.sort(function () {
                    return 
0.5 Math.random()
                }) : 
d._originalPlaylist();
                
d._refresh(!0);
                
|| !b(d.cssSelector.jPlayer).data("jPlayer").status.paused d.play(0) : d.select(0);
                
b(this).slideDown(d.options.playlistOptions.shuffleTime)
            })
        }
    }
})(
jQuery);
?>
Онлайн: 1
Реклама