You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
3.8 KiB

!function(a,b,c,d){a.fn.video=function(b){var c,e=a.extend(!0,{},a.fn.video.settings,b),f=arguments||!1;return a(this).each(function(){var g,h=a(this),i=h.find(e.selector.placeholder),j=h.find(e.selector.playButton),k=h.find(e.selector.embed),l=h.data("module-"+e.namespace),m="string"==typeof b,n=e.namespace,o=e.metadata,p=e.className;g={initialize:function(){g.debug("Initializing video"),i.off(".video").on("click."+n,g.play),j.off(".video").on("click."+n,g.play),h.data("module-"+n,g)},change:function(a,b){g.debug("Changing video to ",b),h.data(o.source,a).data(o.flv,b),e.onChange()},reset:function(){g.debug("Clearing video embed and showing placeholder"),h.removeClass(p.active),k.html(" "),i.show(),e.onReset()},play:function(){g.debug("Playing video");var a=h.data(o.source),b=h.data(o.flv);k.html(g.generate.html(a,b)),h.addClass(p.active),e.onPlay()},generate:{html:function(a,b){g.debug("Generating embed html");var c,d="auto"==e.width?h.width():e.width,f="auto"==e.height?h.height():e.height;return"vimeo"==a?c='<iframe src="http://player.vimeo.com/video/'+b+"?="+g.generate.url(a)+'"'+' width="'+d+'" height="'+f+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':"youtube"==a&&(c='<iframe src="http://www.youtube.com/embed/'+b+"?="+g.generate.url(a)+'"'+' width="'+d+'" height="'+f+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'),c},url:function(a){var b=e.api?1:0,c=e.autoplay?1:0,d=e.hd?1:0,f=e.showUI?1:0,g=e.showUI?0:1,h="";return"vimeo"==a?(h="api="+b+"&amp;title="+f+"&amp;byline="+f+"&amp;portrait="+f+"&amp;autoplay="+c,e.color&&(h+="&amp;color="+e.color)):"youtube"==a&&(h="enablejsapi="+b+"&amp;autoplay="+c+"&amp;autohide="+g+"&amp;hq="+d+"&amp;modestbranding=1",e.color&&(h+="&amp;color="+e.color)),h}},debug:function(a,b){e.debug&&(b!==d?console.info(e.moduleName+": "+a,b):console.info(e.moduleName+": "+a))},error:function(a){console.warn(e.moduleName+": "+a)},invoke:function(b,c,f){var h;return f=f||Array.prototype.slice.call(arguments,2),"string"==typeof b&&l!==d&&(b=b.split("."),a.each(b,function(b,c){return a.isPlainObject(l[c])?(l=l[c],!0):a.isFunction(l[c])?(h=l[c],!0):(g.error(e.errors.method),!1)})),a.isFunction(h)?h.apply(c,f):h}},m?c=g.invoke(f[0],this,Array.prototype.slice.call(f,1)):(l&&g.destroy(),g.initialize())}),c!==d?c:this},a.fn.videoPlaylist=function(b,c){var d=a(this),e=a(b),f=e.find(".embed iframe"),g=a.extend({},a.fn.videoPlaylist.settings,c,!0);d.each(function(){var b=a(this),c=g.metadata,f=g.namespace,h=g.className,i={initialize:function(){b.on("click."+f,i.changeVideo)},changeVideo:function(){var f=b.data(c.flv)||!1,i=b.data(c.source)||!1,j=b.data(c.placeholder)||!1;if(f&&i){if(e.data(c.source,i).data(c.flv,f),g.showPlaceholder)e.removeClass(h.active).find(a.fn.video.selector.placeholder).attr("src",j);else try{e.video("play")}catch(k){console.warn("Video Playlist Module: "+g.error.init)}d.removeClass(h.active),b.addClass(h.active)}}};i.initialize()}),g.playFirst&&(d.eq(0).trigger("click"),f.size()>0&&f.attr("src",f.attr("src").replace("autoplay=1","autoplay=0")))},a.fn.video.settings={moduleName:"Video",namespace:"video",debug:!1,metadata:{source:"source",flv:"flv"},onPlay:function(){},onReset:function(){},onChange:function(){},play:function(){},pause:function(){},stop:function(){},width:"auto",height:"auto",autoplay:!1,color:"#442359",hd:!0,showUI:!1,api:!0,errors:{method:"The method you called is not defined"},className:{active:"active"},selector:{embed:".embed",placeholder:".placeholder",playButton:".play"}},a.fn.videoPlaylist.settings={moduleName:"Video Playlist",namespace:"videoPlaylist",source:"vimeo",showPlaceholder:!1,playFirst:!0,metadata:{flv:"flv",source:"source",placeholder:"placeholder"},errors:{init:"The video player you specified was not yet initialized"},className:{active:"active"}}}(jQuery,window,document);