Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
10 kB
3
Indexable
Never
/*fecli-injected JavaScript*/
  ;(function(){
    var style=document.createElement('style');style.type='text/css';style.appendChild(document.createTextNode('[class*=\'pictureWrapper\']::before {    content: "";    position: absolute;    width: 100%;    height: 100%;    background-color: rgba(0, 0, 0, 0);    opacity: 0;    transition: opacity 0.3s ease;    z-index: 1;}[class*=\'cardWrapper\']>a:hover [class*=\'pictureWrapper\']::before {    background-color: rgba(0, 0, 0, 0.5);    opacity: 1;}[class*=\'cardWrapper\']>a::before {    content: "";    position: absolute;    top: 0;    left: 0;    border-radius: 20px;    width: 100%;    height: 100%;    background-color: rgba(0, 0, 0, 0);    opacity: 0;    transition: opacity 0.3s ease;    z-index: 2;}[data-item="result-card"]>div:last-child {    padding-bottom: 5px;}[class*=\'cardWrapper\']>a:hover::before {    background-color: rgba(0, 0, 0, 0.1);}/* [class*=\'cardWrapper\']>a:hover {    opacity: 0.99;} */.eg-quote-button {    color: rgb(255, 255, 255);    cursor: pointer;    background: rgb(229, 37, 0);    padding: 4px 40px 4px 16px;    border-radius: 16px;    font-size: 14px;    font-weight: 500;    line-height: 24px;    text-decoration: none;    z-index: 3;    position: relative;    margin-bottom: 10px;    pointer-events: all;    font-family: Effra !important;}.eg-quote-button::after {    content: "";    background-image: url(/icons/media/arrow-right-white.svg);    background-repeat: no-repeat;    background-position: 50% 50%;    position: absolute;    right: 15px;    top: 50%;    width: 16px;    height: 16px;    margin: -8px 0px 0px;    background-size: cover;}.eg-learn-more-button {    color: black;    cursor: pointer;    background: #ffffff;    padding: 4px 16px 4px 16px;    border-radius: 16px;    font-size: 14px;    font-weight: 500;    line-height: 24px;    text-decoration: none;    z-index: 3;    position: relative;    border: none;    display: flex;    align-items: center;    justify-content: center;    font-family: \'effra\';}div[class*="-cardWrapper"]:hover .eg-button-wrapper {    display:flex;   }div[class*="-cardWrapper"]:has(.eg-button-wrapper:hover) a[data-item="result-card"] {    box-shadow:rgba(0, 0, 0, 0.08) 0px 10px 80px !important;   }div[class*="-cardWrapper"]:hover a[data-item="result-card"] {     box-shadow:rgba(0, 0, 0, 0.08) 0px 10px 80px;}.eg-button-wrapper {    position: absolute;    top: 32%;    left: 50%;    transform: translate(-50%, -50%);    display: none;    flex-direction: column;    grid-gap: 0px;    opacity: 1;    z-index: 9; }[class*=\'cardWrapper\']>a:hover .eg-button-wrapper {    display: flex;    flex-direction: column;    position: absolute;    top: 50%;    left: 50%;    transform: translate(-50%, -50%);    z-index: 2;}html body .eg-quote-button:hover {    background-color: #c3290b !important;   }html body .eg-learn-more-button:hover {    background: #f5f5f5 !important;   }@media screen and (min-width: 1024px) and (max-width:1144px) {    .eg-learn-more-button {        padding: 4px 16px 4px 16px;    }    .eg-quote-button {        padding: 4px 16px 4px 16px;        width: 130px    }}@media screen and (min-width: 767px) and (max-width:865px) {    .eg-learn-more-button {        padding: 4px 16px 4px 16px;    }    .eg-quote-button {        padding: 4px 16px 4px 16px;        width: 130px    }}[class*=\'backgroundCss-emptyStyles-emptyStyles\'] [class*=\'cardBottomCta\'] {    display: none;}'));document.head.appendChild(style);
(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 listener() {
      window.addEventListener('locationchange', function () {
        waitForElement('[class*="cardWrapper"]', init, 50, 15000);
      })
      history.pushState = ((f) =>
        function pushState() {
          var ret = f.apply(this, arguments);
          window.dispatchEvent(new Event('pushstate'));
          window.dispatchEvent(new Event('locationchange'));
          return ret;
        })(history.pushState);
      history.replaceState = ((f) =>
        function replaceState() {
          var ret = f.apply(this, arguments);
          window.dispatchEvent(new Event('replacestate'));
          window.dispatchEvent(new Event('locationchange'));
          return ret;
        })(history.replaceState);
      window.addEventListener('popstate', () => {
        window.dispatchEvent(new Event('locationchange'));
      });
    }
    listener();

    function live(selector, event, callback, context) {
      function addEvent(el, type, handler) {
        if (el.attachEvent) el.attachEvent('on' + type, handler);
        else el.addEventListener(type, handler);
      }
      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);
      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);
    };


    live('.cardsMapHolder [class*="loadMoreButton"]', 'click', function () {
      waitForElement('[class*="cardWrapper"]', init, 1000, 15000);
    });

    live('[class*="getSearchInputContainerStyles"] + [data-testid="form-submit"], [class*="dropdownSolutions"] [class*="solutionsList"] li', 'mouseover', function () {
      setTimeout(() => {
        waitForElement('[class*="cardWrapper"]', init, 50, 15000);
      }, 3000);
    });

    function init() {
      const cards = document.querySelectorAll('[class*="cardWrapper"]');
      cards.forEach(card => {
        if (!card.querySelector('.eg-button-wrapper')) {

          const pictureWrapper = card.querySelector('[class*="pictureWrapper"]');
          let buttonWrapper = pictureWrapper.querySelector('.eg-button-wrapper');
          if (!buttonWrapper) {
            buttonWrapper = document.createElement('div');
            buttonWrapper.classList.add('eg-button-wrapper');
          }
          let quoteButton = buttonWrapper.querySelector('.eg-quote-button');
          if (!quoteButton) {
            quoteButton = document.createElement('a');
            quoteButton.classList.add('eg-quote-button');
            quoteButton.textContent = "Get a quote";
          }
          let readMoreButton = buttonWrapper.querySelector('.eg-learn-more-button');
          if (!readMoreButton) {
            readMoreButton = document.createElement('a');
            readMoreButton.classList.add('eg-learn-more-button');
            readMoreButton.textContent = "Learn more";
          }
          const href = card.querySelector('[class*="cardBottomCta"]').getAttribute('href');
          quoteButton.setAttribute('href', href);
          buttonWrapper.appendChild(quoteButton);
          buttonWrapper.appendChild(readMoreButton);
          pictureWrapper.appendChild(buttonWrapper);
          card.insertAdjacentElement('beforeend', buttonWrapper);
        }

      });

      var solutionName = document.querySelector("[class*='searchSolutionWrapper'] > [class*='dropdownSolutions'] img + span");
      if (solutionName.innerText.trim() === "Meeting rooms" || solutionName.innerText.trim() === "Day Office" || solutionName.innerText.trim() === "Day Coworking") {
        document.querySelectorAll('.eg-quote-button').forEach(function (e) {
          e.innerText = 'Reserve now';
        })
      }

      var searchname = document.querySelector("[class*='searchSolutionWrapper'] > [class*='dropdownSolutions'] img + span");
      if (searchname.innerText.trim() === "Virtual Offices") {
        document.querySelectorAll('.eg-quote-button').forEach(function (e) {
          e.innerText = 'Buy now';
        })
      }

      var searchname = document.querySelector("[class*='searchSolutionWrapper'] > [class*='dropdownSolutions'] img + span");
      if (searchname.innerText.trim() === "Office space" || searchname.innerText.trim() === "Coworking") {
        document.querySelectorAll('.eg-quote-button').forEach(function (e) {
          e.innerText = 'Get a quote';
        })
      }
    }

    waitForElement("[class*='listingsContainer']", function () {
      var targetNode = document.querySelector('[class*="listingsContainer"]');
      var callback = function (mutationsList, observer) {
        for (var mutation of mutationsList) {
          if (mutation.type === 'childList') {
            for (var removedNode of mutation.removedNodes) {
              if (removedNode.nodeName === 'SECTION') {
                setTimeout(function () {
                  waitForElement('[class*="cardWrapper"]', init, 50, 15000);
                }, 1500);
              }
            }
          }
        }
      };
      var observer = new MutationObserver(callback);
      if (targetNode) {
        observer.observe(targetNode, { attributes: true, childList: true, subtree: true });
      }
    }, 50, 15000);


    waitForElement('[class*="cardWrapper"]', init, 50, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();



})();
/*fecli-injected JavaScript*/
Leave a Comment