search input field,
[wolnelektury.git] / wolnelektury / static / js / player.js
1 (function($) {
2     $(function() {
3
4
5         $("#jplayer").jPlayer({
6             swfPath: "/static/jplayer/",
7             solution: "html,flash",
8             supplied: $(this).attr('data-supplied'),
9     
10             ready: function() {
11                 var player = $(this);
12                 var setMedia = function(elem) {
13                     var li = $(elem).parent();
14                     $('.jp-playlist-current').removeClass('jp-playlist-current');
15                     $(li).addClass('jp-playlist-current');
16                     var media = {}
17     
18                     $('.mp3', li).each(function() {media['mp3'] = $(this).attr('href')});
19                     $('.ogg', li).each(function() {media['oga'] = $(this).attr('href')});
20     
21                     return player.jPlayer("setMedia", media);
22                 };
23                 setMedia($('.play').first()).jPlayer("play");
24     
25                 $('.play').click(function() {
26                     setMedia(this).jPlayer("play");
27                 });
28             }
29         });
30
31
32     });
33 })(jQuery)