var gamesData={CategoryId:[],ThemeId:[],TournamentId:[],GroupId:0,GroupTypeId:0,Page:0,TakeCount:10,SearchText:"",LobbyUrl:"",MinLimit:0,MaxLimit:0,IsOpenFilter:!1},Lobbies=Lobbies||function(){return{init:function(e){$.extend(this,e),gamesData.LobbyUrl=e.lobbyUrl;for(var i,a,c,l="",d="",n="",o="",t=document.location.pathname.split("/"),s=0;s0?r-1:0,0);let i=document.getElementsByClassName("js_lobby_cats");for(a=d.split("-"),s=0;s=1&&a[0]!="all"||o!=""||n!="")&&addClassIfElemExists("js_lobby_buttons_cont","view_clear_all")}let r=document.getElementsByClassName("js_top_winners_item_names active");if(r!=null&&r.length>0&&GetBigWinsWidget(r[0].dataset.lobbyWidgetType,r[0].dataset.winsType,r[0]),i=document.getElementsByClassName("js_dl_mLkd_games"),i!=null&&i.length>0){let t={input:[]},s=Number(i[0].dataset.takeCount),n={GroupId:i[0].dataset.id,GroupTypeId:i[0].dataset.typeId,TakeCount:s*2,Page:0,LobbyUrl:i[0].dataset.lobbyurl};e.isMobileBrowser?(i[0].dataset.page=0,t.input.push(n),GetGamesByGroup(!1,t)):(i[0].dataset.page=1,t.input.push(n),GetGamesByGroup(!1,!1,t))}e.isMobileBrowser||window.addEventListener("resize",checkViewAllButtonVisibility)}}}();let allGamesCount=0,dlSearchTimeOut="",searchTxt="",lobbyMain=document.getElementById("js_lobby_main"),prvCont=document.getElementById("js_lobby_providers_cont"),allowSetFixedLobby=!0,allowRemoveFixedLobby=!0,allowLazyLoad=!1;function setCatInfo(e){allGamesCount=0;let n=-1,i=[],t=document.querySelectorAll(".js_lobby_cats"),s=document.getElementById("js_lobby_view_all_count"),o=t.length;for(let e=0;eprvCont.offsetWidth+2||e[0].offsetTop5){removeClassIfElemExists("js_lobby_view_all_providers_from_cat_raw","hidden");for(let n=0;n5&&e[n].classList.add("hidden")}else addClassIfElemExists("js_lobby_view_all_providers_from_cat_raw","hidden")}function loadGamesOnScroll(){let e=Lobbies.isMobileBrowser?$(window).scrollTop()+$(window).height()>=$(document).height()-$("#footer").height()-400:$(window).scrollTop()+$(window).height()>=$(document).height()-$("#js_footer").height()-200;if(Lobbies.isMobileBrowser){let e=document.getElementById("header"),t=document.documentElement.classList.contains("hide_header_navbar"),n=t?0:64;e&&!t&&(n=e.offsetTop+e.offsetHeight),lobbyMain.getBoundingClientRect().top<=n?allowSetFixedLobby&&(allowSetFixedLobby=!1,allowRemoveFixedLobby=!0,document.body.classList.add("lobbyFilter_fixed")):allowRemoveFixedLobby&&(allowSetFixedLobby=!0,allowRemoveFixedLobby=!1,document.body.classList.remove("lobbyFilter_fixed"))}else{let e=document.getElementById("header_fix"),t=56;e&&(t=e.offsetTop+e.offsetHeight),Lobbies.isFixedHeader||(t=0),lobbyMain.getBoundingClientRect().top<=t-16?allowSetFixedLobby&&(allowSetFixedLobby=!1,allowRemoveFixedLobby=!0,Lobbies.closedPrvList||document.getElementById("js_lobby_providers_cont").classList.remove("collapsed"),document.body.classList.add("lobbyFilter_fixed"),checkViewAllButtonVisibility()):allowRemoveFixedLobby&&(allowSetFixedLobby=!0,allowRemoveFixedLobby=!1,Lobbies.closedPrvList||document.getElementById("js_lobby_providers_cont").classList.add("collapsed"),document.body.classList.remove("lobbyFilter_fixed"),checkViewAllButtonVisibility())}GamesCommon.gameCardType==4&&e&&allowLazyLoad&&(allowLazyLoad=!1,gamesData.Page++,GetGames("js_games_lobby",!0))}function drawGamesAndSetCatInfo(e,t,n,s,o,i){setCatInfo(n),i&&i(e,t,s,o,Lobbies.lobbyUrl,GamesCommon.lobbyPreviewType),window.removeEventListener("scroll",loadGamesOnScroll),window.addEventListener("scroll",loadGamesOnScroll)}function GetGames(e,t,n){$.ajax({type:"POST",data:gamesData,url:"/DynamicLobbyHelper/GetGamesV1",showLoader:!1,success:function(s){allowLazyLoad=s.HasNext,GamesCommon.gameCardType!=4&&(showHideButtonLoader("js_show_more_btn",!1),handleShowMoreButtonVisibility(allowLazyLoad));let i=[],a=s.CategoryInfo;for(var o=0;o0?(gamesData.CategoryId=i,drawGamesAndSetCatInfo(e,s.GamesOutput,s.CategoryInfo,t,GamesCommon.lobbyGridType,drawGames),n&&setPageUrl(),gamesData.SearchText!=""&&s.GamesOutput.length==0&&getSuggestedGames("js_games_lobby")):(gamesData.CategoryId=["0"],GetGames("js_games_lobby",!1,!0))}})}function getSuggestedGames(e){let t=document.querySelector('.js_lobby_groups[data-url="mostpopular"]');if(t){let s={GroupId:t.dataset.id,GroupTypeId:t.dataset.typeId,TakeCount:t.dataset.takeCount,Page:0,LobbyUrl:Lobbies.lobbyUrl},n={input:[]};n.input.push(s),$.ajax({type:"POST",data:n,url:"/DynamicLobbyHelper/GetGamesByGroup",success:function(t){if(t.length>0&&t[0].GamesOutput.length>0){let s=`
`+Lobbies.trns.SuggestedGames+`
`;if(Lobbies.isMobileBrowser)if(GamesCommon.gameCardType==4)for(var n=0;n"}else s+=createGamesHtmlV1(t[0].GamesOutput,GamesCommon.lobbyGridType,Lobbies.lobbyUrl,GamesCommon.lobbyPreviewType);else allGamesCount=t[0].GamesOutput.length,GamesCommon.gameCardType==4?s+=createGameHtmlSpec(t[0].GamesOutput,GamesCommon.lobbyGridType,Lobbies.lobbyUrl,GamesCommon.lobbyPreviewType):s+=createGamesHtmlV1(t[0].GamesOutput,GamesCommon.lobbyGridType,Lobbies.lobbyUrl,GamesCommon.lobbyPreviewType);$("#"+e).append(dlAnimate(s))}}})}}function setPageUrl(){let i=$('.js_lobby_groups[data-id="'+gamesData.GroupId+'"]')[0].dataset.url,e=[],n=$(".js_lobby_cats"),a=n.length;$(n).removeClass("active");for(var o,s=0;s=1&&e[0]!="all"||searchTxt!=""?addClassIfElemExists("js_lobby_buttons_cont","view_clear_all"):removeClassIfElemExists("js_lobby_buttons_cont","view_clear_all")}function openFilter(e){showHideLoader(!0),$.ajax({type:"GET",url:"/DynamicLobbyHelper/GetFilter?showFullPrList="+e,success:function(e){$("#js_lobby_main_wrapper").append(dlAnimate(e)),$("body").addClass("ofh"),showHideLoader(!1)}})}function searchGames(e,t){e.value.length>0?document.getElementById("js_clear_search_val").style.display="block":document.getElementById("js_clear_search_val").style.display="none";var n=e.value.replace(/\s\s+/g," ");if(!isSearchInutTextValid(e,n)||searchTxt==n&&!t||n!=""&&n.charAt(0)==" ")return;searchTxt=n,clearTimeout(dlSearchTimeOut),dlSearchTimeOut=setTimeout(function(){allowLazyLoad=!1;let e=document.querySelector('.js_lobby_groups[data-url="all"]');removeClassIfElemExists("js_lobby_buttons_cont","filtered"),e&&($(".js_lobby_groups").removeClass("active"),e.classList.add("active"),gamesData.GroupId=e.dataset.id,gamesData.GroupTypeId=e.dataset.typeId,gamesData.TakeCount=e.dataset.takeCount),gamesData.SearchText=searchTxt,gamesData.Page=0,imgSortIndex=0,GetGames("js_games_lobby"),setPageUrl(),scrollIntoViewCustom()},400)}function isSearchInutTextValid(e,t){const s=new RegExp(`^[A-Za-z0-9 '&!-"™:]*$`);if(s.test(t))return document.getElementById("js_search_msg")&&document.getElementById("js_search_msg").remove(),!0;if(!document.getElementById("js_search_msg")){var n=document.createElement("span");n.id="js_search_msg",n.innerHTML=Lobbies.trns.UseLatinLettersInSearch,e.parentNode.appendChild(n)}return!1}function GetBigWinsWidget(e,t,n){$.ajax({type:"GET",url:"/DynamicLobbyHelper/GetBigWins?lobbyWidgetType="+e+"&winsType="+t,success:function(e){$(".js_top_winners_item").removeClass("active"),$(".js_top_winners_item_names").removeClass("active"),n.classList.add("active"),document.getElementById("js_top_winers_skelet")&&skeletOff("topwins"),$("#js_top_winners_content").append(e)}})}function scrollIntoViewCustom(){if(document.body.classList.contains("lobbyFilter_fixed")){let e=0;if(Lobbies.isFixedHeader){e=Lobbies.isMobileBrowser?64:56;let t=document.getElementById("header");t==null&&(t=document.getElementById("header_fix")),t&&(e=t.offsetTop+t.offsetHeight)}e-=16,lobbyMain.scrollIntoView(),window.scrollBy(0,-e+10)}}function handleShowMoreButtonVisibility(e){e?document.getElementById("js_show_more_btn_cont").style.display="":document.getElementById("js_show_more_btn_cont").style.display="none"}function GetGameDetails(e){$.ajax({type:"POST",data:"lobbyUrl="+Lobbies.lobbyUrl+"&gameId="+e+"&usrId="+GamesCommon.userId,url:"/DynamicLobbyHelper/GetGameDetails",success:function(e){e.Success?drawGameDetailsView(e.Data):createToast("error","Error",e.Message)}})}function createBadgesV1(e){let t="",n=e.BadgeTypeIds.length;if(n>0){t=`
`;for(let s=0;sTop
`;break;case 2:t+=`
Hot
`;break;case 3:t+=`
Jackpot
`;break;case 4:t+=`
New
`;break;case 5:t+=`
Soon
`;break;case 6:t+=`
Hot
`;break;default:t+=`
New badge
`;break}t+=`
`}return t}function createMaxWin(e){let t="";return e.MinMaxLimits[2]>"0"&&(t+=`
${e.MinMaxLimits[2]}
`),t}function createLanguages(e){let t="",n=e.LanguageIds.length;if(n>0){n>3&&(n=3),t+=`
`;for(let s=0;s
`;t+=""}return t}function createCardFooter(e){let t=``,t}window.onpopstate=function(){for(var s,i,r,a="",c="",o="",n="",t=document.location.pathname.split("/"),e=0;e0?l-1:0,0);let r=document.getElementsByClassName("js_lobby_cats");for(s=c.split("-"),e=0;e=1&&s[0]!="all"||n!=""||o!=""?addClassIfElemExists("js_lobby_buttons_cont","view_clear_all"):removeClassIfElemExists("js_lobby_buttons_cont","view_clear_all")}},$(document).on("click",".js_lobby_groups",function(){$(this).hasClass("active")||(allowLazyLoad=!1,$(".js_lobby_groups").removeClass("active"),this.classList.add("active"),removeClassIfElemExists("js_lobby_buttons_cont","filtered"),gamesData.GroupId=$(this).attr("data-id"),gamesData.GroupTypeId=$(this).attr("data-type-id"),gamesData.TakeCount=$(this).attr("data-take-count"),gamesData.Page=0,gamesData.IsOpenFilter=!1,imgSortIndex=0,GetGames("js_games_lobby",!1,!0),scrollIntoViewCustom())}),$(document).on("click",".js_lobby_cats",function(){(!$(this).hasClass("active")||$(this).attr("data-id")!=0)&&(allowLazyLoad=!1,$(this).hasClass("active")?($(this).removeClass("active"),$(".js_lobby_cats.active").length==0&&($($(".js_lobby_cats")[0]).addClass("active"),addCategoryIdToObj(gamesData,"0")),removeCategoryIdFromObj(gamesData,$(this).attr("data-id")),gamesData.Page=0,imgSortIndex=0,GetGames("js_games_lobby")):($(this).attr("data-id")==0?($(".js_lobby_cats").removeClass("active"),gamesData.CategoryId=[],addCategoryIdToObj(gamesData,"0")):($($(".js_lobby_cats")[0]).removeClass("active"),addCategoryIdToObj(gamesData,$(this).attr("data-id")),removeCategoryIdFromObj(gamesData,"0")),$(this).addClass("active"),gamesData.Page=0,imgSortIndex=0,GetGames("js_games_lobby")),scrollIntoViewCustom(),setPageUrl())}),$(document).on("click","#js_lobby_open_filter_btn",function(){openFilter(!1)}),$(document).on("click","#js_lobby_view_all_providers, #js_lobby_view_all_providers_from_cat_raw",function(){if(Lobbies.catViewType=="2"||Lobbies.isMobileBrowser)openFilter(!0);else{let e=document.getElementById("js_lobby_providers_cont");e.classList.contains("collapsed")?(e.classList.remove("collapsed"),Lobbies.closedPrvList=!0,setCookie("_"+Lobbies.lobbyUrl+"ClosedPrvList",!0,"Session")):(e.classList.add("collapsed"),Lobbies.closedPrvList=!1,setCookie("_"+Lobbies.lobbyUrl+"ClosedPrvList",!1,"Session"))}}),$(document).on("click","#js_close_lobby_filter",function(){$("#js_lobby_filter").fadeOut(),setTimeout(function(){$("body").removeClass("ofh"),$("#js_lobby_filter").remove()},300)}),$(document).on("click","#js_lobby_clear_all",function(){allowLazyLoad=!1,$(".js_lobby_cats").removeClass("active"),$(".js_lobby_groups").removeClass("active"),Lobbies.defaultGroup.classList.add("active"),Lobbies.allCat.classList.add("active"),document.getElementById("js_dl_search_game").value="",document.getElementById("js_clear_search_val").style.display="none",document.getElementById("js_search_msg")&&document.getElementById("js_search_msg").remove(),gamesData.CategoryId=[],gamesData.SearchText=searchTxt="",gamesData.IsOpenFilter=!1,imgSortIndex=0,gamesData.CategoryId.push(Lobbies.allCat.dataset.id),gamesData.GroupId=Lobbies.defaultGroup.dataset.id,gamesData.GroupTypeId=Lobbies.defaultGroup.dataset.typeId,gamesData.TakeCount=Lobbies.defaultGroup.dataset.takeCount,gamesData.Page=0,changePageUrlWithoutRefreshing("/"+GamesCommon.language+"/lobby/"+Lobbies.lobbyUrl+"/main",""),GetGames("js_games_lobby"),Lobbies.slider.slideTo(0,300),removeClassIfElemExists("js_lobby_buttons_cont","filtered"),removeClassIfElemExists("js_lobby_buttons_cont","view_clear_all"),scrollIntoViewCustom()}),$(document).on("click","#js_clear_search_val",function(){var e=document.getElementById("js_dl_search_game");e.value="",e.dispatchEvent(new Event("keyup")),e.focus()}),$(document).on("click","#js_lobby_search_btn",function(){$("#js_lobby_buttons_cont").addClass("collapsed");let e=document.getElementById("js_dl_search_game");e.focus()}),$(document).on("click","#js_close_search_val",function(){$("#js_lobby_buttons_cont").removeClass("collapsed")}),$(document).on("click",".js_top_winners_item_names",function(){if(this.dataset.gotData!="true")GetBigWinsWidget(this.dataset.lobbyWidgetType,this.dataset.winsType,this),this.dataset.gotData=!0;else if(!this.classList.contains("active")){$(".js_top_winners_item_names").removeClass("active"),this.classList.add("active");let e=document.getElementsByClassName("js_top_winners_item"),t=document.getElementsByClassName("js_top_w_nav_cont");for(let n=0;n