Untitled

 avatar
unknown
plain_text
3 years ago
19 kB
3
Indexable
html body .calendar-calendar,
html body .view .row>.list-group {
    width: 90%;
}

.booking-flow .Collapsible__trigger {
    border-radius: 4px;
}

html body .extra-inner {
    border-radius: 4px;
}

.booking-flow .main .nonCollapsible .extra {
    padding-inline: 0;
}


html body .booking-flow .Collapsible__trigger:after {
    content: '' !important;
    background: url('https://editor-assets.abtasty.com/46121/6389f9042cf5f1669986564.svg');
    width: 15px;
    height: 15px;
    background-repeat: no-repeat;
    background-position: center;
}

html body .booking-flow .Collapsible__trigger.is-closed:after {
    transform: rotate(180deg);
}

html body .booking-flow .main .extra .notes {
    margin-top: 0;
    padding-left: 16px;
}


/*css for error message*/
.booking-flow .main .extra.capacity-error {
    background: transparent !important;
}

.booking-flow .main .extra.capacity-error .extra-inner {
    background: rgba(215, 36, 65, .24);
}

.extra-inner-capacity-message {
    padding: 16px;
}

/*css for error message*/

html body span.qualifier {
    color: #bdbdbd;
    display: none;
}

html body .booking-flow .main .extra.child {
    background-color: white;
    display: none;
}

html body .booking-flow .Collapsible__trigger:after {
    float: right;
    font-size: 11px;
    margin: 4px 0 8px;
}

html body .booking-flow .Collapsible {
    border-bottom: none;
}

.booking-flow .Collapsible+.Collapsible {
    margin-top: 17px;
}


html body .booking-flow .main .extra .extra-line-item {
    display: grid;
    grid-template-columns: 200px 1fr;
}

html body .egImg {
    width: 200px;
    height: 100px;
    grid-row-start: 1;
    grid-row-end: 3;
}

html body form>div:nth-child(1) div.extra-description.row>div.text {
    /*white-space: nowrap;*/
    width: 100%;
    /*overflow: hidden;*/
    /*text-overflow: ellipsis;*/
}

html body form>div:nth-child(1) div.extra-description.row>div.text.eg_active .eg-hidden-text {
    display: inline !important;
}


html body .eg-hidden-text {
    display: none;
}


html body #eg_show {
    color: #1BA9E8;
    font-size: 16px;
    cursor: pointer;
    font-weight: 700;
    text-transform: lowercase;
}

html body .extra-inner {
    border: 1px solid #d0cdc5;
}

html body .text {
    padding: 5px 25px 10px;
}

html body .extra-line-item {
    background: #fff !important;
}

html body .booking-flow .main .extra .price-quantity {
    float: none;
    grid-row-start: 2;
    grid-row-end: 3;
    grid-column-start: 2;
    grid-column-end: 3;
    padding-left: 5%;

}

html body .booking-flow .main .extra .eg_withProvision {
    width: 100%;
    flex: 1;
    min-width: max-content;
    display: flex;
    gap: 8px;
}

html body .booking-flow .main .extra .eg_withProvision label {
    max-width: 100%;
    width: max-content;
}

html body .eg_withoutProvision input[type='checkbox'],
html body .eg_withProvision input[type='checkbox']{
    width: 0;
    height: 0;
    margin-right: 20px;
}

html body .eg_withoutProvision input[type='checkbox']:after,
html body .eg_withProvision input[type='checkbox']:after {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 15px;
    top: -2px;
    left: 1px;
    position: relative;
    display: inline-block;
    visibility: visible;
    outline: 1px solid #00244a;
   border: 2px solid white;
}

html body .eg_withoutProvision input[type='checkbox']:checked:after,
html body .eg_withProvision input[type='checkbox']:checked:after {
    width: 12px;
    height: 12px;
    border-radius: 15px;
    top: -2px;
    left: 1px;
    position: relative;
    background-color: #00244a;
    content: '';
    display: inline-block;
    visibility: visible;
    outline: 1px solid #00244a;
}

html body .booking-flow .main .extra .extra-line-item {
    padding: 0;
    border-radius: 5px;
}

