// source --> https://s2pconnect.com/wp-content/plugins/wp-booking-calendar/public/js/wach.calendar.js?ver=2aee91c77b6db7710bfe3fa8f161cadc jQuery.noConflict(); var $wbc = jQuery; booking_path = WPBookingCalendarSettings.path; booking_day_white_bg = WPBookingCalendarSettings.day_white_bg; booking_day_white_bg_hover = WPBookingCalendarSettings.day_white_bg_hover; booking_day_white_line1_color = WPBookingCalendarSettings.day_white_line1_color; booking_day_white_line1_color_hover = WPBookingCalendarSettings.day_white_line1_color_hover; booking_day_white_line2_color = WPBookingCalendarSettings.day_white_line2_color; booking_day_white_line2_color_hover = WPBookingCalendarSettings.day_white_line2_color_hover; booking_day_white_line2_bg = WPBookingCalendarSettings.day_white_line2_bg; booking_day_white_line2_bg_hover = WPBookingCalendarSettings.day_white_line2_bg_hover; booking_recaptcha_style = WPBookingCalendarSettings.recaptcha_style; var booking_currentMousePos = { x: -1, y: -1 }; $wbc(document).mousemove(function(event) { booking_currentMousePos.x = event.pageX; booking_currentMousePos.y = event.pageY; }); var booking_xhr = new Array(); function getBookingMonthCalendar(month, year, calendar_id,recaptchakey) { for(var i = 0; i < booking_xhr.length; i++) { booking_xhr[i].abort(); } $wbc('#booking_container_all').parent().prepend('
'); $wbc('#booking_modal_loading').fadeIn(); booking_xhr.push($wbc.ajax({ url: booking_path+'ajax/getMonthCalendar.php?month='+month+'&year='+year+'&calendar_id='+calendar_id+'&publickey='+recaptchakey+"&wpml_lang="+$wbc('#wpml_lang').val(), success: function(data) { $wbc('#booking_modal_loading').attr("style","display:none !important"); $wbc('#booking_sfondo').remove(); $wbc('#booking_calendar_container').html(data); $wbc('.booking_day_white a').each(function() { if($wbc(this).attr('over')==1) { if($wbc(this).attr('popup') == 1) { $wbc(this).bind('mouseenter', function (e) { fillBookingSlotsPopup($wbc(this).attr('year'), $wbc(this).attr('month'), $wbc(this).attr('day'), calendar_id); $wbc('#booking_box_slots').stop().fadeIn(0); $wbc(this).css({'background-color': booking_day_white_bg_hover}); $wbc(this).children('div.booking_day_number').css({'color': booking_day_white_line1_color_hover, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); $wbc(this).children('div.booking_day_slots').css({'color': booking_day_white_line2_color_hover, 'background-color': booking_day_white_line2_bg_hover, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); $wbc(this).children('div.booking_day_book').css({'color': booking_day_white_line1_color_hover, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); }); $wbc(this).bind('mouseleave', function () { $wbc('#booking_box_slots').attr("style", "display:none !important"); $wbc(this).css({'background-color': booking_day_white_bg}); $wbc(this).children('div.booking_day_number').css({'color': booking_day_white_line1_color, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); $wbc(this).children('div.booking_day_slots').css({'color': booking_day_white_line2_color, 'background-color': booking_day_white_line2_bg, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); $wbc(this).children('div.booking_day_book').css({'color': booking_day_white_line1_color, 'transition': ' background 0.4s, color 0.4s', '-o-transition': 'background 0.4s, color 0.4s', '-ms-transition': 'background 0.4s, color 0.4s', '-moz-transition': 'background 0.4s, color 0.4s', '-webkit-transition': 'background 0.4s, color 0.4s'}); }); $wbc(this).bind('mousemove', function (e) { var top; var left; pageX = e.pageX - $wbc('#booking_container_all').offset().left; pageY = e.pageY - $wbc('#booking_container_all').offset().top; if (pageX - $wbc('#booking_box_slots').width() < 0) { newpageX = 0; } else if (pageX + $wbc('#booking_box_slots').width() > $wbc('#booking_container_all').width()) { newpageX = pageX - $wbc('#booking_box_slots').width() - 20; } else { newpageX = pageX; } if (pageY < 0) { newpageY = 0; } else if (pageY + $wbc('#booking_box_slots').height() + 20 > $wbc('#booking_container_all').height()) { newpageY = pageY - $wbc('#booking_box_slots').height() - 40; } else { newpageY = pageY; } if (newpageY + $wbc('#booking_container_all').offset().top < e.pageY) { top = newpageY + $wbc('#booking_container_all').offset().top - 20; } else { top = newpageY + $wbc('#booking_container_all').offset().top + 20; } if (newpageX + $wbc('#booking_container_all').offset().left < e.pageX) { left = newpageX + $wbc('#booking_container_all').offset().left - 20; } else { left = newpageX + $wbc('#booking_container_all').offset().left + 20; } top = (top - $wbc(window).scrollTop()); left = (left - $wbc(window).scrollLeft()); if (top < 0) { top = pageY + 40; } $wbc('#booking_box_slots').css({ top: top + 'px', left: left + 'px', display: $wbc('#booking_box_slots').css("display") }); }); } $wbc(this).bind('click', function(e) { e.preventDefault(); $wbc('#booking_box_slots').stop().attr("style","display:none !important"); getBookingForm($wbc(this).attr('year'),$wbc(this).attr('month'),$wbc(this).attr('day'),calendar_id,recaptchakey); }); } }); $wbc('#booking_box_slots').resize(function() { $wbc(this).bind('mouseleave', function() { $wbc('#booking_box_slots').attr("style","display:none !important"); }); var top; var left; pageX = booking_currentMousePos.x- $wbc('#booking_container_all').offset().left; pageY = booking_currentMousePos.y- $wbc('#booking_container_all').offset().top; if(pageX-$wbc('#booking_box_slots').width()<0) { newpageX = 0; } else if(pageX+$wbc('#booking_box_slots').width()>$wbc('#booking_container_all').width()) { newpageX = pageX-$wbc('#booking_box_slots').width()-20; } else { newpageX = pageX; } if(pageY<0) { newpageY = 0; } else if(pageY+$wbc('#booking_box_slots').height()+20>$wbc('#booking_container_all').height()) { newpageY = pageY-$wbc('#booking_box_slots').height()-40; } else { newpageY = pageY; } if(newpageY+$wbc('#booking_container_all').offset().top < booking_currentMousePos.y) { top=newpageY+$wbc('#booking_container_all').offset().top -20; } else { top=newpageY+$wbc('#booking_container_all').offset().top +20; } if(newpageX+$wbc('#booking_container_all').offset().left