Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var game_id = 0;
- var addClickHandler;
- var addClickHandlerCreate;
- var addClickHandlerTradeup;
- var addClickHandlerJackpot;
- function setGameId(e){
- game_id = $(e).parent().parent().attr("game_id");
- $("#ModalBodyCreate").empty();
- $("#ModalBody").empty();
- $("#ModalBodyJackpot").empty();
- $("#ModalBody").load("../createGameInventory.php?create=0&game_id="+game_id, function() {
- addClickHandler();
- $("#modalItemsAdd").modal();
- });
- }
- function openModalCreate(){
- $("#ModalBodyCreate").empty();
- $("#ModalBody").empty();
- $("#ModalBodyJackpot").empty();
- $("#ModalBodyCreate").load("../createGameInventory.php?create=1&game_id="+game_id, function() {
- addClickHandlerCreate();
- $("#modalCreateGame").modal();
- });
- }
- function openModalJackpot(){
- $("#ModalBodyCreate").empty();
- $("#ModalBody").empty();
- $("#ModalBodyJackpot").empty();
- $("#ModalBodyJackpot").load("../joinJackpot.php", function() {
- addClickHandlerJackpot();
- $("#modalJackpot").modal();
- });
- }
- function viewGame(e){
- game_id = $(e).parent().parent().attr("game_id");
- $("#ModalBodyView").html("<center><i class='fa fa-spinner fa-spin fa-4x fa-fw'></i></center>");
- $("#modalViewGame").modal();
- $("#ModalBodyView").load("duel-details.php?game_id="+game_id, function() {});
- //addReloadHandler();
- }
- function viewGameModal(e){
- game_id = $(e).parent().parent().attr("game_id");
- $("#ModalBodyView").html("<center><i class='fa fa-spinner fa-spin fa-4x fa-fw'></i></center>");
- $("#modalViewGame").modal();
- $("#ModalBodyView").load("duel-details.php?game_id="+game_id, function() {});
- //addReloadHandler();
- }
- //$("#ModalBody").load("../createGameInventory.php");
- $(document).ready(function(){
- jQuery.expr[':'].icontains = function(a, i, m) {
- return jQuery(a).text().toUpperCase()
- .indexOf(m[3].toUpperCase()) >= 0;
- };
- $("#fname").keyup(function() {
- var $rows = $("#userVorschlaege tr");
- var val = $.trim(this.value);
- if(val === ""){
- $("#userVorschlaege").hide();
- }else{
- $("#userVorschlaege").show();
- }
- if (val === "")
- $rows.show();
- else {
- $rows.hide();
- $rows.has("td:icontains(" + val + ")").show();
- }
- });
- var refreshing = {"duel_table" : true, "recent_openings" : true};
- var requesting = false;
- var timeouts = [];
- var animations = [];
- loadRecentOpening();
- var oldItem = [];
- setInterval(function() {
- if (refreshing["recent_openings"]){
- $.post("recent.php", {refreshing: refreshing["recent_openings"]}).done(function(data){
- if(data.recentStatus == true){
- $("#notUpdatingWarning").hide();
- if(data && data.success == true){
- if (oldItem.indexOf(data.latest_item) === -1) {
- if (refreshing["recent_openings"]) loadRecentOpening();
- }
- oldItem = [];
- oldItem.push(data.latest_item);
- }
- }else{
- $("#notUpdatingWarning").show();
- }
- });
- }
- }, 7000);
- if(refreshing["duel_table"]){
- setInterval(function() {
- $('#DuelTableRefresh').load("../duel_table.php");
- }, 2000);
- }
- /* Wut is dis
- $('.selectpicker').selectpicker({
- size: 4
- });
- */
- function randInt(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- String.prototype.replaceAll = function(search, replacement) {
- var target = this;
- return target.replace(new RegExp(search, 'g'), replacement);
- };
- $(".menu-item").click(function() {
- var linkItem = !($(this).attr('href') == null);
- if (linkItem) NProgress.start();
- var $el = $(this);
- if (linkItem) NProgress.set(0.2);
- $("#content").load($(this).attr("href"), function() {
- if (linkItem) NProgress.done();
- if ($el.attr("crateid")) {
- openload($el.attr("crateid"));
- }
- });
- });
- function loadRecentOpening() {
- $("#refresh").load("recent.php");
- $('#onlineusers').load(document.URL + ' #onlineusers');
- /* $('#userMessages').load(document.URL + ' #userMessages');
- $('#userMessagesHeader').load(document.URL + ' #userMessagesHeader');
- $('#userMessages2').load(document.URL + ' #userMessages2');
- $('#loadMessages').load(document.URL + ' #loadMessages');
- $('#loadNotifications').load(document.URL + ' #loadNotifications');
- */
- }
- function openload(crateid) {
- requesting = false;
- refreshing["recent_openings"] = true;
- for (var i = 0; i < timeouts.length; i++) {
- clearTimeout(timeouts[i]);
- }
- for (var i = 0; i < animations.length; i++) {
- animations[i].stop();
- }
- $("#item-images").clearQueue();
- $("#winner-item").clearQueue();
- $("#winner-item-cell").clearQueue();
- timeouts = [];
- animations = [];
- $("#open").unbind("click");
- $("#open").click(function() {
- NProgress.start();
- if (!requesting) {
- requesting = true;
- refreshing["recent_openings"] = false;
- NProgress.set(0.4);
- var jqxhr1337 = $.post("crate.php?id="+crateid)
- .done(function(data) {
- if (data.success == true) {
- NProgress.done();
- $("#open").parent().hide();
- $("#item-images").empty();
- $("#item-images").css("margin-top",-2000);
- data.randomItems.forEach(function(item, key) {
- if (key == 400) {
- var style = "box-shadow: #"+data.color+" 0px 0px 10px, #"+data.color+" 0px 0px 10px;";
- $("#item-images").append('<div id="winner-item" style="background: url('+((data.hidden == true) ? "images/mystery_decal.png" : data.image)+');background-size: 190px 190px;display:block;width:190px;height:190px;margin:5px;'+style+'"><div id="winner-item-cell" class="glow-'+data.rarity.replaceAll(" ", "").toLowerCase()+'" style="display: table-cell; vertical-align: bottom;height: 190px;width:190px;"><font style="text-shadow: 0 0 10px #'+data.color+', 0 0 20px #'+data.color+', 0 0 30px #'+data.color+', 0 0 40px #'+data.color+', 0 0 70px #'+data.color+', 0 0 80px #'+data.color+', 0 0 100px #'+data.color+', 0 0 150px #'+data.color+';margin-top: -15px; display: block;" color="#'+data.color+'">'+((data.hidden == true) ? "Mystery Universal Decal" : data.name)+'</font></div></div>');
- } else {
- var style = "box-shadow: #"+item.color+" 0px 0px 10px, #"+item.color+" 0px 0px 10px;";
- $("#item-images").append('<div style="background: url('+((item.hidden == true) ? "images/mystery_decal.png" : item.image)+');background-size: 190px 190px;display:block;width:190px;height:190px;margin:5px;'+style+'"><div class="glow-'+item.rarity.replaceAll(" ", "")+'" style="display: table-cell; vertical-align: bottom;height: 190px;width:190px;"><font style="text-shadow: 0 0 10px #'+item.color+', 0 0 20px #'+item.color+', 0 0 30px #'+item.color+', 0 0 40px #'+item.color+', 0 0 70px #'+item.color+', 0 0 80px #'+item.color+', 0 0 100px #'+item.color+', 0 0 150px #'+item.color+';margin-top: -15px; display: block;" color="#'+item.color+'">'+((item.hidden == true) ? "Mystery Universal Decal" : item.name)+'</font></div></div>');
- }
- });
- $("#roll").fadeIn(1500);
- $("#roll-background").fadeIn(1000);
- $("#pick-line").fadeIn(2000);
- refreshCurrency();
- timeouts.push(setTimeout(function() {
- animations.push($("#item-images"));
- animations.push($("#winner-item"));
- animations.push($("#winner-item-cell"));
- $("#item-images").animate({marginTop: -60000+"px"}, 3000, 'linear', function() {
- var wobble = randInt(0, 180);
- $("#item-images").animate({marginTop: (-78010-wobble)+"px"}, 7000, 'easeOutExpo', function() {
- timeouts.push(setTimeout(function() {
- requesting = false;
- $("#roll").fadeOut();
- $("#roll-background").fadeOut();
- $("#open").parent().show();
- $("#opened-name").html("");
- $("#opened-rarity").html("");
- refreshing["recent_openings"] = true;
- loadRecentOpening();
- }, 2000));
- $("#item-images").animate({marginTop: "-78150px"}, 1000, 'easeOutExpo')
- $(".win-info").css("text-shadow", "0 0 10px #"+data.color+" , 0 0 20px #"+data.color+" , 0 0 30px #"+data.color+" , 0 0 40px #"+data.color+" , 0 0 70px #"+data.color+" , 0 0 80px #"+data.color+" , 0 0 100px #"+data.color)
- $(".win-info").css("color", "#"+data.color)
- if (data.hidden == true) {
- $("#winner-item").css("background", "url("+data.image+")")
- $("#winner-item-cell").find("font").html(data.name)
- $("#opened-name").html(data.name);
- $("#opened-rarity").html(data.rarity);
- } else {
- $("#opened-name").html(data.name);
- $("#opened-rarity").html(data.rarity);
- }
- // new Audio('sounds/ending.mp3').play()
- //rank reload
- $('#rankimage').load(document.URL + ' #rankimage');
- $("#pick-line").hide();
- $("#winner-item").animate({height: "300px", width: "300px"}, 1000, "easeOutExpo");
- $("#winner-item-cell").animate({height: "300px", width: "300px"}, {duration: 1000, easing: "easeOutExpo", progress: function() {
- $("#winner-item").css("background-size", "100%")
- }});
- });
- });
- }, 1000));
- } else if (data.error) {
- iziToast.warning({
- title: 'Warning',
- message: data.error,
- timeout: 10000, //10 Sekunden anzeigen
- icon: 'fa fa-exclamation-triangle',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- refreshing["recent_openings"] = true;
- requesting = false;
- } else if (data.error2) {
- iziToast.error({
- title: 'Error',
- message: data.error2,
- timeout: 10000, //10 Sekunden anzeigen
- icon: 'fa fa-exclamation-triangle',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- refreshing["recent_openings"] = true;
- requesting = false;
- }
- })
- .fail(function() {
- requesting = false;
- });
- }
- });
- }
- $("#messagesClick").click(function() {
- $("#messages").toggle();
- $("#notifications").hide();
- });
- $("#notificationsClick").click(function() {
- $("#notifications").toggle();
- $("#messages").hide();
- });
- var arrayJoin = [];
- var selectedItemsPrices = 0;
- addClickHandler = function() {
- arrayJoin = [];
- selectedItemsPrices = 0;
- $(".duel_item").click(function() {
- if(arrayJoin.length < 8){
- var id = $(this).attr("id");
- arrayJoin.push(id);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPrices = parseFloat(selectedItemsPrices) + price;
- document.getElementById("YourBetJoin").innerHTML = ""+selectedItemsPrices.toFixed(2)+"";
- $(this).parent().find(".clicked_container").css("height", "100%");
- }else{
- error("Error", "You can bet max. 8 Items!", "fa fa-times");
- }
- });
- $(".clicked_container").click(function() {
- var id = $(this).parent().find("img").first().attr("id");
- $(this).css("height", "0");
- arrayJoin.splice(arrayJoin.indexOf(id), 1);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPrices = parseFloat(selectedItemsPrices) - price;
- document.getElementById("YourBetJoin").innerHTML = ""+selectedItemsPrices.toFixed(2)+"";
- });
- $("#joinGameSubmit").click(function() {
- if(arrayJoin.length < 9){
- $.post("duel.php", {arrayJoin: arrayJoin, game_id:game_id}).done(function(data){
- if(data.duplicateItem == true){
- error("Error", "Something went wrong...", "fa fa-times");
- $("#content").load("duel.php", function() {});
- }else if(data.already_joined == true){
- error("Too late!", "Someone already joined this duel!", "fa fa-times");
- }else if(data.no_value == true){
- error("Error", "You have to be in the bet area!", "fa fa-times");
- }else if(data.array_count_too_much == true){
- error("Error", "You can not pick more than 8 Items!", "fa fa-times");
- }
- });
- }else{
- error("Error", "You can not pick more than 8 Items!", "fa fa-times");
- }
- arrayJoin = [];
- selectedItemsPrices = 0;
- });
- }
- addClickHandler();
- var arrayCreateGame = [];
- var selectedItemsPricesCreate = 0;
- addClickHandlerCreate = function() {
- arrayCreateGame = [];
- selectedItemsPricesCreate = 0;
- $(".duel_item_create").click(function() {
- if(arrayCreateGame.length < 8){
- var id = $(this).attr("id");
- arrayCreateGame.push(id);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPricesCreate = parseFloat(selectedItemsPricesCreate) + price;
- document.getElementById("YourBetCreate").innerHTML = ""+selectedItemsPricesCreate.toFixed(2)+"";
- $(this).parent().find(".clicked_container_create").css("height", "100%");
- }else{
- error("Error", "You can bet max. 8 Items!", "fa fa-times");
- }
- });
- $(".clicked_container_create").click(function() {
- var id = $(this).parent().find("img").first().attr("id");
- $(this).css("height", "0");
- arrayCreateGame.splice(arrayCreateGame.indexOf(id), 1);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPricesCreate = parseFloat(selectedItemsPricesCreate) - price;
- document.getElementById("YourBetCreate").innerHTML = ""+selectedItemsPricesCreate.toFixed(2)+"";
- });
- $("#createGame").click(function() {
- if(arrayCreateGame.length < 9){
- $.post("duel.php", {arrayCreateGame: arrayCreateGame}).done(function(data){
- $("#content").load("duel.php", function() {});
- if(data.too_much_games == true){
- error("Error", "You can have max. one game at a time!", "fa fa-times");
- }else if(data.array_count_too_much == true){
- error("Error", "You can bet max. 8 Items!", "fa fa-times");
- }
- });
- }else{
- error("Error", "You can not pick more than 8 Items!", "fa fa-times");
- }
- arrayCreateGame = [];
- selectedItemsPricesCreate = 0;
- });
- }
- addClickHandlerCreate();
- addClickHandlerTradeup = function() {
- FirstItem = 0;
- SecondItem = 0;
- ThirdItem = 0;
- FourthItem = 0;
- FifthItem = 0;
- rarityOverall = 0;
- $(".duel_item_tradeup").click(function() {
- var id = $(this).attr("id");
- var src = $(this).attr("src");
- var rarity = $(this).attr("real_rarity");
- var name = document.getElementById("item_info"+id).innerHTML;
- $('.duel_item_container:not([real_rarity='+rarity+'])').hide()
- var allHidden = false;
- if(FirstItem == 0){
- $(this).parent().hide();
- FirstItem = id;
- rarityOverall = rarity;
- document.getElementById("FirstItem").innerHTML = "<p>"+name+"</p><img item='"+id+"' id='tradeupItem' style='width: 70%;' src='"+src+"'</img>";
- $(this).parent().find(".clicked_container_tradeup").css("height", "100%");
- }else if(SecondItem == 0){
- $(this).parent().hide();
- SecondItem = id;
- rarityOverall = rarity;
- document.getElementById("SecondItem").innerHTML = "<p>"+name+"</p><img item='"+id+"' id='tradeupItem' style='width: 70%;' src='"+src+"'</img>";
- $(this).parent().find(".clicked_container_tradeup").css("height", "100%");
- }else if(ThirdItem == 0){
- $(this).parent().hide();
- ThirdItem = id;
- rarityOverall = rarity;
- document.getElementById("ThirdItem").innerHTML = "<p>"+name+"</p><img item='"+id+"' id='tradeupItem' style='width: 70%;' src='"+src+"'</img>";
- $(this).parent().find(".clicked_container_tradeup").css("height", "100%");
- }else if(FourthItem == 0){
- $(this).parent().hide();
- FourthItem = id;
- rarityOverall = rarity;
- document.getElementById("FourthItem").innerHTML = "<p>"+name+"</p><img item='"+id+"' id='tradeupItem' style='width: 70%;' src='"+src+"'</img>";
- $(this).parent().find(".clicked_container_tradeup").css("height", "100%");
- }else if(FifthItem == 0){
- $(this).parent().hide();
- FifthItem = id;
- rarityOverall = rarity;
- document.getElementById("FifthItem").innerHTML = "<p>"+name+"</p><img item='"+id+"' id='tradeupItem' style='width: 70%;' src='"+src+"'</img>";
- $(this).parent().find(".clicked_container_tradeup").css("height", "100%");
- }else{
- error("Error", "You can not pick more than 5 Items!", "fa fa-times");
- }
- $('#TradeupInventory').children().each(function() {
- if ($(this).is(":visible")) {
- allHidden = true;
- }
- });
- if(!allHidden){
- $('#TradeupInventory').append('<h3>No more items available!</h3>');
- }
- });
- $("#makeTradeup").click(function() {
- var arrayTradeup = [];
- arrayTradeup.push(FirstItem);
- arrayTradeup.push(SecondItem);
- arrayTradeup.push(ThirdItem);
- arrayTradeup.push(FourthItem);
- arrayTradeup.push(FifthItem);
- console.log(arrayTradeup);
- console.log(rarityOverall);
- //$("#InnerTradeUpBox").slideUp(1000);
- if (!arrayTradeup.includes(0)){
- $('#ThirdItem').css('z-index', '1');
- $('#FirstItem').animate({left: "33.3%"}, 400);
- $('#SecondItem').animate({left: "16.7%"}, 400);
- $('#FourthItem').animate({left: "-16.7%"}, 400);
- $('#FifthItem').animate({left: "-33.3%"}, 400);
- setTimeout(function(){
- $('#FirstItem').css('visibility', 'hidden');
- $('#SecondItem').css('visibility', 'hidden');
- $('#FourthItem').css('visibility', 'hidden');
- $('#FifthItem').hide();
- }, 800);
- }
- var postInAction = true;
- $.post("tradeup.php", {arrayTradeup:arrayTradeup, rarityOverall:rarityOverall}).done(function(data){
- if(data.allItemsAreRarity == true){
- if(data.winner_item_color != ""){
- winner_item_color = " ("+data.winner_item_color+")";
- }else{
- winner_item_color = "";
- }
- $("#WinnerItem").html("<p>"+data.winner_item_name+""+winner_item_color+"</p><img id='WinnerTradeUpImg' style='width:70%;box-shadow: rgb("+data.winner_item_rarity_color+") 0px 0px 10px, rgb("+data.winner_item_rarity_color+") 0px 0px 10px;' width='120px' src='"+data.winner_item_image+"'</img>");
- $("#makeTradeup").hide();
- $("#clearTradeup").hide();
- $('#backToTradeup').show();
- $('#ThirdItem').fadeOut(1000, function(){
- $('#WinnerItem').fadeIn(1000);
- success("Success", "You successfully traded up your items!", "fa fa-check");
- });
- }else if(data.hasDupes == true){
- error("Error", "Something went wrong...", "fa fa-times");
- }else{
- error("Error", "You have to pick 5 items!", "fa fa-times");
- }
- postInAction = false;
- });
- if (!arrayTradeup.includes(0)){
- AnimateInterval = setInterval(function(){
- if (postInAction){
- $('#ThirdItem')
- .animate({'left':(-5)+'px'},75)
- .animate({'left':(+10)+'px'},65)
- .animate({'left':(-10)+'px'},55)
- .animate({'left':(+10)+'px'},31)
- .animate({'left':(-10)+'px'},31)
- .animate({'left':(+10)+'px'},55)
- .animate({'left':(-10)+'px'},65)
- .animate({'left':(+5)+'px'},75);
- }else{
- clearInterval(AnimateInterval);
- }
- }, 800);
- }
- });
- $("#clearTradeup").click(function() {
- NProgress.start();
- $("#content").load("tradeup.php", function() {
- NProgress.done();
- });
- });
- $('#backToTradeup').click(function() {
- NProgress.start();
- $("#content").load("tradeup.php", function() {
- NProgress.done();
- });
- });
- }
- addClickHandlerTradeup();
- /*
- var already_updated = false;
- addReloadHandler = function() {
- already_updated = false;
- ReloadTimer = setInterval(function() {
- if ($('#modalViewGame').is(':visible')) {
- console.log("found div");
- if(already_updated == false || game_id != 0){
- $.post("duel-details.php?game_id="+$("#ImportantGameID").html(), {refreshing: refreshing["recent_openings"]}).done(function(data){
- if(data && data.success == true){
- $("#ModalBodyView").load("duel-details.php?game_id="+game_id, function() {});
- already_updated = true;
- clearInterval(ReloadTimer);
- }
- });
- }
- }
- }, 1000);
- }
- */
- var arrayJoinJackpot = [];
- var selectedItemsPricesJackpot = 0;
- addClickHandlerJackpot = function() {
- arrayJoinJackpot = [];
- selectedItemsPricesJackpot = 0;
- $(".duel_item_create").click(function() {
- if(arrayJoinJackpot.length < 10){
- var id = $(this).attr("id");
- arrayJoinJackpot.push(id);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPricesJackpot = parseFloat(selectedItemsPricesJackpot) + price;
- document.getElementById("YourBetCreate").innerHTML = ""+selectedItemsPricesJackpot.toFixed(2)+"";
- $(this).parent().find(".clicked_container_create").css("height", "100%");
- }else{
- error("Error", "You can deposit max. 10 Items!", "fa fa-times");
- }
- });
- $(".clicked_container_create").click(function() {
- var id = $(this).parent().find("img").first().attr("id");
- $(this).css("height", "0");
- arrayJoinJackpot.splice(arrayJoinJackpot.indexOf(id), 1);
- var price = parseFloat(document.getElementById(id).getAttribute('price'));
- selectedItemsPricesJackpot = parseFloat(selectedItemsPricesJackpot) - price;
- document.getElementById("YourBetCreate").innerHTML = ""+selectedItemsPricesJackpot.toFixed(2)+"";
- });
- $("#joinJackpot").click(function() {
- if(arrayJoinJackpot.length < 11){
- $.post("jackpot.php", {arrayJoinJackpot: arrayJoinJackpot}).done(function(data){
- if(data.max50Items == true){
- error("Error", "Max Jackpot items is 50!", "fa fa-times");
- }else if(data.max10Items == true){
- error("Error", "You can deposit max. 10 Items!", "fa fa-times");
- }else{
- $("#content").load("jackpot.php", function() {});
- success("Success", "You are in! Good luck!", "fa fa-check");
- }
- });
- }else{
- error("Error", "You can not pick more than 10 Items!", "fa fa-times");
- }
- arrayJoinJackpot = [];
- selectedItemsPricesJackpot = 0;
- });
- }
- addClickHandlerJackpot();
- });
- function tradeItems(){
- }
- function refreshDiv(){
- $("#ModalBody").load("../createGameInventory.php");
- $( ".duel_item_create" ).trigger( "click" );
- $( ".clicked_container_create" ).trigger( "click" );
- }
- function register() {
- var username = $("#username").val();
- var password = $("#password").val();
- NProgress.start();
- $.post("register.php", {username: username, password: password}).done(function(data){
- NProgress.done();
- if (data && data.success == true) {
- iziToast.success({
- title: 'Success',
- message: 'You have been successfully registered!',
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-check',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- $("#content").load("login.php");
- } else if (data && data.success == false) {
- if (data.type == "error")
- iziToast.error({
- title: 'Error',
- message: data.error,
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-times',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- else
- iziToast.warning({
- title: 'Warning',
- message: data.error,
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-exclamation-triangle',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- });
- }
- function login() {
- var username = $("#username").val();
- var password = $("#password").val();
- NProgress.start();
- $.post("login.php", {username: username, password: password}).done(function(data){
- NProgress.done();
- if (data && data.success == true) {
- iziToast.success({
- title: 'Success',
- message: 'You have been successfully logged in!',
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-check',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- if (data.admin == true){
- $(".menu-loggedin-testing").show();
- $(".adminPanelButton").show();
- $("#testing-label").html('Testing-Panel');
- }
- if (data.dailyreward == true){
- iziToast.info({
- title: 'Info',
- message: 'You claimed your daily reward('+data.streak_keys+' Keys) for your '+data.login_streak+' days login streak. Thank you for being faithful!',
- timeout: 8000, //10 Sekunden anzeigen
- icon: 'fa fa-info',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- else if (data.dailyreward == false){
- iziToast.info({
- title: 'Info',
- message: 'You claimed your daily reward(2 Keys). Thank you for being faithful!',
- timeout: 8000, //10 Sekunden anzeigen
- icon: 'fa fa-info',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- $(".menu-loggedin").show();
- $(".menu-loggedout").hide();
- $("#username-label").html('<img src="'+data.exp+'"/>'+data.username+'<div class="keyAmount menu-loggedin"><img src="images/key.png"><span id="currencyID">'+parseFloat(data.currency).toFixed(2)+'</span></div>');
- $("#messages").html('<div style="left: 20px;" class="arrow-up-messages"></div><span>You have <b>'+data.countedMessages+'</b> messages</span><ul id="loadMessages">Loading messages...</ul>');
- $("#notifications").html('<div style="left: 131px;" class="arrow-up-messages"></div><span>You have <b>'+data.countedNotifications+'</b> notifications</span><ul id="loadNotifications">Loading notifications...</ul>');
- $("#content").load("dashboard.php");
- } else if (data && data.success == false) {
- if (data.type == "error")
- iziToast.error({
- title: 'Error',
- message: data.error,
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-times',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- else
- iziToast.warning({
- title: 'Warning',
- message: data.error,
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-exclamation-triangle',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- });
- }
- function logout() {
- $(".menu-loggedin-testing").hide();
- $(".menu-loggedin").hide();
- $(".menu-loggedout").show();
- $("#content").load("dashboard.php");
- iziToast.success({
- title: 'Success',
- message: 'You have been successfully logged out!',
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-check',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- function notAvailable(){
- iziToast.warning({
- title: 'Warning',
- message: 'This function is currently unavailable! Sry brah :p',
- timeout: 5000, //10 Sekunden anzeigen
- icon: 'fa fa-exclamation-triangle',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- }
- var openAdmin = false;
- function testingMenuPoint() {
- if(openAdmin){
- $(".testMenu").slideUp(1500);
- $(".games").slideDown(1500);
- setTimeout(function(){
- $(".panelScrollIcon").removeClass("fa-arrow-up");
- $(".panelScrollIcon").addClass("fa-arrow-down");
- },1500);
- $('.testing-background').animate({ 'background-color': 'rgba(0, 0, 0, 0)' },1000);
- openAdmin = false;
- }else{
- $(".games").slideUp(1500);
- $(".testMenu").slideDown(1500);
- setTimeout(function(){
- $(".panelScrollIcon").removeClass("fa-arrow-down");
- $(".panelScrollIcon").addClass("fa-arrow-up");
- },1500);
- $('.testing-background').animate({ 'background-color': 'rgba(0, 0, 0, 0.3)' },500);
- openAdmin = true;
- }
- };
- function sellItem(inv_id,price) {
- $.post("delete.php" , {inv_id:inv_id,price:price} , function(data){
- if(data)
- $("#item" + inv_id).fadeOut('fast' , function(){
- $(this).remove();
- $("#currencyID").animate({color:'#00FF00'}, 300);
- var oldCurrency = document.getElementById('currencyID');
- var newCurrency = parseFloat(oldCurrency.innerHTML) + parseFloat(price);
- $("#currencyID").html(newCurrency.toFixed(2));
- $("#currencyID").animate({color:'white'}, 600);
- var itemAmount = document.getElementById('itemAmount');
- var newAmount = parseInt(itemAmount.innerHTML) - parseInt(1);
- $("#itemAmount").html(newAmount);
- iziToast.success({
- title: 'Success',
- message: 'You have successfully sold your item for '+parseFloat(price).toFixed(2)+' Keys!',
- timeout: 1000, //10 Sekunden anzeigen
- icon: 'fa fa-check',
- position: 'bottomLeft',
- transitionIn: 'fadeIn',
- transitionOut: 'fadeOutLeft'
- });
- });
- });
- }
- function refreshCurrency() {
- $("#currencyID").animate({color:'#FF0000'}, 300);
- var oldCurrency = document.getElementById('currencyID');
- var newCurrency = parseFloat(oldCurrency.innerHTML) - parseFloat(1);
- $("#currencyID").html(newCurrency.toFixed(2));
- $("#currencyID").animate({color:'white'}, 600);
- }
- function sortDes(items, container){
- var myArray = $(items);
- var count = 0;
- myArray.sort(function (a, b) {
- a = parseInt($(a).attr("price"), 10);
- b = parseInt($(b).attr("price"), 10);
- count += 2;
- if(a < b) {
- return 1;
- } else if(a > b) {
- return -1;
- } else {
- return 0;
- }
- });
- $(container).append(myArray);
- }
- function sortAsc(items, container){
- var myArray = $(items);
- var count = 0;
- myArray.sort(function (a, b) {
- a = parseInt($(a).attr("price"), 10);
- b = parseInt($(b).attr("price"), 10);
- count += 2;
- if(a > b) {
- return 1;
- } else if(a < b) {
- return -1;
- } else {
- return 0;
- }
- });
- $(container).append(myArray);
- }
- function sortRar(items, container){
- var myArray = $(items);
- var count = 0;
- myArray.sort(function (a, b) {
- a = parseInt($(a).attr("rarity"), 10);
- b = parseInt($(b).attr("rarity"), 10);
- count += 2;
- if(a < b) {
- return 1;
- } else if(a > b) {
- return -1;
- } else {
- return 0;
- }
- });
- $(container).append(myArray);
- }
- function sellallItems(rarityID, rarityName, price) {
- $.post("inventory.php", {rarityID: rarityID}, function(data){
- $("#content").load("inventory.php", function() {});
- success("Success", "Successfully sold your "+rarityName+" items for "+price+" Keys!", "fa fa-check");
- $("#currencyID").animate({color:'#00FF00'}, 300);
- var oldCurrency = document.getElementById('currencyID');
- var newCurrency = parseFloat(oldCurrency.innerHTML) + parseFloat(price);
- $("#currencyID").html(newCurrency.toFixed(2));
- $("#currencyID").animate({color:'white'}, 600);
- $('#itemAmount').load(document.URL + ' #itemAmount');
- });
- };
- function addTodo() {
- var text = $("input[name=text]").val();
- var priority = $("select[name=priority]").val();
- var status = $("select[name=status]").val();
- // Date
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth()+1; //January is 0!
- var yyyy = today.getFullYear();
- if(dd<10) {
- dd='0'+dd
- }
- if(mm<10) {
- mm='0'+mm
- }
- today = yyyy+'-'+mm+'-'+dd;
- // Post
- if (text == "" || priority == "" || status == ""){
- error("Missing Data", "Please fill out all fields!", "fa fa-exclamation-triangle");
- }else{
- $.post("todo_list.php", {text:text, priority:priority, status:status, datum:today}, function(data){
- $("#content").load("todo_list.php", function() {});
- success("Success", "Todo-Item succesfully added!", "fa fa-check");
- });
- }
- };
- function closeTodo(todoID) {
- $.post("todo_list.php", {todoID: todoID}, function(data){
- $("#content").load("todo_list.php", function() {});
- success("Success", "You closed the todo entry with id "+todoID+".", "fa fa-check");
- });
- };
- function addItem() {
- var item_id = $("input[name=item_id]").val();
- $.post("edit-users.php", {userid: userid, item_id:item_id}, function(data){
- $("#content").load("edit-users/"+userid, function() {});
- success("Success", "Item with ID " +item_id+ " succesfully added to inventory!", "fa fa-check");
- });
- };
- function banUser(username) {
- $.post("profile_public.php", {username: username}, function(data){
- $("#content").load("profile_public.php/"+username, function() {});
- success("Success", "You permanently banned the user "+username+"!", "fa fa-check");
- });
- };
- function unbanUser(username, status) {
- $.post("profile_public.php", {username: username, status:status}, function(data){
- $("#content").load("profile_public.php/"+username, function() {});
- success("Success", "You unbanned the user "+username+"!", "fa fa-check");
- });
- };
- function buyItem(item_id, tradeid) {
- $.post("trading.php", {userid: userid, item_id:item_id, tradeid:tradeid}, function(data){
- $("#content").load("trading.php", function() {});
- if (data.success == true){
- success("Success", "You successfully buyed Item with ID " +item_id+ "!", "fa fa-check");
- }
- else if (data.success == false){
- error("Error", "Item already selled!", "fa fa-check");
- }
- });
- };
- function chatAdd() {
- var msgText = $("input[name=msgText]").val();
- $.post("chat.php", {userid:userid,msgText: msgText}, function(data){
- if (data.success == true){
- success("Success", "You successfully", "fa fa-check");
- }
- else if (data.success == false){
- error("Error", "Item already selled!", "fa fa-check");
- }
- });
- };
- function dismissMessage(dismissID) {
- $.post("index.php", {dismissID:dismissID}, function(data){
- if (data.success == true){
- success("Success", "You successfully marked your message as read!", "fa fa-check");
- }
- });
- };
- // Toast's
- function error(customTitle, customMessage, customIcon) {
- iziToast.error({
- title: customTitle,
- message: customMessage,
- icon: customIcon,
- position: 'bottomLeft'
- });
- }
- function success(customTitle, customMessage, customIcon) {
- iziToast.success({
- title: customTitle,
- message: customMessage,
- icon: customIcon,
- position: 'bottomLeft'
- });
- }
- function searchUser(searchedName) {
- var $rows = $("#userVorschlaege");
- $("#content").load("profile_public.php/"+searchedName, function() {
- $("#fname").val("");
- $rows.hide();
- });
- };
- function decimalPlaces(num) {
- var match = (''+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
- if (!match) { return 0; }
- return Math.max(
- 0,
- // Number of digits right of decimal point.
- (match[1] ? match[1].length : 0)
- // Adjust for scientific notation.
- - (match[2] ? +match[2] : 0));
- }
- function spinWheel(){
- var loading = false;
- NProgress.start();
- var flipResult = 0;
- var bet = $("input[name=bet]").val();
- //replace
- if(!loading && parseFloat(document.getElementById('currencyID').innerHTML) >= parseFloat(bet)){
- $("#loading").show();
- loading = true;
- $('#coin').removeClass();
- if (!isNaN(bet) && bet != '' && bet != '0' && bet.indexOf('-') === -1 && bet >= '0.01' && decimalPlaces(bet) < 3){
- NProgress.inc()
- NProgress.set(0.6)
- $.post("coinflip.php", {flipResult: flipResult, bet:bet}, function(data){
- if(data.coinflipBan == true){
- error("Error", "Please wait "+data.waitTimeSeconds+" more second(s)!", "fa fa-times");
- loading = false;
- NProgress.done()
- $("#loading").hide();
- }else{
- flipResult = data.flipResult;
- $("#loading").hide();
- setTimeout(function(){
- $("#currencyID").animate({color:'#FF0000'}, 300);
- var oldCurrency = document.getElementById('currencyID');
- var newCurrency = parseFloat(oldCurrency.innerHTML) - parseFloat(bet);
- $("#currencyID").html(newCurrency.toFixed(2));
- $("#currencyID").animate({color:'white'}, 600);
- if(flipResult <= 50){
- $('#coin').addClass('heads');
- setTimeout(function(){
- success("Congrats!", "You won "+bet+" Keys!", "fa fa-check");
- $('#lastCoinflips tr:last').after('<tr>...</tr><tr>...</tr>');
- //new Audio('sounds/win.mp3').play()
- $("#currencyID").animate({color:'#00FF00'}, 300);
- var oldCurrency = document.getElementById('currencyID');
- var newCurrency = parseFloat(oldCurrency.innerHTML) + parseFloat(bet*2);
- $("#currencyID").html(newCurrency.toFixed(2));
- $("#currencyID").animate({color:'white'}, 600);
- loading = false;
- }, 2800);
- }else{
- $('#coin').addClass('tails');
- setTimeout(function(){
- error("Ouch!", "You lost "+bet+" Keys. Better luck next time!", "fa fa-times");
- loading = false;
- }, 2800);
- }
- }, 300);
- }
- });
- }else{
- error("Error", "You have to enter a valid key number!", "fa fa-times");
- loading = false;
- $("#loading").hide();
- }
- }else{
- error("Error", "You don't have enough keys!", "fa fa-times");
- }
- NProgress.done();
- }
- function increaseBet(value) {
- document.getElementById("CoinBet").value = parseFloat(document.getElementById("CoinBet").value) + parseFloat(value);
- };
- function betValue(value) {
- var currency = document.getElementById('currencyID');
- if(value == 1){
- document.getElementById("CoinBet").value = parseFloat(currency.innerHTML);
- }else if(value == 0){
- $('#CoinBet').val('0')
- }else if(value == 'Double'){
- document.getElementById("CoinBet").value = parseFloat(document.getElementById("CoinBet").value) *2;
- }else if(value == 'Half'){
- document.getElementById("CoinBet").value = parseFloat(document.getElementById("CoinBet").value) /2;
- }
- };
- function onEnterPress(e) {
- if (e.keyCode == 13) {
- login();
- return false;
- }
- }
- function disconnectSteam() {
- var steam = true;
- NProgress.start();
- $.post("profile.php", {steam:steam}, function(data){
- $("#content").load("profile.php", function() {});
- success("Success", "You have successfully disconnected your Steam account!", "fa fa-check");
- });
- NProgress.done();
- };
- function disconnectDiscord() {
- var discord = true;
- NProgress.start();
- $.post("profile.php", {discord:discord}, function(data){
- $("#content").load("profile.php", function() {});
- success("Success", "You have successfully disconnected your Discord account!", "fa fa-check");
- });
- NProgress.done();
- };
- function disconnectPatreon() {
- var patreon = true;
- NProgress.start();
- $.post("profile.php", {patreon:patreon}, function(data){
- $("#content").load("profile.php", function() {});
- success("Success", "You have successfully disconnected your Patreon account!", "fa fa-check");
- });
- NProgress.done();
- };
- function updateInformation() {
- var updateInformation = true;
- NProgress.start();
- $.post("profile.php", {updateInformation:updateInformation}, function(data){
- $("#content").load("profile.php", function() {});
- success("Success", "You have successfully updated your Steam informations!", "fa fa-check");
- });
- NProgress.done();
- };
- function resetAccount() {
- var resetAccount = true;
- NProgress.start();
- $.post("profile.php", {resetAccount:resetAccount}, function(data){
- $("#content").load("profile.php", function() {});
- success("Success", "You have successfully reseted your account!", "fa fa-check");
- $("#currencyID").html("47.00");
- });
- NProgress.done();
- };
- /*
- function gotoDuel(game_id) {
- $("#ModalBodyView").load("duel-details.php?game_id="+game_id, function() {
- $("#modalViewGame").modal();
- });
- };
- */
- function duelSpin(flipResult, myid, winner_id,creator_id, joiner_id){
- var loading = false;
- NProgress.start();
- loading = true;
- $('#coin').removeClass();
- NProgress.inc()
- NProgress.set(0.6)
- $.post("duel-details.php", {flipResult: flipResult}, function(data){
- setTimeout(function(){
- if(flipResult <= 50){
- $('#coin').addClass('heads');
- setTimeout(function(){
- $("#winner").slideDown(1400);
- if(winner_id == myid){
- success("Win", "Congratulations you have won the duel! You can now accept your items!", "fa fa-check");
- }else if(myid == creator_id || myid == joiner_id){
- error("Lose", "You lost the round! Better luck next time!", "fa fa-times");
- }
- $('#Player1Img').addClass('winner');
- $('#RightSide').addClass('lost');
- }, 2800);
- }else{
- $('#coin').addClass('tails');
- setTimeout(function(){
- $("#winner").slideDown(1400);
- if(winner_id == myid){
- success("Win", "Congratulations you have won the duel! You can now accept your items!", "fa fa-check");
- }else if(myid == creator_id || myid == joiner_id){
- error("Lose", "You lost the round! Better luck next time!", "fa fa-times");
- }
- $('#Player2Img').addClass('winner');
- $('#LeftSide').addClass('lost');
- }, 2800);
- }
- }, 300);
- });
- NProgress.done();
- }
- function acceptItems(game_id) {
- NProgress.start();
- document.getElementById("acceptButton").innerHTML = "<i class='fa fa-spinner fa-spin fa-1x fa-fw'></i>";
- $.post("duel-details.php?game_id="+game_id, {game_id:game_id}, function(data){
- success("Success", "You have successfully accepted your win!", "fa fa-check");
- document.getElementById("acceptButton").innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>";
- });
- NProgress.done();
- };
- function acceptItemsAsAdmin(game_id) {
- var adminAccept = true;
- document.getElementById("AdminAccept").innerHTML = "<i class='fa fa-spinner fa-spin fa-1x fa-fw'></i>";
- $.post("duel-details.php?game_id="+game_id, {game_id:game_id,adminAccept:adminAccept}, function(data){
- success("Success", "You have successfully accepted the win for a user!", "fa fa-check");
- document.getElementById("AdminAccept").innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>";
- });
- };
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-96562797-1', 'auto');
- ga('send', 'pageview');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement