Guest User

Untitled

a guest
Feb 17th, 2017
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. /*var alertSound = window.localStorage.getItem("alertSound");
  2. if(alertSound == null)
  3. {
  4. alertSound = false;
  5. }
  6. else
  7. {
  8. $("#checkbox_sound").prop('checked', true);
  9. }*/
  10. var alertVibration = window.localStorage.getItem("alertVibration");
  11. if(alertVibration == null)
  12. {
  13. alertVibration = false;
  14. }
  15. else
  16. {
  17. $("#checkbox_vibration").prop('checked', true);
  18. }
  19.  
  20. /*function soundSetting()
  21. {
  22. if($('#checkbox_sound').is(':checked'))
  23. {
  24. alertSound = true;
  25. window.localStorage.setItem("alertSound", true);
  26. }
  27. else
  28. {
  29. alertSound = false;
  30. window.localStorage.setItem("alertSound", false);
  31. }
  32.  
  33. }*/
  34. function vibrationSetting()
  35. {
  36. if($('#checkbox_vibration').is(':checked'))
  37. {
  38. alertVibration = true;
  39. window.localStorage.setItem("alertVibration", true);
  40. }
  41. else
  42. {
  43. alertVibration = false;
  44. window.localStorage.removeItem("alertVibration");
  45. }
  46.  
  47. }
  48.  
  49. var alertPrivateVibration = window.localStorage.getItem("alertPrivateVibration");
  50. if(alertPrivateVibration == null)
  51. {
  52. alertPrivateVibration = false;
  53. }
  54. else
  55. {
  56. $("#checkbox_private_vibration").prop('checked', true);
  57. }
  58.  
  59. function vibrationPrivateSetting()
  60. {
  61. if($('#checkbox_private_vibration').is(':checked'))
  62. {
  63. alertPrivateVibration = true;
  64. window.localStorage.setItem("alertPrivateVibration", true);
  65. }
  66. else
  67. {
  68. alertPrivateVibration = false;
  69. window.localStorage.removeItem("alertPrivateVibration");
  70. }
  71.  
  72. }
  73.  
  74. /*var alertPrivateText = window.localStorage.getItem("alertPrivateText");
  75. if(alertPrivateText == null)
  76. {
  77. alertPrivateText = false;
  78. }
  79. else
  80. {
  81. $("#checkbox_private_text").prop('checked', true);
  82. }
  83.  
  84. function textPrivateSetting()
  85. {
  86. if($('#checkbox_private_text').is(':checked'))
  87. {
  88. alertPrivateText = true;
  89. window.localStorage.setItem("alertPrivateText", true);
  90. }
  91. else
  92. {
  93. alertPrivateText = false;
  94. window.localStorage.removeItem("alertPrivateText");
  95. }
  96.  
  97. }*/
  98.  
  99.  
  100. var currentTheme = window.localStorage.getItem("theme");
  101. if(currentTheme == null)
  102. currentTheme = 'a';
  103. else
  104. changeTheme(currentTheme);
  105.  
  106. function changeTheme(theme)
  107. {
  108. $("#navbar").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  109. $("#popupNoInternetButton").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  110. $("#content").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  111. $("#leftpanelSettings").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  112. $("#leftpanelUserProfile").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  113. $("#leftpanelMoneyWithdraw").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  114. $("#chatList").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  115. $("#avatarSelect").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  116. $("#leftpanelBuyCredits").removeClass("ui-body-" + currentTheme).addClass("ui-body-" + theme);
  117. $("#theme" + theme).prop('checked', true);
  118. if(theme != currentTheme)
  119. $("#theme" + currentTheme).prop('checked', false);
  120. currentTheme = theme;
  121. window.localStorage.setItem("theme", currentTheme);
  122. }
  123.  
  124. var avatarChangeTime;
  125. function userAvatarUpdate()
  126. {
  127. if(!isInternetConnection)
  128. {
  129. noInternetAlert();
  130. return;
  131. }
  132. if(avatarChangeTime >= Math.floor((new Date()).getTime() / 1000))
  133. {
  134. showWarningMsg("Ne taip dažnai!");
  135. return;
  136. }
  137. var avatarURL = $("#userAvatarInput").val();
  138. if(avatarURL.length == "")
  139. {
  140. showWarningMsg("Įveskite nuorodą!");
  141. return;
  142. }
  143. if(avatarURL.length >= 120)
  144. {
  145. showWarningMsg("Nuoroda per ilga!");
  146. return;
  147. }
  148. $.mobile.loading('show');
  149. avatarChangeTime = Math.floor((new Date()).getTime() / 1000)+10;
  150. $.post("http://sarg.lt/app/avatar.php", {name: userName, avatar: avatarURL, code: "0ay3j5as1Zua55f9T9s2upo", token: userData["token"]}, function ( data )
  151. {
  152. if(data == -2)
  153. showWarningMsg("Bloga nuoroda!");
  154. else if(data == -1)
  155. showWarningMsg("Autorizacijos klaida!");
  156. else if(data == 0)
  157. showWarningMsg("Serveris nepasiekiamas!");
  158. else
  159. {
  160. userData["avatar"] = data;
  161. document.getElementById("avatarSelect").innerHTML = 'Avataras:<br><img src="' + userData["avatar"] + '" alt="Avatar" class="img-circle" width="50" height="50" ><br>\
  162. <br>Tinka .png arba .gif nedidesni už 100x100<input type="url" id="userAvatarInput" class="form-control input-sm" maxlength="120" placeholder="http://"/>\
  163. <button class="ui-btn" onclick="userAvatarUpdate()">Pakeisti</button>';
  164. }
  165. $.mobile.loading('hide');
  166. }
  167. );
  168. document.getElementById("userAvatarInput").value = '';
  169. }
Add Comment
Please, Sign In to add comment