index.html 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Admin Panel</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1" >
  7. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  8. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
  10. <style>
  11. body{
  12. overflow: hidden;
  13. }
  14. .windows{
  15. width: 100%;
  16. height: calc(100% - 46px);
  17. background-color: rgb(241, 241, 241);
  18. }
  19. .frameWrapper{
  20. width: 100%;
  21. height: 100%;
  22. }
  23. .frameWrapper iframe{
  24. border: 0px solid transparent;
  25. width: 100%;
  26. height: 100%;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="mainmenu ui inverted menu" style="margin-bottom: 0 !important; border-radius: 0 !important;">
  32. <a class="item" href="/admin/index.html">
  33. <img class="ui tiny image" src="img/icon.svg">
  34. </a>
  35. <a class="active yellow selectable icon item" onclick="switchFrame(event, this);" xframe="fs"><i class="folder icon"></i></a>
  36. <a class="violet selectable icon item" onclick="switchFrame(event, this);" xframe="search"><i class="ui search icon"></i></a>
  37. <a class="green selectable icon item" onclick="switchFrame(event, this);" xframe="shares"><i class="ui share alternate icon"></i></a>
  38. <a class="blue selectable icon item" onclick="switchFrame(event, this);" xframe="users"><i class="ui user icon"></i></a>
  39. <a class="grey selectable icon item" onclick="switchFrame(event, this);" xframe="info"><i class="ui info circle icon"></i></a>
  40. <div class="right menu">
  41. <a class="grey selectable icon item" title="Logout" onclick="handleLogout();"><i class="ui sign-out icon"></i></a>
  42. </div>
  43. </div>
  44. <div class="windows">
  45. <div id="fs" class="frameWrapper">
  46. <iframe src="fs.html"></iframe>
  47. </div>
  48. <div id="search" class="frameWrapper" style="display:none;">
  49. <iframe src="search.html"></iframe>
  50. </div>
  51. <div id="shares" class="frameWrapper" style="display:none;">
  52. <iframe src="shares.html"></iframe>
  53. </div>
  54. <div id="users" class="frameWrapper" style="display:none;">
  55. <iframe src="users.html"></iframe>
  56. </div>
  57. <div id="info" class="frameWrapper" style="display:none;">
  58. <iframe src="info.html"></iframe>
  59. </div>
  60. </div>
  61. <script>
  62. $(".mainmenu .selectable.item").on("click", function(){
  63. $(".mainmenu .item.active").removeClass("active");
  64. $(this).addClass("active");
  65. });
  66. function handleLogout(){
  67. $.get("/api/auth/logout", function(data){
  68. window.location.href = "/index.html";
  69. })
  70. }
  71. function switchFrame(event, object){
  72. event.preventDefault();
  73. let targetFrameID = $(object).attr("xframe");
  74. $(".frameWrapper").hide();
  75. $("#" + targetFrameID).show();
  76. }
  77. //Check login status
  78. function initLoginCheck(){
  79. $.get("/api/auth/chk", function(data){
  80. if (data == false){
  81. window.location.href = "/login.html"
  82. }
  83. });
  84. }
  85. initLoginCheck();
  86. </script>
  87. </body>
  88. </html>