PageSourceSearch

https://hotelpietheineek.nl/wp-content/themes/hotel-piet-hein-eek/js/rooms.js?v=1.0.2&ver=7.0.7

js hotelpietheineek.nl collected 2026-10-08 22:45:18 UTC 12,816 bytes, 395 lines download raw bytes

1var popup = false;
2var popupIsAnimating = false;
3var calendarA;
4var roomsCalendarDayButton = 'from';
5
6function openCalendar(popupOpenBtn){
7  if(!popup.hasClass('animating') && popup.hasClass('opened')){
8    jQuery('#room-calendar-a-close, #room-calendar-b-close').click();
9    return;
10  }
11
12  if(popup === false){
13    popup = jQuery('#room-calendar-popup');
14  }
15  if(!popup.hasClass('animating') && popup.hasClass('opened')){
16    jQuery('#room-calendar-a-close, #room-calendar-b-close').click();
17    return;
18  }
19
20  roomsCalendarDayButton = popupOpenBtn.attr('id') === 'rooms-date-filter-to' ? 'to' : 'from';
21
22  if(popupIsAnimating){
23    return;
24  }
25
26  popupIsAnimating = true;
27
28  /*jQuery('#room-calendar-popup').stop().animate({
29    'bottom' : '0px',
30    'left' : '0px'
31  }).removeClass('closed').addClass('opened');*/
32
33
34  let top = popupOpenBtn.offset().top-popupOpenBtn.outerHeight()+2;
35  if(jQuery('body').hasClass('post-type-archive-hphe_holiday_homes')){
36    top = popupOpenBtn.offset().top + popupOpenBtn.outerHeight()+2 - jQuery('.holiday-homes-header').offset().top;
37  }
38  popup.css({
39    'top' : top+'px',
40    'left' : (popupOpenBtn.offset().left-2)+'px',
41    'width' : popup.hasClass('availability-popup-single') ? '275px' : '550px'
42  });
43  jQuery('.calendar-animating-bg',popup).stop().hide().css({
44    'width' : '0px',
45    'height' : '0px',
46    'top' : (popupOpenBtn.offset().top+popupOpenBtn.outerHeight())+'px',
47    'left' : (popupOpenBtn.offset().left-2)+'px',
48  });
49  jQuery('.calendar-row',popup).css({
50    'opacity':'0'
51  });
52  popup.addClass('animating opened');
53  jQuery('.calendar-animating-bg',popup).fadeIn('fast',function(){
54    jQuery('.calendar-animating-bg',popup).animate({
55      'width' : (jQuery('.calendar-row',popup).width())+'px',
56      'height' : (jQuery('.calendar-row',popup).height())+'px',
57    },{
58      duration: 'fast',
59      complete: function(){
60        jQuery('.calendar-row',popup).animate({
61          'opacity' : '1'
62        },{
63          duration: 'fast',
64          complete: function(){
65            jQuery('.calendar-animating-bg',popup).hide();
66            popup.removeClass('animating');
67            popupIsAnimating = false;
68          }
69        });
70      }
71    });
72  });
73}
74function closeCalendar(){
75  if(popupIsAnimating){
76    return;
77  }
78
79  if(popup === false){
80    popup = jQuery('#room-calendar-popup');
81  }
82
83  if(!popup.hasClass('opened')){
84    return;
85  }
86
87  popupIsAnimating = true;
88  jQuery('.calendar-animating-bg',popup).css({
89    'width' : (jQuery('.calendar-row',popup).width())+'px',
90    'height' : (jQuery('.calendar-row',popup).height())+'px'
91  }).show();
92
93  jQuery('.calendar-row',popup).animate({
94    'opacity' : '0'
95  },{
96    duration: 'fast',
97    complete: function(){
98
99      jQuery('.calendar-animating-bg',popup).animate({
100        'width' : '0px',
101        'height' : '0px'
102      },{
103        duration: 'fast',
104        complete: function(){
105          jQuery('.calendar-animating-bg',popup).fadeOut('fast',function(){
106            popup.removeClass('animating opened');
107
108            popup.css({
109              'left' : '-3000px',
110            });
111
112            popupIsAnimating = false;
113          });
114        }
115      });
116    }
117  });
118
119  /*jQuery('#room-calendar-popup').stop().animate({
120    'bottom' : (0-$('#room-calendar-popup').outerHeight())+'px',
121    'left' : '100%'
122  }).removeClass('opened').addClass('closed');*/
123}
124
125function roomsCalendarDayClick(date,isInPast,isBooked){
126  if(isInPast === true || isInPast === 'true'){
127    return;
128  }
129  if(popup === false){
130    popup = jQuery('#room-calendar-popup');
131  }
132
133
134  popup.attr('data-'+roomsCalendarDayButton,date);
135
136
137
138  let isFrom = roomsCalendarDayButton === 'from';
139  if(isFrom){
140    if(
141      typeof(popup.attr('data-to')) === 'undefined'
142      || popup.attr('data-to') === ''
143      || (popup.attr('data-to') !== '' && Date.parse(popup.attr('data-to')) < Date.parse(popup.attr('data-from')))
144    ){
145      let datePlus1Day = new Date(date);
146      datePlus1Day.setDate(datePlus1Day.getDate() + 1);
147
148      let datePlus1DayYe = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(datePlus1Day);
149      let datePlus1DayMo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(datePlus1Day);
150      let datePlus1DayDa = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(datePlus1Day);
151
152      popup.attr('data-to',datePlus1DayYe+'-'+datePlus1DayMo+'-'+datePlus1DayDa);
153      jQuery('#rooms-date-filter-to span').html(': '+datePlus1DayDa+'-'+datePlus1DayMo+'-'+datePlus1DayYe);
154    }
155  } else {
156    if(
157      typeof(popup.attr('data-from')) === 'undefined'
158      || popup.attr('data-from') === ''
159      || (popup.attr('data-from') !== '' && Date.parse(popup.attr('data-to')) < Date.parse(popup.attr('data-from')))
160    ){
161      let dateMin1Day = new Date(date);
162      dateMin1Day.setDate(dateMin1Day.getDate() - 1);
163
164      let dateMin1DayYe = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(dateMin1Day);
165      let dateMin1DayMo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(dateMin1Day);
166      let dateMin1DayDa = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(dateMin1Day);
167
168      popup.attr('data-from',dateMin1DayYe+'-'+dateMin1DayMo+'-'+dateMin1DayDa);
169      jQuery('#rooms-date-filter-from span').html(': '+dateMin1DayYe+'-'+dateMin1DayMo+'-'+dateMin1DayDa);
170    }
171  }
172
173
174  if(roomsCalendarDayButton === 'from' && (typeof(popup.attr('data-to')) === 'undefined' || popup.attr('data-to') === '')){
175    let datePlus1Day = new Date(date);
176    datePlus1Day.setDate(datePlus1Day.getDate() + 1);
177
178    let datePlus1DayYe = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(datePlus1Day);
179    let datePlus1DayMo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(datePlus1Day);
180    let datePlus1DayDa = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(datePlus1Day);
181    popup.attr('data-to',datePlus1DayYe+'-'+datePlus1DayMo+'-'+datePlus1DayDa);
182    jQuery('#rooms-date-filter-to span').html(': '+datePlus1DayDa+'-'+datePlus1DayMo+'-'+datePlus1DayYe);
183  }
184
185
186  roomsCalendarSelectedRefresh();
187
188  let d = new Date(date);
189  let ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d);
190  let mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(d);
191  let da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d);
192
193  jQuery('#rooms-date-filter-'+roomsCalendarDayButton+' span').html(': '+da+'-'+mo+'-'+ye);
194
195  closeCalendar();
196
197
198  if(
199      typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''
200    &&
201      typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''
202  ){
203    jQuery('#rooms-date-filter-submit').click();
204  }
205}
206function roomsCalendarSelectedRefresh(doRefresh){
207  doRefresh = typeof(doRefresh) !== 'undefined' ? doRefresh : true;
208  //console.log('doRefresh',doRefresh);
209  calendarA.clearDaySpecialClass();
210  if(popup === false){
211    popup = jQuery('#room-calendar-popup');
212  }
213
214  let baseClass = 'selected';
215
216  if(
217      typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''
218      &&
219      typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''
220  ){
221    let startDate = dateToUs(popup.attr('data-from'));
222    let endDate = dateToUs(popup.attr('data-to'));
223    let start = new Date(startDate);
224    let end = new Date(endDate);
225    let loop = new Date(start);
226    while(loop <= end){
227      let dayYear = loop.getFullYear();
228      let dayMonth = loop.getMonth()+1;
229      let dayDay = loop.getDate();
230      let newDate = loop.setDate(loop.getDate() + 1);
231      let loopDate = dayYear+'-'+(dayMonth < 10 ? '0' : '')+dayMonth+'-'+(dayDay < 10 ? '0' : '')+dayDay;
232
233      let loopClass = baseClass ;
234      if(loopDate === startDate){
235        loopClass += ' selected-from';
236      } else if(loopDate === endDate){
237        loopClass += ' selected-to';
238      }
239
240      calendarA.setDaySpecialClass(loopDate,loopClass);
241    }
242
243  } else if(typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''){
244    baseClass += ' selected-from';
245    calendarA.setDaySpecialClass(dateToUs(popup.attr('data-from')),baseClass);
246  } else if(typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''){
247    baseClass += ' selected-to';
248    calendarA.setDaySpecialClass(dateToUs(popup.attr('data-to')),baseClass);
249  }
250  /*if(
251    typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''
252    &&
253    typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''
254  ){
255    let start = new Date(popup.attr('data-from'));
256    let end = new Date(popup.attr('data-to'));
257    let loop = new Date(start);
258    while(loop <= end){
259      let dayYear = loop.getFullYear();
260      let dayMonth = loop.getMonth()+1;
261      let dayDay = loop.getDate();
262      let newDate = loop.setDate(loop.getDate() + 1);
263      calendarA.setDaySpecialClass(dayYear+'-'+(dayMonth < 10 ? '0' : '')+dayMonth+'-'+(dayDay < 10 ? '0' : '')+dayDay,'selected');
264    }
265
266  } else if(typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''){
267    calendarA.setDaySpecialClass(popup.attr('data-from'),'selected');
268  } else if(typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''){
269    calendarA.setDaySpecialClass(popup.attr('data-to'),'selected');
270  }*/
271
272  if(doRefresh){
273    calendarA.refresh();
274  }
275}
276jQuery(document).ready(function($){
277  if(popup === false){
278    popup = jQuery('#room-calendar-popup');
279  }
280  //$('#room-calendar-popup').css('bottom',(0-$('#room-calendar-popup').outerHeight())+'px').hide();
281
282  let pageUrl = $('#rooms-date-filter-submit').attr('data-url');
283
284  $('#rooms-date-filter-from, #rooms-date-filter-to').click(function(e){
285    e.preventDefault();
286    //console.log('rooms-date-filter-from');
287    openCalendar($(this));
288  });
289
290  $('#room-calendar-a-close, #room-calendar-b-close').click(function(e){
291    e.preventDefault();
292    closeCalendar();
293  });
294
295  $('#rooms-date-filter-submit').click(function(e){
296    e.preventDefault();
297
298    let from = '';
299    if(typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''){
300      from = popup.attr('data-from');
301    }
302
303    let to = '';
304    if(typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''){
305      to = popup.attr('data-to');
306    }
307
308    document.location.href = pageUrl+'?from='+from+'&to='+to;
309  });
310  $('#rooms-date-filter-clear-submit').click(function(e){
311    document.location.href = pageUrl+'?show=all';
312  });
313
314
315
316  $(document).click(function(event) {
317    var $target = $(event.target);
318    if(
319        !$target.closest('#room-calendar-popup').length
320    ) {
321      closeCalendar();
322    }
323  });
324
325  function calendarPopupPosition(){
326    if(!$('#room-calendar-popup').hasClass('opened')){
327
328    }
329  }
330  $(window).on('ready',function(){
331    calendarPopupPosition();
332  });
333  $(window).resize(function(){
334    calendarPopupPosition();
335  });
336
337  let today = new Date();
338  if(typeof(popup.attr('data-from')) !== 'undefined' && popup.attr('data-from') !== ''){
339    let dataFrom = popup.attr('data-from').split('-');
340    today = new Date(dataFrom[0],dataFrom[1]-1,dataFrom[2]);
341  } else if(typeof(popup.attr('data-to')) !== 'undefined' && popup.attr('data-to') !== ''){
342    let dataTo = popup.attr('data-to').split('-');
343    today = new Date(dataTo[0],dataTo[1]-1,dataTo[2]);
344  }
345
346  let calendarAYear = today.getFullYear();
347  let calendarAMonth = today.getMonth()+1;
348
349  let calendarBYear = calendarAMonth === 12 ? calendarAYear+1 : calendarAYear;
350  let calendarBMonth = calendarAMonth === 12 ? 1 : calendarAMonth+1;
351
352  //alert(calendarAYear+'/'+calendarAMonth);
353  //alert(calendarBYear+'/'+calendarBMonth);
354  calendarA = new Calendar("calendar-a",calendarAYear,calendarAMonth);
355  //let calendarB = new Calendar("calendar-b",calendarBYear,calendarBMonth);
356
357  let lang = 'en';
358  if(typeof($('html').attr('lang')) !== 'undefined'){
359    let langFull = $('html').attr('lang');
360    let langFullArray = langFull.split('-');
361    if(typeof(langFullArray[0]) !== 'undefined'){
362      lang = langFullArray[0];
363    }
364  }
365
366  calendarA.setLang(lang);
367  calendarA.setOnClick('roomsCalendarDayClick');
368  calendarA.setDayClass('day-hover');
369
370  roomsCalendarSelectedRefresh(false);
371
372  calendarA.build();
373
374  //calendarB.setLang(lang);
375  //calendarB.setOnClick('roomsCalendarDayClick');
376  //calendarB.setDayClass('day-hover');
377  //calendarB.build();
378
379  $('.calendar-arrow-left').click(function(){
380    if(calendarA.isCurrentMonth()){
381      return;
382    }
383
384    calendarA.prev();
385    //calendarB.prev();
386
387    $('.calendar-arrow-left').toggle(!calendarA.isCurrentMonth());
388  });
389  $('.calendar-arrow-right').click(function(){
390    calendarA.next();
391    //calendarB.next();
392
393    $('.calendar-arrow-left').toggle(!calendarA.isCurrentMonth());
394  });
395});

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.