Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
12 kB
3
Indexable
Never
//.header-banner.header-row-brands.d-none

(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";
    /* all Pure helper functions */
    function waitForElement(selector, trigger, delayInterval, delayTimeout) {
      var interval = setInterval(function () {
        if (
          document &&
          document.querySelector(selector) &&
          document.querySelectorAll(selector).length > 0
        ) {
          clearInterval(interval);
          trigger();
        }
      }, delayInterval);
      setTimeout(function () {
        clearInterval(interval);
      }, delayTimeout);
    }

 function live(selector, event, callback, context) {
    /****Helper Functions****/
    // helper for enabling IE 8 event bindings
    function addEvent(el, type, handler) {
      if (el.attachEvent) el.attachEvent("on" + type, handler);
      else el.addEventListener(type, handler);
    }
    // matches polyfill
    this.Element &&
      (function (ElementPrototype) {
        ElementPrototype.matches =
          ElementPrototype.matches ||
          ElementPrototype.matchesSelector ||
          ElementPrototype.webkitMatchesSelector ||
          ElementPrototype.msMatchesSelector ||
          function (selector) {
            var node = this,
              nodes = (
                node.parentNode || node.document
              ).querySelectorAll(selector),
              i = -1;
            while (nodes[++i] && nodes[i] != node);
            return !!nodes[i];
          };
      })(Element.prototype);
    // live binding helper using matchesSelector
    function live(selector, event, callback, context) {
      addEvent(context || document, event, function (e) {
        var found,
          el = e.target || e.srcElement;
        while (
          el &&
          el.matches &&
          el !== context &&
          !(found = el.matches(selector))
        )
          el = el.parentElement;
        if (found) callback.call(el, e);
      });
    }
    live(selector, event, callback, context);
  }



    var egHeroText = `<h2 class="eg-heading">Fired Up For Fall</h2>
    <p class="eg-para">Hut hopping kits to bonfires and après  firepit fits-get fired up for dropping temps and dropping in.</p>
    <div class="eg-button-container">
        <a href="/men/new-arrivals/" target="_self" class="eg-button btn large btn-black solid-fill">Shop Men</a>
        <a href="/women/new-arrivals/" target="_self" class="eg-button btn large btn-black solid-fill">Shop Women</a>
    </div>`;


    var egArrow = '' +
      `<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.22644 6.05006L4.00394 3.39838L6.78144 6.05006C7.06069 6.31665 7.51169 6.31665 7.79094 6.05006C8.07019 5.78347 8.07019 5.35291 7.79094 5.08658L4.50494 1.94994C4.22569 1.68335 3.77469 1.68335 3.49544 1.94994L0.209438 5.08658C-0.0698125 5.35317 -0.0698125 5.78373 0.209438 6.05006C0.488688 6.30969 0.946687 6.31665 1.22594 6.05006H1.22644Z" fill="black"/>
</svg>`;

    var egoption2 = `<div class="eg-top-bar"><div class="eg-navwrap container">
    <ul id="eg-nav" class="eg-nav">
        <li>
            <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-8.svg" alt="Jacket &amp; Vests"> Jacket &amp; Vests `+ egArrow + `</div>
            <ul class="eg-dropdown eg-jackets">
              <li><a href="/men/jackets-and-vests/">Shop Men</a></li>
              <li><a href="/women/jackets-and-vests/">Shop Women</a></li>
            </ul>
        </li>
      <li>
          <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-12.svg" alt="Sleeping Bags"> Sleeping Bags `+ egArrow + `</div>
      <ul class="eg-dropdown eg-sleeping-bags">
          <li><a href="">Shop Men</a></li>
          <li><a href="">Shop Women</a></li>
          <li><a href="/sleepingbagfinder.html">Take our Bag Finder Quiz</a></li>
      </ul>
      </li>
      <li>
        <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-9.svg" alt="Tops"> Tops `+ egArrow + `</div>
    <ul class="eg-dropdown tops">
        <li><a href="/men/tops/">Shop Men</a></li>
        <li><a href="/women/tops/">Shop Women</a></li>
    </ul>
    </li>
      <li>
        <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-11.svg" alt="Rainwear"> Rainwear `+ egArrow + `</div>
      <ul class="eg-dropdown eg-rainwear">
        <li><a href="/men/jackets-and-vests/rainwear/">Shop Men</a></li>
        <li><a href="/women/jackets-and-vests/rainwear/">Shop Women</a></li>
      </ul>
    </li>
      <li>
          <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-9.svg" alt="Bottoms"> Bottoms `+ egArrow + `</div>
      <ul class="eg-dropdown bottoms">
          <li><a href="/men/bottoms/">Shop Men</a></li>
          <li><a href="/women/bottoms/">Shop Women</a></li>
      </ul>
      </li>
      <li>
        <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-14.svg" alt="Tents"> Tents `+ egArrow + `</div>
    <ul class="eg-dropdown eg-tents">
        <li><a href="">Shop Men</a></li>
        <li><a href="">Shop Women</a></li>
    </ul>
    </li>
    </ul>
  </div>
  </div>
  <div class="eg-mobile-bar">
      <div class="eg-navwrap container">
          <ul id="eg-nav" class="eg-nav">
            <li>
                <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-8.svg"
                    alt="Jacket &amp; Vests"> Jacket &amp; Vests `+ egArrow + `</div>
            <div class="eg-dropdown-outer">
                <span>&times;</span>
                <ul class="eg-dropdown eg-jackets">
                    <li>
                        <p class="eg-item-title">Jacket &amp; Vests</p>
                    </li>
                    <li><a href="/men/jackets-and-vests/">Shop Men</a></li>
                    <li><a href="/women/jackets-and-vests/">Shop Women</a></li>
                </ul>
            </div>
            </li>
              <li>
                  <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-12.svg"
                      alt="Sleeping Bags"> Sleeping Bags `+ egArrow + `</div>
              <div class="eg-dropdown-outer">
                  <span>&times;</span>
                  <ul class="eg-dropdown eg-sleeping-bags">
                      <li>
                          <p class="eg-item-title">Sleeping Bags</p>
                      </li>
                      <li><a href="">Shop Men</a></li>
                      <li><a href="">Shop Women</a></li>
                      <li><a href="/sleepingbagfinder.html">Take our Bag Finder Quiz</a></li>
                  </ul>
              </div>
              </li>
              <li>
                  <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-9.svg"
                      alt="Tops"> Tops `+ egArrow + `</div>
              <div class="eg-dropdown-outer">
                  <span>&times;</span>
                  <ul class="eg-dropdown tops">
                      <li>
                          <p class="eg-item-title">Tops</p>
                      </li>
                      <li><a href="/men/tops/">Shop Men</a></li>
                      <li><a href="/women/tops/">Shop Women</a></li>
                  </ul>
              </div>
              </li>
              <li>
                <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-11.svg"
                    alt="Rainwear"> Rainwear `+ egArrow + `</div>
            <div class="eg-dropdown-outer">
                <span>&times;</span>
                <ul class="eg-dropdown eg-rainwear">
                    <li>
                        <p class="eg-item-title">Rainwear</p>
                    </li>
                    <li><a href="/men/jackets-and-vests/rainwear/">Shop Men</a></li>
                    <li><a href="/women/jackets-and-vests/rainwear/">Shop Women</a></li>
                </ul>
            </div>
            </li>
              <li>
                  <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-9.svg"
                      alt="Bottoms"> Bottoms `+ egArrow + `</div>
              <div class="eg-dropdown-outer">
                  <span>&times;</span>
                  <ul class="eg-dropdown bottoms">
                      <li>
                          <p class="eg-item-title">Bottoms</p>
                      </li>
                      <li><a href="/men/bottoms/">Shop Men</a></li>
                      <li><a href="/women/bottoms/">Shop Women</a></li>
                  </ul>
              </div>
              </li>
              <li>
                <div class="select-styled"><img src="https://expogrowth.in/wp-content/uploads/2023/09/image-14.svg"
                    alt="Tents"> Tents `+ egArrow + `</div>
            <div class="eg-dropdown-outer">
                <span>&times;</span>
                <ul class="eg-dropdown eg-tents">
                    <li>
                        <p class="eg-item-title">Tents</p>
                    </li>
                    <li><a href="">Shop Men</a></li>
                    <li><a href="">Shop Women</a></li>
                </ul>
            </div>
            </li>

          </ul>
      </div>
  </div>`;

    function init() {

      document.querySelector('.storepage .experience-commerce_layouts-masonrybrick:nth-child(2) .col-lg-3.layout-region .text-container').innerHTML = egHeroText;

    
      window.addEventListener('scroll', () => {
        if(window.pageYOffset >= document.querySelector('body header.hasStickyNav').clientHeight){
        document.body.classList.add('eg-sticky-element');
    }else{
        document.body.classList.remove('eg-sticky-element');
        
    }
    })


      document.querySelector('.storepage .experience-commerce_layouts-masonrybrick:nth-child(2)').insertAdjacentHTML('afterend', egoption2);

      document.querySelectorAll('.eg-nav .select-styled').forEach(function (element) {
        element.addEventListener('click', function () {
          const activeDropdown = document.querySelector('.eg-nav .select-styled.eg-dropdown-active');

          if (activeDropdown && activeDropdown !== this) {
            activeDropdown.classList.remove('eg-dropdown-active');
            document.querySelector('body').classList.remove('eg-popup');
          }
          
          this.classList.toggle('eg-dropdown-active');
          document.querySelector('body').classList.add('eg-popup');
        });
      });

      (function () {
        // detect touch
        if ("ontouchstart" in document.documentElement) {
          document.documentElement.className += " touch-device";
        }
      
        const scroller = document.querySelector(".eg-mobile-bar .eg-navwrap");
        const egdropdown = document.querySelectorAll("eg-mobile-bar .eg-dropdown-outer");
        scroller.addEventListener("scroll", checkScroll);
      
        function checkScroll() {
          document.activeElement.blur();
         scroller.classList.add("isScrolling");
          for (let i = 0; i < egdropdown.length; i++) {
            egdropdown[i].style.transform =
              "translateX(-" + scroller.scrollLeft + "px)";
          }
         scroller.classList.remove("isScrolling");
        }
      })();

      live('.eg-dropdown-outer span', 'click', function(){
        document.querySelector('.eg-mobile-bar .select-styled.eg-dropdown-active').classList.remove('eg-dropdown-active');
        document.querySelector('body').classList.remove('eg-popup');
      });

      live('.header-banner.header-row-brands button', 'click', function(){
        document.body.classList.add('eg-no-banner');
      });

    }
    function noBanner(){
        document.body.classList.add('eg-no-banner');
    }

    /* Initialise variation */
    waitForElement(".storepage .experience-commerce_layouts-masonrybrick:nth-child(2) .col-lg-3.layout-region .text-container", init, 100, 25000);
    waitForElement('.header-banner.header-row-brands.d-none',noBanner,50,10000);

  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();