index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <meta name="apple-mobile-web-app-capable" content="yes" />
  3. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6"/>
  4. <html>
  5. <head>
  6. <meta charset="UTF-8">
  7. <script type='text/javascript' charset='utf-8'>
  8. // Hides mobile browser's address bar when page is done loading.
  9. window.addEventListener('load', function(e) {
  10. setTimeout(function() { window.scrollTo(0, 1); }, 1);
  11. }, false);
  12. </script>
  13. <title>ArOZ Onlineβ</title>
  14. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  15. <script src="../../../script/tocas/tocas.js"></script>
  16. <script src="../../../script/jquery.min.js"></script>
  17. </head>
  18. <body style="background-color: rgb(247, 247, 247);">
  19. <div class="ts container">
  20. <br>
  21. <div class="ts segment">
  22. <div class="ts header">
  23. Timezone configuration
  24. <div class="sub header">You could change the timezone.</div>
  25. </div>
  26. </div>
  27. <div class="ts divider"></div>
  28. <div class="ts segment">
  29. <div class="ts divided items">
  30. <div class="ts form">
  31. <div class="field">
  32. <label>Change timezone</label>
  33. <select id="tz">
  34. </select>
  35. </div>
  36. <div class="field">
  37. <button class="ts button" onclick="changetimezone()">Apply</button>
  38. </div>
  39. </div>
  40. <p>
  41. The system synchronizes to NTP server.
  42. </p>
  43. </div>
  44. </div>
  45. <br><br><br>
  46. </div>
  47. </div>
  48. <div class="ts bottom right snackbar">
  49. <div class="content"></div>
  50. </div>
  51. <script>
  52. var computerTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
  53. var serverTZ = "";
  54. update();
  55. function update(){
  56. $.get("opr.php?opr=query", function (data) {
  57. var currTime = JSON.parse(data);
  58. serverTZ = currTime["timezone"];
  59. updatelist();
  60. });
  61. }
  62. function updatelist(){
  63. $("#tz").html('<option linuxtz="NA" wintz="NA">Updating...</option>');
  64. $.get("opr.php?opr=alltimezone", function (data) {
  65. $("#tz").html("");
  66. var timezone = JSON.parse(data);
  67. $.each(timezone, function(i, field){
  68. var friendlyname = field[0];
  69. if(serverTZ == field[1]){
  70. friendlyname = friendlyname + " (Current)";
  71. }
  72. if(computerTZ == field[1]){
  73. friendlyname = friendlyname + " (Suggested)";
  74. }
  75. $("#tz").append('<option linuxtz="' + field[1] + '" wintz="' + field[2] + '">' + friendlyname + "</option>");
  76. });
  77. $('#tz option[linuxtz="' + serverTZ + '"]').attr('selected','selected');
  78. });
  79. }
  80. function changetimezone(){
  81. $.ajax({url:"opr.php?opr=modify&tz=" + $('#tz option:selected').attr('linuxtz'),async:false});
  82. msg("Success.");
  83. update();
  84. }
  85. function msg(content) {
  86. ts('.snackbar').snackbar({
  87. content: content,
  88. actionEmphasis: 'negative',
  89. });
  90. }
  91. </script>
  92. </body>
  93. </html>