PageSourceSearch

https://www.hotelavanti.cz/wp-content/plugins/de-builder-evo-block…/js/bookingform_popin_fusion.js?ver=1.0.0

js hotelavanti.cz collected 2026-09-30 21:57:48 UTC 8,968 bytes, 286 lines download raw bytes

1(function ($) {
2
3    function centerBookingform() {
4        var wrap = $('#bookingform_wrap');
5        var bookingform = $('#bookingform');
6        var wrap_height = wrap.outerHeight();
7        var bookingform_height = bookingform.outerHeight();
8        if (bookingform_height < wrap_height) {
9            bookingform.css({
10                'margin-top': (wrap_height - bookingform_height) / 2
11            });
12        } else {
13            wrap.css({
14                'overflow': 'auto'
15            });
16            bookingform.css({
17                'margin-top': 0
18            });
19
20        }
21    }
22
23    function openCloseBf() {
24        $('#bookingform .close').on('click', function () {
25            $('#bookingform_wrap').fadeOut();
26            $('html').removeClass('no_scroll');
27        });
28
29        $('.open_booking').on('click', function () {
30            $('#bookingform_wrap').appendTo('body');
31            $('#bookingform_wrap').fadeIn();
32            $('html').addClass('no_scroll');
33            centerBookingform();
34        })
35    }
36
37    function tabsPopin(clicked_tab){
38
39        var selected_tab = clicked_tab.data('tab');
40
41        $('.tabs_for_popin').removeClass('active');
42
43        $('.hide_tab').hide();
44        setTimeout(function(){
45            $(selected_tab).fadeIn();
46            clicked_tab.addClass('active');
47        }, 50);
48    }
49
50    function slideIn(selector) {
51        selector.css({
52            'transform': 'translateX(0)'
53        })
54    }
55
56    function slideOut(selector) {
57        selector.css({
58            'transform': 'translateX(-100%)'
59        })
60    }
61
62    //STATE manager
63    //Jesus forgive me 'cause I'm a hopeless sinner
64    function readCartVal() {
65        setTimeout(function () {
66            var counter = $('#mobile_bar qw-basket-room-counter').html();
67            var counterVal = parseInt(counter);
68            if (counterVal > 0) {
69                $('.hook_message').fadeOut();
70                $('.qw_button_container').css({
71                    'left': 0
72                });
73            } else {
74                $('.hook_message').fadeIn();
75                $('.qw_button_container').css({
76                    'left': '100%'
77                });
78            }
79        }, 500);
80
81    }
82
83    //custom event (check if cart is full or not)
84    function addFullCartEvent() {
85        if ($('qw-basket').length > 0) {
86            $(this).on('qwBasketIsAccommodationSatisfy', function (e) {
87                var isFull = e.detail.status;
88                var nestedDetails = e.detail.detail;
89                missingAdults = nestedDetails.adults.sessionValue - nestedDetails.adults.currentValue;
90                missingChildren = nestedDetails.children.sessionValue - nestedDetails.children.currentValue;
91                missingInfants = nestedDetails.infants.sessionValue - nestedDetails.infants.currentValue;
92                switch (isFull) {
93                    case 1:
94                        $(window).trigger('qwBasketIsFull');
95                        break;
96                    case 2:
97                        $(window).trigger('qwBasketIsNotFull');
98                        break;
99                    case 0:
100                        $(window).trigger('qwBasketIsEmpty');
101                        break;
102                    default:
103                        $(window).trigger('qwBasketUnknownEvent');
104                        console.log('Unable to recognize the event status triggered by <qw-basket> component. Event Status number: ' + e.detail.status)
105                }
106            });
107        } else {
108            console.log('Dear {Dev}, you need to add the <qw-basket> component somewhere (even hidden) in order to handle checkout and offers. Happy debugging! - MF :)')
109        }
110    }
111
112    //EVENTS management
113    var notificationHeight = '60px';
114    var is_phone = $(window).width() < 768;
115    if (is_phone) {
116        notificationHeight = '120px';
117    }
118
119    //Room added to basket
120    $(window).on('qwRoomRateAddedToBasket', function () {
121        centerBookingform();
122        readCartVal();
123        addFullCartEvent();
124    });
125
126    //Cart ready
127    $(window).on('qwBasketRoomCounterNumber', function () {
128        centerBookingform();
129        readCartVal();
130        addFullCartEvent();
131    });
132
133
134    //Cart reset
135    $(window).on('qwBasketWillBeReset', function () {
136        centerBookingform();
137        readCartVal();
138        addFullCartEvent();
139        $('.notification').css({
140            'height': notificationHeight
141        });
142        slideOut($('.no-enough-rooms'));
143        slideIn($('.reset-basket-popup'));
144
145        $.cookie('checkout_shown', 'no', { expires: 1, path: '/' });
146        setTimeout(function () {
147            slideOut($('.reset-basket-popup'));
148        }, 3000);
149    });
150
151    //Cart full
152    $(window).on('qwBasketIsFull', function () {
153        var shown = $.cookie('checkout_shown');
154
155        //hide ribbon alert on header
156        if( typeof obj !== 'undefined' ){
157            obj.fadeOut();
158        }
159        //show checkout
160        if (shown !== 'yes') {
161            $('#checkout_header').find('.qw-button--checkout').trigger('click');
162            $.cookie('checkout_shown', 'yes', { expires: 1, path: '/' });
163        }
164
165
166        slideOut($('.no-enough-rooms'));
167        setTimeout(function () {
168            $('.notification').css({
169                'height': 0
170            });
171        }, 1000);
172
173        $('#bookingform .check-availabilty').hide();
174        setTimeout(function () {
175            $('#bookingform  qw-basket').fadeIn();
176
177
178            if(!$("#tab_cart").hasClass('active')){
179                tabsPopin($('div[data-tab="#tab_cart"]'));
180            }
181        }, 300);
182
183
184    });
185
186    //Cart empty
187    $(window).on('qwBasketIsEmpty', function () {
188        $.cookie('checkout_shown', 'no', { expires: 1, path: '/' });
189        //hide ribbon alert on header
190        if( typeof obj !== 'undefined' ){
191            obj.fadeOut();
192        }
193
194        slideOut($('.no-enough-rooms'));
195        setTimeout(function () {
196            $('.notification').css({
197                'height': 0
198            });
199        }, 1000);
200
201        $('#bookingform qw-basket').hide();
202        setTimeout(function () {
203            $('#bookingform .check-availabilty').fadeIn();
204
205            if(!$("#tab_calendar").hasClass('active')) {
206                tabsPopin($('div[data-tab="#tab_calendar"]'));
207            }
208
209
210        }, 300)
211
212    });
213
214    //Cart full but not satisfy the accomodation
215    $(window).on('qwBasketIsNotFull', function () {
216
217        var i;
218        var adultsIcons = '';
219        for (i=1; i <= missingAdults; i++){
220            adultsIcons += '<span class="adults"></span>'
221        }
222        var j;
223        var childrenIcons = '';
224        for (j=1; j <= missingChildren; j++){
225            childrenIcons += '<span class="children"></span>'
226        }
227        var k;
228        var infantIcons = '';
229        for (k=1; k <= missingInfants; k++){
230            infantIcons += '<span class="infants"></span>'
231        }
232
233        var string = '<span class="message hidden-xs">' + catchPhrase + '.</span>';
234        string +=  missingAdults > 0 ? ' <span class=adults_label>&nbsp;' + missingAdultsString + ' : ' + adultsIcons + '</span>': '';
235        string +=  missingChildren > 0 ? ' <span class=children_label>&nbsp;-&nbsp;' + missingChildrenString + ' : ' + childrenIcons + '</span>' : '';
236        string +=  missingInfants > 0 ? ' <span class="infants_label">&nbsp;-&nbsp;' + missingInfantsString + ' : ' + infantIcons + '</span>': '';
237
238
239        var el = '<div class="ribbon_alert">' + string+ ' </div>';
240        obj = $('.ribbon_alert');
241        obj.fadeIn();
242
243        if(obj.length === 0) {
244            $('#header').append(el);
245            $('.de_first:not(.slideshow_container )').css({
246                'margin-top': $('.ribbon_alert').height() + 'px'
247        });
248        } else{
249            obj.html(string)
250        }
251
252        $.cookie('checkout_shown', 'no', { expires: 1, path: '/' });
253
254        $('.notification').css({
255            'height': notificationHeight
256        });
257
258        $('#bookingform qw-basket').hide();
259        setTimeout(function () {
260            $('#bookingform .check-availabilty').fadeIn();
261
262            if(!$("#tab_cart").hasClass('active')) {
263                tabsPopin($('div[data-tab="#tab_cart"]'));
264            }
265
266        }, 300);
267
268        setTimeout(function () {
269            slideIn($('.no-enough-rooms'));
270        }, 1500);
271
272    });
273
274    //DOM READY
275    $(document).ready(function () {
276        openCloseBf();
277
278        $('.tabs_for_popin:first-of-type').addClass('active');
279
280        $(document).on('click', '.tabs_for_popin', function() {
281            tabsPopin($(this));
282        });
283
284    });
285
286})(jQuery);

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.