(function(n){n.fn.YouTubePopUp=function(t){var i=n.extend({autoplay:1},t);n(this).on("click",function(t){var r=n(this).attr("href"),u,f,s,e,o;r.match(/(youtube.com)/)&&(u="v=",f=1);(r.match(/(youtu.be)/)||r.match(/(vimeo.com\/)+[0-9]/))&&(u="/",f=3);r.match(/(vimeo.com\/)+[a-zA-Z]/)&&(u="/",f=5);s=r.split(u)[f];e=s.replace(/(&)+(.*)/,"");(r.match(/(youtu.be)/)||r.match(/(youtube.com)/))&&(o="https://www.youtube.com/embed/"+e+"?autoplay="+i.autoplay+"&rel=0");(r.match(/(vimeo.com\/)+[0-9]/)||r.match(/(vimeo.com\/)+[a-zA-Z]/))&&(o="https://player.vimeo.com/video/"+e+"?autoplay="+i.autoplay+"&rel=0");n("body").append('<div class="YouTubePopUp-Wrap YouTubePopUp-animation"><div class="YouTubePopUp-Content"><span class="YouTubePopUp-Close"><\/span><iframe src="'+o+'" allowfullscreen><\/iframe><\/div><\/div>');n(".YouTubePopUp-Wrap").hasClass("YouTubePopUp-animation")&&setTimeout(function(){n(".YouTubePopUp-Wrap").removeClass("YouTubePopUp-animation")},600);n(".YouTubePopUp-Wrap, .YouTubePopUp-Close").click(function(){n(".YouTubePopUp-Wrap").addClass("YouTubePopUp-Hide").delay(515).queue(function(){n(this).remove()})});t.preventDefault()});n(document).keyup(function(t){t.keyCode==27&&n(".YouTubePopUp-Wrap, .YouTubePopUp-Close").click()})}})(jQuery)