Guest User

Untitled

a guest
Feb 17th, 2017
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. function menuProfile()
  2. {
  3. var output = '';
  4. if(userName == null)
  5. {
  6. document.getElementById("loginMenu").style.display = "block";
  7. document.getElementById("contentMenu2").innerHTML = "";
  8. }
  9. else
  10. {
  11. if(userData["xp"] != userXP)
  12. {
  13. $.mobile.loading('show');
  14. userXP = userData["xp"];
  15. document.getElementById("loginMenu").style.display = "none";
  16. document.getElementById("userName").value = '';
  17. document.getElementById("userPassword").value = '';
  18.  
  19. output = '<div class="ui-grid-solo ui-responsive" style="text-align: center;">\
  20. <div class="ui-block">\
  21. <h2><a href="#" class="ui-btn">' + userName + '</a></h2>\
  22. <a href="#" onClick="showWithdrawMoneyPanel()">Pinigai: '+userData["money"]+'</a><br>\
  23. Uždarbis: '+userData["uzdirbo"]+'<br>\
  24. XP: '+userData["xp"]+'<br>\
  25. VIP: '+userData["vip"]+'<br>\
  26. <a href="#" onClick="showCreditsBuy()">Kreditai: '+userData["kreditai"]+'</a><br>\
  27. Valiuta: '+userData["valiuta"]+'<br>\
  28. Admin: '+userData["admin"]+'<br>\
  29. Šiandien pražaidė: '+userData["prazaide"]+' min.<br>\
  30. Darbas: '+userData["job"]+'<br>';
  31. if(userData["vehicle_model0"] >= 400 || userData["vehicle_model1"] >= 400)
  32. {
  33. output += '<div class="ui-grid ui-responsive" style="text-align: center;">\
  34. <a href="#" class="ui-btn" disabled>Transportas</a>';
  35. if(userData["vehicle_model0"] >= 400)
  36. {
  37. output += '<div class="ui-block">\
  38. <div class="ui-bar ui-bar">\
  39. <center><img src="images/vehicles/'+userData["vehicle_model0"]+'.png" class="img-responsive"></center>\
  40. '+userData["vehicle_km0"]+' km\
  41. </div>\
  42. </div>';
  43. }
  44. if(userData["vehicle_model1"] >= 400)
  45. {
  46. output += '<div class="ui-block-b">\
  47. <div class="ui-bar ui-bar">\
  48. <center><img src="images/vehicles/'+userData["vehicle_model1"]+'.png" class="img-responsive"></center>\
  49. '+userData["vehicle_km1"]+' km\
  50. </div>\
  51. </div>';
  52. }
  53. output +='</div>';
  54. }
  55. output +='<button class="ui-btn" onclick="logout()" style="background: red; color: white;"><span class="glyphicon glyphicon-log-out"></span> Atsijungti</button>';
  56. document.getElementById("contentMenu2").innerHTML = output;
  57. $.mobile.loading('hide');
  58. onPaymentCountryChange();
  59. return;
  60. }
  61. else
  62. {
  63. $.mobile.loading('hide');
  64. return;
  65. }
  66. }
  67. $.mobile.loading('hide');
  68. }
  69.  
  70. function showWithdrawMoneyPanel()
  71. {
  72. $("#leftpanelMoneyWithdraw").panel("open");
  73. document.getElementById("bankPIN").setAttribute("type", "number");
  74. }
  75.  
  76. var withdrawMoneyCheckInterval = null;
  77. var withdrawMoneyUid = 0;
  78. var blockWithdraw = false;
  79. function withdrawMoneyCheck()
  80. {
  81. $.post("http://sarg.lt/app/get_withdraw.php", {name: userName, uid: withdrawMoneyUid, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data )
  82. {
  83. var newUserData = parseINIString(data);
  84. if(newUserData["success"] == "0")
  85. return;
  86. clearInterval(withdrawMoneyCheckInterval);
  87. withdrawMoneyCheckInterval = null;
  88. withdrawMoneyUid = 0;
  89. if(newUserData["success"] == "1")
  90. {
  91. showMsg("Pinigai atsirado tavo kišenėje!");
  92. userData["money"] = newUserData["money"];
  93. userData["money_bank"] = newUserData["money_bank"];
  94. }
  95. else if(newUserData["success"] == "-1")
  96. {
  97. showWarningMsg("Reikia žaisti serveryje!");
  98. }
  99. else if (newUserData["success"] == "-2")
  100. {
  101. blockWithdraw = true;
  102. showWarningMsg("Autorizacijos klaida!");
  103. }
  104. });
  105. }
  106. function withdrawMoney()
  107. {
  108. if(blockWithdraw)
  109. {
  110. showWarningMsg("Negalima!");
  111. return;
  112. }
  113. if(withdrawMoneyCheckInterval != null)
  114. {
  115. showWarningMsg("Dar vykdomas senas!");
  116. return;
  117. }
  118. var amount = parseInt(document.getElementById("withdrawAmount").value);
  119. if(amount > userData["money_bank"])
  120. {
  121. showWarningMsg("Neturite tiek pinigų! Banke turite: " + userData["money_bank"] + " EUR");
  122. return;
  123. }
  124. if(amount > 100000000)
  125. {
  126. showWarningMsg("Per didelė suma!");
  127. return;
  128. }
  129. if(amount < 1000)
  130. {
  131. showWarningMsg("Mažiausia suma 1.000 EUR!");
  132. return;
  133. }
  134. var PIN = document.getElementById("bankPIN").value;
  135. if(PIN < 1000)
  136. PIN = 0;
  137. document.getElementById("withdrawAmount").value = '';
  138. document.getElementById("bankPIN").value = '';
  139. $("#leftpanelMoneyWithdraw").panel("close");
  140. $.post("http://sarg.lt/app/withdraw.php", {name: userName, token: userData["token"], PIN: PIN, amount: amount, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data )
  141. {
  142. if (data == "0")
  143. {
  144. showWarningMsg("Serveris nepasiekiamas!");
  145. return;
  146. }
  147. else if (data == "-1")
  148. {
  149. blockWithdraw = true;
  150. showWarningMsg("Autorizacijos klaida!");
  151. return;
  152. }
  153. else
  154. {
  155. withdrawMoneyUid = data;
  156. showMsg("Nurodymas sėkmingai nusiųstas!");
  157. withdrawMoneyCheckInterval = setInterval (withdrawMoneyCheck, 11000);
  158. }
  159. });
  160. }
Add Comment
Please, Sign In to add comment