Untitled

 avatar
unknown
plain_text
6 months ago
7.2 kB
6
Indexable
 ;(function(){
    var style=document.createElement('style');style.type='text/css';style.appendChild(document.createTextNode('html body .eg-herosection .eg-container {    width: 100%;    max-width: 1400px;    margin: auto;    padding: 0 1.6949152542%;    display: flex;    flex-direction: row;}html body .eg-herosection .eg-container .text-image-banner {    width: 100% !important;    max-width: 100% !important;}html body .eg-herosection .eg-container .eg-left {    width: 100%;    max-width: 500px;    padding: 15px;}html body .eg-herosection .eg-container .eg-right {    width: 100%;    height: 100%;    max-height: 339px;}html body .eg-herosection .eg-right .text-image-banner {    padding: 80px 0px !important;    border-radius: 8px;}html body .eg-herosection .eg-left .eg-heading {    font-family: Open Sans, sans-serif !important;    font-size: 36px;    font-weight: 700;    line-height: 43.57px;    text-align: left;    color: #333333;    letter-spacing: 1px;    margin-bottom: 10px;}html body .eg-herosection {    margin-top: 60px;    margin-bottom: 42px;}html body .eg-herosection .eg-left .eg-para {    font-family: Open Sans, sans-serif !important;    font-size: 14px;    font-weight: 400;    line-height: 20.12px;    text-align: left;    color: #333333;}html body .eg-herosection .eg-left .eg-price p {    font-family: Open Sans, sans-serif !important;    font-size: 12px;    font-weight: 400;    line-height: 20px;    text-align: left;    color: #777171;    margin-top: 28px;    margin-bottom: 7px;    display: none;}html body .eg-herosection .eg-left .eg-price a {    background: #E82011;    padding: 4px 20px;    border-radius: 20px;    height: 40px;    width: fit-content;    display: flex;    justify-content: center;    align-items: center;    color: #FFFFFF;    font-weight: 700;}html body [data-component="Feature/Maps/FlightMap"] {    margin-top: 70px;}html body .eg-herosection .eg-left .eg-price a:hover {    background: #f1483b !important;}@media only screen and (max-width:1024px) {    html body .eg-herosection .eg-right .text-image-banner {        border-radius: 0;    }    html body .eg-herosection .eg-container {        flex-direction: column;        padding: 0px;    }    html body .eg-herosection .eg-left .eg-heading {        font-size: 18px;        line-height: 21.57px;    }    html body .eg-herosection {        margin-bottom: 0px !important;    }    html body .eg-herosection .eg-container .eg-right {        order: -1;    }    html body .eg-herosection {        margin-top: 0px;    }}'));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 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('.eg-herosection .eg-left .eg-button', 'click', function () {
      var targetSection = document.querySelector('.wrapper .mmb-login-container');

      var stickyHeaderHeight = window.innerWidth >= 1024 ? 170 : 0;
      window.scrollTo({
        top: targetSection.getBoundingClientRect().top + window.scrollY - stickyHeaderHeight,
        behavior: 'smooth'
      });
    });

    let heroHTML = `<div class="eg-herosection">
    <div class="eg-container">
        <div class="eg-left">
            <h1 class="eg-heading">Cheap flights to Alicante</h1>
            <p class="eg-para">Alicante is the gateway to the Costa Blanca and the place to be if you’re looking for flights to Benidorm. The theme
            parks, pubs and clubs of this popular resort makes it one of the most-loved destinations in Spain. What’s more, you can
            also discover traditional areas such as scenic Calpe and peaceful Albir too.</p>
            <div class="eg-price">
                <p>Cheap flights from £32pp</p>
                <a class="eg-button">Find cheap deals</a>
            </div>
        </div>
        <div class="eg-right"></div>
    </div>
    </div>`

    /* Variation Init */
    function init() {
      let heroImage = document.querySelector('.site-wrapper .text-image-banner');
      if (!document.querySelector('.eg-herosection')) {
        document.querySelector('.site-wrapper .sticky-search-panel').insertAdjacentHTML('afterend', heroHTML);
        document.querySelector('.eg-herosection .eg-right').insertAdjacentElement('beforeend', heroImage);
      }

      const element = document.querySelector('.eg-herosection .eg-right .text-image-banner .strip-header__title');
      const textContent = element.textContent.trim();
      const words = textContent.split(' ');
      const lastWord = words[words.length - 1];

      const headingElement = document.querySelector('.eg-herosection .eg-left .eg-heading');
      if (headingElement) {
        let textContent = headingElement.textContent;
        textContent = textContent.replace('Alicante', lastWord);
        headingElement.textContent = textContent;
      }

      const paraElement = document.querySelector('.eg-herosection .eg-left .eg-para');
      if (paraElement) {
        let textContent = paraElement.textContent;
        textContent = textContent.replace('Alicante', lastWord);
        paraElement.textContent = textContent;
      }
    }

    /* Initialize variation */
    waitForElement('.site-wrapper .text-image-banner', init, 50, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();



})();
Editor is loading...
Leave a Comment