home.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Copyright 2021, 2024 5 Mode
  3. *
  4. * This file is part of 5 Cube.
  5. *
  6. * 5 Cube is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * 5 Cube is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  18. *
  19. * home.js
  20. *
  21. * JS for home.php.
  22. *
  23. * @author Daniele Bonini <my25mb@aol.com>
  24. * @copyrights (c) 2021, 2024, 5 Mode
  25. */
  26. /*
  27. * Display the current hash for the config file
  28. *
  29. * @returns void
  30. */
  31. function showEncodedPassword() {
  32. if ($("#Password").val() === "") {
  33. $("#Password").addClass("emptyfield");
  34. return;
  35. }
  36. if ($("#Salt").val() === "") {
  37. $("#Salt").addClass("emptyfield");
  38. return;
  39. }
  40. passw = encryptSha2( $("#Password").val() + $("#Salt").val());
  41. msg = "Please set your hash in the config file with this value:";
  42. alert(msg + "\n\n" + passw);
  43. }
  44. function setFooterPos() {
  45. if (document.getElementById("footerCont")) {
  46. //if ($("#Password").val() === "") {
  47. // tollerance = 48;
  48. // } else {
  49. // tollerance = 15;
  50. //}
  51. tollerance = 22;
  52. $("#footerCont").css("top", parseInt( window.innerHeight - $("#footerCont").height() - tollerance ) + "px");
  53. $("#footer").css("top", parseInt( window.innerHeight - $("#footer").height() - tollerance + 6) + "px");
  54. }
  55. }
  56. function setContentPos() {
  57. $("#cubeList").css("height", parseInt(window.innerHeight-20) + "px");
  58. }
  59. window.addEventListener("load", function() {
  60. if ($("#cubeList").css("display")==="none") {
  61. setTimeout("setFooterPos()", 9000);
  62. } else {
  63. setTimeout("setFooterPos()", 2000);
  64. }
  65. });
  66. window.addEventListener("resize", function() {
  67. if ($("#cubeList").css("display")==="none") {
  68. setTimeout("setFooterPos()", 9000);
  69. } else {
  70. setTimeout("setFooterPos()", 2000);
  71. }
  72. });