﻿/*!
* jQuery YouTube Popup Player Plugin v1.0
* http://lab.abhinayrathore.com/jquery_youtube/
* Last Updated: Aug 15 2011
*/
(function(d) { var a = null; var b = { init: function(e) { e = d.extend({}, d.fn.YouTubePopup.defaults, e); if (a == null) { a = d("<div></div>").css({ display: "none", padding: 0 }); d("body").append(a); a.dialog({ autoOpen: false, resizable: false, draggable: e.draggable, modal: e.modal, close: function() { a.html("") } }) } return this.each(function() { var g = d(this); var f = g.data("YouTube"); if (!f) { g.data("YouTube", { target: g, active: true }); d(g).bind("click.YouTubePopup", function() { var j = e.youtubeId; if (d.trim(j) == "") { j = g.attr(e.idAttribute) } var h = e.title; if (d.trim(h) == "") { h = g.attr("title") } var i = "http://www.youtube.com/embed/" + j + "?rel=0&showsearch=0&autohide=" + e.autohide; i += "&autoplay=" + e.autoplay + "&color1=" + e.color1 + "&color2=" + e.color2; i += "&controls=" + e.controls + "&fs=" + e.fullscreen + "&loop=" + e.loop; i += "&hd=" + e.hd + "&showinfo=" + e.showinfo + "&color=" + e.color + "&theme=" + e.theme; a.html(c(i, e.width, e.height)); a.dialog({ width: "auto", height: "auto" }); a.dialog({ minWidth: e.width, minHeight: e.height, title: h }); a.dialog("open"); return false }) } }) }, destroy: function() { return this.each(function() { d(this).unbind(".YouTubePopup"); d(this).removeData("YouTube") }) } }; function c(f, h, e) { var g = '<iframe title="YouTube video player" style="margin:0; padding:0;" width="' + h + '" '; g += 'height="' + e + '" src="' + f + '" frameborder="0" allowfullscreen></iframe>'; return g } d.fn.YouTubePopup = function(e) { if (b[e]) { return b[e].apply(this, Array.prototype.slice.call(arguments, 1)) } else { if (typeof e === "object" || !e) { return b.init.apply(this, arguments) } else { d.error("Method " + e + " does not exist on jQuery.YouTubePopup") } } }; d.fn.YouTubePopup.defaults = { youtubeId: "", title: "", idAttribute: "rel", draggable: false, modal: true, width: 640, height: 480, autohide: 2, autoplay: 1, color: "red", color1: "FFFFFF", color2: "FFFFFF", controls: 1, fullscreen: 1, loop: 0, hd: 1, showinfo: 0, theme: "light"} })(jQuery);
