HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /home/zeusxp5/lrliberia.com/wp-content/themes/lifttruck/resources/js/screen/scripts.js
(function() { 'use strict';

  /*look for any elements with the class "wc-block-product-categories__dropdown":*/
  var CreativeDropdown = document.querySelectorAll(".wc-block-product-categories.is-dropdown.is-creative-style .wc-block-product-categories__dropdown");

  if (CreativeDropdown) {
    var i, j, l, ll, selElmnt, a, b, c;
    l = CreativeDropdown.length;
    for (i = 0; i < l; i++) {
      selElmnt = CreativeDropdown[i].getElementsByTagName("select")[0];
      ll = selElmnt.length;
      /*for each element, create a new DIV that will act as the selected item:*/
      a = document.createElement("DIV");
      a.setAttribute("class", "select-selected");
      a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
      CreativeDropdown[i].appendChild(a);
      /*for each element, create a new DIV that will contain the option list:*/
      b = document.createElement("DIV");
      b.setAttribute("class", "select-items select-hide");
      for (j = 1; j < ll; j++) {
        /*for each option in the original select element,
        create a new DIV that will act as an option item:*/
        c = document.createElement("a");
        c.setAttribute("href", selElmnt.options[j].value);
        c.innerHTML = selElmnt.options[j].innerHTML;
        c.addEventListener("click", function (e) {
          /*when an item is clicked, update the original select box,
          and the selected item:*/
          var y, i, k, s, h, sl, yl;
          s = this.parentNode.parentNode.getElementsByTagName("select")[0];
          sl = s.length;
          h = this.parentNode.previousSibling;
          for (i = 0; i < sl; i++) {
            if (s.options[i].innerHTML == this.innerHTML) {
              s.selectedIndex = i;
              h.innerHTML = this.innerHTML;
              y = this.parentNode.getElementsByClassName("same-as-selected");
              yl = y.length;
              for (k = 0; k < yl; k++) {
                y[k].removeAttribute("class");
              }
              this.setAttribute("class", "same-as-selected");
              break;
            }
          }
          h.click();
        });
        b.appendChild(c);
      }
      CreativeDropdown[i].appendChild(b);
      a.addEventListener("click", function (e) {
        /*when the select box is clicked, close any other select boxes,
        and open/close the current select box:*/
        e.stopPropagation();
        closeAllSelect(this);
        this.nextSibling.classList.toggle("select-hide");
        this.classList.toggle("select-arrow-active");
      });
    }


    function closeAllSelect(elmnt) {
      var selectItems = document.getElementsByClassName("select-items");
      var selectSelectedItems = document.getElementsByClassName("select-selected");
      for (var i = 0; i < selectSelectedItems.length; i++) {
        if (elmnt == selectSelectedItems[i]) {
          continue;
        }
        selectSelectedItems[i].classList.remove("select-arrow-active");
      }
      for (var j = 0; j < selectItems.length; j++) {
        if (selectItems[j].classList.contains("select-hide")) {
          continue;
        }
        selectItems[j].classList.add("select-hide");
      }
    }

    document.addEventListener("click", closeAllSelect);

  }

} )();