<commit_before>define [
  'jquery'
  'i18n!calendar'
  'underscore'
  'compiled/calendar/CalendarDefaults'
  'vendor/jquery.ba-tinypubsub'
], ($, I18n, _, calendarDefaults) ->
  class MiniCalendar
    constructor: (selector, @mainCalendar) ->
      @calendar = $(selector)
      @calendar.fullCalendar(_.defaults(
        height: 185
        header:
          left: "prev"
          center: "title"
          right: "next"
        dayClick: @dayClick
        events: @getEvents
        eventRender: @eventRender
        droppable: true
        dragRevertDuration: 0
        dropAccept: '*'
        dropAccept: '.fc-event,.undated_event'
        drop: @drop
        eventDrop: @drop
        eventReceive: @drop
        , calendarDefaults)
      ,
        $.subscribe
          "Calendar/visibleContextListChanged" : @visibleContextListChanged
          "Calendar/refetchEvents" : @refetchEvents
          "Calendar/currentDate" : @gotoDate
          "CommonEvent/eventDeleted" : @eventSaved
          "CommonEvent/eventSaved" : @eventSaved
      )

    getEvents: (start, end, timezone, cb) =>
      # Since we have caching (lazyFetching) turned off, we can rely on this
      # getting called every time we switch views, *before* the events are rendered.
      # That makes this a great place to clear out the previous classes.

      @calendar.find(".fc-content td")
        .removeClass("event slot-available")
        .removeAttr('title')
      @mainCalendar.getEvents start, end, timezone, cb

    dayClick: (date) =>
      @mainCalendar.gotoDate(date)<commit_msg>fix minical highlights when deactivating calendars<commit_after>define [
  'jquery'
  'i18n!calendar'
  'underscore'
  'compiled/calendar/CalendarDefaults'
  'vendor/jquery.ba-tinypubsub'
], ($, I18n, _, calendarDefaults) ->
  class MiniCalendar
    constructor: (selector, @mainCalendar) ->
      @calendar = $(selector)
      @calendar.fullCalendar(_.defaults(
        height: 185
        header:
          left: "prev"
          center: "title"
          right: "next"
        dayClick: @dayClick
        events: @getEvents
        eventRender: @eventRender
        droppable: true
        dragRevertDuration: 0
        dropAccept: '*'
        dropAccept: '.fc-event,.undated_event'
        drop: @drop
        eventDrop: @drop
        eventReceive: @drop
        , calendarDefaults)
      ,
        $.subscribe
          "Calendar/visibleContextListChanged" : @visibleContextListChanged
          "Calendar/refetchEvents" : @refetchEvents
          "Calendar/currentDate" : @gotoDate
          "CommonEvent/eventDeleted" : @eventSaved
          "CommonEvent/eventSaved" : @eventSaved
      )

    getEvents: (start, end, timezone, cb) =>
      # Since we have caching (lazyFetching) turned off, we can rely on this
      # getting called every time we switch views, *before* the events are rendered.
      # That makes this a great place to clear out the previous classes.

      @calendar.find(".fc-widget-content td")
        .removeClass("event slot-available")
        .removeAttr('title')
      @mainCalendar.getEvents start, end, timezone, cb

    dayClick: (date) =>
      @mainCalendar.gotoDate(date)
{'fraction_non_alphanumeric': 0.10471698113207548, 'fraction_numerical': 0.005031446540880503, 'mean_word_length': 2.484118291347207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6807003', 'n_tokens_mistral': 927, 'n_tokens_neox': 897, 'n_words': 224}