<commit_before>(function() {
  "use strict";

  var video = document.querySelector(".camera__video");

  var canvas = document.querySelector(".camera__canvas");
  var context = canvas.getContext("2d");

  var filterElem = document.querySelector('.controls__filter');
  filterElem.value = "invert";

  var thresholdInterval;

  var p = navigator.mediaDevices.getUserMedia({
    audio: false,
    video: {
      facingMode: "user",
      frameRate: {
        ideal: 60
      }
    }
  });

  p.then(function(stream) {
    video.src = window.URL.createObjectURL(stream);
    video.onloadedmetadata = function() {
      video.play();

      canvas.width = video.videoWidth;
      canvas.height = video.videoHeight;

      applyFilter();
    };
  });

  p.catch(function(error) {
    console.log("The following error occured: " + error.name);
  });

  var captureFrame = function() {
    context.drawImage(video, 0, 0);

    var image = context.getImageData(0, 0, canvas.width, canvas.height);
    var data = image.data;
    var result;

    for (var i = 0; i < data.length; i += 4) {
      result = (0.2126 * data[i] + 0.7152 * data[i + 1] + 0.0722 * data[i + 2] >= 128) ? 255 : 0;
      data[i] = data[i + 1] = data[i + 2] = result;
    }

    context.putImageData(image, 0, 0);
  };

  var applyFilter = function() {
    var filterName = filterElem.value;

    switch (filterName) {
      case "invert":
      case "grayscale":
        if (filterName === "invert") {
          video.classList.remove("camera__video___grayscale");
          video.classList.add("camera__video___invert");

        } else {
          video.classList.remove("camera__video___invert");
          video.classList.add("camera__video___grayscale");

        }
        canvas.classList.add("camera__element___hidden");
        video.classList.remove("camera__element___hidden");

        if (thresholdInterval) {
          clearInterval(thresholdInterval);
          thresholdInterval = null;

        }
        break;

      case "threshold":
        if (thresholdInterval == null) {
          thresholdInterval = setInterval(captureFrame, 16);

        }
        video.classList.add("camera__element___hidden");
        canvas.classList.remove("camera__element___hidden");

        break;

      default:
        console.log("Inknown filter: " + filterName);
    }
  };

  filterElem.onchange = function() {
    applyFilter();
  };

})();<commit_msg>[Fix] Log message typo<commit_after>(function() {
  "use strict";

  var video = document.querySelector(".camera__video");

  var canvas = document.querySelector(".camera__canvas");
  var context = canvas.getContext("2d");

  var filterElem = document.querySelector('.controls__filter');
  filterElem.value = "invert";

  var thresholdInterval;

  var p = navigator.mediaDevices.getUserMedia({
    audio: false,
    video: {
      facingMode: "user",
      frameRate: {
        ideal: 60
      }
    }
  });

  p.then(function(stream) {
    video.src = window.URL.createObjectURL(stream);
    video.onloadedmetadata = function() {
      video.play();

      canvas.width = video.videoWidth;
      canvas.height = video.videoHeight;

      applyFilter();
    };
  });

  p.catch(function(error) {
    console.log("The following error occured: " + error.name);
  });

  var captureFrame = function() {
    context.drawImage(video, 0, 0);

    var image = context.getImageData(0, 0, canvas.width, canvas.height);
    var data = image.data;
    var result;

    for (var i = 0; i < data.length; i += 4) {
      result = (0.2126 * data[i] + 0.7152 * data[i + 1] + 0.0722 * data[i + 2] >= 128) ? 255 : 0;
      data[i] = data[i + 1] = data[i + 2] = result;
    }

    context.putImageData(image, 0, 0);
  };

  var applyFilter = function() {
    var filterName = filterElem.value;

    switch (filterName) {
      case "invert":
      case "grayscale":
        if (filterName === "invert") {
          video.classList.remove("camera__video___grayscale");
          video.classList.add("camera__video___invert");

        } else {
          video.classList.remove("camera__video___invert");
          video.classList.add("camera__video___grayscale");

        }
        canvas.classList.add("camera__element___hidden");
        video.classList.remove("camera__element___hidden");

        if (thresholdInterval) {
          clearInterval(thresholdInterval);
          thresholdInterval = null;

        }
        break;

      case "threshold":
        if (thresholdInterval == null) {
          thresholdInterval = setInterval(captureFrame, 16);

        }
        video.classList.add("camera__element___hidden");
        canvas.classList.remove("camera__element___hidden");

        break;

      default:
        console.log("Unknown filter: " + filterName);
    }
  };

  filterElem.onchange = function() {
    applyFilter();
  };

})();
{'fraction_non_alphanumeric': 0.1387116690677094, 'fraction_numerical': 0.016052685737806133, 'mean_word_length': 2.632286995515695, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, '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': '1899926', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1454, 'n_words': 281}