html body .booking-flow .main .extra-line-item>label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    width: 100%;
    font-weight: 400;
    padding-left: 5%;
    font-size: 20px;
}

html body .booking-flow .eg_boxes .extra-line-item > label input,
html body .booking-flow .eg_boxes .extra-line-item > label{
    pointer-events: none !important;
}

.booking-flow .Collapsible__trigger {
    font-size: 20px;
    font-weight: 400;
    background-color: rgb(204 204 204 /35%);
    margin: auto;
}

html body .booking-flow  .extra-line-item>label input[type=checkbox] {
    order: 1;
    min-width: 24px;
    min-height: 24px;
    position: relative;
}

html body .booking-flow  .extra-line-item>label input[type=checkbox]:checked::after{
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: url('https://editor-assets.abtasty.com/46121/6389f8d421c6b1669986516.svg');
    background-repeat: no-repeat;
    background-position: center;
    top: 0;
    left: 0;
    border: 1px solid;
    border-radius: 2px;
}

html body .notes {
    padding-left: 3%;
}

html body .price-quantity {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

html body .booking-flow .main .extra .notes .crew-message {
    border: none !important;
    padding: 0;
    margin: 0;
}

html body .booking-flow .main .extra .extra-description {
    width: 100%;
    margin-inline: 0 !important;
}

span.totalPrice,
.eg_totalPrice {
    font-size: 20px;
    /*font-size: 16px;*/
    font-weight: 400;
}

span.totalPrice,
html body .booking-flow .eg_withProvision .eg_totalPrice {
    color: #1ba9e8;
    font-weight: 400 !important;
    padding-top: 3px;
}

.booking-flow .main .extra .extra-description .text {
    padding-inline: 16px;
}

.booking-flow .main .extra .extra-description .text,
.booking-flow .main .extra .extra-description .notes {
    font-size: 16px;
}

.booking-flow .main .extra label,
.booking-flow .main .extra .price-quantity {
    padding-left: 0.5%;
    font-size: 16px;
    font-weight: 400;
    font-family: "NewBaskervilleW01-Roman", serif;

}

/* .booking-flow .main .extra label{
  padding-left: 0.5%;
} */

@media(min-width: 768px) {
    html body .extras form .Collapsible .Collapsible__contentInner>div {
        padding: 15px 0 0 0;
    }
}

@media(max-width: 767px) {
    html body .booking-flow input[type=checkbox] {
        min-width: 20px;
        min-height: 20px;
    }

    html body .booking-flow  .extra-line-item>label input[type=checkbox]:checked::after{
        width: 20px;
        height: 20px;
    }

    html body .extras form .Collapsible .Collapsible__contentInner>div {
        padding-top: 10px;
    }

    html body .steps {
        width: 100%;
    }

    html body .egImg {
        width: 100%;
    }


    html body .extra-line-item {
        display: flex !important;
        flex-direction: column;
    }

    .egImg {
        width: 100%;
        height: auto !important;
    }


    html body .booking-flow .booking-details {
        margin-bottom: 11px;
    }

    html body .booking-flow .main .extra-line-item>label {
        padding: 10px 10px 0 10px;
    }

    html body .booking-flow .main .extra .price-quantity {
        padding: 10px;
        gap: 8px !important;
    }

    html body .text {
        padding: 0 10px 10px;
        width: 100%;
    }

    html body .booking-flow .main .extra {
        padding: 0;
    }

    html body .booking-flow .Collapsible__trigger {
        width: 100%;
    }
}

@media screen and (max-width: 500px) {
    html body .price-quantity {
        gap: 5px !important;
    }

}



(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 waitForjQuery(trigger, delayInterval, delayTimeout) {
            var interval = setInterval(function() {
                if (window.jQuery !== undefined) {
                    clearInterval(interval);
                    trigger(window.jQuery);
                }
            }, delayInterval);
            setTimeout(function() {
                clearInterval(interval);
            }, delayTimeout);
        }
        /* Variation functions */

        let eg_Img = `
  <div class="egImg">
  <img class="full-2-1-breakpoints-theme-moorings-xsw-1x" src="https://editor-assets.abtasty.com/46121/637c78c60d1091669101766.png" width="768" height="384" alt="">
  </div>
`;

        var eg_images = {
            insurance: `
              <div class="egImg">
              <img class="full-2-1-breakpoints-theme-moorings-xsw-1x" src="https://editor-assets.abtasty.com/46121/637c78a6e843c1669101734.png" width="768" height="384" alt="">
              </div>
            `,
            wifi: `
              <div class="egImg">
              <img class="full-2-1-breakpoints-theme-moorings-xsw-1x" src='https://editor-assets.abtasty.com/46121/637c78ecd9bc91669101804.png' width="768" height="384" alt="">
              </div>
            `,
            crew: {
                cook: `
              <div class="egImg">
              <img class="full-2-1-breakpoints-theme-moorings-xsw-1x" src='https://editor-assets.abtasty.com/46121/637c785999bca1669101657.png' width="768" height="384" alt="">
              </div>
            `,
                skipper: `
              <div class="egImg">
              <img class="full-2-1-breakpoints-theme-moorings-xsw-1x" src='https://editor-assets.abtasty.com/46121/637c78c60d1091669101766.png' width="768" height="384" alt="">
              </div>
            `
            }
        }

        function init() {
            let container = document.querySelectorAll("#tm-booking .main .extra-inner .extra-line-item");
            let nonCollapsible = document.querySelectorAll("#tm-booking .main .nonCollapsible .extra-inner .extra-line-item");

            if (nonCollapsible.length > 0) {
                // non collapsible 
                for (var i = 0; i < nonCollapsible.length; i++) {

                    let egLabelCheck = nonCollapsible[i].parentElement.parentElement.previousElementSibling.textContent;

                    let egHtml = addingImage(egLabelCheck, nonCollapsible[i]);

                    nonCollapsible[i].insertAdjacentHTML("afterbegin", egHtml);

                }
            } else if (container.length > 0) {

                for (var i = 0; i < container.length; i++) {

                    let egLabelCheck = container[i].parentElement.parentElement.parentElement.parentElement.previousElementSibling.textContent;

                    let egHtml = addingImage(egLabelCheck, container[i]);

                    container[i].insertAdjacentHTML("afterbegin", egHtml);

                }

            }
            movingElements(document.querySelectorAll("#tm-booking .main .extra-inner"));

            // mutation observer
            let observer = new MutationObserver(mutations => {
                // console.log(mutations); // console.log(the changes)
                for (let mutation of mutations) {
                    for (let node of mutation.addedNodes) {
                        // we track only elements, skip other nodes (e.g. text nodes)
                        if ((node instanceof HTMLElement)) {
                            node.querySelector(".extra-line-item") && node.querySelector(".extra-line-item").insertAdjacentHTML("afterbegin", eg_Img);
                            movingElements([node]);
                        }
                        // console.log('hello',node);
                    }
                }
            });

            const ele = document.querySelectorAll("#tm-booking .main .extras form");

            ele.forEach(ele => {
                // observe everything except attributes
                observer.observe(ele, {
                    subtree: true, // observe desendents children
                    childList: true
                });
            });

            // adding read more read less
            readMoreLess();


            document.querySelectorAll('.booking-flow .main .extra .extra-line-item > label').forEach(function(el) {
                el.click();
            })

            document.querySelectorAll('.booking-flow .main .extra.child').forEach(function(el) {
                var getProvisionPrice = parseFloat(el.querySelector('.totalPrice').innerHTML.replaceAll('$', ''));
                var getOriginalPrice = parseFloat(el.previousElementSibling.querySelector('.totalPrice').innerHTML.replace(/[$,]/g, ''));

                var totalPriceWithProvision = (getProvisionPrice + getOriginalPrice).toFixed(2);
                el.previousElementSibling.querySelector('.price-quantity').insertAdjacentHTML('beforeend', '<div class="eg_withProvision"><label><input type="checkbox"> With Provision</label><span class="eg_totalPrice"> $' + totalPriceWithProvision + '</span></div>')
            })

            document.querySelectorAll('.eg_withProvision label input').forEach(function(el) {
                el.closest('.extra').classList.add('eg_boxes');

                el.addEventListener('click', function(element) {

                    if (el.closest('.extra').querySelector('.eg_withoutProvision input') && el.closest('.extra').querySelector('.eg_withoutProvision input').checked == true) {
                        el.closest('.extra').querySelector('.eg_withoutProvision input').checked = false;
                        el.closest('.extra').querySelector('.extra-line-item > label').click();
                    }

                    el.closest('.extra').querySelector('.extra-line-item > label input').click();

                    setTimeout(function() {
                        if (el.closest('.extra').nextElementSibling && el.closest('.extra').nextElementSibling.classList.contains('child') && el.closest('.extra').nextElementSibling.querySelector('.extra-line-item > label input').checked == false) {
                            el.closest('.extra').nextElementSibling.querySelector('.extra-line-item > label input').click();
                        }
                    }, 250)

                })

            })

            document.querySelectorAll('.eg_withoutProvision input').forEach(function(el) {
                el.closest('.extra').classList.add('eg_boxes');

                el.addEventListener('click', function(element) {

                    if (el.closest('.extra').querySelector('.eg_withProvision input') && el.closest('.extra').querySelector('.eg_withProvision input').checked == true) {
                        el.closest('.extra').querySelector('.eg_withProvision input').checked = false;
                        el.closest('.extra').querySelector('.extra-line-item > label').click();
                    }
                    el.closest('.extra').querySelector('.extra-line-item > label').click();

                    setTimeout(function() {
                        if (el.closest('.extra').nextElementSibling && el.closest('.extra').nextElementSibling.classList.contains('child') && el.closest('.extra').nextElementSibling.querySelector('.extra-line-item > label input').checked == true) {
                            el.closest('.extra').nextElementSibling.querySelector('.extra-line-item > label input').click();
                        }
                    }, 250)

                })

            })


            setTimeout(function() {
                document.querySelectorAll('.booking-flow .main .extra .extra-line-item > label').forEach(function(el) {
                    el.click();
                })
            }, 500)

        }

        function addingImage(egLabelCheck, container) {
            let egHtml = '';
            if (egLabelCheck == 'Insurance') {
                egHtml = eg_images.insurance;
            } else if (egLabelCheck == "Wi-Fi Service") {
                egHtml = eg_images.wifi;
            } else if (egLabelCheck == "Crew") {
                if (container.children[0].textContent == 'Hire a Skipper') {
                    egHtml = eg_images.crew.skipper;
                } else if (container.children[0].textContent == 'Hire a Cook') {
                    egHtml = eg_images.crew.cook;
                }
            }

            return egHtml;

        }

        function readMoreLess() {
            let egtoggle = document.querySelector("form > div:nth-child(1) div.extra-description.row > div.text")

            egtoggle.innerHTML = egtoggle.textContent.substring(0, 100) + `<span class="eg-hidden-text">${egtoggle.textContent.substring(100)}</span>` + `<span id="eg_show"><span style="color:black;">...</span>read more</span>`;

            let btn = document.querySelector("#eg_show")

            btn.addEventListener("click", function() {
                egtoggle.classList.toggle("eg_active");
                if (egtoggle.classList.contains("eg_active")) {
                    btn.innerHTML = "read less"
                } else {
                    btn.innerHTML = '<span style="color:black;">...</span>read more';
                }
            });
        }

        // moving crew message and text note
        function movingElements(elements) {
            elements.forEach(ele => {
                qualifier = ele.querySelector("span.qualifier");
                priceQuantity = ele.querySelector(".price-quantity");
                notes = ele.querySelector(".extra-description > .notes");
                text = ele.querySelector(".extra-description > .text");

                if (qualifier) {
                    priceQuantity.insertAdjacentElement("beforeend", qualifier);
                    priceQuantity.insertAdjacentHTML('afterbegin', '<label class="eg_withoutProvision"><input type="checkbox" class="eg_withoutProvision"> Without Provision</label>')
                }

                if (notes) {
                    text.insertAdjacentElement("afterend", notes);
                    // notes.querySelector(".crew-message").textContent = notes.querySelector(".crew-message").textContent.replace("*","Note")
                }
            })


        }


        /* Initialize variation */
        waitForElement("#tm-booking .main .extra-inner", init, 50, 15000);
    } catch (e) {
        if (debug) console.log(e, "error in Test" + variation_name);
    }
})();
Editor is loading...