(function($,dla){var testScriptPath=window.localStorage.getItem("testScriptPath");if(testScriptPath){if(!window.usingTestScriptPath){console.log("Using "+testScriptPath);window.usingTestScriptPath=true;$("head").append('');return}}$(document).ready(function(){var quickpicksLotteries=["megaMillions","euroMillions","euroMillionsPlus","euroJackpot","powerBall","austriaLotto","swedishLotto","german6aus49","irishLotto","swissLotto","euroMillionsGo","uKLotto"];var copyConfig={"en-GB":{doubleOrNothing:true,root:"/",shoppingCartLink:"/shoppingcart",login:"Login",register:" Register",home:"HOME",toCart:"to cart",not:"Not",logout:"log out",back:"Back",at:"at",day:"day",days:"days",hours:"hrs",minutes:"mins",seconds:"secs",quickpick:"Quickpick",quickpicks:"Quickpicks",only:"Only",resultsFor:"Results from",betslip:"Betslip",syndicates:"Syndicates",results:"Results",magazine:"Magazine",faq:"Help & FAQ",month:{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},links:{syndicates:"/syndicates",results:"/results-winning-numbers",magazine:"/magazine",faq:"/help",account:"/account"}},en:{doubleOrNothing:false,root:"/en",shoppingCartLink:"/en/shoppingcart",login:"Login",register:" Register",home:"HOME",toCart:"to cart",not:"Not",logout:"log out",back:"Back",day:"day",days:"days",hours:"hrs",minutes:"mins",seconds:"secs",quickpick:"Quickpick",quickpicks:"Quickpicks",only:"Only",resultsFor:"Results from",betslip:"Betslip",syndicates:"Syndicates",results:"Results",magazine:"Magazine",faq:"Help & FAQ",month:{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},links:{syndicates:"",results:"/results-winning-numbers",magazine:"",faq:"/help",account:"/en/account"}},"en-CA":{doubleOrNothing:false,root:"/ca",shoppingCartLink:"/ca/shoppingcart",login:"Login",register:" Register",home:"HOME",toCart:"to cart",not:"Not",logout:"log out",back:"Back",day:"day",days:"days",hours:"hrs",minutes:"mins",seconds:"secs",quickpick:"Quickpick",quickpicks:"Quickpicks",only:"Only",resultsFor:"Results from",betslip:"Betslip",syndicates:"Syndicates",results:"Results",magazine:"Magazine",faq:"Help & FAQ",month:{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},links:{syndicates:"",results:"/results-winning-numbers",magazine:"",faq:"/help",account:"/ca/account"}},"en-AU":{doubleOrNothing:true,root:"/",shoppingCartLink:"/shoppingcart",login:"Login",register:" Register",home:"HOME",toCart:"to cart",not:"Not",logout:"log out",back:"Back",day:"day",days:"days",hours:"hrs",minutes:"mins",seconds:"secs",quickpick:"Quicky",quickpicks:"Quickies",only:"Only",resultsFor:"Results from",betslip:"Betslip",syndicates:"Syndicates",results:"Results",magazine:"Magazine",faq:"Help & FAQ",month:{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},links:{syndicates:"/syndicates",results:"/results",magazine:"/magazine",faq:"/help",account:"/account"}},"en-IE":{doubleOrNothing:true,root:"/",shoppingCartLink:"/shoppingcart",login:"Login",register:" Register",home:"HOME",toCart:"to cart",not:"Not",logout:"log out",back:"Back",day:"day",days:"days",hours:"hrs",minutes:"mins",seconds:"secs",quickpick:"Quickpick",quickpicks:"Quickpicks",only:"Only",resultsFor:"Results from",betslip:"Betslip",syndicates:"Syndicates",results:"Results",magazine:"Magazine",faq:"Help & FAQ",month:{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},links:{syndicates:"/syndicates",results:"/results-winning-numbers",magazine:"/magazine",faq:"/help",account:"/account"}},de:{reduced:true,doubleOrNothing:true,root:"/",shoppingCartLink:"/warenkorb",login:"Anmelden",register:"Neues Konto",home:"Startseite",toCart:"Warenkorb",not:"Nicht",logout:"Abmelden",back:"Zurück",day:"Tag",days:"Tage",hours:"Std.",minutes:"Min.",seconds:"Sek.",quickpick:"Zufallstipp",quickpicks:"Zufallstipps",only:"Nur",resultsFor:"Zahlen vom",betslip:"Tippschein",syndicates:"Spielgemeinschaften",results:"Zahlen & Quoten",magazine:"Magazin",faq:"Hilfe & FAQ",month:{1:"Jan.",2:"Feb.",3:"Mär.",4:"Apr.",5:"Mai",6:"Jun.",7:"Jul.",8:"Aug.",9:"Sep.",10:"Oct.",11:"Nov.",12:"Dez."},links:{syndicates:"",results:"/zahlen-quoten",magazine:"/magazin",faq:"/hilfe",account:"/meinlottoland"}},"de-CH":{reduced:true,doubleOrNothing:true,root:"/ch",shoppingCartLink:"/ch/warenkorb",login:"Anmelden",register:"Neues Konto",home:"Startseite",toCart:"Warenkorb",not:"Nicht",logout:"Abmelden",back:"Zurück",day:"Tag",days:"Tage",hours:"Std.",minutes:"Min.",seconds:"Sek.",quickpick:"Zufallstipp",quickpicks:"Zufallstipps",only:"Nur",resultsFor:"Zahlen vom",betslip:"Tippschein",syndicates:"Spielgemeinschaften",results:"Zahlen & Quoten",magazine:"Magazin",faq:"Hilfe & FAQ",month:{1:"Jan.",2:"Feb.",3:"Mär.",4:"Apr.",5:"Mai",6:"Jun.",7:"Jul.",8:"Aug.",9:"Sep.",10:"Oct.",11:"Nov.",12:"Dez."},links:{syndicates:"",results:"/zahlen-quoten",magazine:"/magazin",faq:"/hilfe",account:"/ch/meinlottoland"}},"de-AT":{doubleOrNothing:true,root:"/",shoppingCartLink:"/warenkorb",login:"Anmelden",register:"Neues Konto",home:"Startseite",toCart:"Warenkorb",not:"Nicht",logout:"Abmelden",back:"Zurück",day:"Tag",days:"Tage",hours:"Std.",minutes:"Min.",seconds:"Sek.",quickpick:"Zufallstipp",quickpicks:"Zufallstipps",only:"Nur",resultsFor:"Zahlen vom",betslip:"Tippschein",syndicates:"Spielgemeinschaften",results:"Zahlen & Quoten",magazine:"Magazin",faq:"Hilfe & FAQ",month:{1:"Jan.",2:"Feb.",3:"Mär.",4:"Apr.",5:"Mai",6:"Jun.",7:"Jul.",8:"Aug.",9:"Sep.",10:"Oct.",11:"Nov.",12:"Dez."},links:{syndicates:"",results:"/zahlen-quoten",magazine:"/magazin",faq:"/hilfe",account:"/meinlottoland"}}};var addLotteryOptsToRestyledMenu=function(){var lotteryOptionsMenu={lang:"",loggedIn:"",isReduced:"",injectHtml:function(){var self=this;var copy=copyConfig[self.lang];var optsMenu=""+'
'+'
'+'
'+copy.back+"
"+'
'+'
'+'
'+''+"
"+'
'+'
'+'
'+'
'+'
'+'
'+'
'+"
"+'
'+'
'+'
'+'
'+"
"+"
"+"
"+'
'+'
'+'
'+"
"+""+"
";$(".page-menu-and-main-restyle .page-menu").append(optsMenu)},injectLotteryOptsLinks:function(){var self=this;$(".page-menu-and-main-restyle .menu-lotteries ul.list li").each(function(){var lotteryId=self.getLotteryId($(this));var lotteryData=$(".js-lotteryInfo."+lotteryId);var isInList=quickpicksLotteries.indexOf(lotteryId)>-1;if(lotteryData.length&&isInList){var url=$(this).find("a").prop("href");var optLink='
';$(this).append(optLink)}})},getRelativeLink:function(url){var host=window.location.hostname;var port=window.location.port;if(port){host=host+":"+port}return url.split(host+"/")[1]},getLotteryId:function($lotteryLi){var itemClass=$lotteryLi.prop("class")||$lotteryLi.find("a").text().trim().toLowerCase().replace(/ /g,"-");return itemClass.split(" ")[0]},addEventListeners:function(){var self=this;$(".page-menu-and-main-restyle .opts").click(function(){self.openLotteryOpts($(this).data("lottery"),$(this).data("url"),$(this).siblings("a").text().trim())});$(".page-menu-and-main-restyle .backBtn").click(function(){self.closeLotteryOpts()});$(".page-menu-and-main-restyle .menu-button").click(function(event){event.preventDefault();self.closeLotteryOpts()});$(window).resize(self.fixAndroidViewport)},getTimeTo:function(time){var day,month,year,hour;if(typeof time!=="undefined"){if(time.indexOf("/")!==-1){day=time.split("/")[0];month=time.split("/")[1];year=time.split("/")[2].split(" ")[0]}else{day=time.split(".")[0];month=time.split(".")[1];year=time.split(".")[2].split(" ")[0]}}else{day=time.split(".")[0];month=time.split(".")[1];year=time.split(".")[2].split(" ")[0]}hour=time.split(" ")[1];time=year+"/"+month+"/"+day+" "+hour;Date.prototype.stdTimezoneOffset=function(){var jan=new Date(this.getFullYear(),0,1);var jul=new Date(this.getFullYear(),6,1);return Math.max(jan.getTimezoneOffset(),jul.getTimezoneOffset())};Date.prototype.dst=function(){return this.getTimezoneOffset()-this.stdTimezoneOffset()};var timezoneOffset;var now=new Date;var nowInMilliseconds=now.getTime();var timeInMilliseconds=new Date(time).getTime();if(now.dst()<0){timezoneOffset=now.getTimezoneOffset()*6e4+36e5}else if(now.dst()>0){timezoneOffset=now.getTimezoneOffset()*6e4-36e5}else{timezoneOffset=now.getTimezoneOffset()*6e4}var timeInSeconds=Math.round((timeInMilliseconds-nowInMilliseconds-timezoneOffset)/1e3);var timeObj={days:Math.floor(timeInSeconds/86400),hours:Math.floor(timeInSeconds%86400/3600),minutes:Math.floor(timeInSeconds%86400%3600/60),seconds:timeInSeconds%86400%3600%60};return timeObj},getLotteryPrice:function(lottery,index){var self=this;var price=index===0?$(".js-lotteryInfo."+lottery).data("quickpickTicketPrice"):$(".js-lotteryInfo."+lottery).data("doubleQuickpickTicketPrice");$(".lotteryOpts .cta").eq(index).find(".value").text(copyConfig[self.lang].only+" "+dla.helper.formatPricePlain(price));$(".lotteryOpts .cta").eq(index).attr("data-track-name","RwdMobile-SecNav-Quickpick-"+lottery).addClass("track")},updateLotteryOpts:function(lottery,targetUrl,lotteryName){var self=this;var domain=window.location.hostname+(window.location.port?":"+window.location.port:"");if(self.lang==="en")domain+="/"+self.lang;var url="//"+domain+"/api/drawings/"+lottery+"?currency="+dla.resources.currency;var prevLotto=$(".lotteryOpts").data("lottery");if(lottery!==prevLotto){$(".lotteryOpts").addClass(lottery);$(".lotteryOpts").removeClass(prevLotto);$(".lotteryOpts").data("lottery",lottery);$.get(url,function(data){var timer=self.getTimeTo(data.next.closingDate.replace(",",""));var timerStr="";if(timer.days>0){var dayX=timer.days===1?"day":"days";timerStr=timer.days+" "+copyConfig[self.lang][dayX]+" "+timer.hours+" "+copyConfig[self.lang].hours}else if(timer.hours>0){timerStr=timer.hours+" "+copyConfig[self.lang].hours+" "+timer.minutes+" "+copyConfig[self.lang].minutes}else if(timer.minutes>0){timerStr=timer.minutes+" "+copyConfig[self.lang].minutes}$(".lotteryOpts .right .counter").text(timerStr);var jackpot=data.next.specialMarketingJackpot||data.next.marketingJackpot||data.next.jackpot;$(".lotteryOpts .right .jackpot").html(dla.helper.formatJackpot(jackpot));var lastData=data.last;var numbers=lastData.numbers||[];if(lottery==="worldMillions"&&lastData.numbers.length===1){numbers=(""+lastData.numbers[0]).split("")}var stars={megaMillions:lastData.megaballs,euroMillions:lastData.stars,euroMillionsPlus:lastData.stars,euroMillionsGo:lastData.stars,euroJackpot:lastData.euroNumbers,powerBall:lastData.powerballs,austriaLotto:lastData.Zusatzzahl,swedishLotto:lastData.bonus,german6aus49:lastData.superzahl,irishLotto:lastData.bonus,swissLotto:lastData.luckyNumber,uKLotto:lastData.bonus};var daySpacer=" ";var dowSpacer=" ";var time="";if(self.lang==="de"||self.lang==="de-AT")dowSpacer=", ";if(self.lang==="de"||self.lang==="de-AT")daySpacer=". ";if(self.lang==="de"&&lastData.date.day<10){lastData.date.day="0"+lastData.date.day}$(".lotteryOpts .results .numbers").html("");$(".lotteryOpts .results .text").text("");if(numbers.length){for(var i=0;i'+numbers[i]+"")}for(var j=0;j'+stars[lottery][j]+"")}if(lottery==="megaMillions"||lottery==="powerBall"){var extra=lastData.megaplier||lastData.powerplay;$(".lotteryOpts .results .numbers").append('x'+extra+"")}else if(lottery==="german6aus49"){$(".lotteryOpts .results .numbers").append(''+lastData.superzahl+"")}if(lottery==="worldMillions"&&numbers.length<8){var diff=8-numbers.length;var zeroes="";for(var d=0;d0'}$(".numbers").prepend(zeroes)}var atCopy=copyConfig[self.lang].at;if(lottery==="euroMillionsGo"&&atCopy&&atCopy!==""){time=" "+atCopy+" "+lastData.drawingDate.split(" ")[1]}$(".lotteryOpts .results .text").text(copyConfig[self.lang].resultsFor+" "+lastData.date.dayOfWeek+dowSpacer+lastData.date.day+daySpacer+copyConfig[self.lang].month[lastData.date.month]+" "+(new Date).getFullYear()+time)}if(lottery==="worldMillions"||lottery==="swissLotto"||lottery==="uKLotto"||lottery==="euroMillionsGo"||lottery==="euroMillionsPlus"){$("a.magazine, a.syndicates").hide()}else if($("html").prop("lang")==="en-IE"&&lottery==="euroMillions"){$("a.magazine, a.syndicates").hide()}else{$("a.magazine, a.syndicates").show()}$(".lotteryOpts ul a").each(function(){var href=$(this).data("link");if(lottery==="german6aus49"&&href==="/zahlen-quoten"){href="/lottozahlen-quoten"}href="/"+targetUrl+href;if(lottery==="irishLotto"){var link=$(this).data("link");if(link==="/results-winning-numbers"){href="/irish-lottery/results-winning-numbers"}else if(link==="/magazine"){href="/lotto/magazine"}else if(link==="/help"){href="/irishlotto/help"}}$(this).prop("href",href).attr("data-track-name","RwdMobile-SecNav-Link-"+$(this).prop("class")).addClass("track")});$(".lotteryOpts ul li span").text(lotteryName);if(self.lang==="en-AU"&&lottery==="powerBall"){lotteryName="US Powerball ";$(".lotteryOpts ul li span").eq(2).text(lotteryName)}$(".lotteryOpts .hotLabel").html("");$(".lotteryOpts .hotLabel").text($("."+lottery+" .hotLabel").text());var link="";var track="&trck5=sidemenu_"+self.lang+"_mobile."+lottery;var doubleLink="";var doubleOrNothing=$(".js-lotteryInfo."+lottery).data("showDoubleQuickpick");var quickpickLines=$(".js-lotteryInfo."+lottery).data("quickpickLines");var doubleQuickpickLines=$(".js-lotteryInfo."+lottery).data("doubleQuickpickLines");if(typeof copyConfig[self.lang].shoppingCartLink!=="undefined"){link=copyConfig[self.lang].shoppingCartLink+"?tickets="+$(".js-lotteryInfo."+lottery).data("encodedQuickpickTicket");doubleLink=copyConfig[self.lang].shoppingCartLink+"?tickets="+$(".js-lotteryInfo."+lottery).data("encodedDoubleQuickpickTicket");link+=track+quickpickLines+".games";doubleLink+=track+doubleQuickpickLines+".games"}else{link="/"+lottery.toLowerCase();doubleLink=link}$(".lotteryOpts .cta").eq(0).data("link",link);$(".lotteryOpts .cta .text span").html((quickpickLines||1)+" "+(quickpickLines>1?copyConfig[self.lang].quickpicks:copyConfig[self.lang].quickpick));self.getLotteryPrice(lottery,0);if(doubleOrNothing){$(".lotteryOpts .cta.double").show().data("link",doubleLink).fadeIn().find(".text span").html(doubleQuickpickLines+" "+copyConfig[self.lang].quickpicks);self.getLotteryPrice(lottery,1)}else{$(".lotteryOpts .cta.double").hide()}if(!$(".js-lotteryInfo."+lottery).data("showQuickpick")){$(".lotteryOpts .cta").hide()}self.updateLotteryOptsEvents()})}},updateLotteryOptsEvents:function(){$(".lotteryOpts .cta").click(function(){window.open($(this).data("link"),"_self")})},openLotteryOpts:function(lottery,url,lotteryName){var self=this;self.showLotteryOpts();self.updateLotteryOpts(lottery,url,lotteryName)},closeLotteryOpts:function(){var self=this;$(".lotteryOpts").addClass("close");$(".lotteryOpts").removeClass("open");$(".page-menu").css("overflow-y","scroll");$(".page-menu").css("overflow-x","");$(".page-menu").height("");$(".lotteryOpts-overlay").hide();setTimeout(function(){$(".lotteryOpts").hide()},500);self.fixAndroidViewport()},showLotteryOpts:function(){var self=this;var ch=$("#cookieHint:visible").length>0?$("#cookieHint").innerHeight():0;$(".lotteryOpts").css({top:0,display:"block"}).css("top",$(".lotteryOpts").offset().top*-1+ch+"px");$(".lotteryOpts").addClass("open");$(".lotteryOpts").removeClass("close");$(".page-menu").css("overflow","hidden");$(".page-menu").height("100%");$(".lotteryOpts-overlay").show();$(".lotteryOpts-overlay").off("click").on("click",function(){self.closeLotteryOpts()});self.fixAndroidViewport()},fixAndroidViewport:function(){$("body").height(window.innerHeight)},watcher:function(){},init:function(){var self=this;self.lang=$("html").prop("lang");var languages=Object.keys(copyConfig);if(languages.indexOf(self.lang)>=0){self.loggedIn=$("#trackingInfo").data("playerLoggedIn")?"loggedIn":"";self.isReduced=$("#trackingInfo").data("reducedMode");self.injectHtml();self.injectLotteryOptsLinks();if(!self.isReduced){self.addEventListeners();self.watcher()}}}};lotteryOptionsMenu.init()};var fixiOStransformations=function(){$("head").append("")};var runScriptForMobileMenu=function(){var isRestyledMenu=$(".page-menu-and-main-restyle").length>0;if(isRestyledMenu){fixiOStransformations();addLotteryOptsToRestyledMenu()}};runScriptForMobileMenu()})})(window.jQuery,window.dla);