54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
$(function() {
|
|
initDatepickerRange();
|
|
initAvailabilityCalendar();
|
|
initCookieInfo();
|
|
initCookieAcceptButtonAction();
|
|
initTooltips();
|
|
});
|
|
|
|
|
|
function initDatepickerRange() {
|
|
// Doku: https://uxsolutions.github.io/bootstrap-datepicker/
|
|
|
|
$('input[data-type="date"]').datepicker({
|
|
format: "dd.mm.yyyy",
|
|
language: "de",
|
|
daysOfWeekHighlighted: "0,6",
|
|
todayHighlight: true,
|
|
orientation: "top auto"
|
|
});
|
|
}
|
|
|
|
function initAvailabilityCalendar() {
|
|
$('.calendar').each(function() {
|
|
var $cal = $(this);
|
|
var unavailableDates = JSON.parse($cal.parent().find('input:first').val());
|
|
|
|
$cal.availabilityCalendar(unavailableDates);
|
|
});
|
|
}
|
|
|
|
function initTooltips() {
|
|
$('[data-toggle="tooltip"]').tooltip({
|
|
placement: 'bottom'
|
|
});
|
|
}
|
|
|
|
function initCookieInfo() {
|
|
var $section = $('section.cookie');
|
|
var accepted = localStorage.getItem('Dein.Equipment.Cookie.Accepted');
|
|
if(accepted) {
|
|
$section.remove();
|
|
}
|
|
}
|
|
|
|
function initCookieAcceptButtonAction() {
|
|
var $section = $('section.cookie');
|
|
var $acceptBtn = $section.find('button:first');
|
|
|
|
$acceptBtn.click(function(e) {
|
|
e.preventDefault();
|
|
localStorage.setItem('Dein.Equipment.Cookie.Accepted', true);
|
|
$section.remove();
|
|
});
|
|
} |