function init(){for(var t=document.getElementsByTagName("img"),n=0;n<t.length;n++)t[n].getAttribute("data-src-nomobile")&&isMobileDevice()===!1&&t[n].setAttribute("src",t[n].getAttribute("data-src-nomobile")),t[n].getAttribute("data-src")&&t[n].setAttribute("src",t[n].getAttribute("data-src"))}function articleHasInlineImage(){var n=$("article img"),t=$("article picture");return n.length+t.length>0?!0:!1}function addFancyboxToInlineImages(){$("article img, article picture").each(function(){var n=$(this).attr("src");$(this).closest("a").attr("href",n);$(this).closest("a").attr("data-fancybox","gallery")})}function createDiv(n){var t=$(n).closest("tr"),i;t=$(t);$("#urlRow").remove();i='<tr id="urlRow"><td colspan="4"><div style="text-align:right"><a href="javascript:void(0);" onclick="removeUrlBox();"><span class="glyphicon glyphicon-remove"><\/span><\/a><\/p><\/div><textarea class="form-control" id="urlBox" rows="3" cols="30" spellcheck="false"><\/textarea><span class="alert alert-success" style="float:right"><b>'+document.getElementById("copySuccessMessage").value+"<\/b><\/span><\/td><\/tr>";$(i).insertAfter(t);console.log(i)}function removeUrlBox(){$("#urlRow").remove()}function scrollFunction(){document.getElementById("scrollToTop").style.display=document.body.scrollTop>400||document.documentElement.scrollTop>400?"block":"none"}function topFunction(){document.body.scrollTop=0;document.documentElement.scrollTop=0;ga("send",{hitType:"event",eventCategory:"ShortcutArticle",eventAction:"ScrollToTop",eventLabel:document.getElementById("programName").value})}function sticky_ad_relocate(){var n=$(window).scrollTop(),t=$("#sticky-left-ad-anchor").offset().top;n>t?($("#sticky-left-ad").addClass("stick"),$("#sticky-left-ad-anchor").height($("#sticky-left-ad").outerHeight())):($("#sticky-left-ad").removeClass("stick"),$("#sticky-left-ad-anchor").height(0))}function autoscrollAd(){var n=$(window).scrollTop()+dir;n>=MAX_TOP_AD?(n=MAX_TOP_AD,dir=-1):n<=MIN_TOP_AD&&(n=MIN_TOP_AD,dir=1);$(window).scrollTop(n);window.setTimeout(autoscrollAd,100)}function sticky_relocate(){var n=$(window).scrollTop(),t=$("#sticky-anchor").offset().top;n>t?(sticked=!0,$("#sticky").addClass("stick"),$("#sticky-anchor").height($("#sticky").outerHeight())):($("#sticky").removeClass("stick"),mobileContentsBarUpdated&&mobileContentsBar.html(mobileContentsBar.attr("initialText")),mobileContentsBarUpdated=!1,sticked=!1,$("#sticky-anchor").height(0))}function autoscroll(){var n=$(window).scrollTop()+dir;n>=MAX_TOP?(n=MAX_TOP,dir=-1):n<=MIN_TOP&&(n=MIN_TOP,dir=1);$(window).scrollTop(n);window.setTimeout(autoscroll,100)}function scrollDownALittle(){var n=$(window).scrollTop();$(window).scrollTop(n-50)}function copyEmbedCodeButton(n){getUrl=document.getElementById("urlAbsolute").value+"?sid="+n+"&lng="+document.getElementById("shortLang").value;getExampleUrl=document.getElementById("urlAbsolute").value+"?sid="+n+"&lng="+document.getElementById("shortLang").value+"&example=true";$.post(document.getElementById("incrementInteraction").value,{i:n},function(){})}function delay(n,t){var i=0;return function(){var r=this,u=arguments;clearTimeout(i);i=setTimeout(function(){n.apply(r,u)},t||0)}}function enableShareButtonAcc(){$(".shareButtonAcc").show()}function disableShareButtonAcc(){$(".shareButtonAcc").hide()}function matchRule(n,t){var r=n=>n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),i;return t=t.split("*").map(r).join(".*"),t="^"+t+"$",i=new RegExp(t),i.test(n)}function scrollToId(n,t){var i=document.getElementById("inlineSearch").value;i.length>0&&clearSearchOutsideSearchBox();$("html, body").animate({scrollTop:$("#"+n).offset().top-44},500);openAccordion(n);typeof ga=="function"&&ga("send",{hitType:"event",eventCategory:"ShortcutArticle",eventAction:"ScrollToHeader with"+t,eventLabel:"Scroll in "+document.getElementById("programName").value})}function scrollToHash(){if(window.location.hash){var n=window.location.hash;$("html, body").animate({scrollTop:$(n).offset().top-100},1500,"swing");$(n).addClass("highlight")}}function clearSearch(){document.getElementById("matchCountOuter").style.visibility="hidden";$("Article").find("button").css({"padding-top":"","padding-bottom":"",margin:""});$("Article").find("button").children("h2").css({"font-size":""});$("Article").unmark({});$("Article").find("button").show();$("Article").find(".panel").css({margin:""});$(".inlineAd").show()}function clearSearchOutsideSearchBox(){clearSearch();enablePanels();$("Article").find("tr").css({display:""});document.getElementById("inlineSearch").value=""}function expandAllAccordions(){for(var t=document.getElementsByClassName("accordion"),n=0;n<t.length;n++)t[n].classList.add("active");expandAllAccordionsSetHeight()}function expandAllAccordionsSetHeight(){for(var t=document.getElementsByClassName("panel"),n=0;n<t.length;n++)t[n].style.maxHeight=t[n].scrollHeight+"px"}function openAccordion(n){var t=$("#"+n).children("button"),i=t[0].nextElementSibling;t[0].classList.add("active");i.style.maxHeight=i.scrollHeight+"px"}function disablePanels(){$("Article").find("button").prop("disabled",!0)}function enablePanels(){$("Article").find("button").prop("disabled",!1)}function isUpperCase(n){var t=n;return t==t.toUpperCase()?!0:t==t.toLowerCase()?!1:void 0}function expandLongDesc(n){$("#longDesc-"+n).collapse("toggle")}function removeVoteProtector(n){removeVoteProtectorMain(n,removeVoteProtectionOff)}function removeVoteProtectorMain(n,t){$(n).hide();timer2=setTimeout(function(){t(n)},disappearTime)}function removeVoteProtectionOff(n){isMobileDevice()&&$(n).show()}function likeArticle(n,t){$.post(document.getElementById("likeArticleAction").value,{programId:n,vote:t},function(i){var s=i.undoVote,f=i.reverseVote,h=i.likeCount,c=i.dislikeCount,u="thumbsUpDownPressed",a="voteButton-"+n,e=$("#thumbsUp-button"),o=$("#thumbsDown-button"),v=this.url,l='onclick="vote('+n+", '"+t+"')\"",r="vote("+n+", '"+t+"')",y="<a href='javascript:void(0)' "+l+">Undo<\/a>";if($("#likeCount").text(h),$("#dislikeCount").text(c),s)o.removeClass(u),e.removeClass(u),showNotification(document.getElementById("shortcutLikeUndo").value,""),writeGoogleAnalyticsEvent("VotePage","UndoVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value);else if(i===0)showNotification(document.getElementById("shortcutLikeError").value,"");else{switch(t){case"up":e.addClass(u);f&&(o.removeClass(u),r=r.replace("up","down"),r=r.replace("down","up"),writeGoogleAnalyticsEvent("VotePage","ReverseVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value));break;case"down":o.addClass(u);f&&(e.removeClass(u),r=r.replace("up","down"),r=r.replace("down","up"),writeGoogleAnalyticsEvent("VotePage","ReverseVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value))}showNotification(document.getElementById("shortcutLikeSuccess").value);f||writeGoogleAnalyticsEvent("VotePage",t+"Vote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value)}})}function likeCount(n,t){$.post(document.getElementById("likeDislikeAction").value,{Id:n,thumbUp:t},function(t){var u=document.getElementById(n).getElementsByClassName("likeCount")[0],f=document.getElementById(n).getElementsByClassName("dislikeCount")[0],i=document.getElementById(n).getElementsByClassName("icon-thumbs-up")[0],r=document.getElementById(n).getElementsByClassName("icon-thumbs-down")[0];u.innerText=t.like;f.innerText=t.dislike;t.activeButton==="thumbUp"&&(i.className="icon icon-green icon-thumbs-up",r.className="icon icon-thumbs-down");t.activeButton==="thumbDown"&&(i.className="icon icon-thumbs-up",r.className="icon icon-red icon-thumbs-down");t.activeButton==="none"&&(i.className="icon icon-thumbs-up",r.className="icon icon-thumbs-down")})}function vote(n,t){$.post(document.getElementById("voteShortcutAction").value,{id:n,vote:t},function(i){setTimeout(function(){fetchUpdatedPage()},1e4);var h=i.remainingVotes,v=i.voteDirection,c=i.undoVote,f=i.reverseVote,l=i.point,u="icon-green",e="voteButton-"+n,o=$("#"+e).find(".voteUpButton"),s=$("#"+e).find(".voteDownButton"),y=this.url,a='onclick="vote('+n+", '"+t+"')\"",r="vote("+n+", '"+t+"')",p="<a href='javascript:void(0)' "+a+">Undo<\/a>";if($("#"+e).find(".votePoints").text(l),c)s.removeClass(u),o.removeClass(u),showNotification(document.getElementById("shortcutVoteUndo1").value+" "+h+" "+document.getElementById("shortcutVoteUndo2").value,""),writeGoogleAnalyticsEvent("VoteShortcut","UndoVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value);else if(i===0)showNotification(document.getElementById("voteNotificationWaitNotification").value,""),writeGoogleAnalyticsEvent("VoteShortcut","OutOfVotes","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value);else{switch(t){case"up":o.addClass(u);f&&(s.removeClass(u),r=r.replace("up","down"),r=r.replace("down","up"),writeGoogleAnalyticsEvent("VoteShortcut","ReverseVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value));break;case"down":s.addClass(u);f&&(o.removeClass(u),r=r.replace("up","down"),r=r.replace("down","up"),writeGoogleAnalyticsEvent("VoteShortcut","ReverseVote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value))}showNotification(document.getElementById("shortcutVoteSuccess1").value+" "+h+" "+document.getElementById("shortcutVoteSuccess2").value+" ",r);f||writeGoogleAnalyticsEvent("VoteShortcut",t+"Vote","Vote in: "+document.getElementById("programName").value+" Lng: "+document.getElementById("shortLang").value)}console.log("Updated vote count.")})}function fetchUpdatedPage(){fetch(window.location.href).then(()=>console.log("Fetch voted page success.")).catch(()=>console.log("Fetch voted page failed."))}function writeGoogleAnalyticsEvent(n,t,i){typeof ga=="function"&&ga("send",{hitType:"event",eventCategory:n,eventAction:t,eventLabel:i})}var acc,sticked,MIN_TOP,MAX_TOP,getUrl,countAnalytics,accordionsExpandedOnce,disappearTime,timer,timer2,articlePanels,i,mobileContentsBar,mobileContentsBarUpdated;$(document).ready(function(){$("#REMOVEcommentGuestUser").attr("name","commentGuestUser");$("#REMOVEcommentGuestUser").attr("id","commentGuestUser");$("#commentForm").css("visibility","visible")});$(document).ready(function(){Modernizr.on("webp",function(n){var t;n?(t=document.getElementById("programImageWebp").value,$(".mobileOverlay").attr("style",t)):(t=document.getElementById("programImageNormal").value,$(".mobileOverlay").attr("style",t),$("#bigPlaceholder").remove(),$("#heroImage").css("position",""))})});window.onload=init;$("#heroImage").on("load",function(){if(!isMobileDevice()){var n=document.querySelector("#heroImage").naturalWidth,t=document.querySelector("#heroImage").naturalHeight;n<1050&&!articleHasInlineImage()?($("#heroAnchor").removeAttr("href"),$("#heroAnchor").removeAttr("data-fancybox")):(addFancyboxToInlineImages(),loadFancyboxNow())}}).each(function(){this.complete&&this.naturalHeight!==0&&$(this).trigger("load")});$(".copyButton").on("click",function(){var n;createDiv(this);var i=document.getElementById("urlBox"),r=this.id,u=document.getElementById("programName").value,t=$(this).parent().parent().parent().children("td").children("span").children("a").attr("id");t=t.trim();n=$(this).parent().parent().parent().children("td").children("p").children("span").text();n=n.trim();i.value=t+" ("+u+")\n"+n+"\n"+r;i.select();document.execCommand("copy");$.post(document.getElementById("incrementInteraction").value,{i:$(this).attr("shortcutArticleId")},function(){});ga("send",{hitType:"event",eventCategory:"CopyURL",eventAction:"CopyURL",eventLabel:r})});$("#favoriteKey").on("click",function(){ga("send",{hitType:"event",eventCategory:"Click",eventAction:"FeaturedShortcut",eventLabel:document.getElementById("programName").value})});for(window.onscroll=function(){scrollFunction()},acc=document.getElementsByClassName("accordion"),i=0;i<acc.length;i++)acc[i].onclick=function(){this.classList.toggle("active");var n=this.nextElementSibling;n.style.maxHeight?(n.style.maxHeight=null,n.classList.remove("panel-collapse","collapse","in"),n.classList.add("panel")):(n.style.maxHeight=n.scrollHeight+"px",n.classList.remove("panel-collapse","collapse","in"),n.classList.add("panel"))};$(function(){$(window).scroll(sticky_ad_relocate);sticky_ad_relocate()});var dir=1,MIN_TOP_AD=50,MAX_TOP_AD=150;sticked=!1;$(function(){$("#sticky-anchor").length&&($(window).scroll(sticky_relocate),sticky_relocate())});dir=1;MIN_TOP=200;MAX_TOP=350;$(document).ready(function(){var n=location.hash.substr(1),t,i;n&&($("#"+n).parent().parent().parent().prevAll("button:first").addClass("active").end().css("maxHeight",$("#"+n).parent().parent().parent().prop("scrollHeight")),$("#"+n).children("button").addClass("active"),$("#"+n).children(".panel").css("maxHeight",$("#"+n).children(".panel").prop("scrollHeight")),$("#"+n).addClass("highlight"),scrollDownALittle());t="longDesc-"+n;i=!!document.getElementById(t);i&&(console.log("Long text exists"),$("#"+t).collapse("show"))});$(document).ready(function(){var n=document.getElementById("programId").value,t=document.getElementById("commentCount").value,i=document.getElementById("LikeDislikeCount").value;$.post(document.getElementById("incrementView").value,{programId:n,lang:document.getElementById("shortLang").value},function(r){t==r.CommentCount&&i==r.LikeCount?console.log("Comments section is up to date! (Comment and like number is equal with db)"):(console.log("Comments section is not up to date! (Comment and like number is different than db. Comment section will be reloaded)"),document.getElementById("commentMobileCount").style.visibility="visible",document.getElementById("commentDesktopCount").style.visibility="visible",$(".commentCountSpan").text(r.CommentCount),$.get("/partial/getprogramcomment?id="+n+"&lang="+document.getElementById("shortLang").value,function(n){$("#commentList").replaceWith(n);scrollToHash()}))})});$(document).ready(function(){$("#email").hide()});$(window).on("shown.bs.modal",function(){function n(n){return $("<div />").html(n).text()}$.get(getUrl,function(n){var t=document.getElementById("embedCode");t.innerHTML=n;isMobileDevice()||($("#embedCode").focus(),$("#embedCode").select())});$.get(getExampleUrl,function(t){$("#embedExample").html(n(t))});ga("send",{hitType:"event",eventCategory:"embedButton",eventAction:"embedButton",eventLabel:"Embed preview: "+document.getElementById("programName").value})});$("#copyEmbedCode").on("click",function(){var t=document.getElementById("embedCode").value;const n=document.createElement("textarea");n.value=t;n.setAttribute("readonly","");n.style.position="absolute";n.style.left="-9999px";document.body.appendChild(n);n.select();document.execCommand("copy");document.body.removeChild(n)});$('button[data-toggle="tooltip"]').tooltip({animated:"fade",container:".modal-dialog",placement:"bottom",trigger:"click"});$("#copyEmbedCode").on("click",function(){setTimeout(function(){$(".modal-dialog > .tooltip").fadeOut("fast")},3e3)});$(".thumbnail").on("click",function(){ga("send",{hitType:"event",eventCategory:"LeftSiteThumbnailClick",eventAction:"LeftSiteThumbnailClick",eventLabel:document.getElementById("urlAbsolute").value})});$(document).ready(function(){var t;moment.locale(document.getElementById("shortLang").value);sessionStorage.getItem("timezone")||(t=jstz.determine()||"UTC",sessionStorage.setItem("timezone",t.name()));var i=sessionStorage.getItem("timezone"),o=moment().format("YYYY-MM-DD"),u=document.getElementById("dateCreated1").value+"T"+document.getElementById("dateCreated2").value+"Z",f=moment(u),r=f.tz(i),e=document.getElementById("shortLang").value,n;n=e==="tr"?r.format("D MMMM YYYY dddd HH:mm"):r.format("D MMM YYYY dddd h:mm A")+" ("+i+")";document.getElementById("dateCreatedInClientTime").innerText=n;document.getElementById("dateCreatedInClientTimeMobile").innerText=n});countAnalytics=!0;accordionsExpandedOnce=!1;$(document).ready(function(){var n=0;$("#inlineSearch, #clearInlineSearch").on("keyup click change copy paste cut",delay(function(){var t=$(this).val().toLowerCase(),i;$("Article").find("button").removeClass("hasMatch");t.length<1?(clearSearch(),enablePanels(),isMobileDevice()||enableShareButtonAcc()):($("Article").find("button").css({"padding-top":"1px","padding-bottom":"1px",margin:"0"}),$("Article").find("button").hide(),$("Article").find(".panel").css({margin:"0"}),$("Article").find("h2").css({"font-size":"22px"}),$(".inlineAd").hide(),disableShareButtonAcc(),disablePanels(),typeof ga=="function"&&countAnalytics===!0&&(ga("send",{hitType:"event",eventCategory:"ShortcutArticle",eventAction:"InlineSearch",eventLabel:"Inline search in "+document.getElementById("programName").value}),countAnalytics=!1),accordionsExpandedOnce===!1&&(expandAllAccordions(),accordionsExpandedOnce=!0));t.indexOf("+")>-1||t.indexOf("-")>-1?i=t.replace(/\+/g,"-").replace(/\s/g,""):t.indexOf("click")>-1?(t=t.replace("left click","leftclick"),t=t.replace("right click","rightclick"),t=t.replace("middle click","middleclick"),t=t.replace("double click","doubleclick"),t=t.replace("middle click","tripleclick"),console.log(t),i=t):t.indexOf(" ")>-1&&(i=t.replace(/\s\s+/g," ").replace(/\s/g,"-"));$("Article tr").filter(function(){var u=!1,f,r;$(this).find(".shortcutKey").attr("href")&&(u=$(this).find(".shortcutKey").attr("href").toLowerCase().indexOf(i)>-1);f=$(this).find("p").text().trim().toLowerCase();r=!1;matchRule(f,t)&&(r=!0);$(this).toggle($(this).text().toLowerCase().indexOf(t)>-1||u||r);($(this).text().toLowerCase().indexOf(t)>-1||u||r)&&($(this).parent().parent().parent().prev("button").addClass("hasMatch"),n++)});t.length>0&&(document.getElementById("matchCountOuter").style.visibility="visible",document.getElementById("matchCount").innerText=n);n=0;$("Article").find("button").hasClass("hasMatch")&&$(".hasMatch").show()},200))});$(function(){var n=function(){var n=$("input[id='inlineSearch']").val(),t={separateWordSearch:!1,exclude:["h2"]};$("Article").unmark({done:function(){$("Article").mark(n,t)}})};$("input[id='inlineSearch']").on("input",n)});document.addEventListener("keydown",function(n){n.keyCode===27&&clearSearchOutsideSearchBox()});disappearTime=6500;const underlinedElementName="underlined",originalTextElementName="original";for($(document).ready(function(){$(".hover").on("mouseover click",function(){$(this).find(".hoverVoteButtons").addClass("hoveredButton");$(this).find(".voteStar").css("visibility","hidden");var n=$(this);clearTimeout(timer);isMobileDevice()&&(timer=setTimeout(function(){$(n).find(".hoverVoteButtons").removeClass("hoveredButton");$(n).find(".voteStar").css("visibility","visible")},disappearTime))});$(".hover").on("mouseleave",function(){$(this).find(".hoverVoteButtons").removeClass("hoveredButton");$(this).find(".voteStar").css("visibility","visible")})}),$(document).ready(function(){$(".shortcutRow").click(function(){var n=$(this).find(".voteProtector");removeVoteProtector(n[0])})}),$(document).ready(function(){$("#optionsMenu").click(function(){writeGoogleAnalyticsEvent("Click","Options dropdown","Options button clicked.")})}),articlePanels=document.querySelectorAll("article .panel"),i=0;i<articlePanels.length;i++)articlePanels[i].classList.add("anything");$.fn.scrollStopped=function(n){var i=this,t=$(i);t.scroll(function(r){clearTimeout(t.data("scrollTimeout"));t.data("scrollTimeout",setTimeout(n.bind(i),250,r))})};$.fn.isOnScreen=function(){var i=$(window),t={top:i.scrollTop(),left:i.scrollLeft()},n;return t.right=t.left+i.width(),t.bottom=t.top+i.height()-65,n=this.offset(),n.right=n.left+this.outerWidth(),n.bottom=n.top+this.outerHeight()-65,!(t.right<n.left||t.left>n.right||t.bottom<n.top||t.top>n.bottom)};mobileContentsBar=$("#mobileContentsNav");mobileContentsBar.attr("initialText",mobileContentsBar.html());mobileContentsBarUpdated=!1;$(window).scrollStopped(function(){var n;if(isMobileDevice)for(n=articlePanels.length-1;n>=0;n--){var t=articlePanels[n].parentElement,i=t.id,r=t.querySelector("h2");$("#"+i).isOnScreen()==!0&&sticked==!0&&(mobileContentsBar.html(r.innerText.substring(0,48)+" <span class='caret'><\/span>"),mobileContentsBarUpdated=!0)}})