Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as extra from './extra.js';
- import {
- gamesConfig
- } from './game_config'
- import {
- resizeConfig
- } from './resizeConfig'
- import {
- store,
- state,
- keno_games,
- gametype,
- keno_fill_hits_and_sortorder,
- ps,
- ticketThings,
- render_bh_tickets,
- update_buy_btn_enable,
- startAnimation,
- } from './keno.js';
- import {
- history2
- } from './history_2.js'
- // import {
- // resizeSplits
- // } from './keno_prizes_table.js'
- import {
- initialize
- } from './initialize.js'
- import * as keno_slider from './keno_slider_2.js';
- import * as bought_tickets from './bought_tickets.js';
- import * as theme from "./theme";
- import * as b_tickets from "./bought_tickets";
- import {
- get
- } from 'https';
- const sprintf = require('sprintf').sprintf;
- const hist_helper = {
- url: {
- getAllGames: '',
- },
- gameNumbers: [],
- historyData: [],
- gameData: [],
- allTicketsHistory: [],
- historyBalls: [],
- firstPageTickets: [],
- firstPage: '',
- shownPage: '',
- historyGamesCounter: '',
- leftArrow: '#previousGame',
- rightArrow: '#nextGame',
- closeBtn: '#closeButton',
- historyBtn: '#repeatButton',
- openModal: '.btnRepeat',
- history_actions: {
- drag_pager: 'HISTORY_DRAG',
- up_btn: 'HISTORY_UP',
- down_btn: 'HISTORY_DOWN',
- up_scroll: 'HISTORY_UP_SCROLL'
- },
- couterForRecursion: 0,
- renderPageCounter: 0,
- animationInvoke: false,
- /* initialize modal html, start it hidden*/
- init() {
- this.historyModal();
- this.test1(); //FIXME
- },
- /* Getting proper URL thanks to proper game id and session id we took from getHistPacket function in keno.js*/
- concatUrl(gameId, sessionId) {
- this.url.getAllGames = 'https://' + window.location.hostname + ':8150/support/allGames/' + gameId + '/' + sessionId;
- },
- /* Getting game numbers in array for easier search from first page to last page */
- getGameNumbers(gameId, sessionId) {
- this.concatUrl(gameId, sessionId);
- const allGameNumbers = extra.getData(this.url.getAllGames);
- const repeatBtn = $('.btnRepeat');
- const repeatBtn2 = $('.kbtn_history');
- allGameNumbers.then((gameNumbers) => {
- if (gameNumbers.success === undefined) {
- console.error('There was an error in the Statistics. the Error was: ');
- console.error(gameNumbers.error);
- return
- }
- repeatBtn.removeClass('btnRepeat_disabled');
- repeatBtn2.removeClass('btnRepeat_disabled2');
- // console.log(gameNumbers.success[0] === undefined);
- // if (!gameNumbers.success) return console.error(gameNumbers.error);
- this.gameNumbers = gameNumbers.success.map((number) => number.gamenumber);
- this.firstPage = this.gameNumbers[0];
- if (gameNumbers.success.length === 0) {
- repeatBtn.addClass('btnRepeat_disabled');
- repeatBtn2.addClass('btnRepeat_disabled2');
- return;
- }
- this.renderPage(this.firstPage);
- }).always(() => {
- $.unblockUI(); // stop loading screen -> packet is here
- }).fail(() => { //jqXHR, textStatus, errorThrown
- if (this.couterForRecursion < 2) {
- this.couterForRecursion++;
- setTimeout(() => this.getGameNumbers(gameId, sessionId), 1000);
- }
- repeatBtn.addClass('btnRepeat_disabled');
- repeatBtn2.addClass('btnRepeat_disabled2');
- console.error('History data error... Please try again later!');
- });
- },
- getFirstPageTickets() {
- this.renderPage(this.firstPage);
- },
- /* Getting the main data for the correct gameNumber */
- renderPage(gameNumber) {
- const route = this.url.getAllGames + '/' + gameNumber;
- const firstPage = extra.getData(route);
- const repeatBtn = $('.btnRepeat');
- const repeatBtn2 = $('.kbtn_history');
- const ls = store.getState().localstate;
- firstPage.then((gameData) => {
- // if (!gameData.success) return console.error(gameData.error);
- repeatBtn.removeClass('btnRepeat_disabled');
- repeatBtn2.removeClass('btnRepeat_disabled2');
- this.gameData = gameData.success[0];
- /*fill tickets from gameDATA*/
- this.allTicketsHistory = this.fillAllTickets(this.gameData).slice();
- if (gameNumber === this.firstPage) this.firstPageTickets = this.allTicketsHistory; //for repeat one game btn
- if (history2.checkVisability()) {
- ls.random_tickets = this.allTicketsHistory;
- ls.totalPages_up_down = Math.ceil(ls.random_tickets.length / 15);
- update_buy_btn_enable(ls);
- }
- this.historyBalls = extra.jp(this.gameData.balls);
- const ballPositions = (gametype === gamesConfig.keno_games.KENO535) ? 0 : 1; //set 5 or 6 balls depending on gametype (try to unify for as one pram from config);
- /*Needed for slider and user interaction, when click arrow to give you the right tickets, grey purchase button
- if you have sum of over 10,000 tickets (bought + purchased), update of buyBtn and resize html of the tickets*/
- store.dispatch({
- type: "NEW_HISTORY_GAME"
- });
- this.clearPanelHits();
- this.renderHits(this.historyBalls); //render hits in panelHitsHistory, (move panelHitsRener function to this file);
- this.renderPrizesRows(); //render prizes 3-4 rowsdepending on gametype, (try to pass it as parame);
- this.render_modal_tickets();
- this.renderBalls(this.gameData.balls, ballPositions); // render balls for displayed game, (ballPositions param is generated above);
- this.historyTextFill(); // function to fill game info in coresponding panel: win, bet, tickets, ticket price
- }).always(() => {
- $.unblockUI(); // stop loading screen => packet is here
- }).fail(() => { //jqXHR, textStatus, errorThrown
- if (this.renderPageCounter < 2) {
- this.renderPageCounter++;
- setTimeout(() => this.renderPage(gameNumber), 1000);
- }
- repeatBtn.addClass('btnRepeat_disabled');
- repeatBtn2.addClass('btnRepeat_disabled2');
- // console.warn("You don't have data, please make a game.");
- });
- },
- /* Fills array with the structure of tickets to help them render when you try to purchase them in premadeTickets Screen*/
- fillAllTickets(gameData) {
- const allTickets = [];
- gameData.playerTickets.map((ticketData) => {
- allTickets.push({
- data: extra.js(ticketData.ticket),
- id: parseInt(ticketData.id),
- cnt: ticketData.cnt,
- });
- });
- return allTickets;
- },
- renderHits(balls) {
- balls.map((e) => {
- const hitCell = $(".panel-hits-hist__cell" + e);
- if (!hitCell.hasClass("panel-hits__cell-hit")) {
- hitCell.addClass("panel-hits__cell-hit");
- }
- });
- },
- clearPanelHits() {
- const panelHitCells = $('#panelHitsHistory').find('.panel-hits__cell');
- if (panelHitCells.hasClass('panel-hits__cell-hit')) panelHitCells.removeClass('panel-hits__cell-hit');
- },
- test1() { //FIXME INVOKING SLIDER, RENAME ME
- this.historyGamesCounter = this.gameNumbers[0];
- const ticketsContainer = $("#ticketsContainer");
- new keno_slider.KenoSlider(ticketsContainer, 'history');
- },
- /* Create transparent div, behind modal */
- creatTransparentDiv() {
- const transparentDiv = $('<div class="transparentDiv" ></div>');
- $('.game_keno').append(transparentDiv);
- },
- /* Remove transparent div, behind modal */
- removeTransparentDiv() {
- $('.transparentDiv').remove();
- },
- changeFontSizeTitle() {
- const priceTitle = $('#ticketPriceTitle');
- const lang = theme.get();
- const priceTitleObj = {
- 8: "1.5vw",
- 13: "1.5vw",
- 15: "1.5vw",
- 16: "1.3vw"
- }
- const priceTitleLang = {
- 'bg': '1.35vw',
- 'ru': '1vw',
- 'ua': '1.2vw'
- };
- extra.changeFontSize(priceTitle, priceTitleObj);
- if (navigator.userAgent.match(/Android/i) && $(window).width() == 798) {
- priceTitle.css('font-size', priceTitleLang[lang]);
- }
- },
- /* Fill divs in modal with proper text (data) */
- historyTextFill() {
- const gameData = this.gameData;
- const gameNumbers = this.gameNumbers;
- const currencyText = gameData.units[this.gameData.currencyid];
- const parsedTickedPrice = extra.jp(gameData.ticketprice);
- const ticketPrice = parsedTickedPrice[gameData.currencyid] * gameData.tickets;
- const winText = gameData.win / extra.jp(gameData.conv)[gameData.currencyid];
- // new history modal data fill
- /* Win - START */
- // const winTitle = $('#winTitle');
- // const winTitleObj = {
- // 3: "3vw",//win
- // 6: "2.4vw",//виграш
- // 7: "2.2vw",//печалба, выигрыш
- // // 9: "1.9vw"//
- // }
- // extra.changeFontSize(winTitle, winTitleObj);
- const win = $('#winValue')
- const winObj = {
- // length of winValue + currency
- 7: "3vw",
- 8: "3vw",
- 9: "3vw",
- 10: "3vw",
- 11: "2.6vw",
- 12: "2.4vw",
- 13: "2.2vw",
- 14: "2vw",
- 15: "1.8vw",
- // 13: "2.7vw",
- // 14: "2.6vw"
- }
- win.text(extra.moneyStyleSmallCurrencyID(winText, win, currencyText));
- extra.changeFontSize(win, winObj);
- /* Win - END */
- /* Bet - START */
- // const betTitle = $('#betTitle');
- // const betTitleObj = {
- // 3: "3vw",
- // 5:"3vw",
- // 6: "2.8vw",
- // 7: "2.6vw",
- // 8: "2.6vw",
- // 14: "2.2vw"
- // }
- // extra.changeFontSize(betTitle, betTitleObj);
- const bet = $('#betValue');
- const betObj = {
- 7: "3vw",
- 8: "3vw",
- 9: "3vw",
- 10: "3vw",
- 11: "2.6vw",
- 12: "2.4vw",
- 13: "2.2vw",
- 14: "2vw",
- 15: "1.8vw",
- }
- bet.text(extra.moneyStyleSmallCurrencyID(ticketPrice, $('#betValue'), currencyText));
- extra.changeFontSize(bet, betObj);
- global.change_bet_size = extra.changeFontSize(bet, betObj);
- /* Bet - END */
- // Change title font-size on Samsung S8 for BG, RU, UA
- this.changeFontSizeTitle();
- $('#ticketsValue').text(gameData.tickets);
- $('#ticketPriceValue').text(extra.moneyStyleSmallCurrencyID(parsedTickedPrice[gameData.currencyid], $('#ticketPriceValue'), currencyText));
- $('#gameIdValue').text(gameData.id);
- $('#dateInfo').text(gameData.gamestart);
- $('#pageInfo').text((store.getState().localstate.hisotryPageCounter + 1) + '/' + this.gameNumbers.length);
- },
- sliderShowHide(pager) {
- return store.getState().localstate.historyTickets.length >= 15 ? pager.show() : pager.hide();
- },
- /* Rendering proper balls by getting array from the packet */
- renderBalls(balls, ballPositions) {
- const parsedBalls = extra.jp(balls);
- const ballsHolder = $('#ballsHolderHistory');
- ballsHolder.empty();
- parsedBalls.forEach((ball, index, ) => {
- const historyBallDiv = $(`<div class='histball histball${index}_${ballPositions} ball_${ball}'></div>`);
- ballsHolder.append(historyBallDiv);
- });
- },
- clearTicketHits() {
- const historyTickets = $('#tickets_container_premade');
- historyTickets.find('.ticket__num-box').attr("class", "ticket__num-box knum"); // Clear number of hits from tickets in history
- historyTickets.find('.ktbought_tickethits').attr("class", "ktbought_tickethits").css('background-image', 'none'); // Clear red circle hits from tickets in history
- },
- /* Render all tickets, sort order, hits and pagination */
- render_modal_tickets() {
- /** function to fill text information inside history modal */
- this.clearTicketHits();
- /** Render History Tickets */
- keno_fill_hits_and_sortorder(this.allTicketsHistory, this.historyBalls); //sorts tickets same same as they on the last stage of the game
- ticketThings();
- render_bh_tickets(true);
- // let ticket;
- // /* b_ticket - boughtTickets */
- // for (var index = store.getState().localstate.shownPage_up_down * 15, i = 0; i < 15 && index < this.gameData.tickets; index++, i++) {
- // ticket = bought_tickets.fillTicketData(sorted[index], i, bought_tickets.target.BP_SHOW_15_TICKETS);
- // if (store.getState().localstate.in_history_modal === 1) {
- // bought_tickets.set_hits(ticket, this.historyBalls, sorted[index], true /* in bet please*/ );
- // }
- // }
- // for (; i < 15; index++, i++) bought_tickets.fillTicketData(null, i, bought_tickets.target.BP_SHOW_15_TICKETS);
- /* Page counter up/down - premade tickets in BP*/
- const totalTicketsHist = this.gameData.tickets;
- const pager_bp = $('.page_counter_hist');
- const history_pager = $('.history_pager');
- history_pager.append(pager_bp);
- /* For slider pager */
- totalTicketsHist === 0 ? pager_bp.hide() : pager_bp.show();
- totalTicketsHist <= 15 ? history_pager.hide() : history_pager.show();
- },
- /* Left Arrow render state*/
- renderLeftArrow(left, ns) {
- if (ns.localstate.hisotryPageCounter === 0) {
- return left.removeClass('historyArrowLeftActive modalPulse').addClass('historyArrowLeftInactive');
- }
- left.removeClass('historyArrowLeftInactive modalPulse').addClass('historyArrowLeftActive modalPulse');
- },
- /* Right Arrow render state */
- renderRightArrow(right, ns) {
- if (ns.localstate.hisotryPageCounter === this.gameNumbers.length - 1) {
- return right.removeClass('historyArrowRightActive modalPulse').addClass('historyArrowRightInactive');
- }
- right.removeClass('historyArrowRightInactive').addClass('historyArrowRightActive modalPulse');
- },
- /* Here are rendered left, right arrows, slider, pager*/
- renderNavigation() {
- const ns = store.getState();
- //Render game navigation arrows state
- this.renderLeftArrow($(this.leftArrow), ns);
- this.renderRightArrow($(this.rightArrow), ns);
- //call slider functions for history slider
- // const total_pages = ns.localstate.historyTotalPages - 1;
- // const shown_page = ns.localstate.historyShownPage;
- // keno_slider.KenoSlider.renderSlider('history', total_pages, shown_page, this.history_actions);
- // keno_slider.KenoSlider.sliderAnimation('history', total_pages, shown_page);
- // try {
- // keno_slider.render(total_pages, 'history_slider', 'history_pager', 'HISTORY_SCROLL');
- // keno_slider.update(total_pages, shown_page, 'history_slider', 'history_pager');
- // keno_slider.slider_animation(shown_page, total_pages, 'k_up_btn_hist', 'k_down_btn_hist', 'history_pager', total_tickets, 7, 7, 20, 30);
- // keno_slider.show_hide_page_num(total_tickets.length - 1, shown_page, 'history_pager', 'bottom_text_hist', 'k_up_btn_hist');
- // } catch (e) {
- // console.error(e);
- // }
- // const pager_history = $('.page_counter_history');
- // ns.localstate.historyTickets.length === 0 ? pager_history.hide() : pager_history.show();
- // pager_history.text(sprintf("%d", ns.localstate.historyShownPage + 1));
- // hist_helper.sliderShowHide($('.history_pager'));
- },
- /* Structure of the whole Modal, starts hidden */
- historyModal() {
- $('.btnRepeat').addClass('btnRepeat_disabled');
- $('.kbtn_history').addClass('kbtn_history_disabled');
- $('#historyModal').remove();
- const body = `<div id="historyModal" style='display:none'>
- <div id="histModalFirstRow" class="histModalRow">
- <div class="historyArrow" >
- <div class="histCenteredButton" id="leftArrow" ></div>
- </div>
- <div id="dataContainer">
- <div id="drawIdContainer" class="styleContainer">
- <div id="gameIdHist" >
- <span id="gameIdTextHist"></span>   
- <span id="gameIdValueHist"></span>
- </div>
- <div id="gamePageHist">
- <span id="historyPagesText" ></span>    
- <span id="historyPages" ></span>
- </div>
- </div>
- <div id="dateContainer" class="styleContainer "></div>
- </div>
- <div class="historyArrow" >
- <div class="histCenteredButton" id="rightArrow" ></div>
- </div>
- </div>
- <div id="histModalSecondRow" class="histModalRow">
- <div class="buttonContainer">
- <div class="histCenteredButton" id="repeatButton" style='display:none'></div>
- <div class="histCenteredButton" id="repeatButtonInactive" style='display:none'></div>
- </div>
- <div id="ticketsBetWinContainer">
- <div id="ticketsBetDiv">
- <div id="ticketsCount" class="histHalfContainer styleContainer">
- <div id="ticketsTextHist"></div>
- <div id="ticketsValueHist"></div>
- </div>
- <div id="betContainer" class="histHalfContainer styleContainer">
- <div id="betTextHist"></div>
- <div id="betValueHist">
- <div class="currencyId"></div>
- </div>
- </div>
- </div>
- <div id="winContainer" class="styleContainer ">
- <div id="winTextHist" ></div>
- <div id="winValueHist">
- <div class="currencyId"></div>
- </div>
- </div>
- </div>
- <div class="buttonContainer">
- <div class="histCenteredButton" id="closeButton" ></div>
- </div>
- </div>
- <div id="histModalThirdRow" class="histModalRow">
- <div id="ticketsContainer"></div>
- <div id='prizesWrapperHistory'>
- <div id='ballsHolderHistory'></div>
- <div id='prizesBodyHistory'></div>
- </div>
- </div>
- </div>`;
- $('.game_keno').append(body); //appends once for the main layout
- },
- /* Generating dynamically rows by gameType */
- generatePrizesRow(parent, index, prizesArr, prizesArrLength, jpArr, currencyText) {
- const row = `<div class='prizesRowHist' id="prizesRowHist${index + 1}">
- <div class='jpLeftBox' id='jpLeftFive'>
- <div class='jpLeftStart'>${index + 3}</div>
- </div>
- <div class='jpMiddleBoxHist' id='jpMiddle${index + 1}'>
- <div id='jackpotStat${index}' class='jpMiddleStartHist numbers_stat'>${jpArr}</div>
- <div id='jackpotWin${index}' class='jpMiddleEnd numbers_stat'>
- <div id='jackpotWinsCountHist${index}' class='jackpotWinsCountHist'>${prizesArrLength}</div>
- <div id='xHist${index}' class='xHist'> x </div>
- <div id='jackpotWins${index}' class='jackpotWins'>${prizesArr}</div>
- <div id='space${index}'> </div>
- <div class='jpCenteredCurrencyHist'>${currencyText}</div>
- </div>
- </div>
- <div class='jpRightBox' id='jpRightFive'></div>
- </div>`;
- parent.append(row);
- },
- clearZeros(index, prizesCount) {
- if (prizesCount === 0) {
- $('#jackpotWinsCountHist' + index).hide();
- $('#xHist' + index).hide();
- $('#jackpotWins' + index).hide();
- }
- },
- /* Render prizes rows dynamically and fill them with calculated data from the packet */
- renderPrizesRows() {
- this.historyTextFill(); // function to fill text information inside history modal
- // this.renderBalls(this.gameData.balls); // display proper balls
- //fixme out of here
- $('#prizesBodyHistory .prizesRowHist').remove();
- // checkingtype of game to know how many rows to render
- const forLoopStartsFrom = (gametype === gamesConfig.keno_games.KENO535) ? 2 : 3;
- const arrWithJpWins = this.gameData.playerProfitByNumbers;
- const currencyText = this.gameData.units[this.gameData.currencyid];
- const prizesBody = $('#prizesBodyHistory');
- const historyData = this.gameData;
- const jpArr = [];
- const prizesArr = [];
- const prizesArrLength = [];
- let counter = 0;
- let formatedWin;
- let formatedAllWin;
- let convertedWin;
- let winsPerJp;
- for (let i = forLoopStartsFrom; i >= 0; i--) {
- arrWithJpWins.forEach((wins) => {
- winsPerJp = wins[3 + i];
- if (winsPerJp === undefined) { //if it's undefined, there's no jp, so setting 0
- prizesArrLength[i] += 0;
- jpArr[i] += 0;
- prizesArr[i] += 0;
- return;
- }
- // calculating value by currency
- prizesArr[i] = winsPerJp; //elm[3+i] is the single jp value
- counter++; // to find how many wins we have from every jp
- });
- if (isNaN(prizesArr[i])) prizesArr[i] = 0; // in the begining is NaN see if needed
- prizesArrLength[i] = counter; // getting how many wins we have from that jp
- convertedWin = extra.money_convert(prizesArr[i], historyData.currencyid, extra.jp(historyData.conv)) | 0;
- jpArr[i] = convertedWin * prizesArrLength[i]; // getting the whole jp
- formatedWin = (convertedWin / 100).toFixed(2);
- formatedAllWin = (jpArr[i] / 100).toFixed(2);
- // appending results
- this.generatePrizesRow(prizesBody, i, formatedWin, prizesArrLength[i], formatedAllWin, currencyText);
- this.clearZeros(i, prizesArrLength[i]);
- counter = 0; //resetting for the next jp
- }
- $('#historyPagesText').text(theme.get_array('historyPagesText'));
- this.resizeHistorySplits();
- this.resizeHistorySplits();
- },
- resizeHistorySplits() {
- const jackpotOne = $('#jackpotStat0');
- const jackpotTwo = $('#jackpotStat1');
- const jackpotThree = $('#jackpotStat2');
- const jackpotFour = $('#jackpotStat3');
- const splitOne = $('#jackpotWins0');
- const splitTwo = $('#jackpotWins1');
- const splitThree = $('#jackpotWins2');
- const splitFour = $('#jackpotWins3');
- if (initialize.device[0] === 'android' && gamesConfig.prizesTable[gametype] === 4) { /* Android */
- let androidHistoryRows4 = resizeConfig.historyPrizesPanel.showSplit.androidPrizesTable4;
- extra.changeFontSize(jackpotOne, androidHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotTwo, androidHistoryRows4.jackpotObj2);
- extra.changeFontSize(jackpotThree, androidHistoryRows4.jackpotObj3);
- extra.changeFontSize(jackpotFour, androidHistoryRows4.jackpotObj4);
- extra.changeFontSize(splitOne, androidHistoryRows4.splitsObj);
- extra.changeFontSize(splitTwo, androidHistoryRows4.splitsObj);
- extra.changeFontSize(splitThree, androidHistoryRows4.splitsObj);
- extra.changeFontSize(splitFour, androidHistoryRows4.splitsObj);
- } else if (initialize.device[0] === 'android' && gamesConfig.prizesTable[gametype] === 3) {
- let androidHistoryRows3 = resizeConfig.historyPrizesPanel.showSplit.androidPrizesTable3;
- extra.changeFontSize(jackpotOne, androidHistoryRows3.jackpotObj1);
- extra.changeFontSize(jackpotTwo, androidHistoryRows3.jackpotObj2);
- extra.changeFontSize(jackpotThree, androidHistoryRows3.jackpotObj3);
- // console.log(androidHistoryRows3.jackpotObj3);
- extra.changeFontSize(splitOne, androidHistoryRows3.splitsObj);
- extra.changeFontSize(splitTwo, androidHistoryRows3.splitsObj);
- extra.changeFontSize(splitThree, androidHistoryRows3.splitsObj);
- } else if (initialize.device[0] === 'iPhone' && gamesConfig.prizesTable[gametype] === 4) { /* Iphone */
- let iosHistoryRows4 = resizeConfig.historyPrizesPanel.showSplit.iosPrizesTable4;
- extra.changeFontSize(jackpotOne, iosHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotTwo, iosHistoryRows4.jackpotObj2);
- extra.changeFontSize(jackpotThree, iosHistoryRows4.jackpotObj3);
- extra.changeFontSize(jackpotFour, iosHistoryRows4.jackpotObj4);
- extra.changeFontSize(splitOne, iosHistoryRows4.splitsObj);
- extra.changeFontSize(splitTwo, iosHistoryRows4.splitsObj);
- extra.changeFontSize(splitThree, iosHistoryRows4.splitsObj);
- extra.changeFontSize(splitFour, iosHistoryRows4.splitsObj);
- } else if (initialize.device[0] === 'iPhone' && gamesConfig.prizesTable[gametype] === 3) {
- let iosHistoryRows3 = resizeConfig.historyPrizesPanel.showSplit.iosPrizesTable3;
- extra.changeFontSize(jackpotOne, iosHistoryRows3.jackpotObj1);
- extra.changeFontSize(jackpotTwo, iosHistoryRows3.jackpotObj2);
- extra.changeFontSize(jackpotThree, iosHistoryRows3.jackpotObj3);
- extra.changeFontSize(splitOne, iosHistoryRows3.splitsObj);
- extra.changeFontSize(splitTwo, iosHistoryRows3.splitsObj);
- extra.changeFontSize(splitThree, iosHistoryRows3.splitsObj);
- } else if (initialize.device[0] === 'iPad' && gamesConfig.prizesTable[gametype] === 4) { /* Iphone */
- let ipadHistoryRows4 = resizeConfig.historyPrizesPanel.showSplit.ipadPrizesTable4;
- extra.changeFontSize(jackpotOne, ipadHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotTwo, ipadHistoryRows4.jackpotObj2);
- extra.changeFontSize(jackpotThree, ipadHistoryRows4.jackpotObj3);
- extra.changeFontSize(jackpotFour, ipadHistoryRows4.jackpotObj4);
- extra.changeFontSize(splitOne, ipadHistoryRows4.splitsObj);
- extra.changeFontSize(splitTwo, ipadHistoryRows4.splitsObj);
- extra.changeFontSize(splitThree, ipadHistoryRows4.splitsObj);
- extra.changeFontSize(splitFour, ipadHistoryRows4.splitsObj);
- } else if (initialize.device[0] === 'iPad' && gamesConfig.prizesTable[gametype] === 3) {
- let ipadHistoryRows3 = resizeConfig.historyPrizesPanel.showSplit.ipadPrizesTable3;
- extra.changeFontSize(jackpotOne, ipadHistoryRows3.jackpotObj1);
- extra.changeFontSize(jackpotTwo, ipadHistoryRows3.jackpotObj2);
- extra.changeFontSize(jackpotThree, ipadHistoryRows3.jackpotObj3);
- extra.changeFontSize(splitOne, ipadHistoryRows3.splitsObj);
- extra.changeFontSize(splitTwo, ipadHistoryRows3.splitsObj);
- extra.changeFontSize(splitThree, ipadHistoryRows3.splitsObj);
- } else if (!initialize.device[0] && gamesConfig.prizesTable[gametype] === 4) { /* desktop */
- let desktopHistoryRows4 = resizeConfig.historyPrizesPanel.showSplit.defaultPrizesTable4;
- // console.log(desktopHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotOne, desktopHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotTwo, desktopHistoryRows4.jackpotObj2);
- extra.changeFontSize(jackpotThree, desktopHistoryRows4.jackpotObj3);
- extra.changeFontSize(jackpotFour, desktopHistoryRows4.jackpotObj4);
- extra.changeFontSize(splitOne, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitTwo, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitThree, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitFour, desktopHistoryRows4.splitsObj);
- } else if (!initialize.device[0] && gamesConfig.prizesTable[gametype] === 3) { /* desktop */
- let desktopHistoryRows3 = resizeConfig.historyPrizesPanel.showSplit.defaultPrizesTable3;
- // console.log(desktopHistoryRows3);
- extra.changeFontSize(jackpotOne, desktopHistoryRows3.jackpotObj1);
- extra.changeFontSize(jackpotTwo, desktopHistoryRows3.jackpotObj2);
- extra.changeFontSize(jackpotThree, desktopHistoryRows3.jackpotObj3);
- extra.changeFontSize(splitOne, desktopHistoryRows3.splitsObj);
- extra.changeFontSize(splitTwo, desktopHistoryRows3.splitsObj);
- extra.changeFontSize(splitThree, desktopHistoryRows3.splitsObj);
- } else if (initialize.device[0] === 'safari-ios' && gamesConfig.prizesTable[gametype] === 4) { /* desktop */
- let desktopHistoryRows4 = resizeConfig.historyPrizesPanel.showSplit.defaultPrizesTable4;
- // console.log(desktopHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotOne, desktopHistoryRows4.jackpotObj1);
- extra.changeFontSize(jackpotTwo, desktopHistoryRows4.jackpotObj2);
- extra.changeFontSize(jackpotThree, desktopHistoryRows4.jackpotObj3);
- extra.changeFontSize(jackpotFour, desktopHistoryRows4.jackpotObj4);
- extra.changeFontSize(splitOne, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitTwo, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitThree, desktopHistoryRows4.splitsObj);
- extra.changeFontSize(splitFour, desktopHistoryRows4.splitsObj);
- } else if (initialize.device[0] === 'safari-ios' && gamesConfig.prizesTable[gametype] === 3) { /* desktop */
- let desktopHistoryRows3 = resizeConfig.historyPrizesPanel.showSplit.defaultPrizesTable3;
- // console.log(desktopHistoryRows3);
- extra.changeFontSize(jackpotOne, desktopHistoryRows3.jackpotObj1);
- extra.changeFontSize(jackpotTwo, desktopHistoryRows3.jackpotObj2);
- extra.changeFontSize(jackpotThree, desktopHistoryRows3.jackpotObj3);
- extra.changeFontSize(splitOne, desktopHistoryRows3.splitsObj);
- extra.changeFontSize(splitTwo, desktopHistoryRows3.splitsObj);
- extra.changeFontSize(splitThree, desktopHistoryRows3.splitsObj);
- }
- },
- /* when close modal null everything used when it was opened */
- closeHistoryModal() {
- const ns = store.getState();
- $('#historyModal2').fadeOut('slow');
- history2.closeHistory();
- ns.localstate.in_history_modal = 0;
- ns.localstate.hisotryPageCounter = 0;
- // this.removeTransparentDiv();
- // bought_tickets.clear_knums();
- this.clearTicketHits();
- },
- /* when open modal initialize and set everything needed to work properly */
- openHistoryModal() {
- this.renderPage(this.firstPage);
- this.renderNavigation();
- store.dispatch({
- type: 'REPEAT_BET_MODAL'
- });
- $('#historyModal2').fadeIn('slow');
- history2.openHistory();
- this.render_modal_tickets();
- extra.resize_text(); // called to resize titles (text divs)
- /* Making shorter animation for History modal and repeat btn */
- startAnimation();
- },
- /* for popUp effect when change the page */
- animateChanginPage() {
- const drawIdContainer = $('#drawIdContainer, #dateContainer');
- drawIdContainer.addClass('scaleStatHistIn').removeClass('scaleStatHistOut');
- setTimeout(() => drawIdContainer.addClass('scaleStatHistOut').removeClass('scaleStatHistIn'), 100);
- }
- };
- global.resizeHistorySplits = hist_helper.resizeHistorySplits;
- /* For Closing modal */
- $(document).on('click', '#exitHistoryButton', () => {
- store.dispatch({
- type: 'LEAVE_HISTORY'
- });
- hist_helper.closeHistoryModal();
- ps('change_denom'); //ps - playSound
- });
- /* When purchase tickets from History modal */
- $(document).on('click', hist_helper.historyBtn, () => {
- store.dispatch({
- type: 'REPEAT_BET_MODAL'
- });
- hist_helper.closeHistoryModal();
- ps('repeat');
- });
- // Left Arrow dispatch action to localState
- $(document).on('click', hist_helper.leftArrow, () => {
- if (store.getState().localstate.hisotryPageCounter !== 0) store.dispatch({
- type: 'DECREMENT_HISTORY'
- });
- hist_helper.renderNavigation(); //recalculate navigation state
- hist_helper.animateChanginPage();
- ps('bet3');
- });
- // Right Arrow dispatch action to localState
- $(document).on('click', hist_helper.rightArrow, () => {
- if (store.getState().localstate.hisotryPageCounter !== hist_helper.gameNumbers.length - 1) {
- store.dispatch({
- type: 'INCREMENT_HISTORY'
- });
- }
- hist_helper.renderNavigation(); //recalculate navigation state
- hist_helper.animateChanginPage();
- ps('bet3');
- });
- export {
- hist_helper,
- }
Add Comment
Please, Sign In to add comment