Untitled
unknown
plain_text
2 years ago
3.1 kB
7
Indexable
(function () { if(!document.querySelector('.eg-what')) 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 init() { if(document.querySelectorAll('label.charter-type-c.selected').length){ console.log('crwed'); document.querySelector('.eg_link') && document.querySelector('.eg_link').remove(); document.querySelector(".moorings-holiduct-side .price .currency").insertAdjacentHTML("afterend" , '<a class="eg_link eg-link-a">What\'s included?</a>'); document.querySelector('.eg-link-a').addEventListener('click',function(){ window.open("https://www.moorings.com/yacht-vacations/crewed-charter/whats-included",'_blank'); }); }else{ document.querySelector('.eg_link') && document.querySelector('.eg_link').remove(); console.log('sailing'); document.querySelector(".moorings-holiduct-side .price .currency").insertAdjacentHTML("afterend" , '<a href="/yacht-charter/whats-included" class="eg_link">What\'s included?</a>'); } } checkAjax(); function checkAjax(){ var send = XMLHttpRequest.prototype.send XMLHttpRequest.prototype.send = function() { this.addEventListener('load', function() { if(this.responseURL.indexOf('/travelopia/main/') !=-1){ waitForElement(".moorings-holiduct-side .price .currency", init, 500, 35000); } }) return send.apply(this, arguments) } } function addTag(){ document.querySelector('body').insertAdjacentHTML('afterend','<div class="eg-what"></div>'); } document.addEventListener('click',function(){ waitForElement(".moorings-holiduct-side .price .currency", init, 500, 10000); }) waitForElement(".moorings-holiduct-side .price .currency", init, 500, 10000); waitForElement("body", addTag, 50, 5000); } catch (e) { if (debug) console.log(e, "error in Test" + variation_name); } })(); html body .moorings-holiduct-side .price{ display: flex; flex-wrap: wrap; align-items: baseline; } html body .moorings-holiduct-side .price .eg_link { font-family: 'NewBaskervilleW01-Roman'; } html body .moorings-holiduct-side .price .currency{ min-width: max-content; margin-right: 10px; } @media screen and (max-width: 991px){ html body .moorings-holiduct-side .price{ justify-content: center; } }
Editor is loading...