Update calendar.js

Now it only get's called once :)
This commit is contained in:
PhyberApex 2020-12-16 14:22:52 +01:00 committed by GitHub
parent 4815388253
commit d8149e22c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
var firstDay = null;
var resized = false;
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
{
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
@ -43,3 +44,17 @@ $("#ical-button").on("click", function(e)
}
);
});
$(window).one("resize", function()
{
// Automatically switch the calendar to "basicDay" view on small screens
// and to "month" otherwise
if ($(window).width() < 768)
{
calendar.fullCalendar("changeView", "agendaDay");
}
else
{
calendar.fullCalendar("changeView", "month");
}
});