{"size": 801, "ext": "js", "max_stars_repo_path": "public/js/confirm.js", "max_stars_repo_name": "gunpowder78/whatajong", "max_stars_repo_stars_event_min_datetime": "2015-06-19T08:20:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-16T13:25:13.000Z", "max_issues_repo_path": "public/js/confirm.js", "max_issues_repo_name": "gunpowder78/whatajong", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/js/confirm.js", "max_forks_repo_name": "gunpowder78/whatajong", "max_forks_repo_forks_event_min_datetime": "2015-02-24T02:46:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-23T16:42:16.000Z"}
{"max_stars_count": 33, "max_issues_count": null, "max_forks_count": 11, "avg_line_length": 18.2045454545, "max_line_length": 56, "alphanum_fraction": 0.5156054931}
(function ($) {
  var Confirm = {};

  /**
   * Shows the Confirm
   *
   * @param {Object} el
   */
  Confirm.open = function (el, callback) {
    function onClickYes(evt) {
      evt.preventDefault();
      Confirm.close(el);
      callback();
    }

    $(el).find('.dialog_yes').click(onClickYes);
    $(el).show();

    // ESC
    $(document).bind('keyup.Confirm', function (event) {
      if (event.keyCode === 27) {
        onClickYes(event);
      }
      if (event.keyCode === 13) {
        onClickYes(event);
      }
    });
  };

  /**
   * Hides the Confirm
   *
   * @param {Object} el
   */
  Confirm.close = function (el) {
    $(el).hide();
    $(document).unbind('keyup.Confirm');
    $(el).find('.dialog_yes').unbind('click');
  };

  // exports
  APP.Confirm = Confirm;
}(jQuery));
