var gameJackMob = ''; var hvrJackpotMob = ''; var allowClick = true var imgSortIndex = 0; let pvInitialPos = 0; let pvFinalpos = 0; let pvCont = ''; let pvCover = ''; let pvOverlayDimm = ''; let pvScrollContainer = ''; let pvStartTime = ''; let pvMoveTime = ''; let allowPvScrolling = false; let hasPvCoverScroll = false; let pvMoved = 0; let pvWinHeight = window.innerHeight; let pvScrollPosition = 0; var GamesCommon = GamesCommon || (function () { return { init: function (args) { $.extend(this, args); } } }()); function GetGamesByGroup(append, gamesByGroupData) { $.ajax({ type: "POST", data: gamesByGroupData, url: "/DynamicLobbyHelper/GetGamesByGroup", success: function (result) { var GroupId = result.GroupId; var cont = document.getElementById('js_lobby_group_' + GroupId); let previewType = cont.dataset.previewType; let lobbyUrl = cont.dataset.lobbyurl; cont.dataset.hasNext = result.HasNext; drawGames('js_lobby_group_' + result.GroupId, result.GamesOutput, append, '', lobbyUrl, previewType); if (result.GamesOutput.length < 3 && cont.dataset.page == 0) { $(cont).removeClass('scrolled-container-r2').addClass('scrolled-container-r1'); } if (result.GamesOutput.length == 0) { $(cont).parents('.js_lobby_groups_cont').addClass('hidden'); } else { $(cont).parents('.js_lobby_groups_cont').removeClass('hidden'); } if (cont && cont.parentNode) { cont.parentNode.removeEventListener('scroll', loadGamesByGroupOnScroll); cont.parentNode.addEventListener('scroll', loadGamesByGroupOnScroll); } } }); } function getLandingWidgetGames(widgetGamesData, append) { $.ajax({ type: "POST", data: widgetGamesData, url: "/DynamicLobbyHelper/GetGamesByGroup", success: function (result) { let curWidgetInfo = widgetGamesData; let gridCont = document.getElementById('js_lg_ws_' + curWidgetInfo.WidgetId); document.querySelector('.js_lg_w_names.active[data-widget-id="' + curWidgetInfo.WidgetId + '"]').dataset.hasNext = result.HasNext; drawMinInfoGames(gridCont, result.GamesOutput, curWidgetInfo.LobbyUrl, append); if (gridCont && gridCont.parentNode) { gridCont.parentNode.removeEventListener('scroll', loadLgWgGamesOnScroll); gridCont.parentNode.addEventListener('scroll', loadLgWgGamesOnScroll); } } }); } function drawMinInfoGames(gridCont, games, lobbyUrl, append) { const gamesLength = games.length; let html = ''; for (let i = 0; i < gamesLength; i++) { html += createMinInfoGameCard(games[i], lobbyUrl); } if (append) { $(gridCont).append(dlAnimate(html)); } else { gridCont.parentNode.scrollLeft = 0; $(gridCont).html(dlAnimate(html)); } } function createMinInfoGameCard(game, lobbyUrl) { let html = ''; let langHtml = ''; let gameUrl = lobbyUrl != 'undefined' && lobbyUrl != '' ? `${game.URL}-${lobbyUrl}` : game.URL; let cdn = game.UseRmCdn ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; for (var l = 0; l < game.LanguageIds.length; l++) { langHtml += `
`; if (l == 2) { break; } } html = `
` + `
${langHtml}
`; if (game.Badges) { html += game.Badges; } html += `
`; if (game.ContributionPercent != undefined) { html += '

' + game.ContributionPercent + '%

'; } html += '
'; if ((game.MinMaxLimits[0] != '0' && game.MinMaxLimits[1] != '0') || game.MinMaxLimits[2] != '0') { html += ``; } html += `
${game.Description}
` + `
${GamesCommon.trns.Play}`; if (game.HasDemo) { html += `${GamesCommon.trns.Demo}`; } html += `
`; return html; } function drawGames(contId, games, append, gridType, lobbyUrl, previewType) { let html = ''; if (games.length > 0) { if (GamesCommon.gameCardType == 4) { for (var i = 0; i < games.length; i++) { html += drawGamesWrapper(games[i], gridType, previewType, lobbyUrl); if (previewType == '0' || previewType == '1') { html += drawGamesCardFooterSpec(games[i]); } html += ""; } } else { html += createGamesHtmlV1(games, gridType, lobbyUrl, previewType); } } else { if (gamesData.SearchText != '') { html += '

' + GamesCommon.trns.NoSearchResults + ' "' + gamesData.SearchText + '"

'; } else if (gamesData.GroupTypeId == GamesCommon.favoriteGroupType) { html += '

' + GamesCommon.trns.YouHaveNoFavoriteGames + '

' + GamesCommon.trns.ToAddFavGames + '
'; } else if (gamesData.GroupTypeId == GamesCommon.lastPlayedGroupType) { html += '

' + GamesCommon.trns.YouHaveNoLastPlayedGames + '
'; } else { html += '

' + GamesCommon.trns.NoSuchGameFound + '

'; } } if (append) { $('#' + contId).append(dlAnimate(html)); } else { $('#' + contId).html(dlAnimate(html)); } } function createGamesHtmlV1(games, gridType, lobbyUrl, prwType) { let html = ''; const length = games.length; for (let i = 0; i < length; i++) { let imgUrl = games[i].Image; let cdn = games[i].UseRmCdn ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; let gridClass = ''; let badgesData = games[i].Badges; if (gridType == 2 || gridType == 4) { imgSortIndex++; imgType = getImgType(gridType); if (imgType == 'vertical') { gridClass = 'lb_card_v'; imgUrl = games[i].VerticalImage; } else if (imgType == 'horizontal') { gridClass += 'lb_card_h'; imgUrl = games[i].HorizontalImage; } } html += `
${games[i].Description}
` + `
${badgesData} ${createMaxWin(games[i])} ${createLanguages(games[i])}
`; if (prwType != '2') { html += createCardFooter(games[i]); } html += `
`; } return html; } function createRecommendedGamesHtml(games) { let html = ''; const length = games.length; for (let i = 0; i < length; i++) { let imgUrl = games[i].Image; let cdn = games[i].UseRmCdn ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; html += `
${games[i].Description}
` + `
`; if (GamesCommon.lobbyPreviewType != '2') { html += ``; } html += `
`; } return html; } function drawGamesWrapper(game, gridType, previewType, lobbyUrl) { let langHtml = ''; for (let l = 0; l < game.LanguageIds.length; l++) { langHtml += ''; } let imgType = '' let html = ''; let gridClass = 'lca-card-wrapper-50'; let cdn = game.UseRmCdn ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; let imgUrl = game.Image; if (gridType == 2 || gridType == 4) { imgSortIndex++; imgType = getImgType(gridType); if (imgType == 'vertical') { gridClass = 'lca-card-wrapper-50 lca-card-wrapper-hx2'; imgUrl = game.VerticalImage; } else if (imgType == 'horizontal') { gridClass = 'lca-card-wrapper-100'; imgUrl = game.HorizontalImage; } } html += '
' + '
' + game.Description + '' + '
'; if ((previewType == '0' || previewType == '1') && GamesCommon.gameCardType != 4) { html += '

' + game.Description + '

'; } html += '
' + langHtml + '
' + game.Badges + '
'; return html; } function drawGamesCardFooterSpec(game) { let favClass = ''; let likeClass = ''; if (game.IsFavorite) { favClass = 'active'; } if (game.IsLiked) { likeClass = 'active'; } let html = ''; return html; } function loadGamesByGroupOnScroll() { var childNode = this.firstElementChild; if ((this.scrollWidth - this.scrollLeft - 200 <= this.clientWidth) && childNode.classList.contains('js_lobby_groups_widget')) { let hasNext = childNode.dataset.hasNext; if (hasNext == 'true') { childNode.dataset.hasNext = false; var data = { GroupId: childNode.dataset.id, GroupTypeId: childNode.dataset.typeId, TakeCount: childNode.dataset.takeCount, Page: Number(childNode.dataset.page) + 1, LobbyUrl: childNode.dataset.lobbyurl, Lang: document.documentElement.lang, Device: document.documentElement.dataset.type.toLowerCase(), Currency: GamesCommon.currencyCode } childNode.dataset.page = data.Page; GetGamesByGroup(true, data); } } } function loadLgWgGamesOnScroll() { let childNode = this.firstElementChild; let wtId = childNode.dataset.wtId; let heading = document.querySelector('.js_lg_w_names.active[data-widget-id="' + wtId + '"]'); if ((this.scrollWidth - this.scrollLeft - 200 <= this.clientWidth)) { let hasNext = heading.dataset.hasNext; if (hasNext == 'true') { heading.dataset.hasNext = false; var data = { GroupId: heading.dataset.id, GroupTypeId: heading.dataset.typeId, WidgetId: heading.dataset.widgetId, TakeCount: heading.dataset.takeCount, Page: Number(heading.dataset.page) + 1, LobbyUrl: heading.dataset.lobbyurl, Lang: document.documentElement.lang, Device: document.documentElement.dataset.type.toLowerCase(), Currency: GamesCommon.currencyCode } heading.dataset.page = data.Page; getLandingWidgetGames(data, true); } } } function getImgType(gridType) { return gridType == 2 ? gridArrangeWithMosaic1() : gridArrangeWithMosaic2(); } function gridArrangeWithMosaic1() { if (imgSortIndex % 5 == 0 && imgSortIndex % 10 != 0) { return 'vertical'; } else if (imgSortIndex % 10 == 0) { return 'horizontal'; } } function gridArrangeWithMosaic2() { if (imgSortIndex == 6 || imgSortIndex == 16) { if (imgSortIndex == 16) { imgSortIndex = 0; } return 'vertical'; } else if (imgSortIndex == 1 || imgSortIndex == 11) { return 'horizontal'; } } function CreateBadges(badgeTypeId) { let badges = ''; for (var b = 0; b < badgeTypeId.length; b++) { switch (badgeTypeId[b]) { case 1: badges += 'Top'; break; case 2: badges += 'HOT'; break; case 3: badges += 'JackPot'; break; case 4: badges += 'New'; break; case 5: badges += 'Soon'; break; case 6: badges += 'Premium'; break; } } return badges; } function prepareGamePreview(data) { var html = '
' + '' + data.Name + '' + '
'; if (data.HasJackpot == 'true') { html += '
JACKPOTS' + '
'; } html += '
' + data.Name + '
'; if (GamesCommon.gameCardType == 4) { html += '
' + data.CatName + '
'; } html += '' + data.Name + ''; if (data.PreviewType == '2') { html += drawGamesCardFooterSpec(data); } html += '
' + GamesCommon.trns.Play + ''; if (data.HasDemo == 'true') { html += '' + GamesCommon.trns.Demo + ''; } html += '
'; $(html).hide().appendTo($('body')).fadeIn(); $('body').addClass('disable-scroll'); if (data.HasJackpot == 'true') { startAction(); } } function playReal(gameUrl, e) { if (GamesCommon.userId > 0) { if (GamesCommon.partnerId != '2') { document.location.href = gameUrl; } else { if (typeof CheckClientVerificationInfo === 'function' && (GamesCommon.isMobileVerified.toLowerCase() == 'false' || GamesCommon.isDocumentVerified.toLowerCase() == 'false')) { CheckClientVerificationInfo(); } else if (typeof insFoundsCheck === 'function') { if (insFoundsCheck(e)) { document.location.href = gameUrl; } } else { document.location.href = gameUrl; } } } else { if (GamesCommon.hasStaticLoginPage) { document.location.href = '/Login/Login?loginHref=' + GamesCommon.language + gameUrl; } else { closeGamePreview(); $('#loginHref').val(GamesCommon.language + gameUrl); openRightSidebar(); } } } function closeGamePreview() { var jackelem = document.getElementById('js_game_jackpot'); if (jackelem != null) { stopAction(); } $('body').removeClass('disable-scroll'); $('#js_game_preview_block').remove(); } function startAction() { getData('/Common/GetCumulativeJackpot', startAnim); hvrJackpotMob = setInterval(() => { getData('/Common/GetCumulativeJackpot', updateAnim, gameJackMob) }, 30050); }; function getData(url, cFunction, cFparam) { var xhttp; xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { try { var json = JSON.parse(this.responseText); cFunction(json, cFparam); } catch (e) { console.error("Invalid JSON format"); } } }; xhttp.open("POST", url, true); xhttp.send(); } function startAnim(json) { if (gameJackMob instanceof FlipJackpotNumbers) { gameJackMob.destroy(); } gameJackMob = new FlipJackpotNumbers({ node: document.querySelector('#js_game_jackpot'), from: json.OldSumJackPot, seperateOnly: json.DigitsAfterpoint, }); gameJackMob.flipTo({ to: json.NewSumJackPot, direct: false }); } function updateAnim(json, jackpotObject) { if (jackpotObject instanceof FlipJackpotNumbers) { if (json.OldSumJackPot > json.NewSumJackPot) { gameJackMob.destroy(); gameJackMob = new FlipJackpotNumbers({ node: jackpotObject.node, from: json.NewSumJackPot, seperateOnly: json.DigitsAfterpoint, }); gameJackMob.flipTo({ to: json.OldSumJackPot, direct: false }); } else { jackpotObject.flipTo({ to: json.NewSumJackPot, direct: false }); } } } function stopAction() { if (gameJackMob instanceof FlipJackpotNumbers) { gameJackMob.destroy(); } clearInterval(hvrJackpotMob); } function createGameDetailsView(data, lobbyUrl, source) { let cdn = data.UseRmCdn ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; let gameUrl = data.URL; if (typeof Lobbies != 'undefined' && source != 'recommended_widget') { gameUrl += '-' + Lobbies.lobbyUrl; } else if (lobbyUrl) { gameUrl += '-' + lobbyUrl; } let gameInfo = ''; let html = `
${data.Description}
` + `

${data.Description}

` + `${data.Badges}
` + `
${data.Description}
` + `
`; switch (data.CatIconType) { case 1: html += `${data.CatName}`; break; case 2: html += `${data.CatName}`; break; case 3: html += `${data.CatName}${data.CatName}`; break; } html += `
`; if (data.HasJackpot) { html += `
${GamesCommon.currencyCode}
`; } gameInfo += `
    `; if (data.MinMaxLimits[0] != '0') { gameInfo += `
  • ${GamesCommon.trns.MinBetAmount}:

    ${data.MinMaxLimits[0]} ${GamesCommon.currencyCode}
  • `; } if (data.MinMaxLimits[1] != '0') { gameInfo += `
  • ${GamesCommon.trns.MaxBetAmount}:

    ${data.MinMaxLimits[1]} ${GamesCommon.currencyCode}
  • `; } if (data.MinMaxLimits[2] != '0') { gameInfo += `
  • ${GamesCommon.trns.MaxWinAmount}:

    ${data.MinMaxLimits[2]} ${GamesCommon.currencyCode}
  • `; } if (data.LanguageIds.length > 0) { gameInfo += `
  • ${GamesCommon.trns.Language}:

    ${createLanguages(data)}
  • `; } if (gameInfo != `
      `) { html += gameInfo + `
    `; } html += `
`; return html; } function setGameDetailsViewPosition(cont, contPos, overlayDimm, coverOpacity) { Object.assign(overlayDimm.style, { '-webkit-transition': 'opacity 300 ms', 'transition': 'opacity 300ms', 'opacity': `${coverOpacity}` }); Object.assign(cont.style, { 'transform': `translateY(${contPos})`, '-webkit-transition': 'transform 300 ms', 'transition': 'transform 300ms', '-webktit-backface-visibility': 'hidden', 'backface-visibility': 'hidden' }); } function drawGameDetailsView(data, lobbyUrl, dataSource) { let html = createGameDetailsView(data, lobbyUrl, dataSource); $(html).appendTo($('body')); if (data.HasJackpot) { startAction(); } pvCont = document.getElementById('js_card_pv_cont'); pvCover = document.getElementById('js_card_pv_cover'); pvOverlayDimm = document.getElementById('js_overlay_dimm'); pvScrollContainer = window.innerHeight <= 450 ? document.getElementById('js_lb_card_preview_content') : document.getElementById('js_lb_card_preview'); preventScroll(); pvCont.addEventListener('touchstart', pullToCloseInit); pvCont.addEventListener('touchmove', pullToCloseUpdate); pvCont.addEventListener('touchend', pullToCloseReset); setTimeout(() => { pvCover.classList.remove('js_anim'); hasPvCoverScroll = pvScrollContainer.offsetHeight < pvScrollContainer.scrollHeight; }, 300); } function pullToCloseInit(e) { allowPvScrolling = !isElemOrChildrenSameAsTarget('#js_card_pv_header', e.target) && pvScrollContainer.scrollTop != 0; let touch = e.touches && e.touches[0]; pvInitialPos = e.clientY || touch.pageY; pvStartTime = new Date().getTime(); } function pullToCloseUpdate(e) { let touch = e.touches && e.touches[0]; pvFinalpos = e.clientY || touch.pageY; pvMoved = pvFinalpos - pvInitialPos; if (!allowPvScrolling && pvMoved > 0) { e.preventDefault(); pvMoveTime = new Date().getTime(); pvOverlayDimm.style.opacity = `${1 - pvMoved / pvCont.offsetHeight}`; Object.assign(pvCont.style, { 'transform': `translateY(${pvMoved}px)`, '-webktit-backface-visibility': 'hidden', 'backface-visibility': 'hidden' }); } } function pullToCloseReset(e) { let isCloseBtnClicked = e.target.id == 'js_card_pv_close_btn' || e.target.parentNode.id == 'js_card_pv_close_btn'; let moveDur = pvMoveTime - pvStartTime; if (isCloseBtnClicked || pvMoved > 150 || (moveDur > 0 && moveDur < 300)) { closeGameDetailsView(); } else if (!allowPvScrolling) { if (pvMoved > 0) { setGameDetailsViewPosition(pvCont, '0px', pvOverlayDimm, '1'); setTimeout(() => { pvCont.style = ''; pvOverlayDimm.style = ''; }, 300); } } } function closeGameDetailsView() { setGameDetailsViewPosition(pvCont, '100%', pvOverlayDimm, '0'); setTimeout(() => { pvCover.remove(); allowScroll(); }, 300); }; function preventTouchMoveEvent(e) { if (!hasPvCoverScroll) { e.preventDefault(); } } function handleOrientatiChange(e) { setTimeout(() => { pvScrollContainer = window.innerHeight <= 450 ? document.getElementById('js_lb_card_preview_content') : document.getElementById('js_lb_card_preview'); allowPvScrolling = pvScrollContainer.scrollTop != 0; hasPvCoverScroll = pvScrollContainer.offsetHeight < pvScrollContainer.scrollHeight; }, 300); } function preventScroll() { $('body').addClass('disable-scroll'); document.documentElement.addEventListener('touchmove', preventTouchMoveEvent, { passive: false }); window.addEventListener('orientationchange', handleOrientatiChange); }; function allowScroll() { $('body').removeClass('disable-scroll') document.documentElement.removeEventListener('touchmove', preventTouchMoveEvent, { passive: false }); window.removeEventListener('orientationchange', handleOrientatiChange); } $(document).on('click', '.js_game_fav', function (e) { e.stopPropagation(); if (GamesCommon.userId == 0) { if (GamesCommon.hasStaticLoginPage) { document.location.href = '/Login/Login'; } else { openRightSidebar(); } return; } if (allowClick) { allowClick = false; var favIcon = $(this); var gameId = $(this).parents('.js_game_info').attr('data-game-id'); if (typeof gameId == 'undefined' || gameId == null) { gameId = $(this).parents('.js_dl_games_cont').attr('data-game-id'); } if ($(favIcon).hasClass('active')) { $.ajax({ url: "/DynamicLobbyHelper/DeleteFromFavList", type: "POST", data: { gameId: gameId }, datatype: "json", success: function (result) { if (result.Code > 0) { createToast('error', result.Message); } else { if (GamesCommon.gameCardType == 4 && typeof WidgetBasedPageHelper == 'undefined') { $('div[data-game-id="' + gameId + '"] .js_game_fav_icon').removeClass('active'); } else { $(favIcon).removeClass('active'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-isfavorite') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-isfavorite', 'false'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-is-favorite') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-is-favorite', 'false'); } } allowClick = true; } }); } else { $.ajax({ url: "/DynamicLobbyHelper/AddToFavList", type: "POST", data: { gameId: gameId }, datatype: "json", success: function (result) { if (result.Code > 0) { createToast('error', result.Message); } else { if (GamesCommon.gameCardType == 4 && typeof WidgetBasedPageHelper == 'undefined') { $('div[data-game-id="' + gameId + '"] .js_game_fav_icon').addClass('active'); } else { $(favIcon).addClass('active'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-isfavorite') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-isfavorite', 'true'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-is-favorite') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-is-favorite', 'true'); } } allowClick = true; } }); } } }); $(document).on('click', '.js_game_like', function (e) { e.stopPropagation(); if (GamesCommon.userId == 0) { if (GamesCommon.hasStaticLoginPage) { document.location.href = '/Login/Login'; } else { openRightSidebar(); } return; } if (allowClick) { allowClick = false; var likeIcon = $(this); var gameId = $(this).parents('.js_game_info').attr('data-game-id'); if (typeof gameId == 'undefined' || gameId == null) { gameId = $(this).parents('.js_dl_games_cont').attr('data-game-id'); } if ($(likeIcon).hasClass('active')) { $.ajax({ url: "/DynamicLobbyHelper/RemoveLike", type: "POST", data: { gameId: gameId }, datatype: "json", success: function (result) { if (result.Code > 0) { createToast('error', result.Message); } else { var likesCount = $(likeIcon).find('.js_game_likes_count').text(); if (GamesCommon.gameCardType == 4 && typeof WidgetBasedPageHelper == 'undefined') { $('div[data-game-id="' + gameId + '"] .js_game_like_icon').removeClass('active'); } else { $(likeIcon).removeClass('active'); } $('div[data-game-id="' + gameId + '"] .js_game_likes_count').html(Number(likesCount) - 1); if ($('div[data-game-id="' + gameId + '"]').attr('data-likescount') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-likescount', Number(likesCount) - 1); $('div[data-game-id="' + gameId + '"]').attr('data-isliked', 'false'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-likes-count') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-likes-count', Number(likesCount) - 1); $('div[data-game-id="' + gameId + '"]').attr('data-is-liked', 'false'); } } allowClick = true; } }); } else { $.ajax({ url: "/DynamicLobbyHelper/AddLike", type: "POST", data: { gameId: gameId }, datatype: "json", success: function (result) { if (result.Code > 0) { createToast('error', result.Message); } else { var likesCount = $(likeIcon).find('.js_game_likes_count').text(); if (GamesCommon.gameCardType == 4 && typeof WidgetBasedPageHelper == 'undefined') { $('div[data-game-id="' + gameId + '"] .js_game_like_icon').addClass('active'); } else { $(likeIcon).addClass('active'); } $('div[data-game-id="' + gameId + '"] .js_game_likes_count').html(Number(likesCount) + 1); if ($('div[data-game-id="' + gameId + '"]').attr('data-likescount') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-likescount', Number(likesCount) + 1); $('div[data-game-id="' + gameId + '"]').attr('data-isliked', 'true'); } if ($('div[data-game-id="' + gameId + '"]').attr('data-likes-count') != undefined) { $('div[data-game-id="' + gameId + '"]').attr('data-likes-count', Number(likesCount) + 1); $('div[data-game-id="' + gameId + '"]').attr('data-is-liked', 'true'); } } allowClick = true; } }); } } }); $(document).on('click', '.js_dl_games', function (e) { let previewType = this.dataset.previewType; let gameInfoFromWrapper = this.dataset.collectDataFromGame; let dataSource = 'games_grid'; if ($(e.target).parents('.js_dl_mLkd_games').length > 0) { dataSource = 'most_liked_widget'; } else if ($(e.target).parents('#js_recommended_games_cont').length > 0) { dataSource = 'recommended_widget'; } if (gameInfoFromWrapper == 'true') { let gameData = {}; gameData.Badges = ''; gameData.Description = this.dataset.description; gameData.HasDemo = JSON.parse(this.dataset.hasDemo); gameData.HasJackpot = JSON.parse(this.dataset.hasJackpot); gameData.Id = JSON.parse(this.dataset.gameId); gameData.Image = this.dataset.image; gameData.LanguageIds = []; gameData.LikesCount = JSON.parse(this.dataset.likesCount); gameData.IsFavorite = JSON.parse(this.dataset.isFavorite); gameData.IsLiked = JSON.parse(this.dataset.isLiked); gameData.MinMaxLimits = ['0', '0', '0']; gameData.URL = this.dataset.url; gameData.UseRmCdn = JSON.parse(this.dataset.useRmCdn); gameData.CatName = this.dataset.catName; gameData.CatIconType = GamesCommon.catIconType == 1 || GamesCommon.catIconType == 3 ? 1 : 0; gameData.WithoutLobby = true; drawGameDetailsView(gameData, null, dataSource); } else if (previewType == '0' || previewType == '2') { if (GamesCommon.gameCardType == 4) { var data = {}; let cdn = this.dataset.usermcdn == 'true' ? GamesCommon.RmCdnUrl : GamesCommon.cdnUrl; data.HasDemo = this.dataset.hasdemo.toLowerCase(); data.HasJackpot = this.dataset.hasjackpot.toLowerCase(); data.bImage = cdn + this.dataset.bimage; data.Image = cdn + this.dataset.image; data.Url = this.dataset.href; data.Name = this.dataset.name; data.CatName = this.dataset.catname; data.GameId = this.dataset.gameId; data.PreviewType = previewType; if (previewType == '2') { let minMaxLimits = this.dataset.minmaxlimits.split('-'); data.IsLiked = (this.dataset.isliked.toLowerCase() == 'true'); data.IsFavorite = (this.dataset.isfavorite.toLowerCase() == 'true'); data.LikesCount = this.dataset.likescount; data.MinMaxLimits = [minMaxLimits[0], minMaxLimits[1], minMaxLimits[2]]; } prepareGamePreview(data); } else { let gameId = this.dataset.gameId; GetGameDetails(gameId, dataSource); } } else { var gameUrl = '/play/real/' + $(this).attr('data-href'); playReal(gameUrl, e); } }); $(document).on('click', '.js_dl_play', function (e) { var gameUrl = '/play/real/'; if (document.getElementById('js_game_preview_block')) { gameUrl += $(this).parents('#js_game_preview_block').attr('data-href'); } else { gameUrl = this.dataset.href; if (typeof gameUrl == 'undefined') { gameUrl = this.getAttribute('href'); } } playReal(gameUrl, e); }); $(document).on('click', '.js_dl_play_demo', function (e) { var gameUrl = '/play/fun/'; if (document.getElementById('js_game_preview_block')) { gameUrl += $(this).parents('#js_game_preview_block').attr('data-href'); } else { gameUrl = this.dataset.href; if (typeof gameUrl == 'undefined') { gameUrl = this.getAttribute('href'); } } document.location.href = gameUrl; }); $(document).on('click', '#js_close_game_preview', function () { closeGamePreview(); }); $(document).on('click', '.js_dl_bw_play', function (e) { e.preventDefault(); e.stopPropagation(); let gameUrl = $(this).attr('data-href'); playReal(gameUrl, e); }); document.addEventListener('click', function (e) { if (!$(e.target).parents().hasClass('js_dl_games_cont')) { $('.js_dl_games_cont').removeClass('hover-effect'); } }); $(document).on('click', '.js_dl_games_cont', function (e) { if (!$(this).hasClass('hover-effect')) { e.preventDefault(); e.stopPropagation(); $('.js_dl_games_cont').removeClass('hover-effect'); $(this).addClass('hover-effect'); } }); $(document).on('click', '.js_jacpkpots', function () { let hoverBlock = $(this).find('.top_jackpots__hover_block')[0]; if (!window.js_topJackpot_cover) { $('body').append('
'); } $('body').addClass('ofh'); $(hoverBlock).css('bottom', '0'); $('#js_to_top_cont').css('z-index', '0'); }); $(document).on('click', '.js_close_hover', function (e) { e.stopPropagation(); $('body').removeClass('ofh'); $('#js_topJackpot_cover').remove(); $('.top_jackpots__hover_block').css('bottom', '-500px'); $('#js_to_top_cont').removeAttr('style'); }); $(document).on('click', '#js_card_pv_cover', function (e) { if (e.clientY < pvCont.offsetTop) { closeGameDetailsView(); } });