/* * VideoBox * Example and Documentation: https://github.com/tedktedk/videobox/blob/master/README.md * * Version: 1.1 * * Copyright (c) 2016 Ted k' * http://tedk.com.br/ * * Dual licensed under the MIT or GPL Version 2 licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ !function(e){e.fn.extend({videoBox:function(t){var a=e(this),i=document.createElement("script"),o=document.getElementsByTagName("script")[0],d=e.extend({autohide:2,autoplay:0,cc_load_policy:1,color:"",controls:1,disablekb:0,enablejsapi:0,fs:1,hl:"",iv_load_policy:1,loop:0,modestbranding:1,showinfo:1,height:390,width:640},t),r=e.extend({width:640,height:360,loop:!1,autoplay:!1,byline:!0,color:"00adef",maxheight:"",maxwidth:"",portrait:!0,title:""},t),n=e.extend({partner_id:"243342",uiconf_id:"12905712",entry_id:"0_uka1msg4",width:640,height:360,switchOnResize:!1,simpleFormat:!0,displayMode:"sizebitrate",inlineScript:!1,hideSource:null,autoPlay:!1},t);e.each(a,function(t,a){var d=e(a);if(d.attr("data-youtube"))i.id="VIDEOBOX_createTag_y",document.getElementById("VIDEOBOX_createTag_y")||(i.src="https://www.youtube.com/iframe_api",o.parentNode.insertBefore(i,o));else if(d.attr("data-vimeo")){var l="VIDEOBOX_"+Math.floor(100*Math.random())+t,c=d.attr("data-vimeo").match(/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/);i.id="VIDEOBOX_createTag_v",d.attr("id",l),document.getElementById("VIDEOBOX_createTag_v")||(i.src="https://player.vimeo.com/api/player.js",o.parentNode.insertBefore(i,o)),i.addEventListener("load",function(e){return r.id=c[3],new Vimeo.Player(document.getElementById(l),r)},!1)}else if(d.attr("data-kaltura")){l="VIDEOBOX_k_"+Math.floor(100*Math.random())+t;i.id="VIDEOBOX_createTag_k",d.attr("id",l),d.attr("itemprop","video"),d.attr("itemscope",!0),d.attr("itemtype","http://schema.org/VideoObject"),d.css({width:n.width+"px",height:n.height+"px"}),document.getElementById("VIDEOBOX_createTag_k")||(i.src="https://cdnapisec.kaltura.com/p/"+n.partner_id+"/sp/"+n.partner_id+"00/embedIframeJs/uiconf_id/"+n.uiconf_id+"/partner_id/"+n.partner_id,o.parentNode.insertBefore(i,o)),i.addEventListener("load",function(e){kWidget.embed({targetId:l,wid:"_"+n.partner_id,uiconf_id:n.uiconf_id,entry_id:n.entry_id,flashvars:{sourceSelector:{plugin:!0,switchOnResize:n.switchOnResize,simpleFormat:n.simpleFormat,displayMode:n.displayMode,hideSource:n.hideSource},"mediaProxy.preferedFlavorBR":"1600",autoPlay:n.autoPlay,inlineScript:n.inlineScript}})},!1)}}),window.onYouTubeIframeAPIReady=function(){e.each(a,function(t,a){var i=e(a),o="VIDEOBOX_"+Math.floor(100*Math.random())+t;if(i.attr("data-youtube")){i.attr("id",o);var r=i.attr("data-youtube").match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);return new YT.Player(o,{height:d.height,width:d.width,videoId:r[1],playerVars:{autohide:d.autohide,autoplay:d.autoplay,cc_load_policy:d.cc_load_policy,color:d.color,controls:d.controls,disablekb:d.disablekb,enablejsapi:d.enablejsapi,fs:d.fs,hl:d.hl,iv_load_policy:d.iv_load_policy,loop:d.loop,modestbranding:d.modestbranding,showinfo:d.showinfo,height:d.height,width:d.width}})}})}}})}(jQuery);