123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- /**
- * Copyright 2021, 2024 5 Mode
- *
- * This file is part of SnipSwap.
- *
- * SnipSwap 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.
- *
- * SnipSwap 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 SnipSwap. If not, see <https://www.gnu.org/licenses/>.
- *
- * home.js
- *
- * JS file for Home page
- *
- * @author Daniele Bonini <my25mb@aol.com>
- * @copyrights (c) 2016, 2024, 5 Mode
- */
- /*
- * Boot up code
- */
- //var fetchDataIntervalId;
- /*
- * App starting proc
- *
- * @returns void
- */
- function startApp() {
- window.name = encryptSha2(rnd(0,99999999)+"");
-
- $(document.body).css("background","#FFFFFF");
- $("#HCsplash").css("display","none");
- $(".body-area").show();
- $(".header2").show();
-
- //fetchDataIntervalId = setInterval("_fetchData()", 2000);
- }
- /*
- * call to startApp
- *
- * @returns void
- */
- function _startApp() {
- setTimeout("startApp()", 1000);
- }
-
- window.addEventListener("load", function() {
- //Splash
- if (firstaccess===1) {
- $("#HCsplash").show();
- }
-
- }, true);
-
- window.addEventListener("load", function() {
- if (firstaccess===1) {
- $(document.body).css("background","#0d0d0d");
- $(".body-area").hide();
- // Fisnished the Intro load the app..
- setTimeout("_startApp()", 6000);
- } else {
- $("#HCsplash").hide();
- _startApp();
- }
-
- // A bit of preload..
- });
- window.addEventListener("resize", function() {
- //if ($("#cubeList").css("display")==="none") {
- // setTimeout("setFooterPos()", 9000);
- //} else {
- // setTimeout("setFooterPos()", 2000);
- //}
- });
- // -- End Boot up code
- /*
- * Display the current hash for the config file
- *
- * @returns void
- */
- function showEncodedPassword() {
- if ($("#Password").val() === "") {
- $("#Password").addClass("emptyfield");
- return;
- }
- passw = encryptSha2( $("#Password").val() );
- msg = "Please set your new pasword in the config file with this value:";
- alert(msg + "\n\n" + passw);
- }
- function initLinkTooltip() {
- $("div.link-div").each(function(){
- $(this).tooltip({
- position: {
- my: "left+20 top+76",
- at: "left top",
- collision: "none"
- }
- });
- });
- }
- function setContentPosHome() {
- bodyRect = document.body.getBoundingClientRect();
- bodyRect.width = window.innerWidth;
-
- $(".snip-code").css("height", parseInt((window.innerHeight * 30) / 100) + "px");
- mytop = parseInt(window.innerHeight - ($("#passworddisplay").height() + 60));
- $("#passworddisplay").css("top", mytop+"px");
- tollerance = 180;
- frmSearchRect = document.getElementById("frmSearch").getBoundingClientRect();
- catListRect = document.getElementById("catList").getBoundingClientRect();
- vertHeight = frmSearchRect.height + catListRect.height + tollerance;
- if (bodyRect.width < 500) {
- $(".header").css("height",vertHeight);
- $("#logo-div").css("margin-left","39%");
- $("#frmSearch").css("left","");
- $("#frmSearch").css("float","none");
- $("#frmSearch").css("clear","both");
- $("#frmSearch").css("margin","auto");
- $("#form-vert-bar").hide();
- $("#form-ori-sep1").show();
- $(".link-div").css("float", "none");
- $(".link-div").css("clear", "both");
- $(".link-div").css("margin", "auto");
- $(".link-div").css("padding-left", "10px");
- $(".link-div").css("padding-right", "10px");
- } else if (bodyRect.width < 950) {
- $(".header").css("height",vertHeight);
- $("#logo-div").css("margin-left","39%");
- $("#frmSearch").css("left","-5%");
- $("#frmSearch").css("float","none");
- $("#frmSearch").css("clear","both");
- $("#frmSearch").css("margin","auto");
- $("#form-vert-bar").hide();
- $("#form-ori-sep1").show();
- $(".link-div").css("float", "left");
- $(".link-div").css("clear", "");
- $(".link-div").css("margin", "");
- $(".link-div").css("padding-left", "10px");
- $(".link-div").css("padding-right", "10px");
- } else {
- $(".header").css("height","228px");
- $("#logo-div").css("margin-left","46%");
- $("#frmSearch").css("left","+25px");
- $("#frmSearch").css("float","left");
- $("#frmSearch").css("clear","none");
- $("#frmSearch").css("margin","");
- $("#form-vert-bar").show();
- $("#form-ori-sep1").hide();
- $(".link-div").css("float", "left");
- $(".link-div").css("clear", "");
- $(".link-div").css("margin", "");
- $(".link-div").css("padding-left", "10px");
- $(".link-div").css("padding-right", "10px");
- }
- }
- window.addEventListener("load", function() {
- setTimeout("initLinkTooltip()", 1500);
- setContentPosHome();
-
- }, true);
- window.addEventListener("resize", function() {
-
- setTimeout("setContentPosHome()", 2000);
-
- }, true);
|