Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array.prototype.insert = function(index, item) {
- this.splice(index, 0, item);
- };
- function pad(str, max) {
- str = str.toString();
- return str.length < max ? pad("0" + str, max) : str;
- }
- function phraser(phrase) {
- if (lang[phrase] == null || lang[phrase] == undefined) {
- return phrase;
- }
- return lang[phrase];
- }
- function copyToClipboard(text) {
- var $temp = $("<input>");
- $("body").append($temp);
- $temp.val(text).select();
- document.execCommand("copy");
- $temp.remove();
- }
- function getRotationDegrees(obj) {
- var matrix = obj.css("-webkit-transform") || obj.css("-moz-transform") || obj.css("-ms-transform") || obj.css("-o-transform") || obj.css("transform");
- if (matrix !== 'none') {
- var values = matrix.split('(')[1].split(')')[0].split(',');
- var a = values[0];
- var b = values[1];
- var angle = Math.round(Math.atan2(b, a) * (180 / Math.PI));
- } else {
- var angle = 0;
- }
- return (angle < 0) ? angle + 360 : angle;
- }
- function needCredits() {
- $.ajax({
- type: "GET",
- url: "/user_credits.php",
- success: function(text) {
- swal({
- title: phraser('ERROR'),
- html: phraser('NOT_ENOUGH_CREDITS') + text + " Credits.</b>",
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- $("#credits").html(parseFloat(text).toFixed(2));
- }
- });
- }
- function updateCredits(value) {
- var newCredits = (parseFloat($("#credits").html()) + parseFloat(value)).toFixed(3);
- if (newCredits < 0) {
- newCredits = 0;
- }
- $("#credits").html(newCredits);
- }
- function addCredits(data) {
- if (data.user_id == userID) {
- $.growl.notice({
- title: phraser('SUCCESS'),
- message: phraser('CREDITS_ADDED') + " <b>" + data['value'] + "</b> Credits"
- });
- updateCredits(data.value);
- }
- }
- function removeCredits(data) {
- if (data.user_id == userID) {
- $.growl.notice({
- title: phraser('SUCCESS'),
- message: phraser('CREDITS_REMOVE') + " <b>" + data['value'] + "</b> Credits"
- });
- updateCredits(-1 * data.value);
- }
- }
- function moveElement(e, target) {
- var moveX = e.pageX;
- var moveY = e.pageY;
- if (typeof e.originalEvent.touches !== 'undefined') {
- moveX = e.originalEvent.touches[0].pageX;
- moveY = e.originalEvent.touches[0].pageY;
- }
- window.my_dragging = {};
- my_dragging.pageX0 = moveX;
- my_dragging.pageY0 = moveY;
- my_dragging.elem = $(target);
- my_dragging.offset0 = $(target).offset();
- function handle_dragging(e) {
- var dragX = e.pageX;
- var dragY = e.pageY;
- if (typeof e.originalEvent.touches !== 'undefined') {
- dragX = e.originalEvent.touches[0].pageX;
- dragY = e.originalEvent.touches[0].pageY;
- }
- var left = my_dragging.offset0.left + (dragX - my_dragging.pageX0);
- var top = my_dragging.offset0.top + (dragY - my_dragging.pageY0);
- $(my_dragging.elem).offset({
- top: top,
- left: left
- });
- }
- function handle_mouseup(e) {
- $('body').off('mousemove touchmove', handle_dragging).off('mouseup touchend touchcancel', handle_mouseup);
- }
- $('body').on('mouseup touchend touchcancel', handle_mouseup).on('mousemove touchmove', handle_dragging);
- }
- function adminCredits(data) {
- if (data.value > 0) {
- $.growl.notice({
- title: "Admin",
- message: phraser('YOU_HAVE_RECEIVED') + " <b>" + data.value + "</b> Credits"
- });
- } else {
- $.growl.error({
- title: "Admin",
- message: phraser('YOU_HAVE_RECEIVED') + " <b>" + data.value + "</b> Credits"
- });
- }
- updateCredits(data.value);
- }
- function sendCreditsNotification(data) {
- $.growl.notice({
- title: phraser('USER_SENT'),
- message: phraser('YOU_HAVE_RECEIVED') + " <b>" + data.value + "</b> Credits " + phraser('FROM') + " <b>" + data.fromUser + "</b>"
- });
- updateCredits(data.value);
- }
- function validateTradeURL(tradeURL) {
- if (!tradeURL.match(/steamcommunity\.com\/tradeoffer\/new\/\?partner=[0-9]*&token=[a-zA-Z0-9_-]*/i)) {
- return false;
- }
- return true;
- }
- function changeText(Otext, cont, speed) {
- var Ocontent = Otext.split("");
- var i = 0;
- function show() {
- if (i < Ocontent.length) {
- cont.append(Ocontent[i]);
- i = i + 1;
- }
- }
- var Otimer = setInterval(show, speed);
- }
- var navbarGiveawayCounter;
- var navbarCount;
- var navbarStartSeconds;
- var navbarStartTime;
- function navbarStartTimer() {
- navbarGiveawayCounter = setInterval(navbarGiveawayTimer, 100);
- navbarCount = $("#navbar_giveaway_timer").html().replace("d", "").replace("h", "").replace("m", "").replace("s", "").split(" ");
- navbarStartSeconds = parseInt(navbarCount[0]) * 24 * 60 * 60 + parseInt(navbarCount[1]) * 60 * 60 + parseInt(navbarCount[2]) * 60 + parseInt(navbarCount[3]);
- navbarStartTime = new Date().getTime();
- }
- function navbarGiveawayTimer() {
- var timeElapse = Math.floor((new Date().getTime() - navbarStartTime) / 1000);
- var totalSeconds = navbarStartSeconds - timeElapse;
- var days = Math.floor(totalSeconds / 60 / 60 / 24);
- var seconds = totalSeconds - days * 24 * 60 * 60;
- var hours = Math.floor(seconds / 60 / 60);
- seconds = seconds - hours * 60 * 60;
- var minutes = Math.floor(seconds / 60);
- seconds = seconds - minutes * 60;
- days = pad(days, 2);
- hours = pad(hours, 2);
- minutes = pad(minutes, 2);
- seconds = pad(seconds, 2);
- $("#navbar_giveaway_timer").html(days + "d " + hours + "h " + minutes + "m " + seconds + "s");
- if (totalSeconds <= 0) {
- $("#navbar_giveaway_timer").html(days + "d " + hours + "h " + minutes + "m " + seconds + "s");
- $("#navbar_giveaway").fadeOut();
- clearInterval(navbarGiveawayCounter);
- }
- }
- function handleSkinGiveaway(data) {
- $(".giveaway_small_image_navbar").attr('src', data.item_image);
- $("#navbar_giveaway_timer").html(data.d + "d " + data.h + "h " + data.m + "m " + data.s + "s ");
- $("#navbar_giveaway").show();
- navbarStartTimer();
- }
- var boxGiveawayCounter;
- var boxCount;
- var boxStartSeconds;
- var boxStartTime;
- function boxStartTimer() {
- boxGiveawayCounter = setInterval(boxGiveawayTimer, 100);
- boxCount = $(".chat_giveaway_box_timer").html().replace("m", "").replace("s", "").split(" ");
- boxStartSeconds = parseInt(parseInt(boxCount[0]) * 60 + parseInt(boxCount[1]));
- boxStartTime = new Date().getTime();
- }
- function boxGiveawayTimer() {
- var timeElapse = Math.floor((new Date().getTime() - boxStartTime) / 1000);
- var totalSeconds = boxStartSeconds - timeElapse;
- var minutes = Math.floor(totalSeconds / 60);
- var seconds = totalSeconds - minutes * 60;
- minutes = pad(minutes, 2);
- seconds = pad(seconds, 2);
- $(".chat_giveaway_box_timer").html(minutes + "m " + seconds + "s");
- if (totalSeconds <= 0) {
- $(".chat_giveaway_box_timer").html(minutes + "m " + seconds + "s");
- clearInterval(boxGiveawayCounter);
- }
- }
- function handleGiveaway(data) {
- if (data.start == 1) {
- $("#chat_giveaway_box").addClass("chat_giveaway_box_live");
- $(".chat_giveaway_box_timer").hide();
- $(".chat_giveaway_box_info").show();
- $("#chat_giveaway_box_type").html(data.type);
- $("#chat_giveaway_box_hint").html(data.hint);
- $("#chat_giveaway_box_value").html(data.value);
- if (data.system == 1) {
- $(".chat_giveaway_box_timer").html("15m 00s");
- boxStartTimer();
- }
- }
- if (data.stop == 1) {
- if (data.winner_user_id == userID) {
- updateCredits(data.value);
- }
- $(".chat_giveaway_box_timer").show();
- $("#chat_giveaway_box").removeClass();
- $(".chat_giveaway_box_info").hide();
- }
- }
- function jukeBoxToken(data) {
- if (userID == data.user_id) {
- $("#jukebox_tokens b").html((parseInt($("#jukebox_tokens b").html()) + 1));
- $.growl.notice({
- title: 'Jukebox',
- message: phraser('YOU_RECEIVED_JUKEBOX_TOKEN')
- });
- }
- }
- var jukeboxTimer;
- function jukeBoxLoad() {
- $.ajax({
- type: "GET",
- url: "/jukebox.php",
- data: {
- load: true
- },
- success: function(text) {
- if (text != 'none') {
- var trackInfo = text.split(";");
- jukeBoxPlay(trackInfo[0], trackInfo[1], trackInfo[2], trackInfo[3], trackInfo[4], trackInfo[5], trackInfo[6], trackInfo[7]);
- }
- }
- });
- }
- function jukeBoxStop() {
- $("#jukebox_current").hide();
- $("#jukebox_form").show();
- $("#jukebox_title").hide();
- $("#jukebox_volume").hide();
- $("#jukebox_available").show();
- youtubePlayer.stopVideo()
- clearTimeout(jukeboxTimer);
- }
- function jukeBoxPlay(track_id, title, artwork, duration, remaining, url, user, avatar) {
- youtubePlayer.loadVideoById(track_id, Math.floor(duration - remaining)).playVideo();
- $(".now_playing").html('<img src="' + artwork + '"> ' + title);
- $("#jukebox_title").show();
- $("#jukebox_volume").show();
- $("#jukebox_available").hide();
- $("#jukebox_current").css('background-image', 'url(' + artwork + ')').html('<img class="tool" src="' + avatar + '" title="' + user + '"><span class="jukebox_current_blur" style="background-image: url(' + artwork + ')"></span><span class="jukebox_current_content"><i>Current Track:</i><br><a href="' + url + '" target="_blank">' + title + '</a></span>').show();
- $("#jukebox_form").hide();
- jukeboxTimer = setTimeout(function() {
- $("#jukebox_current").hide();
- $("#jukebox_form").show();
- $("#jukebox_title").hide();
- $("#jukebox_volume").hide();
- $("#jukebox_available").show();
- youtubePlayer.stopVideo()
- }, remaining * 1000);
- }
- function saveJukeboxVolume(vol) {
- setTimeout(function() {
- if (youtubePlayer.getVolume() == vol) {
- $.ajax({
- type: "GET",
- url: "/jukebox.php",
- data: {
- volume: vol
- },
- success: function(text) {}
- });
- }
- }, 3000);
- }
- function barrelRoll() {
- $("body").addClass('barrel_roller');
- setTimeout(function() {
- $("body").removeClass('barrel_roller');
- }, 4100);
- }
- function recruitsNew(data) {
- $.growl.notice({
- title: 'Recruits',
- message: phraser("YOU_JUST_RECRUITED") + " <b>" + data.persona + "</b>"
- });
- updateCredits(0.05);
- }
- var revolverCountdownTimer;
- function revolverCountdown() {
- var startVal = $("#revolver_countdown span").html().replace("s", "").replace(" ", "").split("m");
- var startSec = parseInt(startVal[0]) * 60 + parseInt(startVal[1]);
- var startTime = new Date().getTime();
- clearInterval(revolverCountdownTimer);
- timeouts.push(revolverCountdownTimer = setInterval(function() {
- var timeElapse = Math.floor((new Date().getTime() - startTime) / 1000);
- var seconds = startSec - timeElapse;
- var minutes = 0;
- if (seconds <= 0) {
- seconds = 0;
- clearInterval(revolverCountdownTimer);
- }
- minutes = Math.floor(seconds / 60);
- seconds = seconds - minutes * 60;
- minutes = pad(minutes, 2);
- seconds = pad(seconds, 2);
- $("#revolver_countdown span").html(minutes + "m " + seconds + "s");
- }, 1000));
- }
- function revolverBet(data) {
- if ($("#revolver_background").length == 0 || $(".revolver_player[data-id='" + data.bet.revolver_bet_id + "']").length > 0) {
- return;
- }
- $(".blop").trigger('play');
- $("#revolver_players").append('<div class="revolver_player" data-id="' + data.bet.revolver_bet_id + '" data-time="' + data.bet.microtime + '"><span><b>' + data.bet.value + '</b> Credits</span><a show-profile="' + data.user.user_id + '"><img src="' + data.user.avatar + '"></a></div>');
- if (data.bet.king == 1) {
- revolverKing(data.bet.revolver_bet_id, data.user.avatar, 0);
- }
- $('#revolver_players').find('.revolver_player').sort(function(a, b) {
- return parseInt($(a).attr('data-time')) - parseInt($(b).attr('data-time'));
- }).prependTo('#revolver_players');
- }
- function revolverKing(revolver_bet_id, avatar, profit) {
- var kingBet = $("#revolver_user_king").attr('data-id');
- if (kingBet != undefined) {
- $("#revolver_players div[data-id='" + kingBet + "']").remove();
- }
- $("#revolver_user_king").attr('src', avatar).attr('data-id', revolver_bet_id).show();
- $("#revolver_hat_king").show();
- $("#revolver_king_profit").show();
- $("#revolver_king_profit b").html(profit);
- }
- function revolverPlayer(user) {
- $("#revolver_list").hide();
- $("#revolver_blood_player, #revolver_blood_king").hide();
- $("#revolver_hat_player").show();
- $("#revolver_user_player").attr('src', user.avatar).show();
- }
- function revolverLoad(chamber) {
- $(".revolver_load").trigger('play');
- timeouts.push(setTimeout(function() {
- $("#cylinder").css('transform', 'rotate(0deg)');
- $("#cylinder").stop(true, true).addClass('cylinder_spin');
- $(".revolver_spin").trigger('play');
- timeouts.push(setTimeout(function() {
- $("#cylinder").removeClass('cylinder_spin');
- $(".revolver_spin").trigger('pause');
- $(".revolver_spin").prop("currentTime", 0);
- }, 2000));
- }, 500));
- }
- function revolverNewRound(data) {
- if (typeof data.king !== 'undefined' && typeof data.king.user !== 'undefined' && data.king.user.user_id == userID) {
- updateCredits(data.king.bet.value);
- $.growl.notice({
- title: 'Revolver',
- message: phraser('YOU_JUST_WON') + " <b>" + data.king.bet.value + "</b> Credits!"
- });
- }
- if ($("#revolver_background").length == 0) {
- return;
- }
- $("#revolver_blood_player, #revolver_blood_king").hide();
- $("#revolver_hat_player").hide();
- $("#revolver_user_player").attr('src', '').hide();
- $("#revolver_king_profit b").html('0');
- $("#revolver_players .revolver_player").first().remove();
- $("#revolver_countdown span").html("3m 00s");
- revolverCountdown();
- if (data.player != null) {
- revolverKing(data.player.bet.revolver_bet_id, data.player.user.avatar, 0);
- } else {
- $("#revolver_user_king").hide();
- $("#revolver_king_profit").hide();
- $("#revolver_hat_king").hide();
- }
- $("#revolver_list_player_bet").html(data.wanted.bet.value);
- $("#revolver_list_player_profit").html(parseFloat(data.wanted.bet.profit).toFixed(3));
- $("#revolver_list_player_kills").html(data.wanted.bet.wins);
- $("#revolver_list_player_survived").html(data.wanted.bet.survived);
- $(".revolver_list_player a").attr('show-profile', data.wanted.user.user_id);
- $(".revolver_list_player a img").attr('src', data.wanted.user.avatar);
- $("#revolver_list").show();
- timeouts.push(setTimeout(function() {
- $("#revolver_list").hide();
- }, 30000));
- $(".revolver_theme").trigger('play');
- setTimeout(function() {
- $(".revolver_theme").trigger('pause');
- $(".revolver_theme").prop("currentTime", 0);
- }, 18 * 1000);
- }
- function revolverDuelHandle(data) {
- timeouts.push(setTimeout(function() {
- if (data.winner.user_id == userID) {
- updateCredits(data.winner.won);
- $.growl.notice({
- title: 'Revolver',
- message: phraser('YOU_JUST_WON') + " <b>" + data.winner.won + "</b> Credits!"
- });
- }
- }, 1200 * (data.chamber.number) + 3000));
- if ($("#revolver_background").length == 0) {
- return;
- }
- revolverPlayer(data.player.user);
- revolverLoad(data.chamber.number);
- var kingChance = parseFloat(data.king.bet.value) / (parseFloat(data.player.bet.value) + parseFloat(data.king.bet.value)) * 100;
- $("#revolver_king_chance b").html((kingChance).toFixed(2) + '%');
- $("#revolver_player_chance b").html((100 - kingChance).toFixed(2) + '%');
- $("#revolver_king_chance, #revolver_player_chance").show();
- $("#revolver_hash b").html(data.hash);
- $("#revolver_hash").show();
- timeouts.push(setTimeout(function() {
- revolverDuel(data.chamber.number, 1);
- }, 2000));
- timeouts.push(setTimeout(function() {
- if (data.chamber.number % 2 != 0) {
- $("#revolver_king_profit b").html(data.winner.profit);
- $("#revolver_players div[data-id='" + data.player.bet.revolver_bet_id + "']").remove();
- } else {
- revolverKing(data.player.bet.revolver_bet_id, data.player.user.avatar, data.winner.profit);
- }
- var effectText = '';
- if (data.chamber.number == 1) {
- effectText = '<i class="fa fa-crosshairs"></i> ONE TAP';
- } else if (data.king.bet.wins >= 1 && data.chamber.number % 2 != 0) {
- effectText = '<i class="fa fa-link"></i> COMBO X' + (parseInt(data.king.bet.wins) + 1);
- } else if (data.king.bet.wins > 1 && data.chamber.number % 2 == 0) {
- effectText = '<i class="fa fa-chain-broken"></i> COMBOBREAKER';
- } else if (data.chamber.number == 6) {
- effectText = '<i class="fa fa-bullseye"></i> LAST BULLET';
- }
- if (effectText != '') {
- $("#revolver_duel_holder").prepend('<div class="revolver_shot_effect">' + effectText + '</div>');
- setTimeout(function() {
- $(".revolver_shot_effect").remove();
- }, 2000);
- }
- $("#revolver_blood_player, #revolver_blood_king").hide();
- $("#revolver_hat_player").hide();
- $("#revolver_user_player").hide();
- $("#revolver_king_chance, #revolver_player_chance, #revolver_hash").hide();
- $("#revolver_king_chance b, #revolver_player_chance b").html('0%');
- $("#revolver_hash b").html('');
- }, 1200 * (data.chamber.number) + 3000));
- timeouts.push(setTimeout(function() {
- $("#cylinder_chambers div:nth-of-type(" + data.chamber.number + ")").append('<span class="bullet"></span>');
- }, (data.chamber.number) * 1200 + 2100));
- }
- function revolverDuel(chamber, shots) {
- if (chamber >= 1) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 1);
- }, 1 * 1200));
- }
- if (chamber >= 2) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 2);
- }, 2 * 1200));
- }
- if (chamber >= 3) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 3);
- }, 3 * 1200));
- }
- if (chamber >= 4) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 4);
- }, 4 * 1200));
- }
- if (chamber >= 5) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 5);
- }, 5 * 1200));
- }
- if (chamber >= 6) {
- timeouts.push(setTimeout(function() {
- revolverShoot(chamber, 6);
- }, 6 * 1200));
- }
- }
- function revolverShoot(chamber, shot) {
- if (shot % 2 != 0) {
- $("#revolver_pistol_king").show();
- timeouts.push(setTimeout(function() {
- $("#revolver_pistol_king").stop(true, true).addClass('revolver_recoil_king');
- }, 500));
- } else {
- $("#revolver_pistol_player").show();
- timeouts.push(setTimeout(function() {
- $("#revolver_pistol_player").stop(true, true).addClass('revolver_recoil_player');
- }, 500));
- }
- timeouts.push(setTimeout(function() {
- $("#revolver_pistol_king, #revolver_pistol_player").removeClass('revolver_recoil_king').removeClass('revolver_recoil_player').hide();
- }, 900));
- timeouts.push(setTimeout(function() {
- if (chamber == shot) {
- $("span.bullet").fadeOut(200);
- $(".revolver_shot").trigger('play');
- setTimeout(function() {
- $(".revolver_shot").trigger('play');
- }, 600);
- if (shot % 2 != 0 && $("#revolver_user_player").is(':visible')) {
- $("#revolver_blood_player").show();
- } else if ($("#revolver_user_player").is(':visible')) {
- $("#revolver_blood_king").show();
- }
- } else {
- $(".revolver_dry").trigger('play');
- setTimeout(function() {
- $(".revolver_dry").trigger('play');
- }, 400);
- }
- $("#cylinder").css('transform', 'rotate(' + (getRotationDegrees($("#cylinder")) + 60) + 'deg)');
- }, 450));
- }
- function casesNew(data) {
- var testSpin = '';
- if (data.item.test == 1) {
- testSpin = ' (Test)';
- }
- $("#cases_latest_title").after('<div class="cases_list_item tool" title="<b>' + data.item.name + '</b><br>' + data.item.value + ' Credits' + testSpin + '"><div class="item_color" style="background: ' + data.item.color + ';"></div><a show-profile="' + data.user.user_id + '"><img src="' + data.user.avatar + '" class="cases_list_item_user"></a><img src="' + data.case.image + '" class="cases_list_item_case_image"><img src="' + data.item.image + '" class="cases_list_item_image"></div>');
- $('.cases_list_item').not('.cases_list_item:lt(24)').remove();
- }
- function casesOpen(case_id, case_price, testSpin, button, buttonHTML) {
- $.ajax({
- type: "GET",
- url: "/cases_bet.php",
- data: {
- case_id: case_id,
- user_token: $("#user_token").val(),
- test: testSpin
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- button.prop('disabled', false).html(buttonHTML);
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- button.prop('disabled', false).html(buttonHTML);
- } else {
- if (parseInt($("#case_tokens span").html()) == 0 && !testSpin) {
- updateCredits(-1 * case_price);
- } else if (!testSpin) {
- $("#case_tokens span").html(parseInt($("#case_tokens span").html()) - 1);
- }
- text = text.split(";");
- $.ajax({
- type: "GET",
- url: "/cases_load.php",
- data: {
- spinner: true,
- case_id: case_id,
- case_item_id: text[0]
- },
- success: function(resp) {
- $(".case_buttons").hide();
- $("#round_draw_pointer").show();
- $(".case_spinner").removeClass('case_spinner_filter').html(resp).css('padding-left', ($(".case_spinner_holder").width() / 2 + 20 - (Math.floor(Math.random() * 110) + 10)) + 'px').addClass('case_spinner_animate');
- $(".case_open_sound").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".case_open_sound").trigger('pause');
- $(".case_open_sound").prop("currentTime", 0);
- }, 8000));
- timeouts.push(setTimeout(function() {
- $("#round_draw_pointer").hide();
- $("#case_item_win").removeClass('background_flow').addClass('background_master').css('border', '2px solid #fad733');
- }, 7100));
- timeouts.push(setTimeout(function() {
- $("#case_item_win .case_item_wear").show();
- $("#case_item_win .case_item_price").show();
- $(".woosh").trigger('play');
- setTimeout(function() {
- $(".woosh").trigger('pause');
- $(".woosh").prop("currentTime", 0);
- }, 300);
- }, 7800));
- timeouts.push(setTimeout(function() {
- $("#case_item_win .case_item_wear").html(text[1]);
- $("#case_item_win .case_item_price").html(text[2]);
- $(".woosh").trigger('play');
- setTimeout(function() {
- $(".woosh").trigger('pause');
- $(".woosh").prop("currentTime", 0);
- }, 300);
- }, 8300));
- timeouts.push(setTimeout(function() {
- button.prop('disabled', false).html(buttonHTML);
- $(".case_buttons").show();
- $(".case_spinner").css('padding-left', '0').removeClass('case_spinner_animate').addClass('case_spinner_filter');
- }, 10000));
- if (!testSpin) {
- setTimeout(function() {
- $.growl.notice({
- title: 'Cases',
- message: phraser("YOUR_CASE_CONTAINED") + " <b>" + text[3] + "</b>. " + phraser("YOUR_ITEM_IS_WORTH") + " <b>" + text[2] + "</b> Credits!"
- });
- updateCredits(text[2]);
- $(".cases_hash span").html(text[4]);
- }, 10000);
- } else {
- setTimeout(function() {
- $(".cases_hash span").html(text[4]);
- }, 10000);
- }
- }
- });
- }
- }
- });
- }
- function BezierCubicXY(p0, p1, p2, p3, t) {
- var ret = {};
- var coords = ['x', 'y'];
- var i, k;
- for (i in coords) {
- k = coords[i];
- ret[k] = Math.pow(1 - t, 3) * p0[k] + 3 * Math.pow(1 - t, 2) * t * p1[k] + 3 * (1 - t) * Math.pow(t, 2) * p2[k] + Math.pow(t, 3) * p3[k];
- }
- return ret;
- }
- function getMultiplierFromBezier(bezierCurve, durationPercent, maxMultiplier) {
- var p1 = {
- x: 0,
- y: 0
- };
- var p2 = {
- x: bezierCurve[0],
- y: bezierCurve[1]
- };
- var p3 = {
- x: bezierCurve[2],
- y: bezierCurve[3]
- };
- var p4 = {
- x: 1,
- y: 1
- };
- var val = BezierCubicXY(p1, p2, p3, p4, durationPercent);
- return val.y * maxMultiplier + 1;
- }
- function getWidthFromMultiplier(bezierCurve, durationPercent, maxMultiplier) {
- var p1 = {
- x: 0,
- y: 0
- };
- var p2 = {
- x: bezierCurve[0],
- y: bezierCurve[1]
- };
- var p3 = {
- x: bezierCurve[2],
- y: bezierCurve[3]
- };
- var p4 = {
- x: 1,
- y: 1
- };
- var val = BezierCubicXY(p1, p2, p3, p4, durationPercent);
- return val.x * maxMultiplier + 1;
- }
- function crashBetAdd(data) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- $("#crash_list").append('<tr data-id="' + data.bet.crash_bet_id + '" data-handled="false"><td class="crash_list_user"><a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '" class="crash_list_img"></a>' + data.player.persona + '</td><td></td><td>' + data.bet.value + '</td><td class="crash_list_profit">---</td></tr>');
- $(".blop").trigger('play');
- }
- function crashBetRemove(data) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- var listItem = $("#crash_list tr[data-id='" + data.bet.crash_bet_id + "']");
- $("#crash_list tr[data-id='" + data.bet.crash_bet_id + "']").remove();
- listItem.insertAfter('#crash_list .crash_list_titles').css('color', '#27c24c').attr('data-handled', 'true');
- $("#crash_list tr[data-id='" + data.bet.crash_bet_id + "'] td.crash_list_profit").html(parseFloat(data.bet.profit).toFixed(2));
- if (data.player.user_id == userID) {
- $("#crash_form_cashout").fadeOut();
- updateCredits(data.bet.credits);
- $.growl.notice({
- title: 'Crash',
- message: phraser('WON_A_TOTAL_OF') + " <b>" + parseFloat(data.bet.credits).toFixed(2) + "</b>" + phraser('CREDITS_ON') + " Crash."
- });
- }
- }
- var crashCountdownTimer;
- function crashCountdown(text) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- $("#crash_graph_y_holder").html('');
- for (y = 11; y >= 1; y--) {
- $("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="' + y + '" style="bottom:' + ((y - 1) * 10) + '%;"><span>' + y + '</span><i></i></div>');
- }
- $("#crash_overlay").height('100%');
- $("#triangle_gradient_color").attr('stop-color', '#0cb6e7');
- $("#crash_amount").fadeOut(100);
- $("#crash_countdown").html(text).fadeIn(100);
- var startSec = parseInt(text);
- var startTime = new Date().getTime();
- timeouts.push(crashCountdownTimer = setInterval(function() {
- var timeElapse = Math.floor((new Date().getTime() - startTime) / 1000);
- var sec = startSec - timeElapse;
- if (sec <= 0) {
- sec = 0;
- clearInterval(crashCountdownTimer);
- }
- $("#crash_countdown").html(sec);
- }, 1000));
- }
- function crashStart(instant_crash, durationPercent) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- clearInterval(crashCountdownTimer);
- $("#crash_countdown").fadeOut(100);
- $("#crash_form_cashout button").prop('disabled', false)
- if (instant_crash == 0) {
- $("#crash_amount").css('color', '#fff').fadeIn(100);
- crashAnimationStart(durationPercent);
- } else {
- $("#crash_amount").css('color', '#b75552').fadeIn(100);
- crashAnimationStop(0.01);
- }
- }
- function crashStop(data) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- if (data.old_round.instant_crash == 0) {
- crashAnimationStop(data.old_round.multiplier);
- }
- $("#crash_hash").html(phraser('HASH') + ': ' + data.new_round.hash);
- $("#crash_round").html(phraser('ROUND_L') + ': ' + data.new_round.crash_id);
- $("#crash_list tr[data-id]").remove();
- $("#crash_latest_list").prepend('<span class="tool-top" title="<b>' + phraser('ROUND_L') + ':</b><br>' + data.old_round.crash_id + '<br><br><b>' + phraser('WIN_PERCENTAGE') + ':</b><br>' + data.old_round.percentage + '<br><br><b>' + phraser('HASH') + ':</b><br>' + data.old_round.hash + '">' + data.old_round.multiplier + '<i class="fa fa-times"></i></span>');
- timeouts.push(setTimeout(function() {
- if (crashAutoBet) {
- $("#crash_form").submit();
- }
- }, 3000));
- }
- var crashAutoBet = false;
- var crash_percentage = "";
- var crashAnimation;
- function crashAnimationStart(durationPercent) {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- if (durationPercent == 0) {
- $(".load").trigger('play');
- setTimeout(function() {
- $(".load").trigger('pause');
- $(".load").prop("currentTime", 0);
- }, 1000);
- }
- var durationFull = 60 * 8;
- var maxMultiplier = 1000;
- var curve = [.35, .01, .37, .1];
- var startTime = new Date().getTime();
- crashAnimation = $({
- value: 0
- }).animate({
- value: maxMultiplier
- }, {
- duration: durationFull * 1000,
- easing: 'linear',
- step: function(now, fx) {
- var multiplier = getMultiplierFromBezier(curve, fx.pos + durationPercent, maxMultiplier).toFixed(2);
- if (multiplier > 11) {
- $("#crash_overlay").css('height', '0%');
- if ($(".crash_graph_y").length < 11) {
- var y = parseInt($(".crash_graph_y").first().attr('data-value')) + 1;
- $("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="' + y + '" style="bottom:150%;"><span>' + y + '</span><i></i></div>');
- }
- $(".crash_graph_y").each(function() {
- var y = $(this).attr('data-value');
- if (y < multiplier - 10) {
- $(this).remove();
- } else {
- $(this).css('bottom', (y - multiplier + 10) * 10 + '%');
- }
- });
- } else {
- $("#crash_overlay").css('height', (100 - (multiplier - 1) * 10) + '%');
- }
- var r = 12 + Math.round(multiplier * 7.5 * 9);
- var g = 182 - Math.round(multiplier * 1.2 * 9);
- var b = 231 - Math.round(multiplier * 2.4 * 9);
- $("#triangle_gradient_color").attr('stop-color', 'rgb(' + r + ', ' + g + ', ' + b + ')');
- $('#crash_amount').text(multiplier + 'x');
- $(".crash_profit_label b").html((parseFloat($(".crash_profit_label").attr('data-value')) * multiplier - parseFloat($(".crash_profit_label").attr('data-value'))).toFixed(2));
- if (multiplier % 5 == 0 || multiplier == 1) {
- crashParticles();
- }
- }
- });
- }
- function crashAnimationStop(endMultiplier) {
- $(".cork").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".cork").trigger('pause');
- $(".cork").prop("currentTime", 0);
- }, 2000));
- $(crashAnimation).stop(true, false);
- $(crashParticleAnimation).stop(true, false);
- $("#crash_form_cashout button").prop('disabled', true);
- $("#crash_form_cashout").fadeOut();
- timeouts.push(setTimeout(function() {
- var stopHeight = 100 - (endMultiplier - 1) * 10;
- if (endMultiplier < 1 || stopHeight > 100) {
- stopHeight = 100;
- }
- $("#crash_amount").stop(true, false).css('color', '#b75552').text(phraser('CRASHED_AT') + ' ' + endMultiplier + 'x');
- $("#crash_overlay").css('height', stopHeight + '%');
- if (endMultiplier > 11) {
- $("#crash_overlay").css('height', '0%');
- $("#crash_graph_y_holder").html('');
- for (y = Math.floor(endMultiplier); y >= Math.floor(endMultiplier) - 10; y--) {
- $("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="' + y + '" style="bottom:' + ((y - endMultiplier + 10) * 10) + '%;"><span>' + y + '</span><i></i></div>');
- }
- } else {
- $("#crash_overlay").css('height', stopHeight + '%');
- $("#crash_graph_y_holder").html('');
- for (y = 11; y >= 1; y--) {
- $("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="' + y + '" style="bottom:' + ((y - 1) * 10) + '%;"><span>' + y + '</span><i></i></div>');
- }
- }
- }, 100));
- timeouts.push(setTimeout(function() {
- crashCountdown(10);
- }, 3000));
- }
- var crashParticleAnimation;
- function crashParticles() {
- if ($("#crash_graph_holder").length == 0) {
- return;
- }
- $(crashParticleAnimation).stop(true);
- $("#crash_amount").css('color', 'rgb(255, 215, 0)');
- crashParticleAnimation = $({
- someValue: 0
- }).animate({
- someValue: 255
- }, {
- duration: 1000,
- easing: 'linear',
- step: function() {
- var g = 215 + Math.round((this.someValue / 255) * (255 - 215));
- var b = 0 + Math.round(this.someValue);
- $("#crash_amount").css('color', 'rgb(255, ' + g + ', ' + b + ')');
- },
- complete: function() {
- $("#crash_amount").css('color', 'rgb(255, 255, 255)');
- }
- });
- $("#graph_particles").explosion({
- origin: {
- x: $("#graph_particles").width() / 2,
- y: $("#graph_particles").height() / 2
- }
- });
- }
- function safeboxBet(data) {
- if (data.answer == 'correct') {
- $("#safe_box_log .round_bet").remove();
- $(".safe_box_empty").show();
- $("#safe_box_pot span").text("1000");
- return;
- }
- var oldValue = $("#safe_box_pot span").text();
- var newValue = parseFloat(oldValue) + 0.25;
- $("#safe_box_pot span").text(newValue);
- $("#safe_box_pot").prepend('<div class="safe_box_add"><i class="fa fa-plus"></i></div>');
- $(".safe_box_add").fadeOut(2000);
- $('<div class="round_bet"><span class="safe_box_tries">' + data.number + '</span><a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '"></a> <b>' + data.player.persona + '</b></div>').hide().prependTo("#safe_box_log").fadeIn(1000);
- $(".safe_box_empty").hide();
- }
- var scratchy_finished = false;
- function scratchyEnd(arg) {
- scratchy_finished = true;
- document.getSelection().removeAllRanges();
- $('#scratchy_pad').wScratchPad('enable', false).wScratchPad('clear');
- arg = arg.split(";");
- result = arg[0];
- $("#scratchy_hash").html("<b>" + phraser('HASH') + ":</b> " + arg[1]);
- if (result > 3) {
- var chestWinnings = [0, 0, 0, 0, 5, 10, 50, 100, 300, 1000];
- updateCredits(chestWinnings[result]);
- $.growl.notice({
- title: 'Scratchy',
- message: phraser("TICKET_RESULTED_IN") + result + " " + phraser("CHESTS") + phraser("SCRATCHY_YOU_WON") + chestWinnings[result] + " Credits."
- });
- } else {
- $.growl.error({
- title: 'Scratchy',
- message: phraser("TICKET_RESULTED_IN") + result + " " + phraser("CHESTS") + phraser("SCRATCHY_YOU_DIDNT_WIN")
- });
- }
- timeouts.push(setTimeout(function() {
- $('#scratchy_pad').wScratchPad('reset').wScratchPad('destroy').remove();
- $("#scratchy_holder").prepend('<div id="scratchy_pad"></div>');
- $("#scratchy_form").show();
- scratchyStart();
- }, 5000));
- }
- function scratchyStart() {
- scratchy_finished = false;
- $("#scratchy_pad").wScratchPad({
- size: 30,
- bg: site + '/images/scratchy_1_1.png?load',
- fg: site + '/images/scratchy_clear.png?load',
- cursor: 'url("' + site + '/images/scratch-coin-small.png") 10 10, default',
- realtime: true,
- scratchDown: null,
- scratchUp: null,
- scratchMove: function(e, percent) {
- if (percent > 50 && !scratchy_finished) {
- scratchy_finished = true;
- scratchyEnd($("#scratchy_result").html());
- }
- }
- }).wScratchPad('enable', false);
- }
- function raceSort() {
- $('#dragrace_listings').find('.dragrace_list').sort(function(a, b) {
- if ($(b).attr('data-status') == $(a).attr('data-status')) {
- return parseInt($(b).attr('data-sort')) - parseInt($(a).attr('data-sort'));
- }
- return parseInt($(a).attr('data-status')) - parseInt($(b).attr('data-status'));
- }).prependTo('#dragrace_listings');
- }
- function raceAdd(data) {
- if ($("#race_" + data.game.dragrace_id).length == 0) {
- $("#dragrace_listings").append('<div class="dragrace_list" id="coin_' + data.game.dragrace_id + '" data-sort="' + data.game.value + '" data-status="0"><span class="dragrace_list_status_join" data-id="' + data.game.dragrace_id + '" data-value="' + data.game.value + '"><i class="fa fa-play-circle"></i> ' + phraser('CHALLENGE') + '</span><span class="dragrace_list_status_view" data-id="' + data.game.dragrace_id + '"><i class="fa fa-eye"></i></span><span class="dragrace_list_value">' + data.game.value + '<br>Credits</span><a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '" class="dragrace_list_avatar"></a></div>');
- raceSort();
- }
- }
- function raceJoin(data) {
- $("#race_" + data.game.dragrace_id).append('<a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '" class="dragrace_list_avatar"></a>');
- if ($("#dragrace_game_" + data.game.dragrace_id).length > 0) {
- $("#race_track_cars").append('<img data-player="' + data.player.position + '" src="' + site + '/images/race_smoke_v2.gif" class="race_track_smoke race_track_car_' + data.player.position + '"><img data-player="' + data.player.position + '" src="' + site + '/images/race_car' + data.player.car_image + '.png" class="race_track_car race_track_car_' + data.player.position + '">');
- $(".race_player[data-player='" + data.player.position + "'").html('<img src="' + site + '/images/race_car' + data.player.car_image + '.png" class="race_player_car"><img src="' + data.player.avatar + '" class="race_player_avatar" data-player="' + data.player.position + '">');
- if (data.game.finish == '1') {
- raceStart(data.game.winner_position);
- }
- }
- if (data.game.finish == '1') {
- raceEnd(data);
- }
- }
- function raceEnd(data) {
- $("#race_" + data.game.dragrace_id).attr('data-status', '1');
- $("#race_" + data.game.dragrace_id + " .dragrace_list_status_join").removeClass('dragrace_list_status_join dragrace_list_status_join_final').addClass('dragrace_list_status_finished').html(phraser('FINISHED'));
- raceSort();
- if (data.top.user_id == userID || data.mid.user_id == userID || data.player.user_id == userID) {
- setTimeout(function() {
- if (data.game.winner_user_id == userID) {
- $.growl.notice({
- title: 'Drag Race',
- message: phraser('THE_GAME_OF') + " <b>" + data.game.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>."
- });
- updateCredits(2.95 * data.game.value);
- } else {
- $.growl.error({
- title: 'Drag Race',
- message: phraser('THE_GAME_OF') + " <b>" + data.game.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>."
- });
- }
- }, 9200);
- }
- if ($("#dragrace_game_" + data.game.dragrace_id).length > 0) {
- raceStart(data.game.winner_position);
- }
- }
- function raceLoad(type, dragrace_id) {
- $("#race_res").hide();
- $("#race_loader").show();
- $.ajax({
- type: "GET",
- url: "/dragrace_load.php",
- data: {
- type: type,
- dragrace_id: dragrace_id
- },
- success: function(text) {
- $("#race_loader").hide();
- $("#race_res").html(text).show();
- }
- });
- }
- function raceStart(winner_position) {
- var winner = 1;
- if (winner_position == 'mid') {
- winner = 2;
- }
- if (winner_position == 'bot') {
- winner = 3;
- }
- var animation = [0, Math.floor(Math.random() * 3) + 1, Math.floor(Math.random() * 3) + 1, Math.floor(Math.random() * 3) + 1];
- animation[winner] = Math.floor(Math.random() * 3) + 4;
- timeouts.push(setTimeout(function() {
- $("[data-light='1']").attr('src', site + '/images/race_light_orange.png');
- $(".race_count").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".race_count").trigger('pause');
- $(".race_count").prop("currentTime", 0);
- }, 4000));
- }, 1000));
- timeouts.push(setTimeout(function() {
- $("[data-light='2']").attr('src', site + '/images/race_light_orange.png');
- }, 2000));
- timeouts.push(setTimeout(function() {
- $("[data-light='3']").attr('src', site + '/images/race_light_orange.png');
- $(".race_track_smoke").fadeIn(1000);
- }, 3000));
- timeouts.push(setTimeout(function() {
- $(".race_crowd, .race_crowd2").removeClass('race_crowd_bg').addClass('race_crowd_move_bg');
- $("[data-light='4']").attr('src', site + '/images/race_light_green.png');
- $(".race_track_car[data-player='top'], .race_track_smoke[data-player='top']").addClass('car_animate_' + animation[1]);
- $(".race_track_car[data-player='mid'], .race_track_smoke[data-player='mid']").addClass('car_animate_' + animation[2]);
- $(".race_track_car[data-player='bot'], .race_track_smoke[data-player='bot']").addClass('car_animate_' + animation[3]);
- $(".race_sound_fx").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".race_sound_fx").trigger('pause');
- $(".race_sound_fx").prop("currentTime", 0);
- }, 8000));
- }, 4000));
- timeouts.push(setTimeout(function() {
- $(".race_crowd, .race_crowd2").removeClass('race_crowd_move_bg').addClass('race_crowd_bg');
- $(".race_track_smoke").fadeOut(1000);
- $(".race_player[data-player='" + winner_position + "']").append('<img src="' + site + '/images/race_winner.png" class="race_player_winner">');
- $(".race_player_avatar[data-player='" + winner_position + "']").css('border', '1px solid #FAD733').css('box-shadow', '0px 0px 5px #FAD733');
- }, 9500));
- }
- function bettingEnd(data) {
- if (data.game.result == 'draw') {
- $.growl.warning({
- title: 'Match Betting',
- message: phraser('THE_GAME_OF') + " <b>" + data.bet.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('DRAW') + "</b>."
- });
- updateCredits(data.bet.result);
- } else if (data.game.result == 'loss') {
- $.growl.error({
- title: 'Match Betting',
- message: phraser('THE_GAME_OF') + " <b>" + data.bet.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>."
- });
- } else {
- $.growl.notice({
- title: 'Match Betting',
- message: phraser('THE_GAME_OF') + " <b>" + data.bet.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>."
- });
- updateCredits(data.bet.result);
- }
- }
- function coinSort() {
- $('#coinflip_listings').find('.coinflip_list').sort(function(a, b) {
- if ($(b).attr('data-status') == $(a).attr('data-status')) {
- return parseInt($(b).attr('data-sort')) - parseInt($(a).attr('data-sort'));
- }
- return parseInt($(a).attr('data-status')) - parseInt($(b).attr('data-status'));
- }).prependTo('#coinflip_listings');
- }
- function coinAdd(data) {
- if ($("#coin_" + data.game.coinflip_id).length == 0) {
- $("#coinflip_listings").append('<div class="coinflip_list" id="coin_' + data.game.coinflip_id + '" data-sort="' + data.game.value + '" data-status="0"><span class="coinflip_list_status_join" data-id="' + data.game.coinflip_id + '" data-value="' + data.game.value + '"><i class="fa fa-play-circle"></i> ' + phraser('CHALLENGE') + '</span><span class="coinflip_list_status_view" data-id="' + data.game.coinflip_id + '"><i class="fa fa-eye"></i></span><img src="' + site + '/images/' + data.creator.side + '.png" class="coinflip_list_side"><span class="coinflip_list_value">' + data.game.value + '<br>Credits</span><a show-profile="' + data.creator.user_id + '"><img src="' + data.creator.avatar + '" class="coinflip_list_avatar"></a><div class="coinflip_list_avatar_vs">VS</div><div class="coinflip_list_avatar_empty">X</div></div>');
- coinSort();
- }
- }
- function coinEnd(data) {
- $("#coin_" + data.game.coinflip_id).attr('data-status', '1');
- $("#coin_" + data.game.coinflip_id + " .coinflip_list_status_join").removeClass('coinflip_list_status_join coinflip_list_status_join_final').addClass('coinflip_list_status_finished').html(phraser('FINISHED'));
- $("#coin_" + data.game.coinflip_id + " .coinflip_list_avatar_empty").remove();
- $("#coin_" + data.game.coinflip_id).append('<a show-profile="' + data.challenger.user_id + '"><img src="' + data.challenger.avatar + '" class="coinflip_list_avatar"></a>');
- coinSort();
- if (data.creator.user_id == userID || data.challenger.user_id == userID) {
- setTimeout(function() {
- if (data.winner.user_id == userID) {
- $.growl.notice({
- title: 'Coin Flip',
- message: phraser('THE_GAME_OF') + " <b>" + data.game.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>."
- });
- updateCredits(1.95 * data.game.value);
- } else {
- $.growl.error({
- title: 'Coin Flip',
- message: phraser('THE_GAME_OF') + " <b>" + data.game.value + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>."
- });
- }
- }, 8500);
- }
- $("#coinflip_amount_" + data.game.side).html(parseInt($("#coinflip_amount_" + data.game.side).html()) + 1);
- if ($("#coinflip_game_" + data.game.coinflip_id).length > 0) {
- $("#coinflip_secret").html(data.game.secret);
- $("#coinflip_percent").html(data.game.percent);
- $("#coinflip_winner_persona").html(data.winner.persona);
- $("#coinflip_waiting").remove();
- $("#coinflip_hidden_user").prepend('<a class="coinflip_player" show-profile="' + data.challenger.user_id + '" data-side="' + data.challenger.side + '"><img src="' + site + '/images/' + data.challenger.side_pic + '.png" class="coinflip_player_side"><img src="' + data.challenger.avatar + '" class="coinflip_player_avatar"></a>');
- coinFlip(data.game.side);
- }
- }
- function coinLoad(type, coinflip_id) {
- $("#coinflip_content").html('<div id="coinflip_loader" class="loader_small"></div>');
- $.ajax({
- type: "GET",
- url: "/coinflip_load.php",
- data: {
- type: type,
- coinflip_id: coinflip_id
- },
- success: function(text) {
- $("#coinflip_content").html(text);
- }
- });
- }
- function coinFlip(side) {
- clearTimeouts();
- $("#coin .both-text").html('5');
- var seconds = 0;
- var timer = setInterval(function() {
- seconds++;
- $("#coin .both-text").html(function(i, html) {
- if ($("#coinflip_table_holder").length == 0 || (parseInt(html) == 0 && seconds == 10)) {
- clearTimeout(timer);
- return "";
- } else if (seconds == 10) {
- seconds = 0;
- return parseInt(html) - 1;
- }
- });
- }, 100);
- $("#coin .both-timer").stop(true).animate({
- 'top': '0px',
- 'opacity': '1',
- }, 6000, "easeInQuad");
- timeouts.push(setTimeout(function() {
- $(".flip").trigger('play');
- setTimeout(function() {
- $(".flip").trigger('pause');
- $(".flip").prop("currentTime", 0);
- }, 2300);
- $('#coin .both').remove();
- $('#coin').addClass('animate' + side);
- $(".coinflip_player, .coinflip_winner").not("#coinflip_winner, #coinflip_info").css('opacity', '0.5');
- }, 6000));
- timeouts.push(setTimeout(function() {
- var borderColor = "#ffd700";
- if (side == 'CT') {
- borderColor = "#0cb6e7";
- }
- $("#coinflip_winner b").css('border-color', borderColor);
- $("[data-side='" + side + "']").css('opacity', '1');
- $("[data-side='" + side + "'] .coinflip_player_side, [data-side='" + side + "'] .coinflip_player_avatar, #coin .front, #coin .back").css('border', '1px solid ' + borderColor).css('box-shadow', '0px 0px 5px ' + borderColor);
- $("#coinflip_winner").css('opacity', '1');
- $("#coinflip_info div").show();
- }, 8000));
- }
- function slotSpin(that, i) {
- var step = 85;
- that.css('margin-top', '0px');
- that.animate({
- marginTop: (-39 * 85) + 'px',
- }, i * 600 + 1000, "easeOutQuad");
- }
- function slotSpinAll() {
- var i = 0;
- $(".slot_child_content").each(function() {
- slotSpin($(this), i);
- i++;
- });
- }
- function slotFill() {
- var fruits = ['apple', 'banana', 'blueberry', 'cherry', 'pear', 'treasure'];
- $(".slot_child_content").each(function() {
- $(this).html('')
- for (var i = 0; i < 40; i++) {
- var fruit = fruits[Math.floor(Math.random() * fruits.length)];
- $(this).append('<img src="' + site + '/images/' + fruit + '.png">');
- }
- });
- }
- function blackJackEnd(data) {
- if (data.player.user_id == userID) {
- var value = data.game.value;
- var credits = data.game.credits;
- var choiceText = data.player.total;
- var oppText = data.dealer.total;
- setTimeout(function() {
- if (data.player.busted) {
- $.growl.error({
- title: 'Blackjack',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(value).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>. " + phraser('YOU_GOT_BUSTED')
- });
- } else if (data.winner.state == 'draw') {
- $.growl.warning({
- title: 'Blackjack',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(value).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('DRAW') + "</b>. " + phraser('YOU_GOT') + choiceText + phraser('DEALER_GOT') + oppText + "."
- });
- updateCredits(credits);
- } else if (data.winner.state == 'win') {
- $.growl.notice({
- title: 'Blackjack',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(value).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>. " + phraser('YOU_GOT') + choiceText + phraser('DEALER_GOT') + oppText + "."
- });
- updateCredits(credits);
- } else {
- $.growl.error({
- title: 'Blackjack',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(value).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>. " + phraser('YOU_GOT') + choiceText + phraser('DEALER_GOT') + oppText + "."
- });
- }
- }, data.dealer.cards * 1000 - 1000);
- }
- }
- function blackJackDeal(cards) {
- var cardArr = cards.split(";");
- var cardOne = cardArr[0].split(",");
- var cardTwo = cardArr[1].split(",");
- var cardThree = cardArr[2].split(",");
- $("#deal_shuffle").hide();
- $("#hit_double_stand").show();
- blackJackAddCard(cardOne[0], 1, cardOne[1], false);
- setTimeout(function() {
- blackJackAddCard(cardThree[0], 1, cardThree[1], true);
- }, 1000);
- setTimeout(function() {
- blackJackAddCard(cardTwo[0], 2, cardTwo[1], false);
- }, 2000);
- setTimeout(function() {
- if (parseInt(cardTwo[1]) != 21) {
- $(".blackjack_double").removeClass('disabled');
- $(".blackjack_hit").removeClass('disabled');
- $(".blackjack_stand").removeClass('disabled');
- } else {
- blackJackStand();
- }
- }, 3000);
- }
- function blackJackHit(card, doubled) {
- card = card.split(",");
- blackJackAddCard(card[0], card[1], card[2], false);
- if (card[3] == 'bust' || doubled) {
- setTimeout(function() {
- $(".blackjack_hit").addClass('disabled');
- blackJackStand();
- }, 1000);
- } else {
- setTimeout(function() {
- $(".blackjack_hit").removeClass('disabled');
- }, 1000);
- }
- if (parseInt(card[2]) == 21 && !doubled) {
- setTimeout(function() {
- blackJackStand();
- }, 1000);
- }
- }
- function blackJackAddCard(card, card_number, sum, dealer) {
- var card_id = "card_p" + card_number;
- var card_color = "card_black";
- var card_icon = "♣";
- var card_value = card.substring(1)
- if (card.charAt(0) == "H") {
- card_color = "card_red";
- card_icon = "♥";
- } else if (card.charAt(0) == "D") {
- card_color = "card_red";
- card_icon = "♦";
- } else if (card.charAt(0) == "S") {
- card_icon = "♠";
- }
- var degVal, topVal, leftVal, topAlign, playerType, valueType, cardsType;
- degVal = topVal = leftVal = 0;
- if (dealer) {
- topAlign = -1;
- playerType = "#blackjack_dealer";
- valueType = "#blackjack_value_number_dealer";
- cardsType = "#blackjack_dealer";
- } else {
- topAlign = 1;
- playerType = "#blackjack_player";
- valueType = "#blackjack_value_number_player";
- cardsType = "#blackjack_player";
- }
- var leftMargin = $("#blackjack_table").width() / -5 + 30 * (card_number - 1);
- var topMargin = 127 - 5 * card_number;
- topAlign = topMargin * topAlign;
- $("#blackjack_deck").prepend('<div class="card card_90 card_back" id="card_spinning_' + card_id + '" style="z-index:20"></div>');
- $({
- deg: 90,
- top: 0,
- left: 0
- }).animate({
- deg: 360,
- top: topAlign,
- left: leftMargin
- }, {
- duration: 300,
- step: function(now, fx) {
- if (fx.prop == "deg") {
- degVal = now;
- } else if (fx.prop == "top") {
- topVal = now;
- } else if (fx.prop == "left") {
- leftVal = now;
- }
- $("#card_spinning_" + card_id).css({
- top: topVal + 'px',
- left: leftVal + 'px',
- transform: 'rotate(' + degVal + 'deg) scaleX(-1)'
- });
- },
- complete: function() {
- $("#card_spinning_" + card_id).css({
- top: topAlign + 'px',
- left: leftMargin + 'px',
- transform: 'rotate(0deg) scaleX(-1)'
- });
- }
- });
- $(".deal").prop("currentTime", 0.1).trigger('play');
- setTimeout(function() {
- $(".deal").trigger('pause');
- $(".deal").prop("currentTime", 0);
- }, 900);
- setTimeout(function() {
- $("#card_spinning_" + card_id).remove();
- $(playerType).append('<div id="' + card_id + '" class="card_flipper"><div class="card card_back"></div><div class="card ' + card_color + '"><div class="card_top">' + card_icon + ' ' + card_value + '</div><div class="card_mid">' + card_icon + '</div><div class="card_bot">' + card_icon + ' ' + card_value + '</div></div></div>');
- setTimeout(function() {
- $("#" + card_id).addClass('card_flip');
- }, 100);
- setTimeout(function() {
- $(valueType).html(sum);
- }, 300);
- }, 300);
- }
- function blackJackStand() {
- $("#hit_double_stand button").addClass('disabled');
- $(".blackjack_stand").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "GET",
- url: "/blackjack_bet.php",
- data: {
- stand: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $(".blackjack_stand").prop('disabled', false).html(phraser('STAND'));
- if (text == 'errorCards' || text == 'errorGameID' || text == 'errorFinished') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- var cardArr = text.split(";");
- if (cardArr[0] != "bust" && cardArr[0] != "blackjack") {
- var i = 0;
- var card = cardArr[i].split(",");
- blackJackAddCard(card[0], (i + 2), card[1], true);
- i++;
- var cardInterval = setInterval(function() {
- if (i == cardArr.length - 1 || i > cardArr.length - 1) {
- clearInterval(cardInterval);
- } else {
- var card = cardArr[i].split(",");
- blackJackAddCard(card[0], (i + 2), card[1], true);
- i++;
- }
- }, 1000);
- timeouts.push(setTimeout(function() {
- $("#blackjack_player").html('').hide();
- $("#blackjack_dealer").html('');
- $("#blackjack_better").show();
- $(".blackjack_block").hide();
- $(".blackjack_controls").hide();
- $(".blackjack_game_value").html('0 Credits').hide();
- }, (i + 4) * 1000));
- } else {
- timeouts.push(setTimeout(function() {
- $("#blackjack_player").html('').hide();
- $("#blackjack_dealer").html('');
- $("#blackjack_better").show();
- $(".blackjack_block").hide();
- $(".blackjack_controls").hide();
- $(".blackjack_game_value").html('0 Credits').hide();
- }, 1500));
- }
- }
- }
- });
- }
- function addRouletteBet(data) {
- var betHTML = '<div class="roulette_bets" id="r' + data.bet.roulette_bet_id + '" data-user="' + data.player.user_id + '" data-choice="' + data.bet.choice + '"><div class="roulette_bets_value">' + data.bet.value + ' Credits</div><div class="roulette_bets_user"><a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '"></a> ' + data.player.persona + '</div></div>';
- if ($(".roulette_table").length > 0 && !$(".roulette_bets_holder #r" + data.bet.roulette_bet_id).length) {
- if (data.bet.timer_start == 1) {
- startTimer('roulette');
- }
- var betContainer = '#roulette_green';
- if (data.bet.choice == 2) {
- betContainer = '#roulette_red';
- } else if (data.bet.choice == 3) {
- betContainer = '#roulette_black';
- }
- $(betContainer).prepend(betHTML);
- var old_val = parseFloat($("#value").html());
- var new_val = (old_val + parseFloat(data.bet.value));
- $("#value").html(new_val.toFixed(2));
- $('.progress_value').stop(true);
- $({
- someValue: old_val
- }).animate({
- someValue: new_val.toFixed(2)
- }, {
- duration: 200,
- easing: 'swing',
- step: function() {
- $('.progress_value').text(this.someValue.toFixed(2));
- },
- complete: function() {
- $('.progress_value').text(new_val.toFixed(2));
- }
- });
- setTimeout(function() {
- $('.progress_value').stop(true).text(new_val.toFixed(2));
- }, 250);
- var newColorVal = Math.round((parseFloat($(betContainer + "_total").html().replace(" Credits")) + parseFloat(data.bet.value)) * 100) / 100;
- $(betContainer + "_total").html(newColorVal + " Credits");
- document.title = new_val.toFixed(2) + ' - Roulette | CSGOSpeed';
- $(".blop").trigger('play');
- }
- if (data.player.user_id == userID && !$("#global_roulette_bets #r" + data.bet.roulette_bet_id).length) {
- $("#global_roulette_bets").append(betHTML);
- }
- }
- function startRouletteAnimation(data) {
- if ($(".roulette_table").length > 0) {
- var number = data.roulette.winner_number;
- var targetColor = '';
- if (number == 0) {
- targetColor = 'green';
- numberCalc = 0;
- } else if (number > 10) {
- targetColor = 'black';
- numberCalc = 2 * (number - 10);
- } else {
- targetColor = 'red';
- numberCalc = 2 * (number) - 1;
- }
- var numberMargin = 60 * numberCalc;
- var randPos = Math.floor(Math.random() * 52) + 6
- var centerMargin = -21 * 60 + 60 * 7 + $("#page_content").width() / 2;
- var startMargin = centerMargin - numberMargin - randPos;
- $("#round_draw_pointer").show();
- $(".roulette_table").css('left', startMargin + 'px').addClass('roulette_animate');
- $(".click").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".click").trigger('pause');
- $(".click").prop("currentTime", 0);
- }, 5200));
- timeouts.push(setTimeout(function() {
- endRouletteAnimation(data);
- }, 11000));
- timeouts.push(setTimeout(function() {
- calcRouletteBets(targetColor);
- $(".roulette_table").css({
- transform: 'translate(-1680px, 0)'
- });
- }, 8000));
- }
- setTimeout(function() {
- checkRouletteWin(data);
- }, 8000);
- }
- function calcRouletteBets(color) {
- $(".roulette_choice_bets").each(function() {
- var that = $(this);
- var thatTotal = 0;
- var thatSign = '-';
- var thatClass = 'losses';
- var thatColor = that.attr("id").replace('roulette_', '');
- that.find(".roulette_bets .roulette_bets_value").each(function() {
- thatTotal += parseFloat($(this).text());
- });
- thatTotal = (Math.round(thatTotal * 100) / 100)
- if (thatColor == color) {
- thatSign = '+';
- thatClass = 'winnings';
- if (color == 'green') {
- thatTotal = thatTotal * 15;
- } else {
- thatTotal = thatTotal * 2;
- }
- }
- $('#roulette_' + thatColor + '_total').addClass(thatClass);
- $({
- someValue: 0
- }).animate({
- someValue: thatTotal.toFixed(2)
- }, {
- duration: 300,
- easing: 'swing',
- step: function() {
- $('#roulette_' + thatColor + '_total').text(thatSign + " " + this.someValue.toFixed(2) + " Credits");
- },
- complete: function() {
- $('#roulette_' + thatColor + '_total').text(thatSign + " " + thatTotal.toFixed(2) + " Credits");
- }
- });
- });
- }
- function endRouletteAnimation(data) {
- $(".roulette_bets_total span").html('0 Credits').removeClass('winnings').removeClass('losses');
- $("#round_draw_pointer").hide();
- $(".roulette_table").css('left', '0').removeClass('roulette_animate').css({
- transform: 'translate(0, 0)'
- });
- $(".roulette_choice_bets").html('');
- document.title = '0 - Roulette | CSGOSpeed';
- $(".progress_value").html('0');
- $("#value").html('0');
- $("#progress_load_holder_roulette").stop(true).animate({
- width: "0%"
- }, 1000);
- $("#timer_seconds_roulette").html('30');
- $("#timer_minutes_roulette").html('0');
- $(".load").trigger('play');
- setTimeout(function() {
- $(".load").trigger('pause');
- $(".load").prop("currentTime", 0);
- }, 1000);
- $(".roulette_id").html(data.roulette.new_roulette_id);
- var bgColor = '';
- if (data.roulette.winner_number == 0) {
- bgColor = '#5FAE63';
- } else if (data.roulette.winner_number >= 11) {
- bgColor = '#1b1e27';
- } else {
- bgColor = '#bc5652';
- }
- if ($("#rr" + data.roulette.roulette_id).length == 0) {
- $(".roulette_results_holder").prepend('<div class="roulette_result" id="rr' + data.roulette.roulette_id + '" style="background: ' + bgColor + '">' + data.roulette.winner_number + '</div>');
- }
- }
- var checkingRouletteWin = false;
- function checkRouletteWin(data) {
- if (!checkingRouletteWin) {
- checkingRouletteWin = true;
- var total = 0;
- $("#global_roulette_bets .roulette_bets[data-user='" + userID + "']").each(function() {
- var betChoice = $(this).attr("data-choice");
- if ((betChoice - 1) * 10 >= data.roulette.winner_number && (betChoice - 1) * 10 - 9 <= data.roulette.winner_number) {
- var times = 2;
- if (betChoice == 1) {
- times = 15;
- }
- total += parseFloat($(this).find('.roulette_bets_value').html()) * times;
- }
- });
- if (total > 0) {
- updateCredits(total);
- $.growl.notice({
- title: 'Roulette',
- message: phraser('WON_A_TOTAL_OF') + " <b>" + parseFloat(total).toFixed(2) + "</b>" + phraser('CREDITS_ON') + " Roulette."
- });
- }
- setTimeout(function() {
- checkingRouletteWin = false;
- }, 5000);
- }
- $("#global_roulette_bets").html('');
- }
- function sortHeadsup() {
- $('#headsup_bets').find('.headsup_thumb').sort(function(a, b) {
- return parseInt($(b).attr('data-sort')) - parseInt($(a).attr('data-sort'));
- }).prependTo('#headsup_bets');
- }
- function addHeadsup(data) {
- if ($("#h" + data.game.headsup_id).length == 0) {
- $("#headsup_bets").append('<div class="headsup_thumb" id="h' + data.game.headsup_id + '" data-sort="' + data.game.value + '"><div class="headsup_thumb_info"><span>' + data.game.value + '</span> Credits<a class="headsup_go"><i class="fa fa-play-circle"></i></a></div><img src="' + data.creator.avatar + '"></div>');
- sortHeadsup();
- }
- }
- function endHeadsup(data) {
- $("#h" + data.game.headsup_id).remove();
- if (data.creator.user_id == userID) {
- var credits = data.game.value;
- var choiceText = '';
- var oppText = '';
- if (data.creator.choice == 1) {
- choiceText = phraser('ROCK');
- } else if (data.creator.choice == 2) {
- choiceText = phraser('PAPER');
- } else if (data.creator.choice == 3) {
- choiceText = phraser('SCISSOR');
- }
- if (data.challenger.choice == 1) {
- oppText = phraser('ROCK');
- } else if (data.challenger.choice == 2) {
- oppText = phraser('PAPER');
- } else if (data.challenger.choice == 3) {
- oppText = phraser('SCISSOR');
- }
- if (data.game.result == '0') {
- $.growl.warning({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('DRAW') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- updateCredits(0.95 * credits);
- } else if (data.game.result == '2') {
- $.growl.notice({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- updateCredits(1.95 * credits);
- } else if (data.game.result == '1') {
- $.growl.error({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- }
- }
- }
- function sortUsers() {
- $('.round_players_holder').find('.round_player').sort(function(a, b) {
- return $(b).attr('data-sort') - $(a).attr('data-sort');
- }).prependTo('.round_players_holder');
- }
- function sortDeposits() {
- $('.round_bets_holder').find('.round_bet').sort(function(a, b) {
- return parseInt($(b).attr('data-sort')) - parseInt($(a).attr('data-sort'));
- }).prependTo('.round_bets_holder');
- }
- function addBet(data) {
- if (!$("#r" + data.deposit.deposit_id).length && $("#round_draw_spinner").length) {
- if (data.deposit.timer_start == 1) {
- startTimer('jackpot');
- }
- $("#round_items_empty").hide();
- $("#round_players_empty").hide();
- $("#round_deposits_empty").hide();
- if (!$("#round_player_" + data.player.user_id).length) {
- $(".round_players_holder").prepend('<a show-profile="' + data.player.user_id + '" class="round_player tool" data-sort="' + data.deposit.value + '" id="round_player_' + data.player.user_id + '" title="' + data.player.persona + '"><span class="round_player_chance" id="val_' + data.deposit.value + '">' + data.deposit.chance + '%</span><img src="' + data.player.avatar + '"></a>');
- } else {
- var new_player_value = parseFloat($("#round_player_" + data.player.user_id).attr('data-sort')) + parseFloat(data.deposit.value);
- var new_player_chance = parseFloat($("#round_player_" + data.player.user_id).find('.round_player_chance')) + parseFloat(data.deposit.chance);
- $("#round_player_" + data.player.user_id).attr('data-sort', new_player_value);
- $("#round_player_" + data.player.user_id).find('.round_player_chance').attr('id', 'val_' + new_player_value).html(new_player_chance + '%');
- }
- $(".round_bets_holder").prepend('<div class="round_bet" id="r' + data.deposit.deposit_id + '" data-sort="' + data.deposit.date + '"><a show-profile="' + data.player.user_id + '"><img src="' + data.player.avatar + '"></a> <b>' + data.player.persona + '</b> ' + phraser('DEPOSITED') + ' ' + data.deposit.value + ' Credits</div>');
- sortUsers();
- sortDeposits();
- var old_val = parseFloat($("#value").html());
- var new_val = (old_val + parseFloat(data.deposit.value));
- $("#value").html(new_val.toFixed(2));
- $('.progress_value').stop(true);
- $({
- someValue: old_val
- }).animate({
- someValue: new_val.toFixed(2)
- }, {
- duration: 200,
- easing: 'swing',
- step: function() {
- $('.progress_value').text(this.someValue.toFixed(2));
- },
- complete: function() {
- $('.progress_value').text(new_val.toFixed(2));
- }
- });
- setTimeout(function() {
- $('.progress_value').stop(true).text(new_val.toFixed(2));
- }, 250);
- document.title = new_val.toFixed(2) + ' - Jackpot | CSGOSpeed';
- $(".round_player_chance").each(function() {
- var new_chance = $(this).attr('id');
- var total_val = $("#value").html();
- if (new_chance != undefined) {
- new_chance = new_chance.replace('val_', '');
- new_chance = (parseFloat(new_chance) / total_val) * 100;
- $(this).text(new_chance.toFixed(2) + "%");
- }
- });
- $(".blop").trigger('play');
- }
- }
- function drawWinner(data) {
- if ($("#round_draw_spinner").length) {
- $(".tipsy").remove();
- var randPos = ($("#page_content").width() / 2) + Math.floor(Math.random() * 112) + 6;
- $("#round_draw_players").css('margin-left', (randPos - 840) + 'px').html(data.spinner.html);
- $("#round_draw_players").addClass('jackpot_animate');
- $("#round_draw_pointer").fadeIn();
- $("#round_holder").fadeOut(300);
- $("#round_draw_holder").fadeIn(300);
- timeouts.push(setTimeout(function() {
- $(".click").trigger('play');
- timeouts.push(setTimeout(function() {
- $(".click").trigger('pause');
- $(".click").prop("currentTime", 0);
- }, 5200));
- }, 500));
- timeouts.push(setTimeout(function() {
- $("#round_draw_players").css({
- transform: 'translate(-2280px, 0)'
- });
- $("#round_draw_pointer").fadeOut();
- $(".win_pic").addClass('winning_picture');
- $("#round_draw_winner").html("<span id='type_winner_persona'><i class='fa fa-user'></i> </span><div class='round_info_title'><i class='fa fa-info-circle'></i> " + phraser('DETAILS') + "</div><table class='round_draw_winner_table waiting_table' style='margin:20px auto 0;'><tr><td>" + phraser("ROUND_L") + "</td><td>#" + data.round.round_id + "</td></tr><tr><td>" + phraser("VALUE") + "</td><td><b class='navi-color-yellow'>" + parseFloat(data.round.value).toFixed(2) + " Credits</b></td></tr><tr><td>" + phraser("CHANCE") + "</td><td><b>" + parseFloat(data.round.winner_chance).toFixed(2) + "%</b></td></tr><tr><td>" + phraser("WINNER_PERCENTAGE") + "</td><td>" + data.round.winner_percentage + "%</td></tr></table>").fadeIn('slow');
- changeText(data.round.winner_persona, $("#type_winner_persona"), (data.round.winner_persona.length - 10) * -5 + 120);
- }, 7300));
- timeouts.push(setTimeout(function() {
- newRound(data);
- }, 11 * 1000));
- }
- setTimeout(function() {
- if (data.round.winner_user_id == userID) {
- updateCredits(data.round.value * data.round.winner_take);
- $.growl.notice({
- title: 'Jackpot',
- message: phraser('WON_A_TOTAL_OF') + " <b>" + parseFloat(data.round.value * data.round.winner_take).toFixed(2) + "</b>" + phraser('CREDITS_ON') + " Jackpot."
- });
- }
- }, 7000);
- }
- function newRound(data) {
- $(".tipsy").remove();
- timerStarted = false;
- $(".round_players_holder").html('');
- $(".round_items_holder").html('');
- $(".round_bets_holder").html('');
- $("#round_items_empty").show();
- $("#round_players_empty").show();
- $("#round_deposits_empty").show();
- $(".round_info_extra").find('.round_old_player:first').remove();
- $(".round_info_extra").prepend('<a show-profile="' + data.round.winner_user_id + '" class="round_old_player tool-top" title="<b>' + phraser('ROUND_L') + ':</b><br>' + data.round.round_id + '<br><br><b>' + phraser('WIN_PERCENTAGE') + ':</b><br>' + data.round.winner_percentage + '<br><br><b>' + phraser('HASH') + ':</b><br>' + data.round.hash + '"><span class="round_old_chance"><b>' + data.round.value + '</b> Credits<br>@ <b>' + data.round.winner_chance.toFixed(2) + '%</b></span><img src="' + data.round.winner_avatar + '"></a>');
- $(".round_info_extra").prepend('<a class="round_old_player tool-top" title="<b>' + phraser('ROUND_L') + '</b>:<br>' + data.new_round.round_id + '<br><br><b>' + phraser('HASH') + ':</b><br>' + data.new_round.hash + '"><span class="round_old_chance"><b>TBD</b><br>TBD</span><img src="' + site + '/images/no_user.jpg"></a>');
- $("#round_draw_holder").hide(500);
- $("#round_holder").show(500);
- $("#round_draw_players").html('').removeClass('spinner_animate').css({
- transform: 'translate(0, 0)'
- });
- $("#round_draw_winner").html('').hide();
- $("#progress_load_holder_jackpot").animate({
- width: "0%"
- }, 1000);
- $("#value").html('0');
- $(".progress_value").text("0");
- document.title = '0 - Jackpot | CSGOSpeed';
- $("#timer_seconds_jackpot").html('30');
- $("#timer_minutes_jackpot").html('0');
- $(".load").trigger('play');
- setTimeout(function() {
- $(".load").trigger('pause');
- $(".load").prop("currentTime", 0);
- }, 1000);
- }
- var ongoingTimerInterval;
- function ongoingTimer() {
- clearInterval(ongoingTimerInterval);
- var counter = parseInt($(".round_draw_ongoing_timer").html());
- ongoingTimerInterval = setInterval(function() {
- counter--;
- if (counter < 0) {
- $(".round_draw_ongoing").fadeOut();
- clearInterval(ongoingTimerInterval);
- } else {
- $(".round_draw_ongoing_timer").html(counter);
- }
- }, 1000);
- }
- timerStarted = false;
- timerFinishedPage = false;
- function startTimerTick(type, text) {
- var tMin = Math.floor(parseInt(text) / 60);
- var tSec = parseInt(text) - tMin * 60;
- var progTime = text * 1000;
- var progWidth = 100 * ((30 - text) / 30);
- if (tSec < 10) {
- tSec = "0" + tSec;
- }
- if (text < -20) {
- tSec = "30";
- tMin = "0";
- } else if (text <= 0) {
- tSec = "00";
- tMin = "0";
- }
- var startTime = new Date().getTime();
- var startSec = parseInt(text);
- $("#timer_seconds_" + type).html(tSec);
- $("#timer_minutes_" + type).html(tMin);
- $("#timer_counter_" + type).show();
- $("#timer_loader_" + type).hide();
- if (text > -20) {
- $("#progress_load_holder_" + type).animate({
- width: progWidth + '%'
- }, 500, 'linear');
- setTimeout(function() {
- $("#progress_load_holder_" + type).animate({
- width: '100%'
- }, progTime, 'linear');
- }, 500);
- }
- if (!timerStarted && text > 0) {
- timerStarted = true;
- var countTimer = setInterval(function() {
- var timeElapse = Math.floor((new Date().getTime() - startTime) / 1000);
- var timerNow = startSec - timeElapse;
- var min = Math.floor(timerNow / 60);
- var sec = timerNow - min * 60;
- if (min < 0) {
- timerStarted = false;
- sec = 0;
- min = 0;
- clearInterval(countTimer);
- } else if (sec == 0 && min > 0) {
- sec = 59;
- min = min - 1;
- } else if (sec > 0) {
- sec = sec - 1;
- } else if (sec == 0 && min == 0) {
- timerStarted = false;
- clearInterval(countTimer);
- }
- if (sec < 10) {
- sec = "0" + sec;
- }
- $("#timer_seconds_" + type).html(sec);
- $("#timer_minutes_" + type).html(min);
- if (timerFinishedPage) {
- $("#progress_load_holder_" + type).stop(true).width('0%')
- $("#timer_seconds_" + type).html('30');
- $("#timer_minutes_" + type).html('0');
- timerStarted = false;
- timerFinishedPage = false;
- clearInterval(countTimer);
- }
- }, 1000);
- }
- }
- function startTimer(type, attempt) {
- setTimeout(function() {
- $("#timer_loader_" + type).show();
- $("#timer_counter_" + type).hide();
- attempt = attempt || 0;
- finishRoundExec = false;
- $.ajax({
- type: "GET",
- url: "/" + type + "_timer.php",
- success: function(text) {
- if ($("." + type + "_hidden_value").length) {
- timerFinishedPage = false;
- startTimerTick(type, text);
- }
- },
- error: function() {
- if (attempt <= 1) {
- startTimer(type, attempt + 1);
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLEASE_TRY_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- }, Math.floor(Math.random() * 400) + 1);
- }
- function docTitle(string) {
- return (string.charAt(0).toUpperCase() + string.slice(1)).replace(".php", "");
- }
- var timeouts = [];
- function clearTimeouts() {
- for (var i = 0; i < timeouts.length; i++) {
- clearTimeout(timeouts[i]);
- clearInterval(timeouts[i]);
- }
- timeouts = [];
- timerFinishedPage = true;
- }
- function stopAnimations() {
- $(".audio_file").each(function() {
- $(this).trigger('pause').prop("currentTime", 0);
- });
- $(".roulette_table, .progress_load_holder").stop(true);
- $("#crash_overlay").css('height', '100%');
- $(crashAnimation).stop(true, false);
- $(crashParticleAnimation).stop(true);
- clearTimeouts();
- crashAutoBet = false;
- }
- freeToLoad = true;
- function loadPage(page, type) {
- var extrasGET = '';
- var extrasURL = '';
- if (typeof type !== 'undefined') {
- extrasGET = '?type=' + type;
- extrasURL = '/' + type;
- }
- var thisPage = document.location.pathname.replace("/", "");
- $("#page_content").html('<div class="loader"></div>');
- stopAnimations();
- $.ajax({
- type: "GET",
- url: "/" + page + extrasGET,
- success: function(resp) {
- document.title = docTitle(page) + ' | CSGOSpeed';
- $("#page_content").html(resp);
- if (thisPage != page.replace(".php", "")) {
- window.history.pushState("", "", '/' + page.replace(".php", "") + extrasURL);
- }
- setTimeout(function() {
- freeToLoad = true;
- }, 100);
- },
- error: function(xhr, ajaxOptions, thrownError) {
- setTimeout(function() {
- freeToLoad = true;
- }, 100);
- swal({
- title: phraser('ERROR'),
- html: phraser('PLEASE_TRY_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- });
- }
- function loadSupport(statsType, ticketID) {
- ticketID = ticketID || '';
- $("#user_stats_response").hide();
- $("#user_stats_loader").show();
- $.ajax({
- type: "GET",
- url: "/support_stats.php",
- data: {
- stats: statsType,
- ticket_id: ticketID
- },
- success: function(text) {
- $("#user_stats_response").html(text);
- $("#user_stats_loader").hide();
- $("#user_stats_response").show();
- }
- });
- }
- function loadUserStats(statsType) {
- $("#user_stats_response").hide();
- $("#user_stats_loader").show();
- var user_id = 0;
- if ($("#stats_user_id").length > 0) {
- user_id = $("#stats_user_id").html();
- }
- $.ajax({
- type: "GET",
- url: "/user_stats.php",
- data: {
- stats: statsType,
- user_id: user_id
- },
- success: function(text) {
- $("#user_stats_loader").hide();
- $("#user_stats_response").html(text).show();
- }
- });
- }
- function loadTopList(chosenDate, chosenType) {
- $("#players_result").hide().html('');
- $("#players_load").show();
- $.ajax({
- type: "GET",
- url: "/players_stats.php",
- data: {
- date: chosenDate,
- type: chosenType
- },
- success: function(text) {
- $("#players_load").hide();
- $("#players_result").html(text).show();
- }
- });
- }
- function addNotice(data) {
- $(".admin_notice_message").html(data.message);
- $(".admin_notice").fadeIn(300);
- }
- function removeNotice(data) {
- $(".admin_notice").hide();
- }
- function ticketResponse(data) {
- $.growl.warning({
- title: phraser('SUPPORT'),
- message: phraser('TICKET_ANSWERED')
- });
- }
- function removeChatMessage(data) {
- $(".tipsy").remove();
- $('.chat_message[data-user="' + data.user_id + '"]').remove();
- }
- function addChatMessage(data) {
- var muted_users = $("#chat_mutes").html().split(";");
- if (muted_users.indexOf(data.user_id) > -1) {
- return;
- }
- var scrolled = false;
- var elem = $("#chat_cell");
- if (elem[0].scrollHeight - elem.scrollTop() > elem.outerHeight() + 50) {
- scrolled = true;
- }
- var usrMod = [];
- if (data.level == 3) {
- usrMod[data.user_id] = 'chat_message_admin';
- } else if (data.level == 2) {
- usrMod[data.user_id] = 'chat_message_mod';
- } else if (data.bot == 1) {
- usrMod[data.user_id] = 'chat_message_bot';
- } else {
- usrMod[data.user_id] = '';
- }
- var mute = [];
- if (userID != 0 && usrMod[data.user_id] == '') {
- mute[data.user_id] = '<a class="mute_user tool-left" data-id="' + data.user_id + '" title="Mute"><i class="fa fa-user-times"></i></a>';
- } else {
- mute[data.user_id] = '';
- }
- var chatModLink = [];
- if (chatMod && usrMod[data.user_id] == '') {
- chatModLink[data.user_id] = '<a sID="' + data.steamID + '" class="chat_ban" data-title="' + data.persona + '"><i class="fa fa-ban"></i></a>';
- } else {
- chatModLink[data.user_id] = '';
- }
- var level = [];
- if (data.bot == 1) {
- level[data.user_id] = '<span class="chat_user_level">999</span>';
- } else {
- level[data.user_id] = '<span class="chat_user_level">' + data.user_level + '</span>';
- }
- $("#chat_cell").append('<div class="chat_message" data-user="' + data.user_id + '"><div class="chat_message_title ' + usrMod[data.user_id] + '">' + chatModLink[data.user_id] + mute[data.user_id] + level[data.user_id] + '<a show-profile="' + data.user_id + '"><img src="' + data.steamPic + '"></a>' + data.steamName + '</div><div class="chat_message_text">' + data.message + '</div></div>');
- if (!scrolled) {
- elem.stop(true).animate({
- scrollTop: elem[0].scrollHeight
- }, 100);
- }
- if ($('#chat_cell').find('.chat_message').length > 30 && !scrolled) {
- $('#chat_cell').find('.chat_message:lt(' + ($('#chat_cell').find('.chat_message').length - 30) + ')').remove();
- }
- }
- function postChatMessage(e) {
- var isTrusted = false;
- if (e.screenX && e.screenX != 0 && e.screenY && e.screenY != 0) {
- isTrusted = true;
- }
- if (e.keyCode == 13 || e.which == 13) {
- isTrusted = true;
- }
- if (!isTrusted) {
- $.ajax({
- type: "POST",
- url: "/chat_message.php",
- data: {
- illegal: true
- },
- success: function(text) {}
- });
- return;
- }
- if ($("#chat_message_textarea").val().length == 0) {
- return;
- }
- var messageVal = $("#chat_message_textarea").val();
- $("#chat_message_textarea").val('');
- $("#chat_message_send").prop('disabled', true).css("background-color", "#2d2d2d");
- var cmdTitle = "";
- var cmdText = "";
- if (messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "") == '/help') {
- cmdTitle = "COMMANDS";
- cmdText = '/help to show all commands<br>/rules to show chat rules<br>/recruits to get link to enter code<br>/hint to see the current chat giveaway hint';
- } else if (messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "") == '/rules') {
- cmdTitle = "CHAT RULES";
- cmdText = 'Do not beg.<br>Do not post links.<br>Do not advertise.<br>Speaking english is preferred.<br>Treat people how you want to be treated yourself.';
- } else if (messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "") == '/recruits') {
- cmdTitle = "RECRUITS";
- cmdText = 'Go to <a class="menu_item" data-page="recruits.php">Recruits</a>';
- }
- if (cmdText != "" && cmdTitle != "") {
- $("#chat_cell").append('<div class="chat_message" data-user="21"><div class="chat_message_title chat_message_bot"><span class="chat_user_level">999</span><a show-profile="21"><img src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/4c/4cdc67b6ef726812b43e7af7c2f66648f7ebc661.jpg"></a>Chat BOT</div><div class="chat_message_text"><center><b>[' + cmdTitle + ']</b></center>' + cmdText + '</div></div>');
- $("#chat_cell").stop(true).animate({
- scrollTop: $("#chat_cell")[0].scrollHeight
- }, 100);
- $("#chat_message_send").prop('disabled', false).css("background-color", "#e69b23");
- return;
- }
- $.ajax({
- type: "POST",
- url: "/chat_message.php",
- data: {
- message: messageVal
- },
- success: function(text) {
- if (text == "errorSpam") {
- swal({
- title: phraser('ERROR'),
- html: phraser('SPAMMING_CHAT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == "errorSlowMode") {
- swal({
- title: phraser('ERROR'),
- html: phraser('SLOW_MODE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == "errorModMode") {
- swal({
- title: phraser('ERROR'),
- html: phraser('MOD_MODE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text.indexOf("errorBanned") > -1) {
- swal({
- title: phraser('ERROR'),
- html: text.replace("errorBanned", ""),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- $("#chat_message_send").prop('disabled', false).css("background-color", "#e69b23");
- },
- error: function(xhr, ajaxOptions, thrownError) {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLEASE_TRY_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- $("#chat_message_send").prop('disabled', false).css("background-color", "#e69b23");
- }
- });
- }
- function loadSteamStatus() {
- $("#steam_status_text").hide();
- $("#steam_status_progress").hide();
- $("#steam_status_loader").show();
- $.ajax({
- type: "GET",
- url: "/steamstatus.php",
- success: function(text) {
- var statusPercent = 0;
- var statusClass = '';
- switch (text) {
- case 'Normal':
- statusPercent = 100;
- statusClass = 'progress-bar-success';
- break;
- case 'Inventory Delayed':
- statusPercent = 60;
- statusClass = 'progress-bar-warning';
- break;
- case 'Sessions Delayed':
- statusPercent = 50;
- statusClass = 'progress-bar-warning';
- break;
- case 'Inventory Critical':
- statusPercent = 35;
- statusClass = 'progress-bar-warning';
- break;
- case 'Going Down':
- statusPercent = 20;
- statusClass = 'progress-bar-danger';
- break;
- case 'Session Surge':
- statusPercent = 15;
- statusClass = 'progress-bar-danger';
- break;
- case 'Sessions Surge':
- statusPercent = 15;
- statusClass = 'progress-bar-danger';
- break;
- case 'No Session':
- statusPercent = 10;
- statusClass = 'progress-bar-danger';
- break;
- case 'WebAPI Offline':
- statusPercent = 5;
- statusClass = 'progress-bar-danger';
- break;
- default:
- statusPercent = 90;
- statusClass = 'progress-bar-success';
- break;
- }
- $("#steam_status_text").show();
- $("#steam_status_progress").show();
- $("#steam_status_loader").hide();
- $("#steam_status").html(text);
- $("#steam_status_percentage").html(statusPercent + "%");
- $("#steam_status_bar").removeClass().addClass('progress-bar ' + statusClass).width(statusPercent + '%');
- }
- });
- }
- deals_bot_loading = false;
- botDealsPage = 1;
- function loadBotDeals(more, min, max) {
- if (!more) {
- $('#withdraw_result').html('<div class="loader_small"></div>');
- $("#withdraw_empty").show();
- $("#withdraw_choose").html('').hide();
- $('#withdraw_bot_chosen').html('');
- $('#item_pot_value_bot').html('0 Credits');
- } else {
- $('#withdraw_result').append('<div class="withdraw_clear" style="clear: both;"></div><div class="loader_small"></div>');
- }
- if (!deals_bot_loading) {
- deals_bot_loading = true;
- $.ajax({
- type: "GET",
- url: "/withdraw_deals.php?min=" + min + "&max=" + max + "&page=" + botDealsPage,
- success: function(text) {
- deals_bot_loading = false;
- if (!more) {
- $('#withdraw_result').html(text);
- } else {
- $('#withdraw_result .loader_small, #withdraw_result .withdraw_clear').remove();
- $('#withdraw_result').append(text);
- $("#withdraw_choose .inventory_item").each(function() {
- var itemID = $(this).attr('id');
- $("#withdraw_result #" + itemID).remove();
- });
- }
- }
- });
- }
- }
- inventory_bot_loading = false;
- botInventoryPage = 1;
- function loadBotInventory(more, search) {
- var order = $("#withdraw_order").val();
- var name = $("#withdraw_search").val();
- var min = $("#withdraw_min").val();
- var max = $("#withdraw_max").val();
- if (!more && !search) {
- $('#withdraw_result').html('<div class="loader_small"></div>');
- $("#withdraw_empty").show();
- $("#withdraw_choose").html('').hide();
- $('#withdraw_bot_chosen').html('');
- $('#item_pot_value_bot').html('0 Credits');
- } else if (search) {
- $('#withdraw_result').html('<div class="loader_small"></div>');
- } else {
- $('#withdraw_result').append('<div class="withdraw_clear" style="clear: both;"></div><div class="loader_small"></div>');
- }
- if (!inventory_bot_loading) {
- inventory_bot_loading = true;
- $.ajax({
- type: "GET",
- url: "/withdraw_load.php?order=" + order + "&name=" + name + "&min=" + min + "&max=" + max + "&page=" + botInventoryPage,
- success: function(text) {
- inventory_bot_loading = false;
- if (!more && !search) {
- $('#withdraw_result').html(text);
- } else {
- $('#withdraw_result .loader_small, #withdraw_result .withdraw_clear').remove();
- $('#withdraw_result').append(text);
- $("#withdraw_choose .inventory_item").each(function() {
- var itemID = $(this).attr('id');
- $("#withdraw_result #" + itemID).remove();
- });
- }
- }
- });
- }
- }
- inventory_loading = false;
- function loadInventory() {
- $('#inventory_result').html('');
- $("#inventory_load").show();
- if (!inventory_loading) {
- inventory_loading = true;
- $.ajax({
- type: "GET",
- url: "/deposit_load.php?load",
- success: function(text) {
- inventory_loading = false;
- $('#inventory_result').html(text);
- $("#inventory_load").hide();
- $('#inventory_result').find('.inventory_item').sort(function(a, b) {
- return $(b).attr('data-sort') - $(a).attr('data-sort');
- }).prependTo('#inventory_result');
- }
- });
- }
- }
- inventory_refresh = false;
- function refreshInventory(attempt) {
- if (!inventory_refresh && !inventory_loading) {
- inventory_refresh = true;
- $('#inventory_attempt').html(phraser('ATTEMPT') + ' #' + (attempt + 1));
- $('#inventory_attempt').show();
- $("#inventory_load").show();
- $('#inventory_result').html('');
- $('#pot_result').html('');
- $("#item_pot_value_user").text("0 Credits");
- $("#pot_empty").show();
- $("#pot_result").hide();
- $.ajax({
- type: "GET",
- url: "/deposit_load.php?refresh",
- success: function(text) {
- if (text == 'success') {
- $('#inventory_attempt').hide();
- inventory_refresh = false;
- loadInventory();
- } else {
- if (attempt >= 49) {
- inventory_refresh = false;
- $('#inventory_attempt').hide();
- $("#inventory_load").hide();
- $('#inventory_result').html('<div id="inventory_empty" style="display: block;padding-top: 35px;">' + phraser('COULDNT_GET_INVENTORY') + '</div>');
- } else {
- inventory_refresh = false;
- refreshInventory(attempt + 1);
- }
- }
- }
- });
- }
- }
- function tradeOfferStatus(type, attempt) {
- attempt = attempt || 0;
- $.ajax({
- type: "GET",
- url: "/" + type + "_response.php",
- data: {
- trade_offer_id: $("#waiting_deposit_id").attr('data-id')
- },
- success: function(text) {
- var response = text.split(";");
- if (response[0] == 'success') {
- $("#waiting_deposit_id").hide();
- $("#accept_link_browser").prop('href', 'https://steamcommunity.com/tradeoffer/' + response[1] + '/');
- $("#accept_link_steam").prop('href', 'steam://url/ShowTradeOffer/' + response[1] + '/');
- $(".accept_link").show();
- } else if (response[0] == 'error' || attempt >= 60 * 5) {
- if (response[1] == 'not_found' || response[1] == 'inventory') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_FIND_ALL_ITEMS_' + type.toUpperCase()),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (response[1] == 'inventory') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER_INVENTORY'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (response[1] == 'trade_url') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER_URL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (response[1] == 'escrow') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER_ESCROW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (response[1] == 'no_slots') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER_SLOTS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (response[1] == 'steam_error' || attempt >= 60 * 5) {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- loadPage(type + '.php');
- } else {
- timeouts.push(setTimeout(function() {
- tradeOfferStatus(type, attempt + 1);
- }, 1500));
- }
- },
- error: function() {
- timeouts.push(setTimeout(function() {
- tradeOfferStatus(type, attempt + 1);
- }, 1000));
- }
- });
- }
- $(function() {
- $(window).bind('popstate', function(e) {
- var newPage = document.location.pathname.replace("/", "");
- if (newPage.length > 1) {
- loadPage(newPage + '.php');
- }
- });
- if (isMobile) {
- $("#chat_cell").height($('body').height() - 75 - 125 - 50);
- }
- $("#chat_cell").scrollTop(999999999, 0);
- $('.tool').tipsy();
- $('.tool-top').tipsy({
- html: true,
- gravity: 's'
- });
- $('.tool-left').tipsy({
- html: true,
- gravity: 'e'
- });
- $('body').on('keyup', '#send_steam_credits, #crash_bet, #crash_cashout, #deposit_value, .roulette_form_value, #headsup_value, #blender_value, #taxi_value, #slot_bet_credits, .betting_value, #send_credits_amount', function(e) {
- if (this.value.charAt(0) == "." || this.value.charAt(0) == ",") {
- this.value = "0" + this.value;
- }
- this.value = this.value.replace(",", ".");
- if ($.isNumeric(this.value) === false) {
- this.value = this.value.slice(0, -1);
- }
- });
- $('body').on('click', '#sign_in_steam', function() {
- $(this).css('opacity', '0.5');
- window.location = site + "/login_request.php?steam";
- });
- $('body').on('click', '.sign_in_new', function() {
- loadPage("login.php");
- });
- $('body').on('click', '.sign_up_new', function() {
- loadPage("register.php");
- });
- $('body').on('mousedown', '.menu_item', function(e) {
- if (freeToLoad) {
- if (e.which == 2) {
- window.open(site + '/' + $(this).attr('data-page').replace(".php", ""), '_blank');
- self.blur();
- } else if (e.which == 1) {
- loadPage($(this).attr('data-page'));
- freeToLoad = false;
- }
- }
- });
- $('body').on('click', '.chat_username_respond', function() {
- var uName = $(this).text();
- if ($('#chat_message_textarea').val().length + uName.length <= 200) {
- $('#chat_message_textarea').val(function(i, text) {
- return text + " [" + uName.replace(/\]/g, "").replace(/\[/g, "") + "] ";
- });
- $('#chat_message_textarea').focus();
- }
- });
- $('#chat_message_textarea').keypress(function(e) {
- var keycode = (e.keyCode ? e.keyCode : e.which);
- if (keycode == 13 && !e.shiftKey) {
- e.preventDefault();
- postChatMessage(e);
- }
- });
- $("#chat_message_send").click(function(e) {
- e.preventDefault();
- postChatMessage(e);
- });
- $(".chat_form").submit(function(e) {
- e.preventDefault();
- });
- $('body').on('click', '.chat_icons', function() {
- var target = $(this).attr('data-target');
- $(".chat_icon_preview img").attr('data-target', target);
- swal({
- title: phraser('CHAT_ICONS'),
- html: $("#chat_icons_html").html(),
- confirmButtonText: phraser('OKAY')
- });
- });
- $('body').on('click', '.chat_icon_preview img', function() {
- var dataShort = $(this).attr('data-keyword');
- var target = $(this).attr('data-target');
- $('#' + target + '_message_textarea').val(function(i, text) {
- return text + " " + dataShort;
- });
- });
- $('body').on('click', '.volume', function() {
- var volumeOn;
- if ($(this).hasClass('on')) {
- $(this).removeClass('on').addClass('off').html('<i class="fa fa-volume-off"></i>');
- volumeOn = 'off';
- $(".audio_file").each(function() {
- $(this).prop("volume", 0);
- });
- } else {
- $(this).removeClass('off').addClass('on').html('<i class="fa fa-volume-up"></i>');
- volumeOn = 'on';
- $(".audio_file").each(function() {
- var volume = $(this).attr("data-volume");
- $(this).prop("volume", volume);
- });
- }
- $.ajax({
- type: "GET",
- url: "/save_volume.php",
- data: {
- volume: volumeOn
- }
- });
- });
- $('#steam_status_holder').click(function() {
- if ($(this).width() > 100) {
- loadSteamStatus();
- }
- });
- $('body').on('click', '#inventory_result .inventory_item', function(e) {
- if ($(this).hasClass('inventory_item_untradable')) {
- swal({
- title: phraser('ERROR'),
- html: phraser('ITEM_IS_NOT_TRADABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- }
- if ($("#pot_result .inventory_item").length >= 50) {
- swal({
- title: phraser('ERROR'),
- html: phraser('MAXIMUM_ITEMS_PER_TRADE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- }
- var old_pot = $(".item_pot_value").text().replace(" Credits", "");
- var new_val = $(this).find(".round_item_price span").text();
- var new_pot = parseFloat(old_pot) + parseFloat(new_val);
- $(".item_pot_value").text(new_pot.toFixed(2) + " Credits");
- if (new_pot >= 1) {
- $(".pot_deposit").removeClass("pot_deposit_disabled");
- }
- $("#pot_empty").hide();
- $("#pot_result").show();
- $(this).appendTo("#pot_result");
- });
- $('body').on('click', '#pot_result .inventory_item', function(e) {
- var old_pot = $(".item_pot_value").text().replace(" Credits", "");
- var new_val = $(this).find(".round_item_price span").text();
- var new_pot = parseFloat(old_pot) - parseFloat(new_val);
- $(".item_pot_value").text(new_pot.toFixed(2) + " Credits");
- if ($("#pot_result .inventory_item").length == 1) {
- $("#pot_empty").show();
- $("#pot_result").hide();
- }
- if (new_pot < 1) {
- $(".pot_deposit").addClass("pot_deposit_disabled");
- }
- $(this).appendTo("#inventory_result");
- $('#inventory_result').find('.inventory_item').sort(function(a, b) {
- return $(b).attr('data-sort') - $(a).attr('data-sort');
- }).prependTo('#inventory_result');
- });
- $('body').on('click', '.inventory_refresh', function() {
- refreshInventory(0);
- });
- $('body').on('click', '#deposit_deposit', function() {
- var numberOfItems = 0;
- var arr = [];
- $('#pot_result').children('.inventory_item').each(function() {
- var itemID = $(this).attr('id').replace("ih", "");
- if (!arr.indexOf(itemID) != -1) {
- arr.push(itemID);
- $("#items").val($("#items").val() + itemID + ';');
- numberOfItems += 1;
- }
- });
- if (numberOfItems > 0 && numberOfItems <= 50 && parseFloat($(".item_pot_value").html().replace(" Credits", "")) >= 1) {
- $(".accept_link").hide();
- $("#user_inventory_holder").slideUp();
- $("#user_deposit").slideDown();
- $("#waiting_pot_value").text($(".item_pot_value").text());
- $.ajax({
- type: "GET",
- url: "/deposit_save.php",
- data: {
- items: $("#items").val()
- },
- success: function(text) {
- if (text == 'error amount' || text == 'error access' || text == 'error item' || text == 'error value' || text == 'error bot') {
- setTimeout(function() {
- $(".accept_link").hide();
- $("#user_inventory_holder").slideDown();
- $("#user_deposit").slideUp();
- swal({
- title: phraser('ERROR'),
- text: text.replace(" ", "_").toUpperCase(),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 500);
- } else {
- var response = text.split(";");
- $("#waiting_pot_value").text($(".item_pot_value").text());
- $("#waiting_code").text(response[0]);
- $("#waiting_deposit_id").attr('data-id', response[1]);
- $("#waiting_bot").text(response[2]);
- timeouts.push(setTimeout(function() {
- tradeOfferStatus('deposit');
- }, 1000));
- }
- }
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('MAXIMUM_ITEMS_PER_TRADE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- });
- var stopScrollTick = false;
- $('body').on('mousedown touchstart', '.scroller', function(e) {
- e.stopPropagation();
- stopScrollTick = false;
- var sender = $(this);
- var target = $(sender.attr('data-target'));
- var child = sender.attr('data-child');
- var pos = target.scrollLeft();
- var scrollSpeed = 2;
- var scrollTime = 0;
- var scrollTick = setInterval(function() {
- var max = target.find(child).length * target.find(child).outerWidth() - $("#page_content").width();
- if (!sender.hasClass('left')) {
- pos = pos + 10 + scrollSpeed;
- } else {
- pos = pos - 10 - scrollSpeed;
- }
- if (pos > max && max < 0) {
- pos = 0;
- } else if (pos > max) {
- pos = max
- }
- target.scrollLeft(pos);
- if (scrollTime % 50 == 0) {
- scrollSpeed = Math.pow(scrollSpeed, 2);
- }
- scrollTime++;
- if (stopScrollTick || pos == max) {
- clearInterval(scrollTick);
- }
- }, 10);
- }).on('mouseup touchend', '.scroller', function() {
- stopScrollTick = true;
- }).on('mouseleave touchmove', '.scroller', function() {
- stopScrollTick = true;
- });
- $('body').on('click', '.accept_link', function() {
- var page = $(this).attr('data-page');
- loadPage(page);
- });
- $('body').on('click', '#user_stats_menu li a', function() {
- var clickedThis = $(this);
- $("#user_stats_menu li").each(function() {
- $(this).removeClass('active');
- });
- clickedThis.parent('li').addClass('active');
- loadUserStats($(this).attr('data-stats'));
- });
- $('body').on('click', '#players_menu li a', function() {
- $("#players_menu li").each(function() {
- $(this).removeClass('active');
- });
- $(this).parent('li').addClass('active');
- loadTopList($(this).attr('data-stats'), $("#players_game_select").val());
- });
- $('body').on('change', '#players_game_select', function() {
- loadTopList($("#players_menu li.active a").attr('data-stats'), $("#players_game_select").val());
- });
- $('body').on('click', '#recruits_menu li a', function() {
- var clickedThis = $(this);
- $("#recruits_menu li").each(function() {
- $(this).removeClass('active');
- });
- clickedThis.parent('li').addClass('active');
- loadRecruits($(this).attr('data-stats'));
- });
- $('body').on('submit', '#settings_form', function(e) {
- e.preventDefault();
- $("#settings_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- if (!validateTradeURL($("#trade_url").val()) && $("#trade_url").val() != "") {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLEASE_ENTER_A_VALID_TRADE_URL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- $("#settings_form button").prop('disabled', false).html(phraser('SAVE'));
- return;
- }
- $.ajax({
- type: "GET",
- url: "/settings_save.php",
- data: {
- trade_url: $("#trade_url").val(),
- stream_link: $("#stream_link").val(),
- status_message: $("#status_message").val(),
- hide_steam: $("#hide_steam").prop('checked'),
- timezone: $("#timezone").val(),
- language: $("#language").val()
- },
- success: function(text) {
- $("#settings_form button").prop('disabled', false).html(phraser('SAVE'));
- if (text == 'errorTradeURL') {
- swal({
- title: phraser('ERROR'),
- html: 'bruh... stahp! you aint the first one to try this bruh',
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- } else if (text == 'errorTimeZone') {
- swal({
- title: phraser('ERROR'),
- html: 'bruh... stahp! you aint the first one to try this bruh',
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- }
- swal({
- title: phraser('SUCCESS'),
- html: phraser('SETTINGS_SUCCESSFULLY_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- }
- });
- });
- $('body').on('click', '.jackpot_deposit_button', function() {
- $("#deposit_value").val('');
- $(".jackpot_deposit_button").fadeOut(250);
- $(".jackpot_deposit_value").fadeIn(250);
- $("#deposit_value").focus();
- });
- $('body').on('mousedown', '#deposit_value_submit', function(e) {
- e.preventDefault();
- $('.jackpot_deposit_value').submit();
- });
- $('body').on('submit', '.jackpot_deposit_value', function(e) {
- e.preventDefault();
- $("#jackpot_form").hide();
- $("#jackpot_loader").show();
- var deposit_value = $("#deposit_value").val();
- $.ajax({
- type: "POST",
- url: "/jackpot_bet.php",
- data: {
- deposit_value: deposit_value,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#jackpot_form").show();
- $("#jackpot_loader").hide();
- if (text == 'success') {
- $("#deposit_value").val('');
- $(".jackpot_deposit_value").hide();
- $(".jackpot_deposit_button").show();
- updateCredits(-1 * deposit_value);
- } else if (text == 'errorValue') {
- needCredits();
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_MANY_BETS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorTimer') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TIMER_IS_CLOSING'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLastRound') {
- swal({
- title: phraser('ERROR'),
- html: phraser('LAST_ROUND_NOT_FINISHED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- var blenderColorAvailable = true;
- $('body').on('click', '.blender_ingredient', function(e) {
- var flaskHeight = $("#flask_fill").height();
- var fruit = $(this).attr('data-fruit');
- var fruitColor = $(this).attr('data-color');
- var fruitColors = $(this).attr('data-color').split(",");
- var blenderColors = $("#blender_potion_content").html().split(";").length;
- if (blenderAvailable) {
- $("#blender_form").show();
- }
- if (flaskHeight < 400 && blenderColorAvailable) {
- blenderColorAvailable = false;
- $(".woosh").trigger('play');
- setTimeout(function() {
- $(".woosh").trigger('pause');
- $(".woosh").prop("currentTime", 0);
- }, 300);
- var imageOffset = $(this).find('img').offset();
- var potionOffset = $("#flask_fill").offset();
- var newFruit = $(this).find('img').clone();
- newFruit.appendTo("body").css({
- 'height': '80px',
- 'position': 'absolute',
- 'top': imageOffset.top + 'px',
- 'left': imageOffset.left + 'px',
- 'z-index': '20'
- }).addClass('fruit_rotate').animate({
- top: potionOffset.top - 40,
- left: potionOffset.left + 90,
- height: '40px'
- }, 400).fadeOut(200, function() {
- $(this).remove();
- });
- setTimeout(function() {
- $(".fill").trigger('play');
- setTimeout(function() {
- $(".fill").trigger('pause');
- $(".fill").prop("currentTime", 0);
- }, 300);
- if (flaskHeight == 0) {
- $('#flask_wave').css('fill', 'rgb(' + fruitColor + ')');
- } else {
- var potionColor = $('#flask_wave').css('fill').replace("rgb(", "").replace(/\ /g, "").replace(")", "").split(",");
- var newColorR = (potionColor[0] * fruitColors[0]) / 255 + 30;
- var newColorG = (potionColor[1] * fruitColors[1]) / 255 + 30;
- var newColorB = (potionColor[2] * fruitColors[2]) / 255 + 30;
- $('#flask_wave').css('fill', 'rgb(' + Math.round(newColorR) + ',' + Math.round(newColorG) + ',' + Math.round(newColorB) + ')');
- }
- $('#flask_fill').animate({
- height: (blenderColors * 40) + 'px'
- }, 300, 'easeOutBack');
- $("#blender_potion_content").append(fruit + ';');
- }, 200);
- setTimeout(function() {
- blenderColorAvailable = true;
- }, 300);
- } else if (blenderColorAvailable) {
- swal({
- title: phraser('FULL_BOTTLE'),
- html: phraser('FULL_BOTTLE_TEXT'),
- type: 'warning',
- confirmButtonText: phraser('OKAY')
- });
- }
- });
- var blenderAvailable = true;
- $('body').on('submit', '#blender_form', function(e) {
- e.preventDefault();
- var bet_value = $("#blender_value").val();
- if (blenderAvailable) {
- blenderColorAvailable = false;
- blenderAvailable = false;
- $("#blender_submit").hide();
- $.ajax({
- type: "POST",
- url: "/blender_blend.php",
- data: {
- credits: bet_value,
- color_order: $("#blender_potion_content").html(),
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- blenderAvailable = true;
- blenderColorAvailable = true;
- $("#blender_submit").show();
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- blenderAvailable = true;
- blenderColorAvailable = true;
- $("#blender_submit").show();
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- blenderAvailable = true;
- blenderColorAvailable = true;
- $("#blender_submit").show();
- } else {
- $("#blender_form").hide();
- updateCredits(-1 * bet_value);
- $(".shake").trigger('play');
- setTimeout(function() {
- $(".shake").trigger('pause');
- $(".shake").prop("currentTime", 0);
- }, 1500);
- $("#blender_holder").effect("shake", {
- direction: "up",
- times: 6,
- distance: 15
- }, 1300);
- setTimeout(function() {
- $("#blender_holder").animate({
- borderSpacing: -360
- }, {
- step: function(now, fx) {
- $("#blender_holder").css({
- '-webkit-transform': 'rotate(' + now + 'deg)',
- '-moz-transform': 'rotate(' + now + 'deg)',
- '-ms-transform': 'rotate(' + now + 'deg)',
- 'transform': 'rotate(' + now + 'deg)'
- });
- },
- duration: 'slow'
- }, 1000);
- }, 1000);
- setTimeout(function() {
- if (text == 'won') {
- updateCredits(bet_value * 1.95);
- $.growl.notice({
- title: 'Blender',
- message: phraser('POTION_APPROVED') + "<b>" + parseFloat(bet_value * 1.95).toFixed(2) + "</b> Credits."
- });
- } else {
- $.growl.error({
- title: 'Blender',
- message: phraser('BAD_POTION')
- });
- }
- $("#blender_form").hide();
- $("#blender_submit").show();
- $("#blender_potion_content").html('');
- $("#flask_fill").height('0px');
- $('#flask_wave').css('fill', 'rgb(255,255,255)');
- blenderAvailable = true;
- blenderColorAvailable = true;
- }, 2000);
- }
- }
- });
- }
- });
- $('body').on('click', '.headsup_new', function(e) {
- $("#headsup_create").toggle(250);
- $("#headsup_challenge").hide(250);
- $("#headsup_create").find(".headsup_form_choices a").removeClass('chosen');
- $("#headsup_value").val('');
- $("#headsup_value").focus();
- });
- $('body').on('click', '.headsup_form_choices a', function(e) {
- $(this).parent().parent().find(".headsup_form_choices a").removeClass('chosen');
- $(this).addClass('chosen');
- $("#headsup_value").focus();
- });
- var headsupAvailable = true;
- $('body').on('submit', '#headsup_form', function(e) {
- e.preventDefault();
- var choice = $("#headsup_form").find("a.chosen").attr('data-choice');
- var credits = $("#headsup_value").val();
- if (headsupAvailable) {
- headsupAvailable = false;
- $("#headsup_form").hide();
- $("#headsup_create_loader").show();
- if (choice == undefined) {
- swal({
- title: phraser('ERROR'),
- html: phraser('NEED_TO_CHOOSE_OPTION'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- headsupAvailable = true;
- $("#headsup_form").show();
- $("#headsup_create_loader").hide();
- } else {
- if (credits >= 0.001) {
- $.ajax({
- type: "GET",
- url: "/headsup_bet.php",
- data: {
- choice: choice,
- credits: credits,
- create: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- text = text.split(";");
- if (text[0] == 'success') {
- $(".woosh").trigger('pause').prop("currentTime", 0).trigger('play');
- $("#headsup_create").toggle(250);
- updateCredits(-1 * text[1]);
- } else if (text[0] == 'errorCredits') {
- needCredits();
- } else if (text[0] == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- headsupAvailable = true;
- $("#headsup_form").show();
- $("#headsup_create_loader").hide();
- }
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_BET_SMALL'),
- type: 'error',
- confirmButtonText: phraser('ERROR')
- });
- headsupAvailable = true;
- $("#headsup_form").show();
- $("#headsup_create_loader").hide();
- }
- }
- }
- });
- $('body').on('click', '.headsup_thumb', function(e) {
- var newID = $(this).attr('id').replace("h", "");
- var newVal = $(this).attr('data-sort');
- $("#headsup_challenge").find(".headsup_form_choices a").removeClass('chosen');
- $("#headsup_challenge").find('#headsup_challenge_value').html(newVal + " Credits");
- $("#headsup_challenge").attr('data-id', newID).show(250);
- $("#headsup_create").hide(250);
- });
- var headsupChallengeAvailable = true;
- $('body').on('click', '#headsup_challenge_button', function(e) {
- e.preventDefault();
- var choice = $("#headsup_challenge").find("a.chosen").attr('data-choice');
- var gameID = $("#headsup_challenge").attr('data-id');
- var credits = $("#headsup_challenge").find('#headsup_challenge_value').html().replace(" Credits", "");
- var choiceText = '';
- if (choice == 1) {
- choiceText = phraser('ROCK');
- } else if (choice == 2) {
- choiceText = phraser('PAPER');
- } else if (choice == 3) {
- choiceText = phraser('SCISSOR');
- }
- if (headsupChallengeAvailable) {
- $("#headsup_challenge_loader").show();
- $("#headsup_challenge_button").hide();
- headsupChallengeAvailable = false;
- if (choice == undefined) {
- swal({
- title: phraser('ERROR'),
- html: phraser('NEED_TO_CHOOSE_OPTION'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- headsupChallengeAvailable = true;
- $("#headsup_challenge_loader").hide();
- $("#headsup_challenge_button").show();
- } else {
- $.ajax({
- type: "GET",
- url: "/headsup_bet.php",
- data: {
- choice: choice,
- headsup_id: gameID,
- challenge: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- text = text.split(";");
- if (text[0] == 'success') {
- $(".woosh").trigger('pause').prop("currentTime", 0).trigger('play');
- updateCredits(-1 * credits);
- var oppText = '';
- if (text[2] == 1) {
- oppText = phraser('ROCK');
- } else if (text[2] == 2) {
- oppText = phraser('PAPER');
- } else if (text[2] == 3) {
- oppText = phraser('SCISSOR');
- }
- if (text[1] == '0') {
- $.growl.warning({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('DRAW') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- updateCredits(0.95 * credits);
- } else if (text[1] == '1') {
- $.growl.notice({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('WIN') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- updateCredits(1.95 * credits);
- } else if (text[1] == '2') {
- $.growl.error({
- title: 'Heads Up',
- message: phraser('THE_GAME_OF') + " <b>" + parseFloat(credits).toFixed(2) + "</b> Credits" + phraser('ENDED_AS') + "<b>" + phraser('LOSS') + "</b>. " + phraser('YOU_CHOSE') + choiceText + phraser('OPPONENT_CHOSE') + oppText + "."
- });
- }
- } else if (text[0] == 'errorCredits') {
- needCredits();
- } else if (text[0] == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CANNOT_PLAY_YOURSELF'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text[0] == 'errorGameID') {
- swal({
- title: phraser('ERROR'),
- html: phraser('GAME_SNATCHED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text[0] == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- $("#headsup_challenge_loader").hide();
- $("#headsup_challenge_button").show();
- headsupChallengeAvailable = true;
- $("#headsup_challenge").hide(250);
- }
- });
- }
- }
- });
- $('body').on('click', '#support_menu li a', function() {
- var clickedThis = $(this);
- $("#support_menu li").each(function() {
- $(this).removeClass('active');
- });
- clickedThis.parent('li').addClass('active');
- loadSupport($(this).attr('data-page'));
- });
- $('body').on('click', '.support_open_ticket', function() {
- loadSupport('user_ticket', $(this).attr('data-id'));
- });
- $('body').on('click', '.support_mark[data-type]', function() {
- var mark = $(this).attr('data-type');
- var ticketID = $(".support_replies").attr('data-id');
- if (mark == 'solved') {
- mark = 1;
- $(this).attr('data-type', 'unsolved').html('<i class="fa fa-thumbs-down"></i> ' + phraser('MARK_AS_UNSOLVED'));
- } else {
- mark = 0;
- $(this).attr('data-type', 'solved').html('<i class="fa fa-thumbs-up"></i> ' + phraser('MARK_AS_SOLVED'));
- }
- $.ajax({
- type: "GET",
- url: "/support_save.php",
- data: {
- mark: mark,
- ticket_id: ticketID
- },
- success: function(text) {
- loadSupport('user_ticket', ticketID);
- }
- });
- });
- $('body').on('submit', '.support_write', function(e) {
- e.preventDefault();
- if ($("#support_answer").val().length > 5) {
- var reply = $("#support_answer").val();
- var ticketID = $(".support_replies").attr('data-id');
- $("#support_answer").val('');
- $.ajax({
- type: "POST",
- url: "/support_save.php",
- data: {
- reply: reply,
- ticket_id: ticketID
- },
- success: function(text) {
- if ($("#admin_loader").length == 0) {
- loadSupport('user_ticket', ticketID);
- } else {
- $("#admin_response").hide();
- $("#admin_loader").show();
- $.ajax({
- type: "GET",
- url: "/admin_pages.php",
- data: {
- page: 'tickets',
- ticket_id: ticketID
- },
- success: function(text) {
- $("#admin_loader").hide();
- $("#admin_response").html(text).show();
- }
- });
- }
- }
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('TEXT_TOO_SHORT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- });
- $('body').on('submit', '#support_new', function(e) {
- e.preventDefault();
- var text = $("#support_new_textarea").val();
- var subject = $("#support_new_subject").val();
- $("#support_new").hide();
- $("#support_new_loader").show();
- $.ajax({
- type: "POST",
- url: "/support_save.php",
- data: {
- text: text,
- subject: subject
- },
- success: function(text) {
- console.log(text);
- $("#support_new").show();
- $("#support_new_loader").hide();
- if (text == 'errorLength') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TEXT_TOO_SHORT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $("#support_menu li").each(function() {
- $(this).removeClass('active');
- });
- $("#support_menu li").first().addClass('active');
- loadSupport('user_ticket', text);
- }
- }
- });
- });
- $('body').on('click', '.taxi_level', function() {
- $(".taxi_level").removeClass('selected');
- $(this).addClass('selected');
- $("#taxi_chance b").html($(this).attr('data-chance') + "%");
- $("#taxi_multiplier b").html("~" + $(this).attr('data-multiplier') + "x");
- });
- $('body').on('submit', '#taxi_create', function(e) {
- e.preventDefault();
- $("#taxi_create button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');
- var credits = parseFloat($("#taxi_value").val());
- var level = $(".taxi_level.selected").attr('data-level');
- $.ajax({
- type: "GET",
- url: "/taxi_bet.php",
- data: {
- value: credits,
- create: true,
- level: level,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#taxi_create button").prop('disabled', false).html(phraser('CREATE'));
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorAmount') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $(".taxi-start").trigger('play');
- setTimeout(function() {
- $(".taxi-start").trigger('pause');
- $(".taxi-start").prop("currentTime", 0);
- }, 4000);
- updateCredits(-1 * credits);
- $(".taximeter_big span").html('0');
- $(".taximeter_big b").html(credits);
- $("#taxi_hash").html('<b>' + phraser('HASH') + ':</b> ' + text);
- $("#taxi_fuel, #taxi_fuel_bg").toggle(250);
- }
- }
- });
- });
- var taxiChoiceAvailable = true;
- $('body').on('click', '.route-enabled', function(e) {
- var that = $(this);
- var choice = that.attr('data-choice');
- if (!taxiChoiceAvailable) {
- return;
- }
- taxiChoiceAvailable = false;
- $('.route-enabled').each(function() {
- $(this).removeClass('route-enabled').addClass('route-disabled');
- });
- var newTaxi = $("<div>", {
- class: "taxi_car"
- });
- newTaxi.html('<img src="' + site + '/images/taxi.png">').appendTo("body").css({
- 'top': that.offset().top - 10 + 'px',
- }).animate({
- left: that.offset().left + 25
- }, 400, 'easeOutQuad').fadeOut(700, function() {
- $(this).remove();
- });
- $.ajax({
- type: "GET",
- url: "/taxi_bet.php",
- data: {
- choice: choice,
- bet: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- taxiChoiceAvailable = true;
- text = text.split(";");
- var value = parseFloat(text[0]);
- var row = text[1];
- var options = text[2].split(",");
- var robbed = text[3];
- $(".route[data-row='" + row + "']").each(function() {
- var content = options[$(this).attr("data-choice") - 1];
- if (content == "R") {
- content = '<img src="' + site + '/images/customer6.png" style="opacity: 1;">';
- }
- $(this).html(content);
- });
- if (robbed == 1) {
- $(".taxi-crash").trigger('play');
- setTimeout(function() {
- $(".taxi-crash").trigger('pause');
- $(".taxi-crash").prop("currentTime", 0);
- }, 2000);
- $.growl.error({
- title: 'Taxi',
- message: phraser('PICKED_UP_CRIMINAL')
- });
- timeouts.push(setTimeout(function() {
- $(".route[data-row='1']").removeClass('route-disabled').addClass('route-enabled');
- $(".route").each(function() {
- $(this).css('color', '').html('<img src="' + site + '/images/customer' + (Math.floor(Math.random() * 5) + 1) + '.png">');
- });
- $(".taximeter_big span, .taximeter_big b").html('0');
- $("#taxi_fuel, #taxi_fuel_bg").toggle(250);
- }, 3000));
- } else {
- $(".taxi-horn").trigger('play');
- setTimeout(function() {
- $(".taxi-horn").trigger('pause');
- $(".taxi-horn").prop("currentTime", 0);
- }, 500);
- $({
- someValue: parseFloat($(".taximeter_big span").html())
- }).animate({
- someValue: value
- }, {
- duration: 400,
- easing: 'swing',
- step: function() {
- $('.taximeter_big span').text(this.someValue.toFixed(1));
- },
- complete: function() {
- $('.taximeter_big span').text(value.toFixed(2));
- }
- });
- setTimeout(function() {
- $(".taximeter_big span").html(value)
- }, 450);
- that.css('color', 'gold');
- if (row < 5) {
- $(".route[data-row='" + (parseInt(row) + 1) + "']").each(function() {
- $(this).removeClass('route-disabled').addClass('route-enabled');
- });
- } else {
- updateCredits(value);
- $.growl.notice({
- title: 'Taxi',
- message: phraser('SUCCESSFULLY_DROVE') + " <b>" + value.toFixed(2) + "</b> Credits"
- });
- timeouts.push(setTimeout(function() {
- $(".route[data-row='1']").removeClass('route-disabled').addClass('route-enabled');
- $(".route").each(function() {
- $(this).css('color', '').html('<img src="' + site + '/images/customer' + (Math.floor(Math.random() * 5) + 1) + '.png">');
- });
- $(".taximeter_big span, .taximeter_big b").html('0');
- $("#taxi_fuel, #taxi_fuel_bg").toggle(250);
- }, 3000));
- }
- }
- }
- });
- });
- $('body').on('click', '.mute_user', function(e) {
- var mThis = $(this);
- swal({
- title: phraser('ARE_YOU_SURE'),
- text: phraser('RECOVER_IN_SETTINGS'),
- type: 'warning',
- showCancelButton: true,
- confirmButtonText: phraser('YES'),
- cancelButtonText: phraser('CANCEL')
- }, function() {
- $.ajax({
- type: "GET",
- url: "/chat_mute.php",
- data: {
- muted_user_id: mThis.attr('data-id'),
- add: true
- },
- success: function(text) {
- $(".tipsy").remove();
- $('.chat_message[data-user="' + mThis.attr('data-id') + '"]').remove();
- $("#chat_mutes").html(text);
- }
- });
- });
- });
- $('body').on('click', '.unmute_user', function(e) {
- var mThis = $(this);
- $.ajax({
- type: "GET",
- url: "/chat_mute.php",
- data: {
- muted_user_id: mThis.attr('data-id'),
- remove: true
- },
- success: function(text) {
- mThis.parent().parent().remove();
- $("#chat_mutes").html(text);
- }
- });
- });
- $('body').on('submit', '#withdraw_form', function(e) {
- e.preventDefault();
- botInventoryPage = 1;
- loadBotInventory(false, true);
- });
- $('body').on('contextmenu', '#withdraw_result .inventory_item', function(e) {
- if (parseInt(userID) > 2) {
- return;
- }
- if ($(this).find('.withdraw_giveaway_item').length == 0) {
- e.preventDefault();
- }
- $(".withdraw_giveaway_item").remove();
- var item_id = $(this).attr('data-id');
- var item_price = $(this).find('.round_item_price span').text();
- $(this).prepend('<a class="withdraw_giveaway_item">GIVEAWAY</a>');
- });
- $('body').on('click', '#withdraw_result .inventory_item', function(e) {
- if ($(this).find('.withdraw_giveaway_item').length) {
- return;
- }
- var old_pot = $(".item_pot_value").text().replace(" Credits", "");
- var new_val = $(this).find(".round_item_price span").text();
- var new_pot = parseFloat(old_pot) + parseFloat(new_val);
- if ($("#withdraw_choose .inventory_item").length >= 10) {
- swal({
- title: phraser('ERROR'),
- html: phraser('MAXIMUM_ITEMS_PER_TRADE_WITHDRAW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- }
- if (new_pot > parseFloat($("#credits").html())) {
- swal({
- title: phraser('ERROR'),
- html: phraser('WALLET_EXCEEDED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- return;
- }
- $(".item_pot_value").text(new_pot.toFixed(2) + " Credits");
- if (new_pot >= 1) {
- $(".pot_deposit").removeClass("pot_deposit_disabled");
- }
- $("#withdraw_empty").hide();
- $("#withdraw_choose").show();
- $(this).appendTo("#withdraw_choose");
- });
- $('body').on('click', '#withdraw_choose .inventory_item', function() {
- var old_pot = $(".item_pot_value").text().replace(" Credits", "");
- var new_val = $(this).find(".round_item_price span").text();
- var new_pot = parseFloat(old_pot) - parseFloat(new_val);
- $(".item_pot_value").text(new_pot.toFixed(2) + " Credits");
- if ($("#withdraw_choose .inventory_item").length == 1) {
- $("#withdraw_empty").show();
- $("#withdraw_choose").hide();
- $("#withdraw_bot_chosen").html('');
- $("#withdraw_result .inventory_item").each(function() {
- $(this).fadeTo(100, 1);
- });
- }
- if (new_pot < 1) {
- $(".pot_deposit").addClass("pot_deposit_disabled");
- }
- $(this).insertBefore("#withdraw_result .withdraw_clear");
- });
- $('body').on('click', '.item_inspect, .item_inspect_instant', function(e) {
- e.stopPropagation();
- });
- $('body').on('click', '.item_inspect_instant', function() {
- var url = $(this).attr('data-link');
- swal({
- title: phraser('INSTANT_INSPECT'),
- html: '<video width="100%" height="100%" controls autoplay loop><source src="' + url + '" type="video/mp4">Video not found</video>',
- confirmButtonText: phraser('OKAY')
- });
- });
- $('body').on('click', '.item_search', function(e) {
- e.stopPropagation();
- $("#withdraw_search").val($(this).attr('data-name'));
- $("#withdraw_min, #withdraw_max").val('');
- $("#withdraw_order").val('price_desc');
- $("#withdraw_form").submit();
- $(".tipsy").remove();
- });
- $('body').on('click', '#withdraw_deposit', function() {
- var withdrawItems = '';
- var withdrawPrices = '';
- var numberOfItems = 0;
- var arr = [];
- $('#withdraw_choose').children('.inventory_item').each(function() {
- var itemID = $(this).attr('data-id');
- if (!arr.indexOf(itemID) != -1) {
- arr.push(itemID);
- withdrawItems = withdrawItems + itemID + ',';
- withdrawPrices = withdrawPrices + $(this).attr('data-price') + ',';
- numberOfItems += 1;
- }
- });
- if (numberOfItems > 0 && numberOfItems <= 50 && parseFloat($(".item_pot_value").html().replace(" Credits", "")) >= 1) {
- $(".accept_link").hide();
- $("#bot_inventory_holder").slideUp();
- $("#user_withdraw").slideDown();
- $("#waiting_pot_value").text($(".item_pot_value").text());
- $.ajax({
- type: "GET",
- url: "/withdraw_save.php",
- data: {
- items: withdrawItems,
- prices: withdrawPrices
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorLevel') {
- setTimeout(function() {
- swal({
- title: phraser('ERROR'),
- html: phraser('ERROR_LEVEL_TOO_LOW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 500);
- } else if (text == 'errorValue') {
- setTimeout(function() {
- swal({
- title: phraser('ERROR'),
- html: phraser('MAXIMUM_ITEMS_PER_TRADE_WITHDRAW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 500);
- } else if (text == 'errorCreditsPlayed') {
- setTimeout(function() {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLAYED_FOR_EXCEEDED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 500);
- } else if (text == 'errorToken') {
- setTimeout(function() {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULDNT_SEND_OFFER_URL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 500);
- } else if (text.indexOf('success') !== -1) {
- var response = text.split(";");
- $("#waiting_pot_value").text($(".item_pot_value").text());
- $("#waiting_code").text(response[1]);
- $("#waiting_deposit_id").attr('data-id', response[2]);
- $("#waiting_bot").text(response[3]);
- updateCredits(-1 * parseFloat($(".item_pot_value").text()));
- timeouts.push(setTimeout(function() {
- tradeOfferStatus('withdraw');
- }, 1000));
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('UNKNOWN_ERROR') + "<br><br>#" + text,
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- if (text.indexOf('success') == -1) {
- $("#bot_inventory_holder").slideDown();
- $("#user_withdraw").slideUp();
- }
- }
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('MAXIMUM_ITEMS_PER_TRADE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- });
- $('body').on('click', '.items_information_withdraw', function() {
- $("#withdraw_played").fadeOut(100);
- $("#withdraw_played_bg").fadeOut(100);
- $(".background_blaze").css('overflow-y', 'auto');
- if ($("#first_time").length > 0) {
- swal({
- title: "Trade URL",
- html: $("#first_time").html(),
- confirmButtonText: phraser('OKAY')
- }, function() {
- loadPage("settings.php");
- });
- }
- });
- $('body').on('submit', '#recruit_code_form', function(e) {
- e.preventDefault();
- var code = $("#recruit_code").val();
- $("#recruit_code_form").html('<div class="loader_small"></div>');
- $.ajax({
- type: "GET",
- url: "/recruits_save.php",
- data: {
- code: code
- },
- success: function(text) {
- if (text == 'success') {
- updateCredits(0.05);
- loadPage("recruits.php");
- } else {
- loadPage("recruits.php");
- swal({
- title: phraser('ERROR'),
- html: phraser('RECRUIT_' + text.toUpperCase()),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('click', '.withdraw_view_more', function() {
- var type = $(this).attr('data-type');
- $(".withdraw_view_more").remove();
- $(".withdraw_clear").remove();
- if (type == 'withdraw') {
- botInventoryPage = botInventoryPage + 2;
- loadBotInventory(true, false);
- }
- if (type == 'deals') {
- botDealsPage = botDealsPage + 2;
- loadBotDeals(true, $(".withdraw_deal.selected").attr('data-min'), $(".withdraw_deal.selected").attr('data-max'));
- }
- });
- $('body').on('submit', '#search_round_form', function(e) {
- e.preventDefault();
- var round_type = $(this).attr('data-type');
- var round_id = $("#search_round_text").val();
- $("#search_round_result").show();
- $("#search_round_result").html('<div class="loader_small"></div>');
- $.ajax({
- type: "GET",
- url: "/" + round_type + "s_search.php",
- data: {
- round_id: round_id
- },
- success: function(text) {
- $("#search_round_result").html(text);
- }
- });
- });
- $('body').on('submit', '#blackjack_create_form', function(e) {
- e.preventDefault();
- var credits = parseFloat($("#blackjack_bet_value").html());
- credits = Math.round(credits * 100.0) / 100.0;
- $("#blackjack_create_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- var chips = '';
- $("#blackjack_chips_container div").each(function() {
- chips = chips + $(this).attr('data-val') + ";";
- });
- $.ajax({
- type: "POST",
- url: "/blackjack_bet.php",
- data: {
- create: true,
- credits: credits,
- chips: chips,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#blackjack_create_form button").prop('disabled', false).html(phraser("CREATE"));
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorMin' || text == 'errorMax') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * credits);
- $(".blackjack_hash").html("<b>" + phraser("HASH") + ":</b> " + text);
- $(".blackjack_block").show();
- $("#blackjack_player").show();
- $("#blackjack_better").hide();
- $("#deal_shuffle").show();
- $("#blackjack_value_number_player").html('0');
- $("#blackjack_value_number_dealer").html('0');
- $(".blackjack_game_value").html(credits + ' Credits').show();
- $("#blackjack_chips_container_ongoing").html($("#blackjack_chips_container").html());
- $(".stand").trigger('play');
- setTimeout(function() {
- $(".stand").trigger('pause');
- $(".stand").prop("currentTime", 0);
- }, 900);
- }
- }
- });
- });
- $('body').on('click', '.blackjack_deal', function(e) {
- var button = $(this);
- button.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "GET",
- url: "/blackjack_bet.php",
- data: {
- deal: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorCards' || text == 'errorGameID' || text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- blackJackDeal(text);
- }
- button.prop('disabled', false).html(phraser('DEAL'));
- }
- });
- });
- $('body').on('click', '.blackjack_shuffle', function(e) {
- var button = $(this);
- button.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "GET",
- url: "/blackjack_bet.php",
- data: {
- shuffle: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorAction' || text == 'errorGameID') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $(".blackjack_hash").html("<b>" + phraser("HASH") + ":</b> " + text);
- $(".stand").trigger('play');
- setTimeout(function() {
- $(".stand").trigger('pause');
- $(".stand").prop("currentTime", 0);
- }, 900);
- }
- button.prop('disabled', false).html(phraser('SHUFFLE'));
- }
- });
- });
- $('body').on('click', '.blackjack_hit, .blackjack_double', function(e) {
- if (!$(this).hasClass('disabled')) {
- var button = $(this);
- button.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $(".blackjack_hit").addClass('disabled');
- $(".blackjack_double").addClass('disabled');
- var doubled = false;
- var buttonString = phraser('HIT');
- if ($(this).hasClass('blackjack_double')) {
- doubled = true;
- updateCredits(-1 * parseFloat($(".blackjack_game_value").html().replace(' Credits', '')));
- buttonString = phraser('DOUBLE');
- }
- $.ajax({
- type: "GET",
- url: "/blackjack_bet.php",
- data: {
- hit: true,
- doubled: doubled,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorCards' || text == 'errorGameID' || text == 'errorTotal') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCredits') {
- $(".blackjack_hit").removeClass('disabled');
- needCredits();
- } else {
- blackJackHit(text, doubled);
- if (doubled) {
- $("#blackjack_chips_container_ongoing").html($("#blackjack_chips_container_ongoing").html() + ' ' + $("#blackjack_chips_container_ongoing").html());
- }
- }
- button.prop('disabled', false).html(buttonString);
- }
- });
- }
- });
- $('body').on('click', '.blackjack_stand', function(e) {
- if (!$(this).hasClass('disabled')) {
- blackJackStand();
- }
- });
- $('body').on('click', '#refresh_steam_info', function(e) {
- $("#refresh_steam_info").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/settings_save.php",
- data: {
- refresh_steam: true
- },
- success: function(text) {
- $("#refresh_steam_info").prop('disabled', false).html(phraser('REFRESH'));
- swal({
- title: phraser('SUCCESS'),
- html: phraser('SETTINGS_SUCCESSFULLY_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- }
- });
- });
- $('body').on('click', '#blackjack_better .chip', function(e) {
- var chip = $(this).clone();
- var bet_val = parseFloat($("#blackjack_bet_value").html());
- if ($(this).parent().attr('id') == 'blackjack_chips') {
- $("#blackjack_chips_container").prepend(chip);
- bet_val += parseFloat(chip.attr('data-val'));
- } else {
- $(this).remove();
- bet_val -= parseFloat(chip.attr('data-val'));
- }
- bet_val = Math.round(bet_val * 100) / 100;
- $("#blackjack_bet_value").html(bet_val)
- $(".blackjack_bet_value").html(bet_val + ' Credits');
- });
- var slot_available = true;
- $('body').on('click submit', '#slot_spin, #slot_bet', function(e) {
- e.preventDefault();
- if ($(this).attr('id') == "slot_bet" && e.type == 'click') {
- return;
- }
- if (slot_available) {
- slot_available = false;
- var credits = parseFloat($("#slot_bet_credits").val());
- $("#slot_spin").addClass('slot_spin_disabled');
- $("#slot_winner").removeClass('slot_winner_highlight');
- $(".slot_legend_result").removeClass('slot_legend_highlight');
- $.ajax({
- type: "GET",
- url: "/slot_bet.php",
- data: {
- credits: credits,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- $("#slot_spin").removeClass('slot_spin_disabled');
- slot_available = true;
- } else if (text == 'errorMin' || text == 'errorMax') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET_10'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- $("#slot_spin").removeClass('slot_spin_disabled');
- slot_available = true;
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $(".spin").trigger('play');
- setTimeout(function() {
- $(".spin").trigger('pause');
- $(".spin").prop("currentTime", 0);
- }, 900);
- updateCredits(-1 * credits);
- var fruits = text.split(";");
- var i = 0;
- slotFill();
- $(".slot_child_content").each(function() {
- $(this).append('<img src="' + site + '/images/' + fruits[i] + '.png">');
- $(this).append('<img src="' + site + '/images/' + fruits[(i + 1)] + '.png">');
- i += 2;
- });
- slotSpinAll();
- setTimeout(function() {
- $("#slot_spin").removeClass('slot_spin_disabled');
- slot_available = true;
- if (fruits[7] == 'win') {
- if (fruits[0] == 'treasure' || fruits[0] == 'blueberry') {
- $(".win_big").trigger('play');
- setTimeout(function() {
- $(".win_big").trigger('pause');
- $(".win_big").prop("currentTime", 0);
- }, 1500);
- } else {
- $(".win_normal").trigger('play');
- setTimeout(function() {
- $(".win_normal").trigger('pause');
- $(".win_normal").prop("currentTime", 0);
- }, 1500);
- }
- updateCredits(fruits[6]);
- $("#slot_winner").addClass('slot_winner_highlight');
- $("#" + fruits[0]).addClass('slot_legend_highlight');
- setTimeout(function() {
- $("#slot_winner").removeClass('slot_winner_highlight');
- $("#" + fruits[0]).removeClass('slot_legend_highlight');
- }, 2000);
- }
- }, 2500);
- }
- }
- });
- }
- });
- $('body').on('submit', '#jukebox_form', function(e) {
- e.preventDefault();
- $("#jukebox_form").hide();
- $("#jukebox_loader").show();
- $.ajax({
- type: "GET",
- url: "/jukebox.php",
- data: {
- create: true,
- track_url: $("#track_url").val()
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorURL') {
- swal({
- title: phraser('ERROR'),
- html: phraser('JUKEBOX_URL_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAvailable') {
- swal({
- title: phraser('ERROR'),
- html: phraser('JUKEBOX_AVAILABLE_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $("#track_url").val('');
- var jukeboxTokens = parseInt($("#jukebox_tokens b").html());
- if (jukeboxTokens == 0 && !chatMod && !userVIP) {
- updateCredits(-1);
- } else if (jukeboxTokens > 0) {
- $("#jukebox_tokens b").html((jukeboxTokens - 1));
- }
- }
- $("#jukebox_form").show();
- $("#jukebox_loader").hide();
- }
- });
- });
- $("#jukebox_slider").bind("slider:changed", function(event, data) {
- var newVolume = Math.round((data.ratio) * 100);
- youtubePlayer.setVolume(newVolume);
- saveJukeboxVolume(newVolume);
- $("#jukebox_volume_holder").val(data.ratio);
- });
- $('body').on('click', '#jukebox_toggle', function(e) {
- var newVolume = 0.75;
- if ($("#jukebox_volume_holder").val() > 0) {
- newVolume = 0;
- }
- $("#jukebox_slider").simpleSlider("setValue", newVolume);
- $("#jukebox_volume_holder").val(newVolume);
- });
- $('body').on('click', '#mini_guide_terms', function(e) {
- loadPage('terms.php');
- });
- $('body').on('click', '[show-profile]', function(e) {
- var isVisible = $("#user_profile").is(':visible');
- var user_id = $(this).attr('show-profile');
- $("#user_profile_links").show();
- $("#send_credits").hide();
- $("#user_profile").html('<div class="loader_small_darker" style="margin-top: 60px;"></div>').fadeIn(100);
- $.ajax({
- type: "GET",
- url: "/user_info.php",
- data: {
- user_id: user_id
- },
- success: function(text) {
- $("#user_profile").attr("data-user", user_id);
- $("#user_profile").html(text);
- }
- });
- if (!isVisible) {
- var posTop = e.pageY - 40;
- var posLeft = e.pageX - 30;
- if (isMobile) {
- posLeft += 30;
- }
- if (posLeft + $("#user_profile").width() > $('body').width()) {
- posLeft -= posLeft + $("#user_profile").width() - $('body').width() + 10;
- }
- if (posTop + $("#user_profile").height() > $('body').height()) {
- posTop -= posTop + $("#user_profile").height() - $('body').height() + 10;
- }
- $("#user_profile").html('<div class="loader_small_darker" style="margin-top: 60px;"></div>').css({
- top: posTop,
- left: posLeft
- }).fadeIn(100);
- }
- });
- $('body').on('click', '#user_profile_close', function(e) {
- $(this).parent().hide();
- });
- var chatOriginalWidth, chatOriginalHeight;
- $('body').on('click', '#chat_hide', function(e) {
- chatOriginalWidth = $(".chat").width();
- chatOriginalHeight = $(".chat").height();
- $("#chat_show").show();
- $(".chat").animate({
- 'width': '0',
- 'height': '0'
- }, 300, function() {
- $(".chat").css({
- 'display': 'none',
- 'width': '',
- 'height': ''
- });
- });
- pusherChat.unsubscribe("chat_channel");
- });
- $('body').on('click', '#chat_show', function(e) {
- $(".chat").css('display', 'table-cell');
- $("#chat_show").hide();
- $(".chat").animate({
- 'width': chatOriginalWidth + 'px',
- 'height': chatOriginalHeight + 'px'
- }, 300, function() {
- $(".chat").css({
- 'width': '',
- 'height': ''
- });
- });
- var cChannel = pusherChat.subscribe('chat_channel');
- cChannel.bind('chat_message_new', function(data) {
- addChatMessage(data);
- });
- cChannel.bind('chat_message_remove', function(data) {
- removeChatMessage(data);
- });
- cChannel.bind('chat_giveaway_new', function(data) {
- handleGiveaway(data);
- });
- });
- $('body').on('change', '#giveaway_random', function(e) {
- if (!$("#giveaway_random").is(':checked')) {
- $("#giveaway_answer").attr('disabled', 'disabled');
- $("#giveaway_hint").attr('disabled', 'disabled');
- } else {
- $("#giveaway_answer").removeAttr('disabled');
- $("#giveaway_hint").removeAttr('disabled');
- }
- });
- $('body').on('click', '.betting_game_minimize', function(e) {
- $(this).hide();
- $(this).parent().find('.betting_game_loader, .betting_game_result').hide();
- $(this).parent().addClass('betting_game_small').css('height', '100px');
- $(this).parent().find('.betting_game_bg').css('height', '100px');
- });
- $('body').on('click', '.betting_game_small', function(e) {
- $(".betting_game").each(function() {
- $(this).find('.betting_game_minimize, .betting_game_loader, .betting_game_result').hide();
- $(this).addClass('betting_game_small').css('height', '100px');
- $(this).find('.betting_game_bg').css('height', '100px');
- });
- var game_id = $(this).attr('show-game');
- var content_height = 120 + $(this).find('.betting_game_result').height();
- $(this).find('.betting_game_minimize').show();
- $(this).removeClass('betting_game_small').css('height', content_height + 'px');
- $(this).find('.betting_game_bg').css('height', content_height + 'px');
- $(this).find('.betting_game_result').fadeIn(500);
- });
- $('body').on('click', '.betting_create_team', function(e) {
- $(".betting_create_team").removeClass('betting_selected');
- $(this).addClass('betting_selected');
- });
- var betting_bet_available = true;
- $('body').on('submit', '.betting_create', function(e) {
- e.preventDefault();
- var that = $(this);
- if (betting_bet_available) {
- betting_bet_available = false;
- var credits = that.find(".betting_value").val();
- var team_id = that.find(".betting_selected").attr('data-id');
- var game_id = that.attr('data-id');
- $("#betting_create_loader").show();
- $("#betting_create_info").hide();
- $.ajax({
- type: "GET",
- url: "/betting_bet.php",
- data: {
- game_id: game_id,
- team_id: team_id,
- credits: credits,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- betting_bet_available = true;
- $("#betting_create_loader").hide();
- $("#betting_create_info").show();
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorMin' || text == 'errorMax') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('ERROR')
- });
- } else if (text == 'errorStarted') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MATCH_IS_LIVE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * credits);
- loadPage('betting.php');
- }
- }
- });
- }
- });
- var betting_swap_available = true;
- $('body').on('click', '.betting_swap', function(e) {
- if (betting_swap_available) {
- betting_swap_available = false;
- var bet_id = $(this).attr('data-id');
- $("#betting_swap_loader").show();
- $.ajax({
- type: "GET",
- url: "/betting_bet.php",
- data: {
- bet_id: bet_id,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#betting_swap_loader").hide();
- betting_swap_available = true;
- if (text == 'errorStarted') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MATCH_IS_LIVE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- loadPage('betting.php');
- }
- }
- });
- }
- });
- $('body').on('keyup', '.betting_value', function(e) {
- var value = $(this).val();
- var home_multiplier = parseFloat($('.betting_home_multiplier').html());
- var away_multiplier = parseFloat($('.betting_away_multiplier').html());
- if (value.length == 0) {
- value = 0;
- }
- $(".betting_both_value").html(value);
- $(".betting_home_reward").html(Math.round(value * home_multiplier * 100.0) / 100.0);
- $(".betting_away_reward").html(Math.round(value * away_multiplier * 100.0) / 100.0);
- });
- $('body').on('change', '#home_team_id, #away_team_id', function() {
- if ($("#home_team_id").val() == $("#away_team_id").val()) {
- alert("You can't choose same team for both home and away!");
- if ($("#home_team_id").val() == "16") {
- $(this).val("3");
- } else {
- $(this).val("16");
- }
- }
- });
- $('body').on('click', '.coinflip_list_status_join', function(e) {
- $(".coinflip_list_status_join").removeClass('coinflip_list_status_join_final').html('<i class="fa fa-play-circle"></i> ' + phraser("CHALLENGE"));
- $(this).addClass('coinflip_list_status_join_final').html('<i class="fa fa-arrow-right"></i> ' + phraser("CONTINUE"));
- });
- var coinflip_challenge_available = true;
- $('body').on('click', '.coinflip_list_status_join_final', function(e) {
- var coinflip_id = $(this).attr('data-id');
- var value = $(this).attr('data-value');
- var buttonHTML = $(this).html();
- var button = $(this);
- if (coinflip_challenge_available) {
- coinflip_challenge_available = false;
- button.html('<div class="loader_small" style="width: 18px;height: 18px;margin: 15px auto;"></div>');
- $.ajax({
- type: "GET",
- url: "/coinflip_bet.php",
- data: {
- challenge: true,
- coinflip_id: coinflip_id,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- coinflip_challenge_available = true;
- button.html(buttonHTML);
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorGameID') {
- swal({
- title: phraser('ERROR'),
- html: phraser('GAME_SNATCHED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CANNOT_PLAY_YOURSELF'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAvailable') {
- swal({
- title: phraser('ERROR'),
- html: phraser('JUKEBOX_AVAILABLE_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * value);
- coinLoad("game", coinflip_id);
- }
- }
- });
- }
- });
- $('body').on('click', '.coinflip_list_status_view', function(e) {
- var coinflip_id = $(this).attr('data-id');
- coinLoad("game", coinflip_id);
- });
- $('body').on('click', '.coinflip_view_all', function(e) {
- loadPage("coinflip.php");
- });
- $('body').on('click', '#coinflip_create img', function(e) {
- $("#coinflip_create img").removeClass('coinflip_selected');
- $(this).addClass('coinflip_selected');
- });
- $('body').on('submit', '#coinflip_create', function(e) {
- e.preventDefault();
- $("#coinflip_create button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');
- var value = $("#coinflip_value").val();
- var choice = $(".coinflip_selected").attr('data-side');
- $.ajax({
- type: "GET",
- url: "/coinflip_bet.php",
- data: {
- create: true,
- credits: value,
- choice: choice,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#coinflip_create button").prop('disabled', false).html(phraser('CREATE'));
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_BET_SMALL'),
- type: 'error',
- confirmButtonText: phraser('ERROR')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorChoice') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_MANY_BETS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * value);
- }
- }
- });
- });
- $('body').on('click', '.dragrace_list_status_join', function(e) {
- $(".dragrace_list_status_join").removeClass('dragrace_list_status_join_final').html('<i class="fa fa-play-circle"></i> ' + phraser("CHALLENGE"));
- $(this).addClass('dragrace_list_status_join_final').html('<img src="' + site + '/images/race_car1.png" data-choice="1"> <img src="' + site + '/images/race_car2.png" data-choice="2"> <img src="' + site + '/images/race_car3.png" data-choice="3"> <img src="' + site + '/images/race_car4.png" data-choice="4">');
- });
- var dragrace_challenge_available = true;
- $('body').on('click', '.dragrace_list_status_join img', function(e) {
- var dragrace_id = $(this).parent().attr('data-id');
- var value = $(this).parent().attr('data-value');
- var choice = $(this).attr('data-choice');
- if (dragrace_challenge_available) {
- dragrace_challenge_available = false;
- $("#dragrace_challenge_loader").show();
- $.ajax({
- type: "GET",
- url: "/dragrace_bet.php",
- data: {
- challenge: true,
- dragrace_id: dragrace_id,
- choice: choice,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- dragrace_challenge_available = true;
- $("#dragrace_challenge_loader").hide();
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorGameID') {
- swal({
- title: phraser('ERROR'),
- html: phraser('GAME_SNATCHED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CANNOT_PLAY_YOURSELF'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAvailable') {
- swal({
- title: phraser('ERROR'),
- html: phraser('JUKEBOX_AVAILABLE_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * value);
- raceLoad("game", dragrace_id);
- }
- }
- });
- }
- });
- $('body').on('click', '.dragrace_list_status_view', function(e) {
- var dragrace_id = $(this).attr('data-id');
- raceLoad("game", dragrace_id);
- });
- $('body').on('click', '.race_view_all', function(e) {
- loadPage("dragrace.php");
- });
- $('body').on('click', '#dragrace_create img', function(e) {
- $("#dragrace_create img").removeClass('dragrace_selected');
- $(this).addClass('dragrace_selected');
- });
- var dragrace_create_available = true;
- $('body').on('submit', '#dragrace_create', function(e) {
- e.preventDefault();
- if (dragrace_create_available) {
- dragrace_create_available = false;
- var value = $("#dragrace_value").val();
- var choice = $(".dragrace_selected").attr('data-choice');
- $("#dragrace_create_loader").show();
- $("#dragrace_create").hide();
- $.ajax({
- type: "GET",
- url: "/dragrace_bet.php",
- data: {
- create: true,
- credits: value,
- choice: choice,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- dragrace_create_available = true;
- $("#dragrace_create_loader").hide();
- $("#dragrace_create").show();
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_BET_SMALL'),
- type: 'error',
- confirmButtonText: phraser('ERROR')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_MANY_BETS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * value);
- }
- }
- });
- }
- });
- $('body').on('click', '.giveaway_win', function(e) {
- $(this).html('<div class="loader_small" style="margin-top: 0;"></div>');
- $.ajax({
- type: "GET",
- url: "/giveaway_bet.php",
- data: {
- winner: true
- },
- success: function(text) {
- if (text == 'errorNotFound') {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLEASE_TRY_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorName') {
- swal({
- title: phraser('ERROR'),
- html: phraser('GIVEAWAY_NEED_NAME'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(text);
- loadPage("giveaway.php");
- }
- }
- });
- });
- $('body').on('change', '#answer_select', function(e) {
- var new_text = $("#answer_" + $(this).val()).text();
- $("#support_answer").val(new_text);
- });
- $('body').on('click', '#go_to_settings', function(e) {
- loadPage("settings.php");
- $(".sweet-alert").removeClass('visible').hide();
- $(".sweet-overlay").hide();
- });
- $('body').on('click', '.send_credits_button', function(e) {
- $("#user_profile_links").hide();
- $("#send_credits").show();
- });
- $('body').on('click', '.send_credits_back', function(e) {
- $("#user_profile_links").show();
- $("#send_credits").hide();
- });
- $('body').on('submit', '#send_credits form', function(e) {
- e.preventDefault();
- $(".loader_small_dark").show();
- $("#send_credits_form").hide();
- var credits = $("#send_credits_amount").val();
- var user_id = $("#user_profile").attr('data-user');
- $.ajax({
- type: "GET",
- url: "/send_credits.php",
- data: {
- user_id: user_id,
- credits: credits,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $(".loader_small_dark").hide();
- $("#send_credits_form").show();
- if (text == 'errorValue') {
- swal({
- title: phraser('ERROR'),
- html: phraser('DAILY_SEND_LIMIT_NEW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLevel') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ERROR_LEVEL_TOO_LOW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAmount') {
- swal({
- title: phraser('ERROR'),
- html: phraser('SEND_ERROR_AMOUNT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULD_NOT_FIND_USER'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorDeposit') {
- swal({
- title: phraser('ERROR'),
- html: phraser('SEND_NEED_DEPOSIT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * credits);
- $("#user_profile_links").show();
- $("#send_credits").hide();
- swal({
- title: phraser('SUCCESS'),
- html: phraser('CREDITS_SUCCESSFULLY_SENT'),
- type: 'success',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('mousedown touchstart', '#user_profile_background_holder', function(e) {
- e.preventDefault();
- moveElement(e, "#user_profile");
- });
- $('body').on('submit', '#scratchy_form', function(e) {
- e.preventDefault();
- $("#scratchy_loader").show();
- $("#scratchy_form").hide();
- var oldTokens = parseInt($(".amount_tokens b").html());
- var newTokens = oldTokens - 1;
- if (newTokens < 0) {
- newTokens = 0;
- }
- $.ajax({
- type: "GET",
- url: "/scratchy_bet.php",
- data: {
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#scratchy_loader").hide();
- $("#scratchy_form").show();
- $(".amount_tokens b").html(newTokens);
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CANNOT_SEND_YOURSELF'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $("#scratchy_form").hide();
- $('#scratchy_pad').wScratchPad('enable', true);
- var result = text.split(";");
- var chestResult = result[0].split("_");
- $('#scratchy_pad img').attr('src', site + '/images/scratchy_' + result[0] + '.png');
- $("#scratchy_result").html(chestResult[0] + ";" + result[1]);
- if (oldTokens == 0) {
- updateCredits(-3);
- }
- }
- }
- });
- });
- var safebox_available = true;
- $('body').on('click', '#safe_box_pad div', function(e) {
- var code = $("#safe_box_pin_code").text();
- var button = $(this).attr('data-pad');
- var newCode = '';
- $(".beep").trigger('play');
- setTimeout(function() {
- $(".beep").trigger('pause');
- $(".beep").prop("currentTime", 0);
- }, 100);
- if (button == 'BACK' && code != 'CODE') {
- if (code.length == 1) {
- newCode = 'CODE';
- } else {
- newCode = code.substring(0, code.length - 1);
- }
- $("#safe_box_pin_code").text(newCode);
- }
- if (button != 'BACK' && button != 'GO') {
- if (code == 'CODE') {
- newCode = button;
- } else if (code.length < 4) {
- newCode = code + '' + button;
- } else {
- newCode = code;
- }
- $("#safe_box_pin_code").text(newCode);
- }
- if (button == 'GO' && safebox_available) {
- if (code.length == 4 && code != 'CODE') {
- var oldTokens = parseInt($(".amount_tokens b").html());
- var newTokens = oldTokens - 1;
- if (newTokens < 0) {
- newTokens = 0;
- }
- safebox_available = false;
- $.ajax({
- type: "GET",
- url: "/safebox_bet.php",
- data: {
- code: code,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $(".amount_tokens b").html(newTokens);
- safebox_available = true;
- text = text.split(";");
- if (oldTokens == 0) {
- updateCredits(-0.5);
- }
- if (text[0] == 'errorCredits') {
- setTimeout(function() {
- needCredits();
- }, 100);
- } else if (text[0] == 'errorAction') {
- setTimeout(function() {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }, 100);
- } else if (text[0] == 'success') {
- if (text[1] == 'correct') {
- updateCredits(parseFloat(text[2]));
- $("#safe_box_circle").addClass('safe_circle_green');
- $(".win_big").trigger('play');
- setTimeout(function() {
- $(".win_big").trigger('pause');
- $(".win_big").prop("currentTime", 0);
- }, 1500);
- } else {
- $("#safe_box_circle").addClass('safe_circle_red');
- $(".error").trigger('play');
- setTimeout(function() {
- $(".error").trigger('pause');
- $(".error").prop("currentTime", 0);
- }, 1500);
- }
- }
- timeouts.push(setTimeout(function() {
- $('#safe_box_pin_code').text('CODE');
- $("#safe_box_circle").removeClass();
- }, 500));
- }
- });
- }
- }
- });
- $("body").on('click', '.perks_claim', function() {
- var that = $(this);
- var perk_id = that.attr('data-id');
- $("#chat_giveaway_ineligible").remove();
- $.ajax({
- type: "GET",
- url: "/perks_claim.php",
- data: {
- perk_id: perk_id
- },
- success: function(text) {
- that.replaceWith(phraser("CLAIMED"));
- }
- });
- });
- $("body").on('click', '.bet_edit', function() {
- var that = $(this);
- var id = that.attr('id');
- var input = $(that.attr('data-input'));
- var value = parseFloat(input.val());
- var max = that.attr('data-max');
- var newValue;
- if (isNaN(value)) {
- value = 0;
- }
- if (id == "bet_clear") {
- newValue = '';
- } else if (id == "bet_one") {
- newValue = value + 1;
- } else if (id == "bet_ten") {
- newValue = value + 10;
- } else if (id == "bet_half") {
- newValue = value / 2;
- } else if (id == "bet_double") {
- newValue = value * 2;
- } else if (id == "bet_max") {
- newValue = parseFloat($("#credits").html());
- }
- if (newValue > max) {
- newValue = max;
- }
- if (newValue > parseFloat($("#credits").html())) {
- newValue = parseFloat($("#credits").html());
- }
- input.val(newValue);
- });
- $("body").on('click', '.copy', function() {
- var text = $(this).attr('original-title');
- copyToClipboard(text);
- $(this).html(phraser('COPIED'));
- });
- $('body').on('keyup', '#credits_amount', function(e) {
- if (this.value.charAt(0) == "." || this.value.charAt(0) == ",") {
- this.value = "0" + this.value;
- }
- this.value = this.value.replace(",", ".");
- if ($.isNumeric(this.value) === false) {
- this.value = this.value.slice(0, -1);
- }
- var newValue = $(this).val();
- var maxValue = parseFloat($("#credits").html());
- if (newValue > maxValue) {
- newValue = maxValue;
- }
- this.value = newValue;
- var newBitcoins = newValue * 1 / $("#bitcoins_rate").html() - 0.00060;
- if (newBitcoins < 0) {
- newBitcoins = 0;
- }
- $("#bitcoins_amount").html(newBitcoins.toFixed(6));
- });
- $('body').on('submit', '#withdraw', function(e) {
- e.preventDefault();
- $("#withdraw button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- var credits = $("#credits_amount").val();
- $.ajax({
- type: "GET",
- url: "/withdraw_request.php",
- data: {
- address: $("#address").val(),
- credits: $("#credits_amount").val(),
- save_address: $("#save_address").prop('checked'),
- user_token: $("#user_token").val()
- },
- success: function(text) {
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorBlocked') {
- swal({
- title: phraser('ERROR'),
- html: phraser('WITHDRAW_ADDRESS_BLOCKED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBitcoin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('BITCOIN_VALUE_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCreditsPlayed') {
- swal({
- title: phraser('ERROR'),
- html: phraser('PLAYED_FOR_EXCEEDED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_WITHDRAW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPerform') {
- swal({
- title: phraser('ERROR'),
- html: phraser('WITHDRAW_ACTION_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- updateCredits(-1 * credits);
- $("#user_profile_links").show();
- $("#send_credits").hide();
- swal({
- title: phraser('SUCCESS'),
- html: phraser('CREDITS_SUCCESSFULLY_SENT'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- loadPage('withdraw.php');
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: text,
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- $("#withdraw button").prop('disabled', false).html(phraser('WITHDRAW_TITLE'));
- }
- });
- });
- $('body').on('submit', '#login_form', function(e) {
- e.preventDefault();
- $("#login_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/login_request.php",
- data: {
- email: $("#email").val(),
- password: $("#password").val()
- },
- success: function(text) {
- $("#login_form button").prop('disabled', false).html(phraser('LOG_IN'));
- if (text == 'errorCredentials') {
- swal({
- title: phraser('ERROR'),
- html: phraser('LOGIN_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLoginSpam') {
- swal({
- title: phraser('ERROR'),
- html: phraser('LOGIN_ERROR_SPAM'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $(".user_form_holder").fadeOut(100);
- window.location = site + "/home";
- }
- }
- });
- });
- $('body').on('submit', '#forgot_form', function(e) {
- e.preventDefault();
- $("#forgot_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/forgot_request.php",
- data: {
- email: $("#email").val()
- },
- success: function(text) {
- $("#forgot_form button").prop('disabled', false).html(phraser('LOG_IN'));
- if (text == 'errorCredentials') {
- swal({
- title: phraser('ERROR'),
- html: phraser('FORGOT_ERROR_EMAIL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorSending') {
- swal({
- title: phraser('ERROR'),
- html: phraser('FORGOT_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorTooSoon') {
- swal({
- title: phraser('ERROR'),
- html: phraser('FORGOT_ERROR_TOO_SOON'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- swal({
- title: phraser('SUCCESS'),
- html: phraser('FORGOT_SUCCESS'),
- type: 'success',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('submit', '#reset_form', function(e) {
- e.preventDefault();
- $("#reset_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/reset_request.php",
- data: {
- password: $("#password").val(),
- password_again: $("#password_again").val()
- },
- success: function(text) {
- $("#reset_form button").prop('disabled', false).html(phraser('SAVE'));
- if (text == 'errorPasswordStrength') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPasswordAgain') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- swal({
- title: phraser('SUCCESS'),
- html: phraser('RESET_SUCCESS'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- $(".user_form_holder").fadeOut(100);
- window.location = site + "/login";
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('submit', '#add_login_form', function(e) {
- e.preventDefault();
- $("#add_login_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/settings_save.php",
- data: {
- register: true,
- email: $("#email").val(),
- password: $("#password").val(),
- password_again: $("#password_again").val()
- },
- success: function(text) {
- $("#add_login_form button").prop('disabled', false).html(phraser('SAVE'));
- if (text == 'errorEmail') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_EMAIL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorEmailTaken') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_EMAIL_TAKEN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPasswordStrength') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPasswordAgain') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- swal({
- title: phraser('SUCCESS'),
- html: phraser('SETTINGS_SUCCESSFULLY_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('submit', '#change_password_form', function(e) {
- e.preventDefault();
- $("#change_password_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/settings_save.php",
- data: {
- change_password: true,
- password_old: $("#password_old").val(),
- password: $("#password").val(),
- password_again: $("#password_again").val()
- },
- success: function(text) {
- $("#change_password_form button").prop('disabled', false).html(phraser('SAVE'));
- if (text == 'errorPasswordOld') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CHANGE_PASSWORD_ERROR'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPasswordStrength') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPasswordAgain') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_PASSWORD_AGAIN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- swal({
- title: phraser('SUCCESS'),
- html: phraser('SETTINGS_SUCCESSFULLY_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('submit', '#change_email_form', function(e) {
- e.preventDefault();
- $("#change_email_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/settings_save.php",
- data: {
- change_email: true,
- email: $("#email").val()
- },
- success: function(text) {
- console.log(text);
- $("#change_email_form button").prop('disabled', false).html(phraser('SAVE'));
- if (text == 'errorEmailInvalid') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_EMAIL'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorEmailTaken') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REGISTER_ERROR_EMAIL_TAKEN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- swal({
- title: phraser('SUCCESS'),
- html: phraser('SETTINGS_SUCCESSFULLY_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('click', '#crash_manual_bet', function() {
- $('#crash_manual_bet_holder').show();
- $('#crash_auto_bet_holder').hide();
- });
- $('body').on('click', '#crash_auto_bet', function() {
- $('#crash_manual_bet_holder').hide();
- $('#crash_auto_bet_holder').show();
- });
- $('body').on('change', '#crash_auto', function() {
- if ($(this).is(':checked')) {
- $("#crash_form button").html(phraser('START_L'));
- } else {
- $("#crash_form button").html(phraser('PLACE_BET'));
- }
- });
- $('body').on('submit', '#crash_form', function(e) {
- e.preventDefault();
- var btnText = $("#crash_form button").html();
- var credits = parseFloat($('#crash_bet').val());
- var cashout = parseFloat($('#crash_cashout').val())
- var auto = $("#crash_auto").prop('checked');
- $("#crash_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- if (auto && (isNaN(cashout) || cashout < 1)) {
- swal({
- title: phraser('ERROR'),
- html: phraser('AUTO_BET_NEEDS_AUTO_CASHOUT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- $("#crash_form button").prop('disabled', false).html(btnText);
- return;
- }
- if (isNaN(cashout)) {
- $(".crash_cashout_label").html(phraser('NO_AUTO_CASHOUT'));
- } else {
- $(".crash_cashout_label").html(phraser('AUTO_CASHOUT_LABEL') + cashout);
- }
- $.ajax({
- type: "POST",
- url: "/crash_bet.php",
- data: {
- credits: credits,
- cashout: cashout,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#crash_form button").prop('disabled', false).html(btnText);
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorValue') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_MANY_BETS_ONE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLastRound') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ROUND_IN_PROGRESS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCashout') {
- swal({
- title: phraser('ERROR'),
- html: phraser('CASHOUT_MIN_MAX'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- $(".crash_profit_label").attr('data-value', credits);
- $(".crash_profit_label b").html('0');
- $("#crash_form_cashout").fadeIn();
- updateCredits(-1 * credits);
- if (auto && !crashAutoBet) {
- $("#crash_form_auto_stop").fadeIn();
- }
- crashAutoBet = auto;
- }
- }
- });
- });
- $('body').on('submit', '#crash_form_cashout', function(e) {
- e.preventDefault();
- $("#crash_form_cashout button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "POST",
- url: "/crash_bet.php",
- data: {
- cashout_action: true,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#crash_form_cashout button").prop('disabled', false).html(phraser('CASHOUT'));
- if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLate') {
- swal({
- title: phraser('ERROR'),
- html: phraser('YOU_WERE_TOO_LATE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('NO_BETS_IN_ROUND'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorEarly') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_EARLY_FOR_CASHOUT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- $("#crash_form_cashout").fadeOut();
- crashAutoBet = false;
- $("#crash_form_auto_stop").hide();
- $(".crash_profit_label").attr('data-value', 0);
- $(".crash_profit_label b").html('0');
- }
- }
- });
- });
- $('body').on('submit', '#crash_form_auto_stop', function(e) {
- e.preventDefault();
- crashAutoBet = false;
- $("#crash_form_auto_stop").fadeOut();
- $(".crash_profit_label").attr('data-value', 0);
- $(".crash_profit_label b").html('0');
- });
- $("body").on('click', '.crash_edit_link', function() {
- var that = $(this);
- var id = that.attr('id');
- var value = parseFloat($('#crash_bet').val());
- var newValue;
- if (isNaN(value)) {
- value = 0;
- }
- if (id == "crash_clear") {
- newValue = '';
- } else if (id == "crash_one") {
- newValue = value + 1;
- } else if (id == "crash_five") {
- newValue = value + 5;
- } else if (id == "crash_ten") {
- newValue = value + 10;
- } else if (id == "crash_half") {
- newValue = value / 2;
- } else if (id == "crash_double") {
- newValue = value * 2;
- } else if (id == "crash_max") {
- newValue = parseFloat($("#credits").html());
- }
- if (newValue > 300) {
- newValue = 100;
- }
- if (newValue > parseFloat($("#credits").html())) {
- newValue = parseFloat($("#credits").html());
- }
- $('#crash_bet').val(newValue);
- });
- $('body').on('click', '.resend_withdraw_user', function() {
- var that = $(this);
- that.text('...');
- $.ajax({
- type: "GET",
- url: "/withdraw_resend.php",
- data: {
- security_code: $(this).attr('data-code'),
- user_id: $(this).attr('data-user')
- },
- success: function(text) {
- if (text != 'success') {
- swal({
- title: phraser('ERROR'),
- html: text,
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- that.text(phraser('RESEND'));
- } else {
- swal({
- title: phraser('SUCCESS'),
- html: phraser(''),
- type: 'success',
- confirmButtonText: phraser('OKAY')
- });
- that.text(phraser('DONE')).removeClass('resend_withdraw_user');
- }
- }
- });
- });
- $('body').on('submit', '#send_credits_steam', function(e) {
- e.preventDefault();
- $("#send_credits_steam button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- var credits = $("#send_steam_credits").val();
- var steam_id = $("#send_steam_id").val();
- $.ajax({
- type: "GET",
- url: "/send_credits.php",
- data: {
- steam_id: steam_id,
- credits: credits,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#send_credits_steam button").prop('disabled', false).html(phraser('SEND'));
- if (text == 'errorValue') {
- swal({
- title: phraser('ERROR'),
- html: phraser('DAILY_SEND_LIMIT_NEW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAmount') {
- swal({
- title: phraser('ERROR'),
- html: phraser('SEND_ERROR_AMOUNT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorUser') {
- swal({
- title: phraser('ERROR'),
- html: phraser('COULD_NOT_FIND_USER'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorDeposit') {
- swal({
- title: phraser('ERROR'),
- html: phraser('SEND_NEED_DEPOSIT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * credits);
- $("#user_profile_links").show();
- $("#send_credits").hide();
- swal({
- title: phraser('SUCCESS'),
- html: phraser('CREDITS_SUCCESSFULLY_SENT'),
- type: 'success',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- });
- });
- $('body').on('click', '.withdraw_switch', function() {
- var type = $(this).attr('data-type');
- $(".withdraw_switch").removeClass('selected');
- $(this).addClass('selected');
- if (type == 'withdraw') {
- $("#withdraw_form").show();
- $("#withdraw_form_deals").hide();
- botInventoryPage = 1;
- loadBotInventory(false, false);
- }
- if (type == 'deals') {
- $("#withdraw_form").hide();
- $("#withdraw_form_deals").show();
- $(".withdraw_deal").removeClass('selected');
- $(".withdraw_deal").first().addClass('selected');
- botDealsPage = 1;
- loadBotDeals(false, 50, 0);
- }
- });
- $('body').on('click', '.withdraw_deal', function() {
- var min = $(this).attr('data-min');
- var max = $(this).attr('data-max');
- $(".withdraw_deal").removeClass('selected');
- $(this).addClass('selected');
- botDealsPage = 1;
- loadBotDeals(false, min, max);
- });
- $('body').on('click', '.recruit_prize_pick', function() {
- var that = $(this);
- that.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- $.ajax({
- type: "GET",
- url: "/recruits_save.php",
- data: {
- pick_reward: true,
- prize_id: that.attr('data-prize')
- },
- success: function(text) {
- if (text != 'success') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- }, function() {
- window.location.reload();
- });
- return;
- }
- swal({
- title: phraser('SUCCESS'),
- html: phraser('RECRUIT_REWARD_SAVED'),
- type: 'success',
- confirmButtonText: phraser('OKAY'),
- allowOutsideClick: false,
- allowEscapeKey: false
- }, function() {
- window.location.reload();
- });
- }
- });
- });
- $('body').on('click', '.cases_list', function() {
- $("#case_list_holder").hide();
- $("#case_holder").html('<div class="loader_small" style="margin-top:30px;"></div>').show();
- $.ajax({
- type: "GET",
- url: "/cases_load.php",
- data: {
- case_id: $(this).attr('data-id')
- },
- success: function(text) {
- $("#case_holder").html(text);
- }
- });
- });
- $('body').on('click', '.cases_back', function() {
- $("#case_holder").hide();
- $("#case_list_holder").show();
- loadPage('cases.php');
- });
- $('body').on('click', '#case_buy', function() {
- var testSpin = false;
- var button = $(this);
- var buttonHTML = button.html();
- var case_id = button.attr('data-id');
- var case_price = button.attr('data-price');
- button.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- casesOpen(case_id, case_price, testSpin, button, buttonHTML);
- });
- $('body').on('click', '#case_test', function() {
- var testSpin = true;
- var button = $(this);
- var buttonHTML = button.html();
- var case_id = button.attr('data-id');
- var case_price = button.attr('data-price');
- button.prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');
- casesOpen(case_id, case_price, testSpin, button, buttonHTML);
- });
- $('body').on('click', '.roulette_bet_choice', function() {
- $(".roulette_bet_choice").removeClass('roulette_choice_select');
- $(this).addClass('roulette_choice_select');
- });
- $('body').on('submit', '.roulette_bet_form', function(e) {
- e.preventDefault();
- var button = $('.roulette_bet_form button');
- var buttonHTML = $('.roulette_bet_form button').html();
- var choice = $(".roulette_choice_select").attr('data-color');
- var credits = parseFloat($('.roulette_form_value').val());
- button.prop('disabled', true).html('<div class="loader_small loader_small_dark" style="width: 18px;height: 18px;margin: 0 auto;display:block;"></div>');
- $.ajax({
- type: "GET",
- url: "/roulette_bet.php",
- data: {
- credits: credits,
- choice: choice,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- button.prop('disabled', false).html(buttonHTML);
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorValue') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_MAXIMUM_BET'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TOO_MANY_BETS'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorTimer') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TIMER_IS_CLOSING'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorLastRound') {
- swal({
- title: phraser('ERROR'),
- html: phraser('LAST_ROUND_NOT_FINISHED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorChoiceMultiple') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ERROR_CHOICE_MULTIPLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'success') {
- updateCredits(-1 * credits);
- }
- }
- });
- });
- $('body').on('click', '.case_contain_view', function() {
- $(this).hide();
- $(".case_contain_item").show();
- });
- $('body').on('click', '.betting_matches_table tr.betting_table_clickable td', function() {
- var table = $(".betting_matches_table[data-type='" + $(this).parent().parent().parent().attr('data-type') + "']");
- var firstRow = table.find('tr').first();
- var thisRow = $(this).parent();
- var game_id = thisRow.attr('data-id');
- table.html('<tr>' + firstRow.html() + '</tr><tr>' + thisRow.html() + '</tr>');
- $("#betting_bets_title, .betting_info").remove();
- $("#betting_matches_title a").hide();
- $("#betting_matches_title a:first-of-type").show();
- $("#betting_matches_title a.selected").show();
- $.ajax({
- type: "GET",
- url: "/betting_load.php",
- data: {
- game_id: game_id
- },
- success: function(text) {
- table.after(text);
- }
- });
- });
- $('body').on('click', '.betting_switch', function() {
- var type = $(this).attr('data-type');
- $(".betting_switch").removeClass('selected');
- $(this).addClass('selected');
- if (type == "all") {
- loadPage("betting.php");
- return;
- }
- $(".betting_matches_table").hide();
- $(".betting_matches_table[data-type='" + type + "']").show();
- });
- $('body').on('change', '#betting_event_select', function() {
- if ($("#betting_event_select").val() == 'all') {
- $(".betting_matches_table tr").removeClass('invisible').addClass('visible');
- } else {
- $(".betting_matches_table tr").removeClass('visible').addClass('invisible');
- $(".betting_matches_table tr[data-event='" + $("#betting_event_select").val() + "'], .betting_matches_table tr:first-of-type").removeClass('invisible').addClass('visible');
- }
- $(".betting_matches_table .visible:odd td").css({
- "background": "transparent"
- });
- $(".betting_matches_table .visible:even td").css({
- "background": "rgba(0, 0, 0, 0.21)"
- });
- });
- $('body').on('click', '.betting_stream_link', function(e) {
- e.stopPropagation();
- var streamURL = $(this).attr('data-link');
- var streamWidth = $("#betting_stream_holder").width();
- var streamHeight = $(window).height() - 50;
- $("#betting_stream_holder").height(streamHeight).html('<div class="round_info_title" id="betting_bets_title"><a class="betting_hide_stream"><i class="fa fa-compress"></i> ' + phraser('HIDE') + '</a><i class="fa fa-video-camera"></i> ' + phraser('STREAM') + '</div><iframe src="' + streamURL + '" id="betting_stream_iframe" height="' + (streamHeight - 35) + '" allowfullscreen></iframe>').show();
- });
- $('body').on('click', '.betting_hide_stream', function() {
- $("#betting_stream_holder").html('').hide();
- });
- $('body').on('click', '.buy_coins_item[data-id]', function() {
- var buy_item_id = $(this).attr('data-id');
- $.ajax({
- type: "GET",
- url: "/buy_process.php",
- data: {
- buy_item_id: buy_item_id
- },
- success: function(text) {
- if (text == 'errorItem') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ITEM_WAS_NOT_FOUND'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorSteamLevel') {
- swal({
- title: phraser('ERROR'),
- html: phraser('STEAM_LEVEL_TOO_LOW_NEW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- var json = JSON.parse(text);
- if (json.success == true) {
- window.location = json.url;
- } else {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- }
- }
- });
- });
- $('body').on('click', '.provably_fair_game', function() {
- $(".provably_fair_content").hide();
- $(this).next('.provably_fair_content').show();
- });
- $('body').on('submit', ".betting_comment", function(e) {
- e.preventDefault();
- var message = $("#betting_message_textarea").val();
- var game_id = $("#betting_game_id").val();
- $("#betting_message_textarea").val('');
- $("#betting_message_send").prop('disabled', true).css("background-color", "#2d2d2d");
- $.ajax({
- type: "POST",
- url: "/betting_message.php",
- data: {
- message: message,
- game_id: game_id
- },
- success: function(text) {
- if (text == "errorSpam") {
- swal({
- title: phraser('ERROR'),
- html: phraser('SPAMMING_CHAT'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- $.ajax({
- type: "GET",
- url: "/betting_load.php",
- data: {
- game_id: game_id
- },
- success: function(text) {
- $("#betting_match_holder").replaceWith(text);
- }
- });
- }
- $("#betting_message_send").prop('disabled', false).css("background-color", "#e69b23");
- }
- });
- });
- $('body').on('click', '#entry_join', function(e) {
- $(this).html('<div class="loader_small" style="margin-top:8px;"></div>');
- var giveaway_id = $(this).attr('data-id');
- var page = $(this).attr('data-page');
- $.ajax({
- type: "GET",
- url: "/giveaway_bet.php",
- data: {
- enter: true,
- giveaway_id: giveaway_id,
- type: 'join'
- },
- success: function(text) {
- if (text == 'errorFinished') {
- swal({
- title: phraser('ERROR'),
- html: phraser('NO_OPEN_GIVEAWAY_WAS_FOUND'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorPlaytime') {
- swal({
- title: phraser('ERROR'),
- html: phraser('RECRUIT_ERROR_PLAYTIME'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorSteamLevel') {
- swal({
- title: phraser('ERROR'),
- html: phraser('STEAM_LEVEL_TOO_LOW_NEW'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorEntry') {
- swal({
- title: phraser('ERROR'),
- html: phraser('YOU_HAVE_ALREADY_ENTERED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorName') {
- swal({
- title: phraser('ERROR'),
- html: phraser('GIVEAWAY_NEED_NAME'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- loadPage(page + ".php");
- }
- });
- });
- $('body').on('click', '.entries', function(e) {
- e.stopPropagation();
- $(this).html('<div class="loader_small" style="margin-top:8px;"></div>');
- var giveaway_id = $(this).attr('data-id');
- var type = $(this).attr('data-type');
- var url = $(this).attr('data-url');
- var page = $(this).attr('data-page');
- var popup = window.open(url, '_blank', 'height=500,width=500,toolbar=0,location=0,menubar=0');
- var closeCheck = setInterval(function() {
- if (popup == null || popup.closed) {
- clearInterval(closeCheck);
- onWindowClosed();
- }
- }, 500);
- var onWindowClosed = function() {
- $.ajax({
- type: "GET",
- url: "/giveaway_entries.php",
- data: {
- enter: true,
- giveaway_id: giveaway_id,
- type: type
- },
- success: function(text) {
- if (text == 'errorFinished') {
- swal({
- title: phraser('ERROR'),
- html: phraser('NO_OPEN_GIVEAWAY_WAS_FOUND'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorEntry') {
- swal({
- title: phraser('ERROR'),
- html: phraser('YOU_HAVE_ALREADY_ENTERED'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorComplete') {
- swal({
- title: phraser('ERROR'),
- html: phraser('TASK_NOT_COMPLETE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- }
- loadPage(page + ".php");
- }
- });
- }
- });
- $('body').on('submit', '#revolver_form', function(e) {
- e.preventDefault();
- $("#revolver_form button").prop('disabled', true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');
- var value = $("#revolver_value").val();
- $.ajax({
- type: "GET",
- url: "/revolver_bet.php",
- data: {
- credits: value,
- user_token: $("#user_token").val()
- },
- success: function(text) {
- $("#revolver_form button").prop('disabled', false).html(phraser('BET'));
- if (text == 'errorCredits') {
- needCredits();
- } else if (text == 'errorMin') {
- swal({
- title: phraser('ERROR'),
- html: phraser('MINIMUM_BET_SMALL'),
- type: 'error',
- confirmButtonText: phraser('ERROR')
- });
- } else if (text == 'errorAction') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ACTION_NOT_AVAILABLE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorBets') {
- swal({
- title: phraser('ERROR'),
- html: phraser('ALREADY_IN_QUEUE'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else if (text == 'errorCooldown') {
- swal({
- title: phraser('ERROR'),
- html: phraser('REVOLVER_IS_COOLING_DOWN'),
- type: 'error',
- confirmButtonText: phraser('OKAY')
- });
- } else {
- updateCredits(-1 * value);
- }
- }
- });
- });
- $('body').on('click', '#show_chat_mobile', function() {
- if ($(".chat").is(':visible')) {
- $(".chat").stop(true).fadeOut(100);
- } else {
- $(".chat").stop(true).fadeIn(100);
- }
- $("#chat_cell").scrollTop(999999999, 0);
- });
- });
Add Comment
Please, Sign In to add comment