define([
    'require',
    '../lib/jquery',
    '../jqueryPlugin!../lib/jquery.mutations/src/mutations.html',
    '../lib/fullcalendar'
], function(require) {
    var fullcalendar = {
        initContent: function(root) {
            var $calroot = $(root).find('.full-calendar'),
                $filter = $calroot.find('.calendar-filters');
            $calroot.find('.month').each(function() {
                var $month = $(this),
                    $events = $('.events', $month),
                    ym = $('time', $month).attr('datetime').split('-'),
                    year = ym[0],
                    month = Number(ym[1]) - 1,
                    $calendar = $('<div class="calendar">\n</div>')
                        .insertAfter($events),
                    mapal = require('../core/init');
                var refetch = function() {
                    $calendar.fullCalendar('refetchEvents');
                    // XXX: replace with mutator event listener
                    mapal.initContent($calendar);
                };
                var refetch_deb = _.debounce(refetch, 400);
                $events.bind('html', refetch);
                if ($filter && $filter.length > 0) {
                    $('.searchText', $filter).on("keyup", refetch_deb);
                    $('.searchText[type=search]', $filter).on("click", refetch_deb);
                    $('select[name=state]', $filter).on("change", refetch);
                }
                $events.css('display', 'None');
                $calendar.fullCalendar({
                    dayDblClick: function(date, allDay, jsEvent, view) {
                        // XXX: add event
                    },
                    events: function(start, end, callback) {
                        var events = fullcalendar.parseEvents($events, $filter);
                        callback(events);
                    },
                    eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
                        // XXX: change event
                        revertFunc();
                    },
                    eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
                        // XXX: change event
                        revertFunc();
                    },
                    header: { left: '', right: '' },
                    month: month,
                    year: year
                    // XXX: consume calendar-control and pass to fullCalendar
                });
                mapal.initContent($calendar);
            });
        },
        parseEvents: function($events, $filter) {
            // apply filters to source
            if ($filter && $filter.length > 0) {
                var searchText = $('.searchText', $filter).val();
                var state = $('select[name=state]').val();
            }
            var events = $(
                '.event'
                    + ((state && state !== "all") ? ('.state-' + state) : '')
                    + (searchText ? (':Contains(' + searchText + ')') : ''),
                $events
            ).map(function(idx, event) {
                var classNames = $(event).attr('class').split(/\s+/).filter(function(cls) {
                    return (cls !== 'event');
                });
                var allattrs = $('a', event)[0].attributes,
                    attrs = {};
                for (var attr, i=0; i<allattrs.length; i++){
                    attr = allattrs.item(i);
                    if (attr.nodeName.slice(0,5) === "data-") {
                        attrs[attr.nodeName] = attr.nodeValue;
                    }
                }
                var ev = {
                    title: $('.title', event).html().trim(),
                    start: $('.start', event).attr('datetime'),
                    end: $('.end', event).attr('datetime'),
                    allDay: $(event).hasClass('all-day'),
                    url: $('a', event).attr('href'),
                    className: classNames,
                    attrs: attrs,
                    editable: $(event).hasClass('editable')
                };
                if (!ev.title) console.error('No event title for:', event);
                if (!ev.start) console.error('No event start for:', event);
                if (!ev.url) console.error('No event url for:', event);
                return ev;
            }).toArray();
            return events;
        }
        // XXX: pimp fullcalendar to set further attributes
        // XXX: initContent on whatever fullcalendar creates
        // XXX: support update if original container changes
        // XXX: make hiding of original optional
        // XXX: provide solgemafullcalendar as alternative, use fullcalendar as fallback or sth like that
    };
    return fullcalendar;
});

@@ -479,17 +479,17 @@
  $month)
-,
+;
 %0A       
@@ -497,19 +497,73 @@
         
-   
+if ($events.length === 0) %7B return; %7D%0A                var
  ym = $(

stop work if there is no events list in the month