HEX
Server: Apache/2
System: Linux saturn 4.18.0-477.15.1.lve.2.el8.x86_64 #1 SMP Wed Aug 2 10:43:45 UTC 2023 x86_64
User: centuryt (1072)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/centuryt/public_html/wp-content/themes/vinowine/resource/js/custom.js
/**
 * Custom JS for theme elements
 */

/**
 * Wocommerce active class for category list
 */
let vinoWineurl = window.location.href;
const vinoWinecatLink = document.querySelectorAll(
  ".wc-block-product-categories-list li a"
);
vinoWinecatLink.forEach((item) => {
  if (item.href === vinoWineurl) {
    item.classList.add("active");
  }
});

/*
    Add class in body when search clicked
*/
let vinoWinesearchBtn = document.querySelector(".search-controller svg.search");

if (vinoWinesearchBtn !== null) {
  vinoWinesearchBtn.addEventListener("click", function (e) {
    document.body.classList.remove("open-social");
    document.body.classList.add("open-search");
    document.body.addEventListener("click", function () {
      document.body.classList.remove("open-search");
    });

    let vinoWinesearchContainer = document.querySelector(".search-container");
    vinoWinesearchContainer.addEventListener("click", function (e) {
      e.stopPropagation();
    });

    var vinoWinesearchInput = document.querySelector(".wp-block-search__input");
    window.setTimeout(() => vinoWinesearchInput.focus(), 0);
  });
}

var vinoWinesearchBtnClose = document.querySelector(
  ".search-controller svg.cross"
);

if (vinoWinesearchBtnClose !== null) {
  vinoWinesearchBtnClose.addEventListener("click", function (e) {
    document.body.classList.remove("open-search");

  });
}


/*
    Add class in body when social clicked
*/
let vinoWinesocialBtn = document.querySelector(".social-controller svg.social");

if (vinoWinesocialBtn !== null) {
  vinoWinesocialBtn.addEventListener("click", function (e) {
    document.body.classList.remove("open-search");
    document.body.classList.add("open-social");
    document.body.addEventListener("click", function () {
      document.body.classList.remove("open-social");
    });

    let vinoWinesocialContainer = document.querySelector(".social-container");
    vinoWinesocialContainer.addEventListener("click", function (e) {
      e.stopPropagation();
    });

    var vinoWinesocialInput = document.querySelector(".wp-block-social__input");
    window.setTimeout(() => vinoWinesocialInput.focus(), 0);
  });
}

var vinoWinesocialBtnClose = document.querySelector(
  ".social-controller svg.cross"
);

if (vinoWinesocialBtnClose !== null) {
  vinoWinesocialBtnClose.addEventListener("click", function (e) {
    document.body.classList.remove("open-social");

  });
}

/*
    Add blinker on input field when active
*/
let vinoWineblinkerField = document.querySelector(".social-controller svg.search");

if (vinoWineblinkerField !== null) {
  vinoWineblinkerField.addEventListener("click", function () {
    var vinoWinesearchInput = document.querySelector(".wp-block-search__input");
        window.setTimeout(() => vinoWinesearchInput.focus(), 0);
  });
}