/*! * lazyyt * v0.3.1 - 2014-03-07 * Copyright (c) 2014 Tyler Pearson (http://tylerp.me); Licensed MIT %> */!function(a){"use strict";function b(b){var c=b,d=c.data("width"),e=c.data("height"),f=c.data("youtube-id"),g=c.data("parameters")||"";if("undefined"==typeof d||"undefined"==typeof e||"undefined"==typeof f)throw new Error("lazyYT is missing a required data attribute.");c.css({position:"relative",height:e,width:d,background:"url(https://img.youtube.com/vi/"+f+"/maxresdefault.jpg) center center no-repeat",cursor:"pointer","-webkit-background-size":"cover","-moz-background-size":"cover","-o-background-size":"cover","background-size":"cover"}).html('

').addClass("lazyYT-image-loaded"),a.getJSON("https://gdata.youtube.com/feeds/api/videos/"+f+"?v=2&alt=json",function(b){a("#lazyYT-title-"+f).text(b.entry.title.$t)}),c.on("click",function(a){a.preventDefault(),!c.hasClass("lazyYT-video-loaded")&&c.hasClass("lazyYT-image-loaded")&&c.html('').removeClass("lazyYT-image-loaded").addClass("lazyYT-video-loaded")})}a.fn.lazyYT=function(){return this.each(function(){var c=a(this).css("cursor","pointer");b(c)})}}(jQuery);