PageSourceSearch

https://www.newlifeportugal.com/wp-content/plugins/pms-qsm/assets/js/pms-mews-script.js?ver=1791209386

js newlifeportugal.com collected 2026-10-05 18:03:36 UTC 3,475 bytes, 63 lines download raw bytes

1Mews.Distributor(
2    // Set Configuration ID of your booking engine.
3    {
4        configurationIds: ['50f35865-daa4-48f9-9225-b0030098354f'],
5    },
6    // Add callback which will enable Submit button and open the Booking Engine Widget upon button click.
7    function (api) {
8        // Listen on submit and when user submits, open booking engine with given dates.
9        const listenOnSubmit = () => {
10            // Find the form in DOM and listen on submit.
11            const form = document.getElementById('date-form-qsm');
12            if(form){
13                form.addEventListener('submit', event => {
14                    // Don't use the default submit button behavior. We want to handle it ourselves.
15                    event.preventDefault();
16                    // Get the dates from the date form.
17    //                             const { start, end, adultCount } = event.target.elements;
18                    const start = document.getElementById('start');
19                    const end = document.getElementById('end');
20                    const adultCount = document.getElementById('guest-selector');
21                    const voucherCode = document.getElementById('voucher-code');
22
23                    const [startYears, startMonths, startDays] = start.value.split('-');
24                    const [endYears, endMonths, endDays] = end.value.split('-');
25
26                    const startDate = new Date(startYears, startMonths - 1, startDays);
27                    const endDate = new Date(endYears, endMonths - 1, endDays);
28                    let redirectUrl = PMSMEWS.redirect_url_28_night;
29                    let nightsCount = jQuery(document).find('.choose-stay-type .custom-select-dropdown li.selected').attr('data-val');
30                    let programsSlug = jQuery(document).find('.choose-stay-type .custom-select-dropdown li.selected').attr('data-name');
31                    let programsName = jQuery(document).find('.choose-stay-type .custom-select-dropdown li.selected').text();
32                    let mewsRateId = jQuery(document).find('.choose-stay-type .custom-select-dropdown li.selected').attr('data-mews-rateid');
33
34                    redirectUrl = redirectUrl+'?path='+encodeURIComponent(programsName)+'&datecheckin='+start.value+'&datecheckout='+end.value+'&mewsid='+mewsRateId;
35                    if(nightsCount != '' && Number(nightsCount) >= 28 && redirectUrl != ''){
36                        window.location.href = redirectUrl;
37                    }else{
38                        // Use the Booking Engine Widget Javascript API to set the dates in the widget and open it.
39                        api.setStartDate(startDate);
40                        api.setEndDate(endDate);
41                        api.setAdultCount(Number(adultCount.value));
42                        api.setVoucherCode(voucherCode.value);
43                        api.open();
44                        api.showRooms();
45                    }
46                });
47            }
48        };
49
50        listenOnSubmit();
51
52        // Enable the submit button, because the Booking Engine Widget is ready to be used.
53        const enableSubmit = () => {
54            const submitButton = document.getElementById('dates-submit');
55            if(submitButton){
56                submitButton.value = 'Submit';
57                submitButton.disabled = false;
58            }
59        };
60        enableSubmit();
61    }
62    // 4. Note - this guide is written for the Production environment.
63);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.