thd/web/js/flowplayer/.svn/text-base/flowplayer.playlist-3.0.5.min.js.svn-base
author Gautier Thibault <gthibault@universcine.com>
Tue, 22 Sep 2009 16:40:38 +0200
changeset 35 94a1dc255022
permissions -rw-r--r--
Commit the all thd project created with the framework symfony
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     1
/**
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     2
 * flowplayer.playlist.js 3.0.5. Flowplayer JavaScript plugin.
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     3
 * 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     4
 * This file is part of Flowplayer, http://flowplayer.org
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     5
 *
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     6
 * Author: Tero Piirainen, <support@flowplayer.org>
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     7
 * Copyright (c) 2008 Flowplayer Ltd
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     8
 *
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
     9
 * Dual licensed under MIT and GPL 2+ licenses
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    10
 * SEE: http://www.opensource.org/licenses
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    11
 * 
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    12
 * Version: 3.0.5 - Tue Feb 24 2009 11:42:22 GMT-0000 (GMT+00:00)
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    13
 */
94a1dc255022 Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff changeset
    14
(function($){$f.addPlugin("playlist",function(wrap,options){var self=this;var opts={playingClass:'playing',pausedClass:'paused',progressClass:'progress',template:'<a href="${url}">${title}</a>',loop:false,playOnClick:true,manual:false};$.extend(opts,options);wrap=$(wrap);var manual=self.getPlaylist().length<=1||opts.manual;var els=null;if(!manual){var template=wrap.is(":empty")?opts.template:wrap.html();wrap.empty();$.each(self.getPlaylist(),function(){if(this.duration===0){return false;}var el=template;var self=this;$.each(this,function(key,val){if(!$.isFunction(val)){el=el.replace("$\{"+key+"\}",val).replace("$%7B"+key+"%7D",val);}});wrap.append(el);});els=wrap.children().click(function(){return play($(this),els.index(this));});}else{els=wrap.children();if(els.eq(0).hasClass("__scrollable")){els=els.children();}if($.isFunction(els.live)){$(wrap.selector+"> *").live("click",function(){var el=$(this);return play(el,el.attr("href"));});}else{els.click(function(){var el=$(this);return play(el,el.attr("href"));});}var clip=self.getClip(0);if(!clip.url&&opts.playOnClick){clip.update({url:els.eq(0).attr("href")});}}function play(el,clip){if(el.hasClass(opts.playingClass)||el.hasClass(opts.pausedClass)){self.toggle();}else{el.addClass(opts.progressClass);self.play(clip);}return false;}function clearCSS(){if(manual){els=wrap.children();}els.removeClass(opts.playingClass);els.removeClass(opts.pausedClass);els.removeClass(opts.progressClass);}function getEl(clip){return(manual)?els.filter("[href="+clip.url+"]"):els.eq(clip.index);}self.onBegin(function(clip){clearCSS();getEl(clip).addClass(opts.playingClass);});self.onPause(function(clip){getEl(clip).removeClass(opts.playingClass).addClass(opts.pausedClass);});self.onResume(function(clip){getEl(clip).removeClass(opts.pausedClass).addClass(opts.playingClass);});if(!opts.loop&&!manual){self.onBeforeFinish(function(clip){if(clip.index<els.length-1){return false;}});}if(manual&&opts.loop){self.onBeforeFinish(function(clip){var el=getEl(clip);if(el.next().length){el.next().click();}else{els.eq(0).click();}return false;});}self.onUnload(function(){clearCSS();});return self;});})(jQuery);