<commit_before><commit_msg>The default event handling plugin. Adds a small delay to watched forms and some links to provide time for the watcher to make a successful server call.<commit_after>/*! Copyright (c) 2013 Fresh Codes LLC
 * Licensed under the MIT License (LICENSE.txt).
 */
(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['antycs'], function(antycs) {
      return factory(root, antycs);
    });
  } else if (typeof exports === 'object') {
    module.exports = factory(root, require('antycs'));
  } else {
    factory(root, antycs);
  }
}(this, function(root, antycs) {

  var plugin = {
    timeout: 300,
    watch: function(type, target, fn) {
      antycs.dom.on(type, target, function(event) {
        if (!antycs.event.isPropagationStopped(event)) {
          antycs.event.stopPropagation(event);
          fn(event);
          if ((antycs.event.isPropagationStopped(event)) &&
              (event.type in plugin.handlers) &&
              (event.target.nodeName in plugin.handlers[event.type])) {
            plugin.handlers[event.type][event.target.nodeName](event);
          }
        }
      });
    },
    delay: function(fn) {
      setTimeout(fn, plugin.timeout);
    },
    handlers: {
      submit: {
        FORM: function(event) {
          event.preventDefault();
          plugin.delay(function() {
            event.target.submit();
          });
        }
      },
      click: {
        A: function(event) {
          if (!event.metaKey && event.target.href && event.target.target !== "_blank") {
            event.preventDefault();
            plugin.delay(function() {
              window.location.href = event.target.href;
            });
          }
        }
      }
    }
  };

  return (antycs.plugins._default = plugin);

}));
{'fraction_non_alphanumeric': 0.14301490889011595, 'fraction_numerical': 0.003865267807840972, 'mean_word_length': 2.2184724689165187, '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': '6681965', 'n_tokens_mistral': 538, 'n_tokens_neox': 533, 'n_words': 115}