|
@@ -0,0 +1,111 @@
|
|
|
+/**
|
|
|
+ * Copyright 2021, 2024 5 Mode
|
|
|
+ *
|
|
|
+ * This file is part of Http Console.
|
|
|
+ *
|
|
|
+ * Http Console is free software: you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
|
+ * (at your option) any later version.
|
|
|
+ *
|
|
|
+ * Http Console is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ * GNU General Public License for more details.
|
|
|
+ *
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
+ * along with Http Console. If not, see <https://www.gnu.org/licenses/>.
|
|
|
+ *
|
|
|
+ * home.js
|
|
|
+ *
|
|
|
+ * JS file for Home page
|
|
|
+ *
|
|
|
+ * @author Daniele Bonini <my25mb@aol.com>
|
|
|
+ * @copyrights (c) 2021, 2024, the Open Gallery's contributors
|
|
|
+ */
|
|
|
+
|
|
|
+function closeSplash() {
|
|
|
+ $("#hideSplash").val("1");
|
|
|
+ $("#splash").hide();
|
|
|
+}
|
|
|
+
|
|
|
+function startApp() {
|
|
|
+ if (document.getElementById("HCsplash")) {
|
|
|
+ $("#HCsplash").hide();
|
|
|
+ $("#frmHC").show();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Encrypt the given string
|
|
|
+ *
|
|
|
+ * @param {string} string - The string to encrypt
|
|
|
+ * @returns {string} the encrypted string
|
|
|
+ */
|
|
|
+function encryptSha2(string) {
|
|
|
+ var jsSHAo = new jsSHA("SHA-256", "TEXT", 1);
|
|
|
+ jsSHAo.update(string);
|
|
|
+ return jsSHAo.getHash("HEX");
|
|
|
+}
|
|
|
+
|
|
|
+function setFooterPos() {
|
|
|
+ if (document.getElementById("footerCont")) {
|
|
|
+ tollerance = 25;
|
|
|
+ $("#footerCont").css("top", parseInt( window.innerHeight - $("#footerCont").height() - tollerance ) + "px");
|
|
|
+ $("#footer").css("top", parseInt( window.innerHeight - $("#footer").height() - tollerance ) + "px");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function showEncodedPassword() {
|
|
|
+ if ($("#Password").val() === "") {
|
|
|
+ $("#Password").addClass("emptyfield");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ($("#Salt").val() === "") {
|
|
|
+ $("#Salt").addClass("emptyfield");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ passw = encryptSha2( $("#Password").val() + $("#Salt").val());
|
|
|
+ msg = "Please set your password in the config file with this value:";
|
|
|
+ alert(msg + "\n\n" + passw);
|
|
|
+}
|
|
|
+
|
|
|
+function upload() {
|
|
|
+ $("input#files").click();
|
|
|
+}
|
|
|
+
|
|
|
+$("input#files").on("change", function(e) {
|
|
|
+ frmHC.submit();
|
|
|
+});
|
|
|
+
|
|
|
+$("#Password").on("keydown", function(e){
|
|
|
+ $("#Password").removeClass("emptyfield");
|
|
|
+});
|
|
|
+
|
|
|
+$("#Salt").on("keydown", function(e){
|
|
|
+ $("#Salt").removeClass("emptyfield");
|
|
|
+});
|
|
|
+
|
|
|
+window.addEventListener("load", function() {
|
|
|
+
|
|
|
+ setTimeout("setFooterPos()", 3000);
|
|
|
+
|
|
|
+ $(".footer").css("width", parseInt(window.innerWidth)+"px");
|
|
|
+ $("#footerCont").css("width", parseInt(window.innerWidth)+"px");
|
|
|
+
|
|
|
+ setTimeout("startApp()", 5000);
|
|
|
+
|
|
|
+ document.getElementById("CommandLine").focus();
|
|
|
+
|
|
|
+}, true);
|
|
|
+
|
|
|
+window.addEventListener("resize", function() {
|
|
|
+
|
|
|
+ setTimeout("setFooterPos()", 3000);
|
|
|
+
|
|
|
+ $(".footer").css("width", parseInt(window.innerWidth)+"px");
|
|
|
+ $("#footerCont").css("width", parseInt(window.innerWidth)+"px");
|
|
|
+
|
|
|
+}, true);
|
|
|
+
|
|
|
+
|