var Site = { loadedContact: false, contactMessage: null, contactTitle: null, lang: document.body.lang, baseUrl: '/', MyCoupon: 1, TYPE_WARNING: 'type-warning', TYPE_SUCCESS: 'type-success', SEARCH_IN: false, NOTIFICATION_ON: false, loggedin: false, mobile: false, shortName: null, brandName: null, masterTheme: null, themeName: null, cssVer: null, thumbVer: null, inGame: false, popupOpen: null, ignoreInsufficientFunds: false, ver: document.body.getAttribute("data-ver"), init: function () { var Me = this; this.loggedin = _tr.get('loggedin') == 1; this.mobile = _tr.get('is_mobile') == 1; this.shortName = _tr.get('short_name'); this.brandName = _tr.get('brand_name'); this.masterTheme = _tr.get('master_theme'); this.themeName = _tr.get('theme'); this.cssVer = _tr.get('css_ver'); this.ver = _tr.get('ver'); this.baseUrl = this.getBaseURL(); this.thumbVer = _tr.get('game_thumb_ver', 31); this.isBlaster = Site.masterTheme === 'blaster'; this.inGame = document.body.classList.contains('game_page'); if (!registrationModel) { $('.btnRegister, .open-register1').click(function (e) { e.preventDefault(); Me.getRegisterForm(this); }); } if ($('body').attr('id')) { this.pageID = $('body').attr('id'); } this.initFavorite(); if (this.loggedin) { this.keepAlive(); this.setMyCoupon(); this.verifyUser(); this.setAmountMessages(); window.addEventListener('load', function () { populateUserRegEventInfo(); var loginObject = window.userRegInfo; loginObject.usersCountry = window.usersCountryId; events.publish(allUserRegEvents.couponInfoLoad, loginObject); }); } else { if ($('#forgot_pwd_form').length) { Registration.forgotPassword(); } Registration.login('toploginform'); if ($('#Registration').length) { Registration.registration(); } else { if (!registrationModel) { this.loadRegistration(); } else { Registration.registration(); } } if (window.location.href.search('#registration') != -1) { Me.getRegisterForm(this); } $('.btnLogin').click(function (e) { Registration.openLoginDialog(e); }); $("#forgotpass").click(function (e) { e.preventDefault(); $("#dlgForgot").show(); $("#login-pop").hide(); }); $("#back-to-login").click(function (e) { e.preventDefault(); $("#login-pop").show(); $("#dlgForgot").hide(); }); } $('[data-toggle="offcanvas"]').click(function () { $('.row-offcanvas').toggleClass('active'); }); if ($('#accordion').length) { this.initAccordion(); } if ($('.pagination').length) { this.setPagination(); } this.setDateFields(); if ($('#tabSet').length) { this.horizontalTabs(); } if ($('#search-head').length) { this.setSearchBar(); } if ($('a.games_pic').length) { this.loadGame(); } $('a.contact_us_link').click(function (e) { e.preventDefault(); Me.loadContactUs(e); }); Me.setSocial(); var container = $(".articles_links"); var closeTipsButtonHtml = '×'; if ($('#add_more_funds').length) { $('#add_more_funds').click(function (e) { e.preventDefault(); window.open('/' + Site.lang + '/?show=deposit'); }); }; if ($('#reload_game').length) { $('#reload_game').click(function (e) { e.preventDefault(); if (Site.popupOpen) { Site.popupOpen = closeDialog(Site.popupOpen); } GameScreen.reloadGame(); }); }; $('.articles_link').mouseover(function (e) { if (!$('.close_tips').length) { $(closeTipsButtonHtml).insertAfter($('.articles_link')); } container.show(); }); $('.articles_links .close, .articles_links .close_tips').click(function (e) { e.preventDefault(); container.hide(); }); $(document).mouseup(function (e) { if (!container.is(e.target) && container.has(e.target).length === 0) { container.hide(); $('.close_tips').remove(); } }); this.checkRecommendation(); }, setSocial: function () { var Me = this; $('.login_social').click(function (e) { var id = $(this).data('id'), url = '/social/login.php?provider=' + id + '&action=' + $(this).data('action') + '&lang=' + Me.lang, win = window.open(url, '_blank', "width=700,height=550"); $(win).unload(function () { window.location.reload(); }); }); }, setDateFields: function () { const now = new Date(), year = parseInt(now.getFullYear()), max_date = new Date(year - 18, now.getMonth(), now.getDate()), min_date = new Date(year - 100, now.getMonth(), now.getDate()); try { initDatepicker('.date'); initDatepicker('#birthdate_select', { max: max_date, min: min_date, onChange: (event, inst) => { const birthdate = moment(inst.value).format('YYYY-MM-DD'); $('#birthdate_select, #birthdate_value').val(birthdate); } }); } catch (e) { } }, loadGame: function () { var Me = this; $('a.games_pic').click(function (e) { e.preventDefault(); var provider = $(this).data('prov'), href = $(this).prop('href'); $.post(Me.baseUrl + Me.lang + '/ajax/load_game.php', { GameID: $(this).data('game_id'), PlayMode: _tr.get('loggedin') == 1 ? 'real' : 'demo', task: 'link', mobile: 1 }, function (response) { if (!response.ignore) { if (Me.mobile) { if (response.game_link) { window.location.href = response.game_link; } else { $('body').html(response.html.replace('\"', '"')); } } else { $('#games_cont').html(response.html); } } else { location.href = href; } }, 'json'); }); }, getBaseURL: function () { var url = location.href, // entire url including querystring - also: window.location.href; baseURL = url.substring(0, url.indexOf('/', 14)); if (baseURL.indexOf('http://localhost') != -1) { var url = location.href, pathname = location.pathname, index1 = url.indexOf(pathname), index2 = url.indexOf("/", index1 + 1), baseLocalUrl = url.substr(0, index2); return baseLocalUrl + "/"; } else { // Root Url for domain name return baseURL + "/"; } }, getPopUpContainer: function () { if (!$('#popupblock').length) { $('
', { id: 'popupblock', 'class': 'popupblock modal fade registration_cont', style: 'display:none', tabindex: -1, role: 'dialog', 'aria-labelledby': 'popupLabel' }).appendTo('body'); } return $('#popupblock'); }, initButtons: function () { var Me = this; if ($('#usernameLink').length) { $('#usernameLink').click(function (e) { Me.openMyAccount('details', this, e); }); } if ($('#accountLink').length) { $('#accountLink').click(function (e) { Me.openMyAccount('details', this, e); }); } $('.btnDeposit, .btnCoupon').click(function (e) { var page = 'deposit'; if ($(this).data('my_coupon')) { page += '?coupon_code=' + $(this).data('my_coupon'); } Me.openMyAccount(page, this, e); }); $('.btnWithdraw').click(function (e) { Me.openMyAccount('withdrawal', this, e); }); $('.btnBanking').click(function (e) { e.preventDefault(); window.location.href = '/' + this.lang + '/banking.html' }); if ($('#ballanceLink').length) { $('#ballanceLink').click(function (e) { Me.openMyAccount('balance', this, e); }); } if ($('#messengerIcon').length) { $('#messengerIcon').click(function (e) { Me.openMyAccount('messages', this, e); }); } $('.btnRegister').click(function (e) { e.preventDefault(); Me.getRegisterForm(this); }); }, initHomeFilterButtons: function () { $('.filter-btns .filter-btn').click(function (e) { e.preventDefault(); var $type = $(this).data('type'); }); }, gameWagerMaxbet: function (wager, max_bet) { if ($('.game-wager').length) { if (parseInt(wager)) { $('.game-wager span.value').html(wager); } if (max_bet) { $('.game-maxbet').show(); $('.game-maxbet span.value').html(max_bet); } else if ($('.game-maxbet span.value').html() == '') { $('.game-maxbet').hide(); } } }, displayError: function (error, title, event_type) { try { if (error) { if (!title) { title = 'Warning!'; } if (!$('.bootstrap-dialog').length) { console.log(error, $('.bootstrap-dialog').length); BootstrapDialog.show({ title: title, message: error, type: BootstrapDialog.TYPE_WARNING, onhide: function () { console.log('hide dialog'); location.reload(); }, onshown: function () { if (event_type === 'game') { console.log('show dialog'); betEvent($('#game_container'), 0, error); } } }); } } } catch (e) { } }, keepAliveNotConnected: function (response) { if (Site.isBlaster) { userNotice({ type: "notice", level: "3", target: "#notice", title: response.error_title, subTitle: "", grayContent: "", text: "", content: response.error, action: "home", btnText: response.error_btnText }); } else { BootstrapDialog.show({ title: response.error_title, message: response.error, type: BootstrapDialog.TYPE_WARNING, onhide: function () { window.location.href = '/'; } }); $('.close-btn').attr('href', '/').on("click", function (e) { window.location.href = '/'; }); } }, handleInsufficientFunds: function (insufficient_funds) { if (insufficient_funds) { if (this.ignoreInsufficientFunds) { return; } if (this.popupOpen && this.popupOpen != "insufficient_funds") { closeDialog(this.popupOpen); } this.popupOpen = openDialog("insufficient_funds"); return; } if (this.popupOpen && this.popupOpen === "insufficient_funds") { this.ignoreInsufficientFunds = false; closeDialog(this.popupOpen); this.popupOpen = openDialog("balance_updated"); } }, handleIgnoreInsufficientFunds: function() { Site.ignoreInsufficientFunds = true; }, keepAlive: function (oneTime) { var Me = this; $.post(this.baseUrl + this.lang + '/ajax/keepalive.php', {keepalive: true}, function (response) { if (!response.connected) { Site.keepAliveNotConnected(response); return; } if (response.totalbalance) { $('#ballanceLink span').text(response.total_balance_html); $('.wallet-Sport').text(response.sport_balance_html); $('.wallet-Casino').text(response.balance_html); $('.total-balance').text(response.total_balance_html); if (window.userBalance != response.balance) { Me.ignoreInsufficientFunds = false; } window.userBalance = response.balance; window.userWagerValue = response.wager; } Me.gameWagerMaxbet(response.wager, response.max_bet); if (typeof response.insufficient_funds === 'boolean' && Me.inGame) { Me.handleInsufficientFunds(response.insufficient_funds); } if (response.error) { Me.displayError(response.error, null, 'game'); } if (response.message && response.message.content && response.message.content.length && !Me.NOTIFICATION_ON) { Me.NOTIFICATION_ON = true; BootstrapDialog.show({ title: '', message: response.message.content, cssClass: 'user_notification', onhide: function () { $.post(Me.baseUrl + Me.lang + '/ajax/notification_shown.php', {msg_id: response.message.msg_id}, function (data) { }, 'json'); Me.NOTIFICATION_ON = false; console.log('onhide'); }, onshown: function (dialog) { $('.user_notification .btnDeposit, .user_notification .btnCoupon').click(function (e) { var page = 'deposit'; if ($(this).data('my_coupon')) { page += '?coupon_code=' + $(this).data('my_coupon'); } dialog.close(); Me.openMyAccount(page, this, e); }); } }); } if (!oneTime) { setTimeout('Site.keepAlive()', 10000); } }, 'json'); }, initAccordion: function () { var $active = $('#accordion .panel-collapse.in').prev().addClass('active'); $active.find('a').append(''); $('#accordion .panel-heading').not($active).find('a').append(''); $('#accordion').on('show.bs.collapse', function (e) { $('#accordion .panel-heading.active').removeClass('active').find('.fa').toggleClass('fa-plus fa-minus'); $(e.target).prev().addClass('active').find('.fa').toggleClass('fa-plus fa-minus'); }); $('#accordion').on('hide.bs.collapse', function (e) { $(e.target).prev().removeClass('active').find('.fa').removeClass('fa-minus').addClass('fa-plus'); }); }, setPagination: function () { var Me = this; $('.pagination .historyPageBtn').click(function (e) { var pageNumber = $(this).data('num'), filters = $('#frmSearch').length ? $('#frmSearch').serializeArray() : {}, obj = $('#frmSearch').data('object'); filters.push({name: 'page', value: pageNumber}); obj = (obj) ? eval(obj) : null; Me.loadData($(this).data('tab'), filters, obj); }); }, loadData: function (container, filters, caller) { var Me = this, url = this.baseUrl + this.lang + '/ajax/get_tab.php'; $.post(url, {filters: filters, tabname: container.replace('tab_', ''), mobile: 1}, function (response) { $('#' + container).html(response); Me.initPage(caller); }); }, initPage: function (caller) { this.setPagination(); this.setDateFields(); if (caller) { try { caller.init(); } catch (e) { console.log(e); } } }, dialog: function (title, content, params) { var params = params; params.title = title; params.message = content; BootstrapDialog.show(params); }, setMyCoupon: function () { var Me = this, url = this.baseUrl + this.lang + '/ajax/my_coupon.php'; if (_tr.get('loggedin') == 1 && $('#my_coupon')) { if (this.MyCoupon) { this.MyCoupon = 0; $.post(url, {mobile: 1}, function (response) { Me.MyCoupon = 1; $('#my_coupon').css('visibility', 'visible'); $('#my_coupon div').html(response.message); if (response.data > '0') { $('#mybonus_amount').show(); $('#mybonus_amount').text(response.data); } if (this.ver == 2017) { $('#coupons_wrapper').prepend(''); setWrapperSize(); $(window).on("orientationchange", function () { setWrapperSize(); }); } $(window).resize(setWrapperSize); $('.btnCoupon').click(function (e) { e.preventDefault(); $('#coupons_wrapper').toggle(); }); $('.close_coupons').click(function (e) { e.preventDefault(); $('#coupons_wrapper').hide(); }); $('.coupon p a.open_terms').click(function (e) { e.preventDefault(); var parent = $(this).closest('div'); $(parent).next('.terms').show(); $(parent).hide(); return false; }); $('.coupon .terms a').click(function (e) { e.preventDefault(); var parent = $(this).closest('div'); $(parent).prev('div').show(); $(parent).hide(); return false; }); $('#coupons_wrapper .btnDeposit').click(function (e) { Me.openMyAccount('deposit', this, e); }); $('.my_account').click(function (e) { Me.openMyAccount($(this).data('page'), this, e); }); }, 'json'); } } function setWrapperSize() { if ($('#my_coupon').length && _tr.get('is_mobile') == 1) { var maxTop = $(window).height() - $('.navbar').height(), wrapperHeight = $('#coupons_wrapper').height(), t = Math.min(maxTop, wrapperHeight), w = $(window).width(); $('#coupons_wrapper').css({ top: -t + 'px', height: t + 4 + 'px', width: w + 'px', left: -$('#my_coupon').offset().left }); } } }, verifyUser: function () { var Me = this; $.post(Me.baseUrl + Me.lang + '/ajax/verify.php', {}, function (response) { if (response.result == false) { BootstrapDialog.warning(response.error); setInterval(function () { window.location.href = '/'; }, 10000); } }, 'json'); }, openMyAccount: function (tab, btn, event, method, reload) { if (event) { event.preventDefault(); } //var url = (window.location.href.indexOf('.com') !=-1? this.baseUrl.replace('http://', 'https://') : this.baseUrl) + this.lang+'/my_account/'; var url = (window.location.href.indexOf('.com') != -1 ? this.baseUrl.replace('http://', 'http://') : this.baseUrl) + this.lang + '/my_account/'; url += tab; if (method) { url += '?method=' + method; } if (btn) { var couponCode = $(btn).data('coupon'); if (couponCode) { url += '?coupon_code=' + couponCode; } } if (796 < $(window).width() && window.location.href.indexOf('/my_account/') == -1) { window.open(url, '_blank', 'status=0, width=800, height=840, left=100, top=100, scrollbars=1'); if (reload) { location.reload(); } } else { //Mobile window.location.href = url; } }, loadRegistration: function (exData) { $(this.getPopUpContainer()).load(this.baseUrl + this.lang + '/ajax/registration_form.php', exData, function () { Registration.registration(); }); }, getRegisterForm: function (btn) { var exData = {}, $cont = this.getPopUpContainer(); if (_tr.get('registerRedirect') == 1) { window.location.href = '/' + Site.lang + '/register'; return; } if (btn) { exData.source = $(btn).data('source'); } //this.popup = $($cont).modal('show'); this.popup = $($cont).modal({backdrop: 'static', keyboard: false}); this.setSocial(); }, horizontalTabs: function () { $('#tabSet').scrollTabs(); }, setSearchBar: function () { var Me = this, $resultDiv = $('#search_result'); $('#game_search').click(function (e) { e.preventDefault(); if (_tr.get('popfixerConf') !== 'no-fixer') { if ($('body').hasClass('menu-toggled-in')) { closeMainMenu(); } } if ($resultDiv.hasClass('in')) { checkAndBack(); } else { pushState('#search_result'); } openSearch(); }); $('#search-head button').click(function (e) { closeSearch(); }); $('#search-head input').keyup(function () { var $featuredGameIcon = ' ', $newGameBadge = ''; var q = $(this).val(); if (q.length > 1) { var html = '', rawClosed = false, img_dir = _tr.get('img_dir'); if (Me.SEARCH_IN == false || Me.SEARCH_IN.status == 200) { Me.SEARCH_IN = $.post(Me.baseUrl + Me.lang + '/ajax/common.php', { q: q, action: 'search_games' }, function (response) { $.each(response.games, function (i, game) { if (game.is_new) { $newGameBadge = 'New!'; } if (!Site.isBlaster) { html += 'Showing ' + response.games.length + ' results
' + html); } else { $('#search-content').html('Sorry, no results.
'); } }, 'json'); } } else { $('#search-content').html(''); } }); }, setAmountMessages: function () { var $cont = $('#messengerIcon span'); if ($cont.length) { var Me = this; $.post(Site.baseUrl + Site.lang + '/ajax/messages.php', {action: 'total'}, function (responseJSON) { $cont.text(responseJSON.result); setTimeout('Site.setAmountMessages()', 600000);//Each 10 min }, 'json'); } }, loadContactUs: function (e) { var Me = this; e.preventDefault(); if (!$('#dialog_cont').length) { $('', {id: 'dialog_cont', 'class': ''}).appendTo('body'); } $.ajax({ url: this.baseUrl + this.lang + '/ajax/common.php', type: 'POST', dataType: 'json', data: { action: 'contact_us_form' }, success: function (response) { if (response.result) { BootstrapDialog.show({ message: response.data.message, title: response.data.title, cssClass: 'contact_dlg', onshown: function () { Me.validateContactUs('frmContactUs'); labelit(); } }); Me.loadedContact = false; } }, beforeSend: function () { console.log(Me.loadedContact); if (Me.loadedContact === true) { return false; } } }); Me.loadedContact = true; }, showDialog: function (message, title) { var Me = this; BootstrapDialog.show({ message: message, title: title, cssClass: 'contact_dlg', onshown: function () { Me.validateContactUs('frmContactUs'); labelit(); } }); }, validateContactUs: function (frmId) { console.log($("#" + frmId)); var Me = this, $validator = $("#" + frmId).validate({ rules: { name: { required: true, minlength: 2 }, email: { required: true, email: true }, message: { required: true, minlength: 5 } }, messages: { name: _tr.get('PLEASE_ENTER_NAME', "Please enter your name"), email: { required: _tr.get('PLEASE_ENTER_EMAIL', "Please enter your email"), email: _tr.get('ERROR_EMAIL', "Password.(6-16) At least: 1-digit,1-upp,1-low") }, message: _tr.get('PLEASE_ENTER_MESSAGE', "Please enter your message") }, submitHandler: function (frm) { var data = $(frm).serializeArray(); $.post(Site.baseUrl + Site.lang + '/ajax/common.php', data, function (response) { var msg = '' + response.message + '
'; $("#" + frmId).html(msg); }, 'json'); } }); }, addLoader: function ($selector) { if (Site.ver == 2018) { $('.loadinggif').show(); } else { if ($($selector).find('.loader').length == 0) { $($selector).append(''); } $($selector + ' .loader').show(); } }, stopLoader: function () { $('.loadinggif').hide(); }, changeLoaderToSuccess: function (addRedirectMsg = false) { const successImg = document.createElement("img"); successImg.src = '/images/' + Site.masterTheme + '/Check.svg'; $('.loadinggif').html(successImg); if (addRedirectMsg) { setTimeout(function () { $('.loadinggif').append('Success! You are being redirected'); }, 700); } }, initFavorite: function (block) { var Me = this; if (!block) { block = ''; } $(block + '.favorite_star').on("click", function (e) { var gameId = $(this).data('game_id'), add = !$(this).hasClass('active'); $('.favorite_star[data-game_id="' + gameId + '"]').toggleClass('active'); $.post(Site.baseUrl + Site.lang + '/ajax/common.php', { game_id: gameId, add: add, action: 'set_favourite', per_row: 6 }, function (responseJSON) { if (responseJSON.result) { $('#favourite_games').fadeOut('slow', function () { $(this).html(responseJSON.data); Me.initFavorite('#favourite_games '); }).fadeIn("slow"); } }, 'json'); if (!$(this).hasClass('active')) { $(this).attr('data-original-title', "Add to Favourites"); } else { $(this).attr('data-original-title', "Remove from Favourites"); } }); }, checkRecommendation: function () { var recommendation = '', Me = this; if (!this.loggedin && !this.mobile && this.pageID === 'online-slots') { if (this.isFlashEnabled() == 0 && !this.getCookie("flash_disabled")) { $.post(Me.baseUrl + Me.lang + '/ajax/common.php', { name: 'flash_disabled', action: 'get_page', lang: Me.lang }, function (response) { if (response) { var enableLink; if (navigator.userAgent.match(/chrome/i)) { enableLink = 'https://helpx.adobe.com/flash-player/kb/enabling-flash-player-chrome.html'; } else if (navigator.userAgent.match(/firefox/i)) { enableLink = 'https://helpx.adobe.com/flash-player/kb/enabling-flash-player-firefox.html'; } else if (navigator.userAgent.match(/msie/i) || navigator.userAgent.match(/wow64/i)) { enableLink = 'https://helpx.adobe.com/flash-player/kb/install-flash-player-windows.html'; } else if (navigator.userAgent.match(/safari/i)) { enableLink = 'https://helpx.adobe.com/flash-player/kb/enabling-flash-player-safari.html'; } else if (navigator.userAgent.match(/opera/i)) { enableLink = 'https://helpx.adobe.com/flash-player/kb/enabling-flash-player-opera.html'; } else { enableLink = 'https://helpx.adobe.com/flash-player.html'; } if (response.data) { recommendation += '' + response.data.content.replace('%enable%', enableLink) + '
'; } } Me.showRecommendation(recommendation, 'flash_disabled', 1); } }, 'json'); } } }, showRecommendation: function (recommendation, name, val) { if (recommendation) { var $recommend = $('#user_recommendation'), Me = this; if ($recommend.length == 0) { if (this.ver == 2017) { $("#top_info").prepend('