index.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. <label>Change NTP Server</label>
  38. <div class="ts floating dropdown labeled icon button" style="padding: 0em;padding-left: 3em!important;padding-right: 0em!important;">
  39. <i class="dropdown icon"></i>
  40. <span class="text">
  41. <div class="ts basic fluid input">
  42. <input type="text" id="ntp" placeholder="Netowk Time Server (NTP)">
  43. </div>
  44. </span>
  45. <div class="menu">
  46. <div class="header">
  47. <i class="server icon"></i> Recommended NTP server
  48. </div>
  49. <div class="item">ntp.google.com</div>
  50. <div class="item">0.pool.ntp.org</div>
  51. <div class="item">time-a-g.nist.gov</div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="field">
  56. <button class="ts button" onclick="changetimezone()">Apply</button>
  57. </div>
  58. </div>
  59. <p>
  60. Please aware that a significant time difference might cause system services to crash unexpectedly.
  61. </p>
  62. </div>
  63. </div>
  64. <br><br><br>
  65. </div>
  66. </div>
  67. <div class="ts bottom right snackbar">
  68. <div class="content"></div>
  69. </div>
  70. <script>
  71. //enable the dropdown feature
  72. $(".ts.dropdown:not(.basic) > .menu > .item").click(function(elem) {
  73. $(this).parent().parent().children("span").children("div").children("input").val($(this).html());
  74. });
  75. ts('.ts.dropdown:not(.basic)').dropdown();
  76. $(".ts.fluid.input").click(function(e) {
  77. e.stopPropagation();
  78. });
  79. var computerTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
  80. var serverTZ = "";
  81. var serverNTP = "";
  82. update();
  83. function update(){
  84. $.get("opr.php?opr=query", function (data) {
  85. var currTime = JSON.parse(data);
  86. serverTZ = currTime["timezone"];
  87. serverNTP = currTime["ntpserver"];
  88. $("#ntp").val(serverNTP);
  89. updatelist();
  90. });
  91. }
  92. function updatelist(){
  93. $("#tz").html('<option linuxtz="NA" wintz="NA">Updating...</option>');
  94. $.get("opr.php?opr=alltimezone", function (data) {
  95. $("#tz").html("");
  96. var timezone = JSON.parse(data);
  97. $.each(timezone, function(i, field){
  98. var friendlyname = field[0];
  99. if(serverTZ == field[1]){
  100. friendlyname = friendlyname + " (Current)";
  101. }
  102. if(computerTZ == field[1]){
  103. friendlyname = friendlyname + " (Suggested)";
  104. }
  105. $("#tz").append('<option linuxtz="' + field[1] + '" wintz="' + field[2] + '">' + friendlyname + "</option>");
  106. });
  107. $('#tz option[linuxtz="' + serverTZ + '"]').attr('selected','selected');
  108. });
  109. }
  110. function changetimezone(){
  111. $.ajax({url:"opr.php?opr=modify&tz=" + $('#tz option:selected').attr('linuxtz') + "&ntpserver=" + $('#ntp').val(),async:false});
  112. msg("Success.");
  113. update();
  114. }
  115. function msg(content) {
  116. ts('.snackbar').snackbar({
  117. content: content,
  118. actionEmphasis: 'negative',
  119. });
  120. }
  121. </script>
  122. </body>
  123. </html>