Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function menuProfile()
- {
- var output = '';
- if(userName == null)
- {
- document.getElementById("loginMenu").style.display = "block";
- document.getElementById("contentMenu2").innerHTML = "";
- }
- else
- {
- if(userData["xp"] != userXP)
- {
- $.mobile.loading('show');
- userXP = userData["xp"];
- document.getElementById("loginMenu").style.display = "none";
- document.getElementById("userName").value = '';
- document.getElementById("userPassword").value = '';
- output = '<div class="ui-grid-solo ui-responsive" style="text-align: center;">\
- <div class="ui-block">\
- <h2><a href="#" class="ui-btn">' + userName + '</a></h2>\
- <a href="#" onClick="showWithdrawMoneyPanel()">Pinigai: '+userData["money"]+'</a><br>\
- Uždarbis: '+userData["uzdirbo"]+'<br>\
- XP: '+userData["xp"]+'<br>\
- VIP: '+userData["vip"]+'<br>\
- <a href="#" onClick="showCreditsBuy()">Kreditai: '+userData["kreditai"]+'</a><br>\
- Valiuta: '+userData["valiuta"]+'<br>\
- Admin: '+userData["admin"]+'<br>\
- Šiandien pražaidė: '+userData["prazaide"]+' min.<br>\
- Darbas: '+userData["job"]+'<br>';
- if(userData["vehicle_model0"] >= 400 || userData["vehicle_model1"] >= 400)
- {
- output += '<div class="ui-grid ui-responsive" style="text-align: center;">\
- <a href="#" class="ui-btn" disabled>Transportas</a>';
- if(userData["vehicle_model0"] >= 400)
- {
- output += '<div class="ui-block">\
- <div class="ui-bar ui-bar">\
- <center><img src="images/vehicles/'+userData["vehicle_model0"]+'.png" class="img-responsive"></center>\
- '+userData["vehicle_km0"]+' km\
- </div>\
- </div>';
- }
- if(userData["vehicle_model1"] >= 400)
- {
- output += '<div class="ui-block-b">\
- <div class="ui-bar ui-bar">\
- <center><img src="images/vehicles/'+userData["vehicle_model1"]+'.png" class="img-responsive"></center>\
- '+userData["vehicle_km1"]+' km\
- </div>\
- </div>';
- }
- output +='</div>';
- }
- output +='<button class="ui-btn" onclick="logout()" style="background: red; color: white;"><span class="glyphicon glyphicon-log-out"></span> Atsijungti</button>';
- document.getElementById("contentMenu2").innerHTML = output;
- $.mobile.loading('hide');
- onPaymentCountryChange();
- return;
- }
- else
- {
- $.mobile.loading('hide');
- return;
- }
- }
- $.mobile.loading('hide');
- }
- function showWithdrawMoneyPanel()
- {
- $("#leftpanelMoneyWithdraw").panel("open");
- document.getElementById("bankPIN").setAttribute("type", "number");
- }
- var withdrawMoneyCheckInterval = null;
- var withdrawMoneyUid = 0;
- var blockWithdraw = false;
- function withdrawMoneyCheck()
- {
- $.post("http://sarg.lt/app/get_withdraw.php", {name: userName, uid: withdrawMoneyUid, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data )
- {
- var newUserData = parseINIString(data);
- if(newUserData["success"] == "0")
- return;
- clearInterval(withdrawMoneyCheckInterval);
- withdrawMoneyCheckInterval = null;
- withdrawMoneyUid = 0;
- if(newUserData["success"] == "1")
- {
- showMsg("Pinigai atsirado tavo kišenėje!");
- userData["money"] = newUserData["money"];
- userData["money_bank"] = newUserData["money_bank"];
- }
- else if(newUserData["success"] == "-1")
- {
- showWarningMsg("Reikia žaisti serveryje!");
- }
- else if (newUserData["success"] == "-2")
- {
- blockWithdraw = true;
- showWarningMsg("Autorizacijos klaida!");
- }
- });
- }
- function withdrawMoney()
- {
- if(blockWithdraw)
- {
- showWarningMsg("Negalima!");
- return;
- }
- if(withdrawMoneyCheckInterval != null)
- {
- showWarningMsg("Dar vykdomas senas!");
- return;
- }
- var amount = parseInt(document.getElementById("withdrawAmount").value);
- if(amount > userData["money_bank"])
- {
- showWarningMsg("Neturite tiek pinigų! Banke turite: " + userData["money_bank"] + " EUR");
- return;
- }
- if(amount > 100000000)
- {
- showWarningMsg("Per didelė suma!");
- return;
- }
- if(amount < 1000)
- {
- showWarningMsg("Mažiausia suma 1.000 EUR!");
- return;
- }
- var PIN = document.getElementById("bankPIN").value;
- if(PIN < 1000)
- PIN = 0;
- document.getElementById("withdrawAmount").value = '';
- document.getElementById("bankPIN").value = '';
- $("#leftpanelMoneyWithdraw").panel("close");
- $.post("http://sarg.lt/app/withdraw.php", {name: userName, token: userData["token"], PIN: PIN, amount: amount, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data )
- {
- if (data == "0")
- {
- showWarningMsg("Serveris nepasiekiamas!");
- return;
- }
- else if (data == "-1")
- {
- blockWithdraw = true;
- showWarningMsg("Autorizacijos klaida!");
- return;
- }
- else
- {
- withdrawMoneyUid = data;
- showMsg("Nurodymas sėkmingai nusiųstas!");
- withdrawMoneyCheckInterval = setInterval (withdrawMoneyCheck, 11000);
- }
- });
- }
Add Comment
Please, Sign In to add comment