Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
12 kB
1
Indexable
Never
html body .offices-list {
    display: flex;
    flex-wrap: wrap;
}

html body .offices-list-item {
    display: flex;
    grid: none;
    flex-direction: column;
    margin-bottom: 0px;
    height: 100%;
}

@media screen and (min-width: 1200px) {
    html body .offices-list>div {
        width: 25%;
    }
}

@media screen and (max-width: 1199px) and (min-width:992px) {
    html body .offices-list>div {
        width: 33.33%;
    }
}

@media screen and (max-width: 991px) and (min-width:650px) {
    html body .offices-list>div {
        width: 50%;
    }
}

@media screen and (max-width: 649px) {
    html body .offices-list>div {
        width: 100% !important;
        padding: 10px 0px !important;
    }

    html body .offices-list-item-data-link {
        padding: 10px 10px !important;
    }
}

html body .offices-list>div {
    padding: 10px;
    box-sizing: border-box;
}

html body main .search-content-aside {
    display: none;
}

html body main .search-content {
    -ms-grid-columns: minmax(944px, 1300px) minmax(0px, 0px) !important;
    grid-template-columns: minmax(944px, 1300px) minmax(0px, 0px) !important;
    grid-column-gap: 0px !important;
}

.eg-copy .facilities-list {
    display: flex;
    flex-wrap: wrap;
    grid-column-gap: 15px;
    grid-row-gap: 0px;
}

.facilities-list-item svg .eg-copy .facilities-list {
    display: flex;
    flex-wrap: wrap;
    grid-column-gap: 10px;
    grid-row-gap: 4px;
}

.eg-copy .tab-content {
    min-height: auto !important;
}

.eg-copy>.tab-content:nth-child(1),
.eg-copy>.tab-content:nth-child(2) {
    display: block !important;
}

.offices-list-item-data .offices-list-item-data-cta a[data-gtm-cta="Explore space"],
.eg-copy>.tab-content:nth-child(1) .facilities-list-item svg,
.eg-copy>.tab-content:nth-child(2) .facilities-list-item .facilities-list-item-name {
    display: none;
}

.eg-copy>.tab-content:nth-child(2) .facilities-list-item {
    max-width: 28px;
}

a.offices-list-item-data-link {
    padding: 15px !important;
}

.eg-copy .tab-content.current .facilities-list-item-name {
    font-size: 10px;
    padding-top: 4px;
    position: relative;
}

.eg-copy .tab-content.current .facilities-list-item-name:after {
    content: '';
    background: #1d1d1b;
    width: 5px;
    height: 5px;
    position: absolute;
    top: 50%;
    right: -8px;
    border-radius: 100%;
}

.eg-copy .tab-content.current .facilities-list-item {
    width: auto;
}

.eg-copy .tab-content:not(.current) svg {
    filter: grayscale(1);
    height: 22px;
    width: 28px;
    margin-bottom: 6px;
}
.eg-copy .tab-content:not(.current) {
    margin-top: 10px;
    margin-bottom: 15px;
}

.offices-list-item .offices-list-item-data-title {
    font-size: 16px;
    line-height: 1.5;
    min-height: 42px;
    -webkit-line-clamp: 2 !important;
}

.offices-list-item .office-list-item-price {
    background: none;
    color: #000;
    font-size: 12px;
    max-width: 89px;
    position: static;
    padding-left: 0px;
}

.offices-list-item .offices-list-item-data-location {
    display: none;
}

.offices-list-item .offices-list-item-data-cta a[data-gtm-cta="Book a viewing"] {
    color: #f95658;
    background: #fff;
    padding: 6px 10px;
    bottom: 47px !important;
    border: 1px solid #f95658;
}

.offices-list-item .offices-list-item-data-cta a[data-gtm-cta="Book a viewing"]:hover {
    color: #fff;
    background: #f95658;
}

.offices-list-item .offices-list-item-data-cta {
    bottom: 20px !important;
}

.eg-copy>.tab-content:nth-child(2) .facilities-list>li,
.offices-list .js-get-quote-cta.get-quote-cta,
.offices-list-item .offices-list-item-data-text {
    display: none;
}

.eg-copy>.tab-content:nth-child(2) .facilities-list>li:nth-child(1),
.eg-copy>.tab-content:nth-child(2) .facilities-list>li:nth-child(2),
.eg-copy>.tab-content:nth-child(2) .facilities-list>li:nth-child(3),
.eg-copy>.tab-content:nth-child(2) .facilities-list>li:nth-child(4),
.eg-copy>.tab-content:nth-child(2) .facilities-list>li:nth-child(5) {
    display: block;
}

.eg-copy>.tab-content:nth-child(2) .facilities-list {
    position: relative;
}

