index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <link rel="icon" type="image/png" href="/favicon.png">
  8. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  9. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
  11. <style>
  12. body{
  13. overflow: hidden;
  14. }
  15. .windows{
  16. width: 100%;
  17. height: calc(100% - 46px);
  18. background-color: rgb(241, 241, 241);
  19. }
  20. .frameWrapper{
  21. width: 100%;
  22. height: 100%;
  23. }
  24. .frameWrapper iframe{
  25. border: 0px solid transparent;
  26. width: 100%;
  27. height: 100%;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div class="mainmenu ui inverted menu" style="margin-bottom: 0 !important; border-radius: 0 !important;">
  33. <a class="item" href="/admin/index.html">
  34. <img class="ui tiny image" src="img/icon.svg">
  35. </a>
  36. <a class="active yellow selectable icon item" onclick="switchFrame(event, this);" xframe="fs"><i class="folder icon"></i></a>
  37. <a class="teal selectable icon item" onclick="switchFrame(event, this);" xframe="blog"><i class="ui edit icon"></i></a>
  38. <a class="violet selectable icon item" onclick="switchFrame(event, this);" xframe="search"><i class="ui search icon"></i></a>
  39. <a class="green selectable icon item" onclick="switchFrame(event, this);" xframe="shares"><i class="ui share alternate icon"></i></a>
  40. <a class="blue selectable icon item" onclick="switchFrame(event, this);" xframe="users"><i class="ui user icon"></i></a>
  41. <a class="grey selectable icon item" onclick="switchFrame(event, this);" xframe="info"><i class="ui info circle icon"></i></a>
  42. <div class="right menu">
  43. <a class="grey selectable icon item" title="Logout" onclick="handleLogout();"><i class="ui sign-out icon"></i></a>
  44. </div>
  45. </div>
  46. <div class="windows">
  47. <div id="fs" class="frameWrapper">
  48. <iframe src="fs.html"></iframe>
  49. </div>
  50. <div id="blog" class="frameWrapper">
  51. <iframe src="blog.html"></iframe>
  52. </div>
  53. <div id="search" class="frameWrapper" style="display:none;">
  54. <iframe src="search.html"></iframe>
  55. </div>
  56. <div id="shares" class="frameWrapper" style="display:none;">
  57. <iframe src="shares.html"></iframe>
  58. </div>
  59. <div id="users" class="frameWrapper" style="display:none;">
  60. <iframe src="users.html"></iframe>
  61. </div>
  62. <div id="info" class="frameWrapper" style="display:none;">
  63. <iframe src="info.html"></iframe>
  64. </div>
  65. </div>
  66. <script>
  67. $(".mainmenu .selectable.item").on("click", function(){
  68. $(".mainmenu .item.active").removeClass("active");
  69. $(this).addClass("active");
  70. });
  71. function handleLogout(){
  72. $.get("/api/auth/logout", function(data){
  73. window.location.href = "/index.html";
  74. })
  75. }
  76. function switchFrame(event, object){
  77. event.preventDefault();
  78. let targetFrameID = $(object).attr("xframe");
  79. $(".frameWrapper").hide();
  80. $("#" + targetFrameID).show();
  81. window.location.hash = targetFrameID;
  82. }
  83. //Check login status
  84. function initLoginCheck(){
  85. $.get("/api/auth/chk", function(data){
  86. if (data == false){
  87. window.location.href = "/login.html"
  88. }
  89. });
  90. }
  91. initLoginCheck();
  92. // Restore previously selected frame on page load
  93. if (window.location.hash.length > 1) {
  94. let targetFrameID = window.location.hash.substring(1);
  95. if ($("#" + targetFrameID).length) {
  96. $(".frameWrapper").hide();
  97. $("#" + targetFrameID).show();
  98. $(".mainmenu .item.active").removeClass("active");
  99. $(".mainmenu .item[xframe='" + targetFrameID + "']").addClass("active");
  100. }
  101. }
  102. </script>
  103. </body>
  104. </html>