<commit_before>Alchemy.on = function (eventName, baseSelector, targetSelector, callback) {
  var baseNode = document.querySelector(baseSelector)
  baseNode.addEventListener(eventName, function (evt) {
    var targets = Array.from(baseNode.querySelectorAll(targetSelector))
    var currentNode = evt.target
    while (currentNode !== baseNode) {
      if (targets.includes(currentNode)) {
        callback.call(currentNode, evt)
        return
      }
      currentNode = currentNode.parentElement
    }
  });
}

Alchemy.xhr = function(method, url) {
  var xhr = new XMLHttpRequest()
  var token = document.querySelector('meta[name="csrf-token"]').attributes.content.textContent
  xhr.open(method, url);
  xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
  xhr.setRequestHeader('X-CSRF-Token', token)

  return xhr;
}<commit_msg>Add Accept: application/json to Alchemy.xhr<commit_after>Alchemy.on = function (eventName, baseSelector, targetSelector, callback) {
  var baseNode = document.querySelector(baseSelector)
  baseNode.addEventListener(eventName, function (evt) {
    var targets = Array.from(baseNode.querySelectorAll(targetSelector))
    var currentNode = evt.target
    while (currentNode !== baseNode) {
      if (targets.includes(currentNode)) {
        callback.call(currentNode, evt)
        return
      }
      currentNode = currentNode.parentElement
    }
  });
}

Alchemy.xhr = function(method, url) {
  var xhr = new XMLHttpRequest()
  var token = document.querySelector('meta[name="csrf-token"]').attributes.content.textContent
  xhr.open(method, url);
  xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
  xhr.setRequestHeader('Accept', 'application/json');
  xhr.setRequestHeader('X-CSRF-Token', token)

  return xhr;
}
{'fraction_non_alphanumeric': 0.12695749440715884, 'fraction_numerical': 0.0011185682326621924, 'mean_word_length': 4.437689969604863, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1683198', 'n_tokens_mistral': 543, 'n_tokens_neox': 542, 'n_words': 100}