{"size": 1266, "ext": "js", "max_stars_repo_path": "web/app/plugins/legal-navigator/assets/js/topic.js", "max_stars_repo_name": "LSCOIT/LN_CMS_WP", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web/app/plugins/legal-navigator/assets/js/topic.js", "max_issues_repo_name": "LSCOIT/LN_CMS_WP", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/app/plugins/legal-navigator/assets/js/topic.js", "max_forks_repo_name": "LSCOIT/LN_CMS_WP", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.7727272727, "max_line_length": 83, "alphanum_fraction": 0.5355450237}
(function ($) {
  'use strict';

  $(function () {
    var button = $('#upload-topic');
    button.prop('disabled', true);

    $('input[name="server_id"]').click(function () {
      button.prop('disabled', false);
    });

    button.on('click', function () {
      const server_id = $('input[name="server_id"]:checked').val();
      $.ajax({
        url: lsc_topic_params.ajax_url,
        type: 'post',
        data: {
          server_id: server_id,
          security: lsc_topic_params.upload_topic_nonce,
          action: 'lsc_upload_topic',
          term_id: lsc_topic_params.term_id,
        },
        dataType: 'json',
        success: function (json) {
          const uploadMessage = $('#upload-message');
          uploadMessage.removeClass().text('');
          uploadMessage.text(json.data.text);
          if (json.success) {
            uploadMessage.addClass('success');
            $('.upload-topic-table .date_' + server_id).text(json.data.date);
          } else {
            uploadMessage.addClass('error');
          }
        },
        error: function (xhr, ajaxOptions, thrownError) {
          alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
        },
      });

      return false;
    });
  });
})(jQuery);
