Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
8.1 kB
5
Indexable
Never
(function() {
    // --------------------------
    // Simple ABTasty js wrapper
    // --------------------------

    const domain = 'LB.COM'; //eg LB, CIT, SOV etc
    const testId = '1132188'; // ABTasty variant id
    const testVar = 'P1'; // Cx for campaign level code , Vx for variation version
    const testName = 'Navigation : Eyebrow bar '; // location : test name, eg
    
    let trans_obj = [
        { //.com
            'lang':'en',
            'myaccount_text':'My Account',
            'myaccount_url': '/booking/login',
            'help_text':'Help',
            'help_url':'/travel-information/faqs'
        },
        {//.ca
            'lang':'en-ca',
            'myaccount_text':'My Account',
            'myaccount_url': '/en/booking/login',
            'help_text':'Help',
            'help_url':'/en/travel-information/faqs'
        },
        {//.co.uk
            'lang':'en-gb',
            'myaccount_text':'My Account',
            'myaccount_url': '/booking/login',
            'help_text':'Help',
            'help_url':'/travel-information/faqs'
        },
        {//.co.za
            'lang':'en-za',
            'myaccount_text':'My Account',
            'myaccount_url': '/booking/login',
            'help_text':'Help',
            'help_url':'/good-know/find-out-more/faq-frequently-asked-questions'
        },
        {//.com.au
            'lang':'en-au',
            'myaccount_text':'My Account',
            'myaccount_url': '/booking/login',
            'help_text':'Help',
            'help_url':'/travel-information/faqs'
        },
        {//emeraldstar
            'lang':'en-ie',
            'myaccount_text':'My Account',
            'myaccount_url': '/booking/login',
            'help_text':'Help',
            'help_url':'/travel-information/faqs'
        },
        
        {//.de
            'lang':'de',
            'myaccount_text':'Mein Konto',
            'myaccount_url': '/booking/login',
            'help_text':'Hilfe',
            'help_url':'/reiseplanung/faq'
        },
        {//.ch/de
            'lang':'de-ch',
            'myaccount_text':'Mein Konto',
            'myaccount_url': '/de/booking/login',
            'help_text':'Hilfe',
            'help_url':'/de/reiseplanung/faq'
        },
        {//.at
            'lang':'de-at',
            'myaccount_text':'Mein Konto',
            'myaccount_url': '/booking/login',
            'help_text':'Hilfe',
            'help_url':'/reiseplanung/faq'
        },
        
        {//.nl
            'lang':'nl',
            'myaccount_text':'Mijn rekening',
            'myaccount_url': '/booking/login',
            'help_text':'Hulp',
            'help_url':'/reisinformatie/faq'
        },
        {//.be/nl
            'lang':'nl-be',
            'myaccount_text':'Mijn rekening',
            'myaccount_url': '/nl/booking/login',
            'help_text':'Hulp',
            'help_url':'/nl/reisinformatie/faq'
        },
        
        {//.fr
            'lang':'fr',
            'myaccount_text':'Mon compte',
            'myaccount_url': '/booking/login',
            'help_text':'Aide',
            'help_url':'/preparer-son-voyage/faq'
        },
        {//.ch/fr
            'lang':'fr-ch',
            'myaccount_text':'Mon compte',
            'myaccount_url': 'fr/booking/login',
            'help_text':'Aide',
            'help_url':'/fr/preparer-son-voyage/faq'
        },
        {//.be/fr
            'lang':'fr-be',
            'myaccount_text':'Mon compte',
            'myaccount_url': 'fr/booking/login',
            'help_text':'Aide',
            'help_url':'/fr/preparer-son-voyage/faq'
        },
        {//.ca/fr
            'lang':'fr-ca',
            'myaccount_text':'Mon compte',
            'myaccount_url': 'fr/booking/login',
            'help_text':'Aide',
            'help_url':'/fr/preparer-son-voyage/faq'
        },
      
        {//.es
            'lang':'es',
            'myaccount_text':'Mi cuenta',
            'myaccount_url': '/booking/login',
            'help_text':'Ayuda',
            'help_url':'/informacion-de-viaje/faq'
        },
        
        {//.it
            'lang':'it',
            'myaccount_text':'Il mio account',
            'myaccount_url': '/booking/login',
            'help_text':'Aiuto',
            'help_url':'/informazioni-di-viaggio/domande-frequenti'
        }
    ];

    const inQA = function() {
      // test for QA cookie : "testId=test|true|QA"
      const re = new RegExp(`${testId}\=(test|true|qa|abt)`, 'i');
      let qaMode = ((re).test(document.cookie) == true) ? true : false;
      // test for preview mode.
      let previewMode = (window.location.search.includes('ab_project=preview' == true || document.querySelector('#ABTastyPreviewBar') != null)) ? true : false;
      // test for qa console mode.
      let consoleMode = window.location.search.includes('abtasty_qa_assistant=true');
      // test for qa console.
      let qaConsole = (document.querySelector('#abtasty-qa-assistant-frame') != null);
      return (qaMode || previewMode || consoleMode || qaConsole) ? true : false;
    }();
    
    document.querySelector('body').classList.add(`${domain}${testId}`);
    console.log(`${domain} : ${testId} : ${testVar} : ${testName} : TEST RUNNING : QA=${inQA}`);    
    
    function waitFor(condition, callback, timeout, fallback) {
        var stopTime = typeof timeout === 'number' ? timeout : 7000;
        var stop = false;
        window.setTimeout(function () {
            stop = true;
        }, stopTime);
        return function _innerWaitFor() {
            var value = condition();
            if (stop) {
                fallback && fallback();
                return null;
            }
            if (value) return callback(value);
            return window.setTimeout(_innerWaitFor, 250);
        };
    }
    
    function init(){
      let trans_lang = trans_obj.filter(x=>x.lang==document.querySelector('html').getAttribute('lang'));
      let trans_text = trans_lang[0];
      //let faqLink_ele=document.querySelectorAll('ul#dropdown-2>li')[3].querySelectorAll('ul li a');
      //let faqLink = faqLink_ele[faqLink_ele.length-1];
      //let myacc_ele  = document.querySelectorAll('ul#dropdown-2>li')[4].querySelectorAll('ul li a')[1];
      
      let eyebBar = `<div class='ebnav_main'><div class='ebnav_wrap'><div class="ebnav-right"><a id="ABT_account" href="${trans_text.myaccount_url}">${trans_text.myaccount_text}</a><a id="ABT_faq" href="${trans_text.help_url}">${trans_text.help_text}</a></div></div></div>`;
      
      if (document.querySelector(".ebnav_main") == null) {
        document.querySelector('header').insertAdjacentHTML('afterbegin', eyebBar);
      }
    }
    
    
    waitFor(()=>{
      return document.querySelector('header');
    },()=>{
      init();
    })();
    
})();

//# sourceURL=c--site-script.js




header{
  border: none !important;
}
.ebnav_main{
  margin: 0 auto;
  background-color: #D3E8EA;
  height: 35px;
  border: 0;
  border-image-slice: 1;
  border-image-source: url(https://www.leboat.com/profiles/leboat/themes/custom/leboat/assets/images/coloured-border.svg);
  border-bottom: 4px solid;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
}


@media only screen and (min-width: 768px) {
  .ebnav_wrap {
    width: 736px;
  }
}
@media only screen and (min-width: 992px) {
  .ebnav_wrap {
    width: 956px;
  }
}
@media only screen and (min-width: 1200px) {
  .ebnav_wrap {
    width: 1156px;
  }
}
@media only screen and (max-width: 767px) {
  .ebnav_wrap {
    padding: 0 10px !important;
    width: 100%;
  }
}

.ebnav-right{
  float: right;
  display: block;
}
.ebnav-right a {
  float: left;
  color: #003366;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-family: 'Effra';
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  line-height: 14px;
  text-transform: capitalize;
}
.ebnav-right a:hover {
  opacity: 0.8;
}
#ABT_faq {
  padding-right:0px;
}
Leave a Comment