load_something.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. function load_user_info(name) {
  2. var url = "/api/user_info/" + encodeURI(name) + "?render=1";
  3. var xhr = new XMLHttpRequest();
  4. xhr.open("GET", url, true);
  5. xhr.send(null);
  6. xhr.onreadystatechange = function() {
  7. if(this.readyState === 4 && this.status === 200) {
  8. document.getElementById('get_user_info').innerHTML += JSON.parse(this.responseText)['data'];
  9. }
  10. }
  11. }
  12. function load_ver() {
  13. var url = "/api/version";
  14. var xhr = new XMLHttpRequest();
  15. xhr.open("GET", url, true);
  16. xhr.send(null);
  17. xhr.onreadystatechange = function() {
  18. if(this.readyState === 4 && this.status === 200) {
  19. document.getElementById('ver_send').innerHTML += JSON.parse(this.responseText)['lastest_version'];
  20. document.getElementById('ver_send').style.display = "list-item";
  21. }
  22. }
  23. }
  24. function do_skin_ver_check() {
  25. var url = "/api/skin_info?all=true";
  26. var xhr = new XMLHttpRequest();
  27. xhr.open("GET", url, true);
  28. xhr.send(null);
  29. xhr.onreadystatechange = function() {
  30. if(this.readyState === 4 && this.status === 200) {
  31. var json_data = JSON.parse(this.responseText);
  32. var all_need_update = [];
  33. for(var key in json_data) {
  34. if(json_data[key]['lastest_version']) {
  35. var new_skin_ver = json_data[key]['lastest_version']['skin_ver'];
  36. var old_skin_ver = json_data[key]['skin_ver'];
  37. var skin_name = json_data[key]['name'];
  38. if(new_skin_ver !== old_skin_ver) {
  39. all_need_update.push(skin_name);
  40. }
  41. }
  42. }
  43. if(all_need_update.length !== 0) {
  44. document.getElementById('need_skin_update').innerHTML += ' (' + (all_need_update.join(', ')) + ')';
  45. }
  46. }
  47. }
  48. }
  49. function do_twofa_check(init = 0) {
  50. var data_check = document.getElementById('twofa_check_input').checked;
  51. document.getElementById('fa_plus_content').style.display = data_check === true ? "block" : "none";
  52. }
  53. function ie_end_support() {
  54. if(document.currentScript === undefined) {
  55. window.location = 'microsoft-edge:' + window.location;
  56. setTimeout(function() {
  57. window.location = 'https://go.microsoft.com/fwlink/?linkid=2135547';
  58. }, 1);
  59. }
  60. }
  61. ie_end_support();