${e.sites[t].site.length>7?'
':""+e.sites[t].site+"
"}`)}))}}),$(document).on("click",".innerTalking",(function(){var e=$(this).find(".activeTalk"),t=$(this).closest(".scene"),a=$(this).closest(".element");$(e).next("p").length>0?($(e).empty(),$(e).removeClass("activeTalk"),$(e).next("p").addClass("activeTalk"),startMajorityVoteTalk(a)):$(t).next(".scene").length>0?($(t).next(".scene").addClass("active"),$(t).find(".activeTalk").removeClass("activeTalk"),$(t).removeClass("active"),$(t).next(".scene").find(".innerTalking p").eq(0).addClass("activeTalk"),startMajorityVoteTalk(a)):($(".activeTalk").removeClass("activeTalk"),$(this).closest(".element").find(".active").removeClass("active"),$(this).closest(".element").find(".scene").eq(0).addClass("active"),$(this).closest(".element").find(".scene.active .innerTalking p").eq(0).addClass("activeTalk"),startMajorityVoteTalk(a))})),$(document).on("click",".spotItem",(function(){$(amaCtx).find("img").remove(),$(amaCtx).find(".askExtra").append(``),$(amaCtx).data("song",$(this).find("h5").text()),$(amaCtx).data("artist",$(this).find("p").text()),$(amaCtx).data("sound",$(this).find(".spotMeta").attr("data-sound")),$(".spotSearch").removeClass("bringUp")})),$(document).on("click",".askExtra",(function(){amaCtx=$(this).closest(".element"),$(".spotSearch").addClass("bringUp")})),$(document).on("click",".spotSearch .closer",(function(){$(".spotSearch").removeClass("bringUp")})),$(document).on("click",".element[data-scrollto]",(function(e){e.stopImmediatePropagation();var t=$(this).data("scrollto").trim();$("html, body").animate({scrollTop:$(`.element[data-uid=${t}]`).offset().top},400)})),$(window).on("load",(function(){$(".element[data-type=blogcontent]").each((function(){var e=$(this)[0].getBoundingClientRect(),t=parseFloat($(this).css("--h")),a=parseFloat($(this).css("--y")),n=calculateH(e.height)-t;$(".element").not(this).each((function(){var i=$(this)[0].getBoundingClientRect();if(i.lefte.left){var s=parseFloat($(this).css("--y"));s>=a+t&&$(this).css("--y",s+n)}}))})),calculateEditorHeight()})),$(document).on("click","a",(function(){if($(this).find(".element[data-type=button2]").length>0){var e=$(this).text().trim();ok.track("clicked: "+e)}}));var extraInfo=[];$(document).on("click",".memeControls i.fa-plus",(function(){$(this).closest(".element").find(".memeGallery").fadeIn(100)})),$(".memeGallery input").keyup((function(){var e=this;debounce((function(){var t=$(e).val();$.ajax({url:"/search/stickers",method:"POST",data:{query:t},success:function(t){$(e).closest(".element").find(".memeGallResults").empty();for(var a=0;a`)}})}),300)()})),$(document).on("click",".memeControls i.fa-plus,.memeInp i",(function(){$(this).closest(".element").find(".memeGallery").toggleClass("showMemeGallery")})),$(".element[data-type=memegen]").each((function(){const e=$(this),t=e.find(".officialMemeContainer"),a="container-"+Math.random().toString(36).substr(2,9);t.attr("id",a);const n=new Konva.Stage({container:a,width:t.outerWidth(),height:t.outerHeight()}),i=new Konva.Layer;n.add(i);const s=$(this).data("img"),o=new Image;let l;o.crossOrigin="anonymous",o.src=s,o.onload=function(){const e=n.width(),t=n.height(),a=o.width,s=o.height,c=Math.max(e/a,t/s),r=a*c,d=s*c,m=(e-r)/2,h=(t-d)/2;l=new Konva.Image({image:o,x:m,y:h,width:r,height:d,listening:!1}),i.add(l),i.moveToBottom(),i.draw()},e.on("click",".memeGallResults img",(function(){const t=new Image;t.crossOrigin="anonymous",t.src=$(this).attr("src"),$(this).closest(".memeGallery").removeClass("showMemeGallery"),t.onload=function(){let a=1;a=t.width>t.height?100/t.width:100/t.height;const s=t.width*a,o=t.height*a,l=new Konva.Image({image:t,x:(n.width()-s)/2,y:(n.height()-o)/2,width:s,height:o,draggable:!0});i.add(l),i.draw();const c=new Konva.Transformer({nodes:[l],rotateEnabled:!0,enabledAnchors:["top-left","top-right","bottom-left","bottom-right","middle-left","middle-right","top-center","bottom-center"],flipEnabled:!0,stroke:"black",strokeWidth:2,anchorStroke:"black",anchorFill:"black",anchorSize:6,borderStroke:"black",borderStrokeWidth:1});i.add(c),i.draw();const r=e.find(".stickerButtons");l.on("click",(function(){c.nodes([l]),i.draw(),r.addClass("showMemeGallery")})),n.on("click",(function(e){e.target===n&&(c.nodes([]),i.draw(),r.removeClass("showMemeGallery"))})),r.find(".fa-trash").on("click",(function(){l.destroy(),c.destroy(),i.draw(),r.removeClass("showMemeGallery")})),r.addClass("showMemeGallery")}})),e.find(".downloadMeme").on("click",(function(){const e=n.find("Transformer");e.forEach((e=>e.hide())),i.draw();const t=n.toDataURL({pixelRatio:3});e.forEach((e=>e.show())),i.draw();const a=document.createElement("a");a.href=t,a.download="meme.png",document.body.appendChild(a),a.click(),document.body.removeChild(a)})),e.find(".resetMeme").on("click",(function(){i.destroyChildren(),i.add(l),i.draw()})),e.find(".changeBackground").on("click",(function(){const e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=function(e){const t=e.target.files[0],a=new FileReader;a.onload=function(e){const t=new Image;t.src=e.target.result,t.crossOrigin="anonymous",t.onload=function(){const e=n.width(),a=n.height(),s=t.width,o=t.height,c=Math.max(e/s,a/o),r=s*c,d=o*c,m=(e-r)/2,h=(a-d)/2;l.image(t),l.width(r),l.height(d),l.position({x:m,y:h}),i.draw()}},a.readAsDataURL(t)},e.click()}))}))