Untitled
unknown
plain_text
2 years ago
16 kB
5
Indexable
(function () { try { var debug = 0; var variation_name = ""; var tag = "officeDataCard"; 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 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-text"), pdpLink = productTile.querySelector(".offices-list .property-list-item a"); movePrice(productTile); productTile.classList.add("checked"); if (targetElem && pdpLink) { var pdpUrl = pdpLink.href, cachedVal = cachedList[pdpUrl]; if (cachedVal) { insertCopy(targetElem, cachedVal); // setPriority(); // movePrice(productTile); console.log("product retrieved from cache"); } else { getHTML(pdpUrl, function(response) { try { var style = response.querySelector(".facilities .tabs-content-group"); var list1 = style.querySelector('.facilities .tabs-content-group > div:first-of-type ul'); var list2 = style.querySelector('.facilities .tabs-content-group > div:first-of-type + div ul'); if (list1 && list2) { style = list1.innerHTML + list2.innerHTML; insertCopy(targetElem, style); cachedList[pdpUrl] = style; // setPriority(); } 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() { initVariation(); stop = true; localStorage.setItem(tag, JSON.stringify(cachedList)); }, 5000); //document.querySelector('#centre_filters > .facilities-list').insertAdjacentHTML('afterend', egFilters); // var egLocation = document.querySelectorAll('.offices-list-item .offices-list-item-data .offices-list-item-data-location'); // var egPrice = document.querySelectorAll('.offices-list-item .office-list-item-price'); // for(var i = 0; i < egLocation.length; i++){ // egLocation[i].insertAdjacentElement('afterend', egPrice[i]); // } } function movePrice(target){ var egLocation = target.querySelector('.GetQuote_ctaButton'); var egPrice = target.querySelector('.office-list-item-price'); var priceCopy = egPrice.innerHTML; var newCopy = priceCopy.replaceAll(' ',''); var newCopy1 = newCopy.replace('From$','From $'); var finalCopy = newCopy1.replace('pm','pm'); // egPrice.innerHTML = finalCopy; egLocation.insertAdjacentElement('beforebegin', egPrice); if(window.location.pathname.indexOf('/office-space/') != -1){ if(target.getAttribute('data-iscw') == true ||target.getAttribute('data-iscw') == "true") { var tags = '<div class="eg-tag"><span>Office Space </span> <span> Serviced Office</span></div>'; target.querySelector('h2.offices-list-item-data-title').insertAdjacentHTML('afterend',tags); } else { var tags = '<div class="eg-tag"> <span> Serviced Office</span></div>'; target.querySelector('h2.offices-list-item-data-title').insertAdjacentHTML('afterend',tags); } } else if(window.location.pathname.indexOf('/co-working-space/') != -1) { var tags = '<div class="eg-tag"> <span> Coworking Space</span></div>'; target.querySelector('h2.offices-list-item-data-title').insertAdjacentHTML('afterend',tags); } } 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 = '<ul>'+copy+'</ul>'; cont.classList.add("eg-copy"); targetElem.insertAdjacentElement("beforebegin", cont); setPriority(); } window.requestAnimationFrame(check); } catch (err) { console.log(err.message); } }; window.requestAnimationFrame(check); setTimeout(function() { stop = true; }, 2000); } function setPriority(){ document.querySelectorAll(".eg-copy ul .facilities-list-item:not(.eg-check)").forEach(function(ele,i){ ele.classList.add('eg-checked'); var copy = ele.innerHTML; if(copy.indexOf('Meeting Rooms') !=-1 || copy.indexOf('Parking') != -1 || copy.indexOf('24 Hour Access') !=-1){ ele.classList.add('eg-priority'); } }); } waitForElement(".offices-list .property-list-item:not(.checked) .GetQuote_ctaButton", initVariation, 500, 8000); } catch (e) { if (debug) console.log(e, "error in Test" + variation_name); } })(); /* @media screen and (max-width: 1365px) { html body .search-content { padding: 30px 0px 0px 20px !important; } } */ .eg-copy > ul { position: relative; max-height: 25px; overflow: hidden; display: flex; flex-wrap: wrap; } .eg-copy .facilities-list-item-name { font-size: 12px; padding-top: 4px; position: relative; font-weight: 400; color: #1D1D1B; } .eg-copy .facilities-list-item { width: auto; } .eg-copy .facilities-list-item svg { filter: grayscale(1); height:18px; width: 18px; color: #0a0a0a; } .eg-copy{ margin-top: 5px; margin-bottom: 5px; } .offices-list-item .offices-list-item-data-title { font-size: 16px; line-height: 1.5; margin-bottom: 0px; } html body .get-quote-cta, #centre_filters .facilities-list, #centre_filters, .offices-list-item-data .offices-list-item-data-cta a[data-gtm-cta="Explore space"]{ display: none !important; } .eg-copy .facilities-list-item svg{ display: inline-block !important; } html body .eg-copy li > h5 { padding-top: 0px; margin-left: 10px; margin-right: 10px; font-size: 12px; } html body .eg-tag span { font-size: 12px; padding: 1px 10px; margin: 5px 0 2px 0; display: inline-block; border: 1px solid; border-radius: 30px; color: #0083a0; font-family: 'Poppins'; font-weight: 600; } html body .eg-tag span:nth-child(1) { margin-right: 4px; } .offices-list-item .offices-list-item-images img:first-child { width: 100% !important; } .offices-list-item .offices-list-item-images { grid: none !important; } html body .offices-list-item { -ms-grid-columns: 1fr 1.3fr !important; grid-template-columns: 1fr 1.3fr !important; position: relative; } .eg-copy .facilities-list { display: flex; flex-wrap: wrap; grid-column-gap: 5px; grid-row-gap: 0px; } .offices-list-item-data-cta a[data-gtm-id="book_a_viewing"] { position: static !important; color: #f95658; background: #fff; padding: 6px 10px; bottom: 47px !important; border: 1px solid #f95658; text-align: center; width: auto; font-size: 14px; margin-left: auto; } html body .offices-list-item-data-bottom{ width: 100%; visibility: hidden; } .offices-list-item-data-text { padding-bottom: 10px; padding-top: 10px; font-size: 12px !important; } html body .office-list-item-price { background: none !important; color: #0083a0 !important; font-size: 15px !important; position: static !important; padding-left: 0px; margin-left: auto; padding-right: 0px; display: block; width: 100%; } html body .offices-list-item-data-cta { bottom: 15px; right: 15px; } /* ul.eg-filters { display: flex; align-items: center; justify-content: space-between; } ul.eg-filters li { width: 20%; text-align: center; list-style: none; border: 1px solid #c8c7c6; padding: 10px 10px; cursor: pointer; } ul.eg-filters li:not(:last-child) { border-right: none; } ul.eg-filters li:hover, ul.eg-filters .eg-filter-active { background: #f95658; color: #fff; border: 1px solid #f95658; } */ /* Toggle Button */ /* .eg-toggle { position: relative; width: 102px; height: 34px; overflow: hidden; border-radius: 20px; margin-bottom: -29px; margin-left: auto; top: -53px; } .checkbox { position: relative; width: 100%; height: 100%; padding: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 3; } .eg-list, .eg-map { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } .eg-list:before, .eg-list:after, .eg-list span { position: absolute; top: 0px; width: 53px; height: 34px; font-size: 12px; font-weight: bold; text-align: center; line-height: 1.5; transition: 0.3s ease all; border-radius: 20px; display: flex; align-items: center; justify-content: center; } .eg-list span { display: flex; left: 0px; z-index: 1; color: #4e4e4e; } .eg-list:after { content: "Map"; right: 0px; color: #4e4e4e; width: 48px; } .eg-list { z-index: 2; } .eg-map { width: 100%; background-color: transparent; transition: 0.3s ease all; z-index: 1; border: 1px solid; border-radius: 20px; } .eg-list:before { content: ""; left: 0px; background-color: transparent; color: #4e4e4e !important; border: 1px solid #4e4e4e; } .checkbox:checked+.eg-list:before { left: 49px; } .checkbox:checked+.eg-list span { color: #4e4e4e; } .checkbox:checked+.eg-list:after { color: #4e4e4e; } .checkbox:checked~.eg-map { background-color: transparent; border: 1px solid #4e4e4e; border-radius: 20px; } */ .filter-fields.eg-distance { display: block; width: 100%; padding: 20px; } .filter-fields.eg-distance .modal-close { display: none; } .eg-filters li p { font-size: 15px; } .eg-map-show #map { display: block !important; height: 800px; } .eg-map-show .why-choose-office, .eg-map-show #centre_filters, .eg-map-show .offices-list { display: none !important; } .office-list-item-price span { font-size: 10px; } .offices-list-item-data-link { padding: 15px !important; } .filters [data-filter="filter-distance"]{ display: none !important; } .property-list-item .left-arrow, .property-list-item .right-arrow { /* position: absolute !important; */ } html body .offices-list-item-image{ -ms-grid-column-span: 1 !important; -ms-grid-row-span: 1 !important; grid-column: 1 !important; grid-row: 1 !important; } .eg-copy .facilities-list-item { display: flex; margin: 5px 0px; } .eg-copy .facilities-list { height: 24px; overflow: hidden; } @media screen and (min-width:1200px) and (max-width:1600px){ html body .offices-list-item >a { position: absolute; top: 0px; left: 0px; height: 100%; width: 45%; } html body .offices-list-item .offices-list-item-images { height: 100%; } html body .offices-list-item { -ms-grid-columns: 1fr !important; grid-template-columns: 1fr !important; position: relative; padding-left: 45%; } } .eg-copy .facilities-list-item.eg-priority{ order: -2; } html body .offices-list-item-data > .office-list-item-price { display: inline-flex !important; width: auto; margin-right: auto !important; margin-left: 0px; height: auto !important; align-items: center; } html body .offices-list-item-data .offices-list-item-data-bottom { display: none; } html body .offices-list-item-data .offices-list-item-data-cta { display: flex; flex-direction: row; justify-content: space-between; width: 100%; position: static; } html body .offices-list-item-data-cta .GetQuote_ctaButton { padding-left: 18px !important; } @media screen and (max-width:767px){ html body .offices-list-item-image { height: auto !important; } }
Editor is loading...