Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.6 kB
3
Indexable
Never
(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";
    var $;
    /* 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 init() {
      if (!document.querySelector(".eg-map-cta")) {
        document.body.classList.add("eg-active");
        document.querySelector('[data-id="filters-button"]').insertAdjacentHTML("afterend", `<button class="eg-map-cta"><span class="eg-text">Show Map</span><span class="eg-icon"><i class="icon-map"></i></span></button>`);
        document.querySelector(".eg-map-cta").addEventListener("click", function () {
          document.body.classList.toggle("eg-active");
          document.querySelector(".eg-map-cta").childNodes[0].innerText = document.body.classList.contains("eg-active") ? "Show Map" : "Hide Map";
        });
        document.querySelector('html body span[data-id="filters-button"]:nth-child(1)').innerText = "Filter & Sort";
      }
    }

    waitForElement('[data-id="filters-button"]', init, 50, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();


html body .eg-map-cta {
    display: flex;
    flex-direction: row;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: space-around;
    width: 162px;
    height: 64px;
    border: 1px solid rgb(215, 215, 215);
    border-radius: 32px;
    background-color: rgb(255, 255, 255);
    cursor: pointer;
    color: rgb(57, 57, 57);
    margin-left: 14px !important;
    padding: 0 20px !important;
}

html body.eg-active .eg-map-cta {
    background: rgb(229, 37, 0) !important;
    color: white !important;
}

html body.eg-active .cardsMapHolder>div:nth-child(2) {
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

html body.eg-active .cardsMapHolder>div:nth-child(1) {
    width: 100% !important;
}

html body .eg-map-cta:hover {
    background-color: rgb(245, 245, 245);
}

html body .eg-text {
    flex: 1;
    justify-content: center;
    margin-left: 0 !important;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    padding-left: 6px;
    display: flex;
    order: 2;
}

html body .eg-icon {
    display: flex;
}


@media(min-width:1024px) {
    html body.eg-active .cardsMapHolder>div:nth-child(1) section>div>div {
        max-width: calc(25% - 8px) !important;
    }
}

@media(max-width:1023px) {
    html body #searchBar-modal+div {
        flex-direction: column !important;
        align-items: center;
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    html body #searchBar-modal+div>div {
        width: 100% !important;
    }

    html body [data-id="filters-button"]>span {
        display: flex !important;
    }

    html body button[data-id="filters-button"],
    .eg-map-cta {
        width: 180px !important;
        height: 40px !important;
        margin-top: 9px !important;
    }

    html body.eg-active .cardsMapHolder>div:first-child>div>div:first-child {
        display: none !important;
    }

    html body.eg-active .cardsMapHolder>div:first-child>div>div:nth-child(2) {
        margin-top: 20px !important;
    }
}