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.

0 lines
4.7 KiB

  1. !function(a,b,c,d){a.fn.video=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.video.settings,b):a.fn.video.settings,g=e.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1),m=f.selector,n=f.className,o=f.error,p=f.metadata,q=f.namespace,r="."+q,s=q+"-module";return e.each(function(){var b,q=a(this),t=q.find(m.placeholder),u=q.find(m.playButton),v=q.find(m.embed),w=this,x=q.data(s);b={initialize:function(){b.debug("Initializing video"),t.on("click"+r,b.play),u.on("click"+r,b.play),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),x=b,q.data(s,b)},destroy:function(){b.verbose("Destroying previous instance of video"),q.removeData(s).off(r)},change:function(a,c,d){b.debug("Changing video to ",a,c,d),q.data(p.source,a).data(p.id,c).data(p.url,d),f.onChange()},reset:function(){b.debug("Clearing video embed and showing placeholder"),q.removeClass(n.active),v.html(" "),t.show(),f.onReset()},play:function(){b.debug("Playing video");var a=q.data(p.source)||!1,c=q.data(p.url)||!1,d=q.data(p.id)||!1;v.html(b.generate.html(a,d,c)),q.addClass(n.active),f.onPlay()},generate:{html:function(a,c,d){b.debug("Generating embed html");var e,g="auto"==f.width?q.width():f.width,h="auto"==f.height?q.height():f.height;return a&&c?"vimeo"==a?e='<iframe src="http://player.vimeo.com/video/'+c+"?="+b.generate.url(a)+'"'+' width="'+g+'" height="'+h+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':"youtube"==a&&(e='<iframe src="http://www.youtube.com/embed/'+c+"?="+b.generate.url(a)+'"'+' width="'+g+'" height="'+h+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'):d?e='<iframe src="'+d+'"'+' width="'+g+'" height="'+h+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':b.error(o.noVideo),e},url:function(a){var b=f.api?1:0,c=f.autoplay?1:0,d=f.hd?1:0,e=f.showUI?1:0,g=f.showUI?0:1,h="";return"vimeo"==a&&(h="api="+b+"&amp;title="+e+"&amp;byline="+e+"&amp;portrait="+e+"&amp;autoplay="+c,f.color&&(h+="&amp;color="+f.color)),"ustream"==a?(h="autoplay="+c,f.color&&(h+="&amp;color="+f.color)):"youtube"==a&&(h="enablejsapi="+b+"&amp;autoplay="+c+"&amp;autohide="+g+"&amp;hq="+d+"&amp;modestbranding=1",f.color&&(h+="&amp;color="+f.color)),h}},setting:function(b,c){return c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:w,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.name+":",j=0;h=!1,clearTimeout(b.performance.timer),a.each(i,function(a,b){j+=b["Execution Time"]}),c+=" "+j+"ms",g&&(c+=" '"+g+"'"),e.size()>1&&(c+=" ("+e.size()+")"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(c),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(e,f,g){var h,i,j;return f=f||l,g=w||g,"string"==typeof e&&x!==d&&(e=e.split(/[\. ]/),h=e.length-1,a.each(e,function(c,f){var g=c!=h?f+e[c+1].charAt(0).toUpperCase()+e[c+1].slice(1):e;if(a.isPlainObject(x[f])&&c!=h)x=x[f];else{if(!a.isPlainObject(x[g])||c==h)return x[f]!==d?(i=x[f],!1):x[g]!==d?(i=x[g],!1):(b.error(o.method),!1);x=x[g]}})),