<commit_before>/*
  Character mask for jQuery.
  https://github.com/sobrinho/jquery.singlemask

  Copyright (c) 2011-2013 <NAME> (http://gabrielsobrinho.com/).
  Released under the MIT license
*/
(function ($) {
  function getPasteEvent() {
    var el = document.createElement('input'),

    name = 'onpaste';
    el.setAttribute(name, '');
    return (typeof el[name] === 'function') ? 'paste' : 'input';
  }

  var pasteEventName = getPasteEvent();

  $.fn.singlemask = function (mask) {
    $(this).keydown(function (event) {
      var key = event.keyCode;

      if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
        return;
      }

      // Numpad key numbers starts on 96 (0) and ends on 105 (9)
      // Somehow the String.fromCharCode doesn't knows that
      // Subtracting 48 we have the 'standard' number code
      if (key >= 96 && key <= 105) {
        key = key - 48;
      }

      return String.fromCharCode(key).match(mask);
    }).bind(pasteEventName, function () {
      this.value = $.grep(this.value, function (character) {
        return character.match(mask);
      }).join('');
    });
  }
})(jQuery);
<commit_msg>Using preventDefault instead of return null values<commit_after>/*
  Character mask for jQuery.
  https://github.com/sobrinho/jquery.singlemask

  Copyright (c) 2011-2013 <NAME> (http://gabrielsobrinho.com/).
  Released under the MIT license
*/
(function ($) {
  function getPasteEvent() {
    var el = document.createElement('input'),

    name = 'onpaste';
    el.setAttribute(name, '');
    return (typeof el[name] === 'function') ? 'paste' : 'input';
  }

  var pasteEventName = getPasteEvent();

  $.fn.singlemask = function (mask) {
    $(this).keydown(function (event) {
      var key = event.keyCode;

      if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
        return;
      }

      // Numpad key numbers starts on 96 (0) and ends on 105 (9)
      // Somehow the String.fromCharCode doesn't knows that
      // Subtracting 48 we have the 'standard' number code
      if (key >= 96 && key <= 105) {
        key = key - 48;
      }

      if (!String.fromCharCode(key).match(mask)) {
        event.preventDefault();
      };
    }).bind(pasteEventName, function () {
      this.value = $.grep(this.value, function (character) {
        return character.match(mask);
      }).join('');
    });
  }
})(jQuery);

{'fraction_non_alphanumeric': 0.16041666666666668, 'fraction_numerical': 0.028333333333333332, 'mean_word_length': 2.578241430700447, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '2856121', 'n_tokens_mistral': 843, 'n_tokens_neox': 753, 'n_words': 207}