Untitled
unknown
plain_text
2 years ago
8.9 kB
5
Indexable
(function () { 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 live (selector, event, callback, context) { /****Helper Functions****/ // helper for enabling IE 8 event bindings function addEvent(el, type, handler) { if (el.attachEvent) el.attachEvent("on" + type, handler); else el.addEventListener(type, handler); } // matches polyfill 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); // live binding helper using matchesSelector 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); } var keys = [ { type: "charter-type-b", content: ' <div class="one">'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>WiFi</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Care Package</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Skipper</p>'+ ' </div>', newText: '<p>*For more information, view the full list <br>of <a href="https://www.moorings.com/yacht-charter/whats-included" class="eg_link">What\'s included here</a>.</p>' }, { type: "charter-type-p", content: ' <div class="one">'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Fuel</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>WiFi</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Care Package</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Skipper</p>'+ ' </div>', newText: '<p>*For more information, view the full list <br>of <a href="https://www.moorings.com/yacht-charter/whats-included" class="eg_link">What\'s included here</a>.</p>' }, { type: "charter-type-c", content: ' <div class="one">'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Fuel</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>WiFi</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Care Package</p>'+ ' </div>'+ ' <div>'+ ' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+ ' <path d="M8 0L8 16M0 8H16" stroke="#A99384" stroke-width="2"/>'+ ' </svg>'+ ' <p>Skipper</p>'+ ' </div>', newText: '<p>*For more information, view the full list <br>of <a href="https://www.moorings.com/yacht-vacations/crewed-charter/whats-included" class="eg_link">What\'s included here</a>.</p>' } ] function init() { if(document.querySelector('.eg_content--wrapper')){ document.querySelector('.eg_content--wrapper').remove(); } for( var i = 0; i < keys.length; i++){ if(document.querySelector('.'+keys[i].type+'.selected')){ var htmlString =''+ '<div class="eg_content--wrapper">'+ ' <p class="eg_title">What\'s included?</p>'+ ' <div class="eg_content">'+ keys[i].content+ ' </div>'+ ' <div class="eg_text">'+ keys[i].newText+ ' </div>'+ '</div>'; document.querySelector(".moorings-holiduct-side .sidebar-subtitle").insertAdjacentHTML("afterend" , htmlString); } } } 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 .sidebar-subtitle", init, 100, 35000); } }) return send.apply(this, arguments) } } document.addEventListener('click',function(){ waitForElement(".moorings-holiduct-side .price .currency", init, 500, 35000); }) waitForElement(".moorings-holiduct-side .sidebar-subtitle", init, 100, 35000); } catch (e) { if (debug) console.log(e, "error in Test" + variation_name); } })(); html body .eg_content--wrapper .eg_title { color: #000; font-family: 'NewBaskervilleW01-Roman'; font-size: 20px; } html body .eg_content--wrapper .eg_content { display: flex; align-items: center; margin-top: -14px; margin-bottom: 14px; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 425px; margin-left: auto; margin-right: auto; } html body .eg_content--wrapper .eg_content > div{ display: flex; align-items: center; justify-content: center; } html body .eg_content--wrapper .eg_content p { margin-left: 5px; font-size: 18px; } html body .eg_content--wrapper .eg_text{ margin-bottom: 14px; } @media screen and (max-width: 360px){ html body .eg_content--wrapper .eg_text br{ display: none; } }
Editor is loading...