/*! * jQuery YouTube Popup Player Plugin v2.1 * http://lab.abhinayrathore.com/jquery_youtube/ * Last Updated: May 23 2012 */ (function(e){var b=null;var c={init:function(f){f=e.extend({},e.fn.YouTubePopup.defaults,f);if(b==null){b=e("
").css({display:"none",padding:0});e("body").append(b);b.dialog({autoOpen:false,resizable:false,draggable:f.draggable,modal:f.modal,close:function(){b.html("");e(".ui-dialog-titlebar").show()}})}return this.each(function(){var h=e(this);var g=h.data("YouTube");if(!g){h.data("YouTube",{target:h,active:true});e(h).bind("click.YouTubePopup",function(){var k=f.youtubeId;if(e.trim(k)==""){k=h.attr(f.idAttribute)}var i=e.trim(f.title);if(i==""){if(f.useYouTubeTitle==true){a(k)}else{i=h.attr("title")}}var j="http://www.youtube.com/embed/"+k+"?rel=0&showsearch=0&autohide="+f.autohide;j+="&autoplay="+f.autoplay+"&color1="+f.color1+"&color2="+f.color2;j+="&controls="+f.controls+"&fs="+f.fullscreen+"&loop="+f.loop;j+="&hd="+f.hd+"&showinfo="+f.showinfo+"&color="+f.color+"&theme="+f.theme;b.html(d(j,f.width,f.height));b.dialog({width:"auto",height:"auto"});b.dialog({minWidth:f.width,minHeight:f.height,title:i});b.dialog("open");e(".ui-widget-overlay").fadeTo("fast",f.overlayOpacity);if(f.hideTitleBar&&f.modal){e(".ui-dialog-titlebar").hide();e(".ui-widget-overlay").click(function(){b.dialog("close")})}if(f.clickOutsideClose&&f.modal){e(".ui-widget-overlay").click(function(){b.dialog("close")})}return false})}})},destroy:function(){return this.each(function(){e(this).unbind(".YouTubePopup");e(this).removeData("YouTube")})}};function d(g,i,f){var h='';return h}function a(g){var f="https://gdata.youtube.com/feeds/api/videos/"+g+"?v=2&alt=json";e.ajax({url:f,dataType:"jsonp",cache:true,success:function(h){b.dialog({title:h.entry.title.$t})}})}e.fn.YouTubePopup=function(f){if(c[f]){return c[f].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof f==="object"||!f){return c.init.apply(this,arguments)}else{e.error("Method "+f+" does not exist on jQuery.YouTubePopup")}}};e.fn.YouTubePopup.defaults={youtubeId:"",title:"",useYouTubeTitle:true,idAttribute:"rel",draggable:false,modal:true,width:640,height:480,hideTitleBar:false,clickOutsideClose:false,overlayOpacity:0.5,autohide:2,autoplay:1,color:"red",color1:"FFFFFF",color2:"FFFFFF",controls:1,fullscreen:1,loop:0,hd:1,showinfo:0,theme:"light"}})(jQuery);