define("discourse/plugins/lazy-yt/initializers/lazyYT",["exports","discourse/lib/plugin-api","../lib/lazyYT"],(function(a,t,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l={name:"apply-lazyYT",initialize:function(){(0,t.withPluginApi)("0.1",(function(a){(0,e.default)($),a.decorateCooked((function(t){0!==$(".lazyYT",t).length&&$(".lazyYT",t).lazyYT({onPlay:function(t,e){var l=parseInt(e.closest("article").data("post-id"),10);l&&a.preventCloak(l)}})}),{id:"discourse-lazyyt"})}))}};a.default=l})),define("discourse/plugins/lazy-yt/lib/lazyYT",["exports","discourse-common/lib/escape"],(function(a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default= /*! * lazyYT (lazy load YouTube videos) * v1.0.1 - 2014-12-30 * (CC) This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. * http://creativecommons.org/licenses/by-sa/4.0/ * Contributors: https://github.com/tylerpearson/lazyYT/graphs/contributors || https://github.com/daugilas/lazyYT/graphs/contributors * * Usage:
loading...
* * Note: Discourse has forked this from the original, beware when updating the file. * */ function(a){a.fn.lazyYT=function(e){var l=a.extend({default_ratio:"16:9",callback:null,container_class:"lazyYT-container"},e);return this.each((function(){!function(e,l){var i,s,u,d=e.data("width"),c=e.data("height"),n=e.data("ratio")?e.data("ratio"):l.default_ratio,o=e.data("youtube-id"),p=e.data("youtube-title"),r=[],h=e.data("parameters")||"";n=n.split(":"),"number"==typeof d&&"number"==typeof c?(e.width(d),i=c+"px"):"number"==typeof d?(e.width(d),i=d*n[1]/n[0]+"px"):(0===(d=e.width())&&(d=e.parent().width()),i=n[1]/n[0]*100+"%"),r.push('
'),r.push('
"),r.push(""),r.push(''),r.push(''),r.push(""),r.push("
"),r.push("
"),r.push('
'),r.push('
'),r.push('"),r.push("
"),r.push("
");var f=e[0].querySelector(".ytp-thumbnail-image");e.css({"padding-bottom":i}).html(r.join("")),u=d>640?"maxresdefault.jpg":d>480?"sddefault.jpg":d>320?"hqdefault.jpg":d>120?"mqdefault.jpg":0===d?"hqdefault.jpg":"default.jpg",f?e.find(".ytp-thumbnail").append(f):e.find(".ytp-thumbnail").append(a([''].join(""))),s=e.find(".ytp-thumbnail").addClass("lazyYT-image-loaded").on("click",(function(a){a.preventDefault(),!e.hasClass("lazyYT-video-loaded")&&s.hasClass("lazyYT-image-loaded")&&e.html('').addClass("lazyYT-video-loaded"),l.onPlay&&l.onPlay(a,e)}))}(a(this).addClass(l.container_class),l)}))}}})); //# sourceMappingURL=/assets/plugins/lazy-yt-4e94ac3522a311236b5b7b0cf0ad4f98ee8632f45a4c686ac5b6676fcabe6f78.js.map