.eg-copy>.tab-content:nth-child(2) .facilities-list:after {
    content: 'Veja todos';
    display: block;
    width: 100%;
    font-size: 13px;
    font-weight: bold;
    text-decoration: underline;
    color: #1d1d1b;
    opacity: .8;
    margin-top: 8px;
}

.eg-copy>.tab-content:nth-child(1) {
    min-height: 48px !important;
}

.offices-list-item .offices-list-item-images img:first-child {
    width: 100% !important;
}

.offices-list-item .offices-list-item-images {
    grid: none !important;
}

.offices-list-item .offices-list-item-images img:not(:first-child) {
    display: none !important;
}

.office-list-item-price span {
    font-size: 10px;
    font-weight: 500;
}

.offices-by-city {
    display: none;
}

.eg-sort-by,
.eg-more-filters,
.eg-facilities {
    cursor: pointer;

}

(function () {
    try {
        var debug = 0;
        var variation_name = "";
        var tag = "officeData";

        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);
        }

        var egFilters = '' +
            '  <ul class="eg-filters">' +
            '      <li class="eg-sort-by">' +
            '          <p>Sort by</p>' +
            '      </li>' +
            '      <li class="eg-facilities">' +
            '          <p>Distance</p>' +
            '      </li>' +
            '      <li class="eg-more-filters">' +
            '          <p>More filters</p>' +
            '      </li>' +
            '  </ul>';

        function initVariation() {
            var stop,
                cachedList = JSON.parse(localStorage.getItem(tag)) || JSON.parse("{}"),
                check = function () {
                    try {


                        var productTiles = document.querySelectorAll(".offices-list .property-list-item:not(.checked)");

                        if (stop) return;

                        if (productTiles.length) {
                            productTiles.forEach(function (productTile) {
                                var targetElem = productTile.querySelector(".offices-list-item-data-title"),
                                    pdpLink = productTile.querySelector(".offices-list .property-list-item a");
                                productTile.classList.add("checked");
                                movePrice(productTile);
                                if (targetElem && pdpLink) {
                                    var pdpUrl = pdpLink.href,
                                        cachedVal = cachedList[pdpUrl];

                                    if (cachedVal) {
                                        insertCopy(targetElem, cachedVal);
                                        console.log("product retrieved from cache");
                                    } else {
                                        getHTML(pdpUrl, function (response) {
                                            try {
                                                var style = response.querySelector(".facilities .tabs-content-group");
                                                if (style) {
                                                    style = style.innerHTML;
                                                    insertCopy(targetElem, style);
                                                    cachedList[pdpUrl] = style;

                                                } else {
                                                    console.log('error', productTile)
                                                }
                                            } catch (err) {
                                                console.log(err.message);
                                            }
                                        });
                                    }
                                } else {
                                    console.log("no target and/or link for product tile:");
                                    console.log(productTile);
                                }
                            });

                        }

                        window.requestAnimationFrame(check);
                    } catch (err) {
                        console.log(err.message);
                    }
                };

            window.requestAnimationFrame(check);

            setTimeout(function () {
                stop = true;

                localStorage.setItem(tag, JSON.stringify(cachedList));
            }, 5000);
        }
        function movePrice(target) {
            var egLocation = target.querySelector('.offices-list-item .offices-list-item-data .offices-list-item-data-location');

            var egPrice = target.querySelector('.office-list-item-price');
            var priceCopy = egPrice.innerHTML;
            var newCopy = priceCopy.replace('From INR ', 'From <br>₹');
            var finalCopy = newCopy.replace('pm', '<span>p/m</span>');
            egPrice.innerHTML = finalCopy;
            egLocation.insertAdjacentElement('beforebegin', egPrice);


        }
        function getHTML(url, callback) {
            try {
                if (!window.XMLHttpRequest) return;

                var xhr = new XMLHttpRequest();

                if (callback && typeof callback === "function") {
                    xhr.onload = function () {
                        callback(this.responseXML);
                    };

                    xhr.onerror = function () {
                        console.log("XHR error");
                    };
                }

                xhr.open("GET", url);
                xhr.responseType = "document";
                xhr.send();
            } catch (err) {
                console.log(err.message);
            }
        }
        function insertCopy(targetElem, copy) {
            var stop,
                check = function () {
                    try {
                        var isAdded = targetElem.closest('.offices-list .property-list-item').querySelector(".eg-copy");

                        if (stop) return;

                        if (!isAdded) {
                            var cont = document.createElement("div");
                            cont.innerHTML = copy;
                            cont.classList.add("eg-copy");

                            targetElem.insertAdjacentElement("afterend", cont);
                        }

                        window.requestAnimationFrame(check);
                    } catch (err) {
                        console.log(err.message);
                    }
                };

            window.requestAnimationFrame(check);

            setTimeout(function () {
                stop = true;
            }, 2000);
        }

        waitForElement(".offices-list .property-list-item:not(.checked)", initVariation, 50, 8000);

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