2
0

load_something.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 send_render(i = 0) {
  54. var get_class = document.getElementsByClassName('send_content')[i];
  55. if(get_class) {
  56. send_render(i + 1);
  57. var data = get_class.innerHTML;
  58. if(data === '<br>') {
  59. document.getElementsByClassName('send_content')[i].innerHTML = '<br>';
  60. } else {
  61. data = data.replace(/javascript:/i, '');
  62. data = data.replace(/&lt;a&gt;((?:(?!&lt;\/a&gt;).)+)&lt;\/a&gt;/g, function(x, x_1) {
  63. return '<a href="/w/' + encodeURIComponent(x_1) + '">' + x_1 + '</a>';
  64. });
  65. document.getElementsByClassName('send_content')[i].innerHTML = data;
  66. }
  67. }
  68. }
  69. function ie_end_support() {
  70. if(document.currentScript === undefined) {
  71. window.location = 'microsoft-edge:' + window.location;
  72. setTimeout(function() {
  73. window.location = 'https://go.microsoft.com/fwlink/?linkid=2135547';
  74. }, 1);
  75. }
  76. }
  77. ie_end_support();