
' +
'
';
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 = '
' +
'

' +
'';
if (data.HasJackpot == 'true') {
html += '
JACKPOTS' +
'
';
}
html += '
' + data.Name + '
';
if (GamesCommon.gameCardType == 4) {
html += '
' + data.CatName + '
';
}
html += '

';
if (data.PreviewType == '2') {
html += drawGamesCardFooterSpec(data);
}
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 = `

` +
`
` +
`
`;
switch (data.CatIconType) {
case 1:
html += `
${data.CatName}`;
break;
case 2:
html += `

`;
break;
case 3:
html += `
${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();
}
});