{"size": 1186, "ext": "js", "max_stars_repo_path": "spkcspider/apps/spider/static/spider_base/UserComponent.js", "max_stars_repo_name": "devkral/spkbspider", "max_stars_repo_stars_event_min_datetime": "2019-06-24T14:15:54.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-14T23:16:31.000Z", "max_issues_repo_path": "spkcspider/apps/spider/static/spider_base/UserComponent.js", "max_issues_repo_name": "devkral/spkbspider", "max_issues_repo_issues_event_min_datetime": "2018-06-19T09:56:18.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-20T12:02:44.000Z", "max_forks_repo_path": "spkcspider/apps/spider/static/spider_base/UserComponent.js", "max_forks_repo_name": "devkral/spkbspider", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 37.0625, "max_line_length": 203, "alphanum_fraction": 0.6779089376}

document.addEventListener("DOMContentLoaded", function(){
  let required_passes_html = document.getElementById("id_required_passes");

  let checked_handler = function(event){
    let required_passes_counter = 0;
    let target_val;
    let element = event.target;
    for (let el of document.getElementsByClassName("update-required_passes")) {
      if (el.type == "radio" && el.value == "b" && el.checked) {
        // radio child
        required_passes_counter += 1;
      }
    }
    target_val = Number(required_passes_html.value);
    if ((target_val == required_passes_counter - 1 && element.type == "radio" && element.value == "b") || (target_val == required_passes_counter + 1 && element.type == "radio" && element.value != "b" )){
      required_passes_html.value = required_passes_counter;
    }
    // should not propagate
    return false;
  }

  // update-required_passes classes consist of instant_fail and active
  for (let element of document.getElementsByClassName("update-required_passes")){
    if(element.type != "radio"){
      // parent
      element.dataset.lastselected = element.value;
      element.addEventListener("change", checked_handler);
    }
  }
})
