<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$(function() {
    // Calendar handler

    var date = $('#currDate').attr('data-time');
    var timeout = false;

    if (typeof date == "undefined") {
        date = new Date();
    } else {
        date = new Date(date * 1000)
    }

    $('#prevMonth').click(function() {
        setTimeout(function(){ timeout = false }, 500);

        if (!timeout) {
            date.setMonth(date.getMonth() - 1);
            getCalendar(date.getTime());
            timeout = true;
        }

    });

    $('#nextMonth').click(function() {
        setTimeout(function(){ timeout = false }, 500);

        if (!timeout) {
            date.setMonth(date.getMonth() + 1);
            getCalendar(date.getTime());
            timeout = true;
        }
    });

    getCalendar(date.getTime());

    document.getElementById("course-list-calendar").addEventListener('swiped-right', function(e) {
        $('#nextMonth').click();
    });

    document.getElementById("course-list-calendar").addEventListener('swiped-left', function(e) {
        $('#prevMonth').click();
    });
});

function getCalendar(date) {

    $("#course-list-calendar #loading").toggleClass("hidden");

    $.get("/?type=32750&amp;tx_itemkgconnect_ajax[action]=month&amp;tx_itemkgconnect_ajax[controller]=Calendar", {
        'tx_itemkgconnect_ajax[date]': date / 1000,
        'tx_itemkgconnect_ajax[uid]': $("#course-list-calendar").attr('data-plginUid')
    }, function( data ) {
        $("#course-list-calendar #date-list").html(data);

        // Clean URL
        $("#course-list-calendar #date-list table tr td a").each(function () {
            var link = new URL($(this).attr('href').replaceAll("_ajax", ""), location.origin);
            link.searchParams.delete('cHash');
            $(this).attr('href', link.href);
        });

        // Mark curr date
        if ($("#course-list-calendar #date-list").hasClass('markActive')) {
            date = new Date(date);
            var fdate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
            $("td.date_" + fdate).addClass('active');
        }

        $("#course-list-calendar #loading").toggleClass("hidden");
    });
}
</pre></body></html>