PageSourceSearch

https://bellevue.lv/en/assets/templates/bellevue/js/scripts.js?v=1.1.4

js bellevue.lv collected 2026-10-09 21:47:12 UTC 7,301 bytes, 236 lines download raw bytes

1/* $.fancybox.defaults.touch = false;
2$.fancybox.defaults.buttons = ["zoom", "close"]; */
3
4const bookingForm = {
5    form: $('#checkin-widget'),
6    setArrivalDate: function(date) {
7        const year = date.getFullYear();
8        const month = String(date.getMonth() + 1).padStart(2, '0');
9        const day = String(date.getDate()).padStart(2, '0');
10        this.form.find('[name="arrivalDate"]').val(year + '-' + month + '-' + day)
11    },
12    setNights: function(date) {
13        const arrivalDate = new Date(this.form.find('[name="arrivalDate"]').val())
14        const diffInDays = Math.round((date.getTime() - arrivalDate.getTime()) / (1000 * 3600 * 24));
15        this.form.find('[name="nights"]').val(diffInDays || 1)
16    }
17}
18
19function copyTextToClipboard(text, successMessage) {
20    if (!navigator.clipboard) {
21        let textArea = document.createElement("textarea");
22        textArea.value = text;
23        
24        // Avoid scrolling to bottom
25        textArea.style.top = "0";
26        textArea.style.left = "0";
27        textArea.style.position = "fixed";
28        
29        document.body.appendChild(textArea);
30        textArea.focus();
31        textArea.select();
32        
33        try {
34            if(document.execCommand('copy')) {
35                SweetAlert2.Message.success(successMessage)
36            }
37            else {
38                console.log('Fallback: Copying text command was unsuccessful');
39            }
40        } catch (err) {
41            console.error('Fallback: Oops, unable to copy', err);
42        }
43        
44        document.body.removeChild(textArea);
45        return;
46    }
47    navigator.clipboard.writeText(text).then(function() {
48        SweetAlert2.Message.success(successMessage)
49    }, function(err) {
50        console.error('Async: Could not copy text: ', err);
51    });
52}
53
54$('.special-offers__wrapper').each(function(e) {
55    if ($(this).find('.special-offers__slide').length == 2) {
56        $(this).find('.special-offers__slide').clone().appendTo($(this))
57    }
58})
59
60setInterval(() => {
61    $('.iti__selected-dial-code').each(function() {
62        let $phone_code = $(this).closest('form').find('input[name="phone_code"]')
63        if ($phone_code.length) {
64            $phone_code.val($(this).text())
65        }
66    })
67}, 500)
68
69$(document).on('keypress', '[name="phone"]', function(e) {
70    let charCode = (e.which) ? e.which : event.keyCode    
71
72    if (String.fromCharCode(charCode).match(/[^0-9]/g)) {
73        return false; 
74    }
75})
76
77let AjaxFormLoadCallback = setInterval(function() {
78    if (typeof AjaxForm !== 'undefined') {
79
80        AjaxForm.Message.error = function(e, i) {
81            SweetAlert2.Message.error(e)
82        }
83
84        AjaxForm.Message.success = function(e, i) {
85            //$('#success .text').html(e);
86            
87            /* let selectorSuccess = '#success';
88
89            $.fancybox.close();
90
91            $.fancybox.open({
92                src  : selectorSuccess,
93                type : 'inline',
94                opts : {
95                    touch: false,
96                    hideScrollbar: false,
97                }
98            }); */
99        }
100        
101        clearInterval(AjaxFormLoadCallback);
102    }
103}, 500);
104
105$(document).on('af_complete', function(event, response) {
106    let $form = response.form,
107        success = response.success;
108
109    if (success) {
110        if ($form.attr('data-redirect')) {
111            window.location = $form.attr('data-redirect');
112        }
113        else {
114            $('body').append('<a style="opacity:0;visibility:hidden;position:absolute;" data-popup="#thanks">')
115            $('[data-popup="#thanks"]')[0].dispatchEvent(
116                new MouseEvent("click", {
117                    "view": window,
118                    "bubbles": true,
119                    "cancelable": false
120                })
121            );
122        }
123    }
124})
125
126$(document).on('focus', 'input, textarea, select', function(e){
127    $(this).removeClass('error');
128});
129
130$('.js-cookie').click(function(e) {
131    e.preventDefault();
132    document.cookie = "cookies_agreement=1; path=/; max-age=31536000";
133    setTimeout(() => {
134        if($('#banner').length) {
135            $('body').append('<a style="opacity:0;visibility:hidden;position:absolute;" data-popup="#banner">')
136            $('[data-popup="#banner"]')[0].dispatchEvent(
137                new MouseEvent("click", {
138                    "view": window,
139                    "bubbles": true,
140                    "cancelable": false
141                })
142            );
143            document.cookie = "banner=1; path=/; max-age=31536000";
144        }
145    }, 1000)
146}
146);
147
148$('.js-copy-code').click(function(e) {
149    let code = $(this).attr('data-promo-code');
150    let successMessage = $(this).attr('data-success-msg');
151    copyTextToClipboard(code, successMessage);
152    //$(this).addClass('btn_bg-green')
153});
154
155$('.food-menu__tab').click(function(e) {
156    e.preventDefault();
157    
158    if ($(this).hasClass('_active')) return;
159    
160    let index = $(this).index();
161    
162    console.log(index);
163    
164    $(this).siblings('.food-menu__tab').removeClass('_active');
165    $(this).addClass('_active');
166    
167    let tabsWrapper = $(this).parent().next();
168    
169    //$('.food-menu__groups').css('min-height', $('.food-menu__groups').height() + 'px');
170    tabsWrapper.css('min-height', $('.food-menu__groups').height() + 'px');
171    
172    tabsWrapper.find('.food-menu__group._active').fadeOut(250, function(){
173        $(this).removeClass('_active');
174        tabsWrapper.find('.food-menu__group').eq(index).fadeIn(250, function(){
175            $(this).addClass('_active');
176            tabsWrapper.css('min-height', '0');
177        });
178        
179    });
180});
181
182$('.food-menu__title').click(function(e) {
183    e.preventDefault();
184    
185    if ($(this).hasClass('_active')) return;
186    
187    let index = $(this).index();
188    
189    $(this).siblings('.food-menu__title').removeClass('_active');
190    $(this).addClass('_active');
191    
192    let sectionsWrapper = $(this).closest('.food-menu').find('.food-menu__sections');
193    
194    sectionsWrapper.css('min-height', $('.food-menu__sections').height() + 'px');
195    
196    sectionsWrapper.find('.food-menu__section._active').fadeOut(200, function(){
197        $(this).removeClass('_active');
198        sectionsWrapper.find('.food-menu__section').eq(index).fadeIn(200, function(){
199            $(this).addClass('_active');
200            sectionsWrapper.css('min-height', '0');
201        });
202        
203    });
204});
205
206$(document).on("click", "a", function(e){
207  var anchor = $(this).attr('href');
208  
209  if (anchor != "#" && $(anchor).length) {
210    e.preventDefault();
211
212    $('html, body').stop().animate({
213      scrollTop: $(anchor).offset().top - 100
214   }, 600);
215  }
216});
217
218/* if ($('.js-phone-code').length) {
219    $.ajax({
220        url: `/assets/components/countrycode/index.php`,
221        type: 'GET',
222        dataType: "json",
223        success: function(response) {
224            if (response.success) {
225                $('.js-phone-code').each(function() {
226                    let option = $(this).find('option[data-country-code="'+response.country+'"]');
227                    option.parent().prepend(option);
228                    option.prop('selected', true)
229                })
230            }
231        },
232        complete: function() {
233            initSelect2($('.js-phone-code'))
234        }
235    });
236} */

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.