<commit_before>/*
 * CSRF stuff.
 */
(function() {
  getCookie = function(name) {
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
      var cookies = document.cookie.split(';');
      for (var i = 0; i < cookies.length; i++) {
        var cookie = jQuery.trim(cookies[i]);
        // Does this cookie string begin with the name we want?
        if (cookie.substring(0, name.length + 1) == (name + '=')) {
          cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
          break;
        }
      }
    }
    return cookieValue;
  }
  csrfSafeMethod = function(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
  }
  var csrftoken = getCookie('csrftoken');
  $.ajaxSetup({
    crossDomain: false, // obviates need for sameOrigin test
    beforeSend: function(xhr, settings) {
      if (!csrfSafeMethod(settings.type)) {
        xhr.setRequestHeader("X-CSRFToken", csrftoken);
      }
    }
  });
})();

$(document).ready(function() {
  /*
   * Initialize FullCalendar.
   */
  $('#calendar').fullCalendar({
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay',
    },
    editable: true,
    events: function(start, end, callback) {
      $.ajax({
        url: '/timesheet/events/read/',
        type: 'GET',
        contentType: 'application/json',
        dataType: 'json',
        data: {
          begin: Math.round(start.getTime() / 1000),
          end: Math.round(end.getTime() / 1000),
        },
        success: function(data) {
          for (var i in data) {
            var d = data[i];
            var e = {};
            e.allDay = d.all_day;
            e.start = d.begin;
            e.end = d.end;
            e.title = '' + d.issue;
            data[i] = e;
          }
          callback(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          alert('Failure while fetching events!');
        },
      });
    },
  });
});

// vim:set et:
// vi:set sw=2 ts=2:
<commit_msg>Enabling jQuery UI theme in calendar.<commit_after>/*
 * CSRF stuff.
 */
(function() {
  getCookie = function(name) {
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
      var cookies = document.cookie.split(';');
      for (var i = 0; i < cookies.length; i++) {
        var cookie = jQuery.trim(cookies[i]);
        // Does this cookie string begin with the name we want?
        if (cookie.substring(0, name.length + 1) == (name + '=')) {
          cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
          break;
        }
      }
    }
    return cookieValue;
  }
  csrfSafeMethod = function(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
  }
  var csrftoken = getCookie('csrftoken');
  $.ajaxSetup({
    crossDomain: false, // obviates need for sameOrigin test
    beforeSend: function(xhr, settings) {
      if (!csrfSafeMethod(settings.type)) {
        xhr.setRequestHeader("X-CSRFToken", csrftoken);
      }
    }
  });
})();

$(document).ready(function() {
  /*
   * Initialize FullCalendar.
   */
  $('#calendar').fullCalendar({
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay',
    },
    theme: true,
    editable: true,
    events: function(start, end, callback) {
      $.ajax({
        url: '/timesheet/events/read/',
        type: 'GET',
        contentType: 'application/json',
        dataType: 'json',
        data: {
          begin: Math.round(start.getTime() / 1000),
          end: Math.round(end.getTime() / 1000),
        },
        success: function(data) {
          for (var i in data) {
            var d = data[i];
            var e = {};
            e.allDay = d.all_day;
            e.start = d.begin;
            e.end = d.end;
            e.title = '' + d.issue;
            data[i] = e;
          }
          callback(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          alert('Failure while fetching events!');
        },
      });
    },
  });
});

// vim:set et:
// vi:set sw=2 ts=2:

{'fraction_non_alphanumeric': 0.15678462620107805, 'fraction_numerical': 0.0065619873447386925, 'mean_word_length': 2.007751937984496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '813309', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1344, 'n_words': 299}