<commit_before>// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function mark_for_destroy(element) { 
  $(element).next('.should_destroy').value = 1 
  $(element).up('.role_membership').hide(); 
}

function toggle_investigator_forms(id_to_show) {
  
  id_to_hide = $("active_form").value
  id_to_hide = "form_investigate_" + id_to_hide
  
  $("active_form").value = id_to_show
  id_to_show = "form_investigate_" + id_to_show

  $(id_to_hide).hide()
  $(id_to_show).show()
  
}

function sendConditionRequest(element, event_id, question_element_id) {
  new Ajax.Request('../../question_elements/process_condition?question_element_id=' + question_element_id +'&response=' + element.value + '&event_id=' + event_id, {asynchronous:true, evalScripts:true})
}

function sendCoreConditionRequest(element, event_id, core_path) {
  new Ajax.Request('../../follow_up_elements/process_core_condition?core_path=' + core_path + '&response=' + element.value + '&event_id=' + event_id, {asynchronous:true, evalScripts:true})
}

function setUpSearchFields() {
  if (document.getElementById("name").value.length > 0) {
    document.getElementById("sw_first_name").disabled = true;
    document.getElementById("sw_last_name").disabled = true;
  }
  
  if (document.getElementById("sw_first_name").value.length > 0 || document.getElementById("sw_last_name").value.length > 0) {
    document.getElementById("name").disabled = true;
  }
}

function checkNameSearchFields(field) {
  if (field.id == "name") {
    if (field.value.length > 0) {
      document.getElementById("sw_first_name").disabled = true;
      document.getElementById("sw_last_name").disabled = true;
    }
    else {
      document.getElementById("sw_first_name").disabled = false;
      document.getElementById("sw_last_name").disabled = false;
    }
  }
  else if (field.id == "sw_first_name" || field.id == "sw_last_name") {
    first = document.getElementById("sw_first_name");
    last = document.getElementById("sw_last_name");
     
    if (first.value.length > 0 || last.value.length > 0) {
      document.getElementById("name").disabled = true;
    }
    else {
      document.getElementById("name").disabled = false;
    }
  }
}

function build_url_with_tab_index(url) {
  if (!(window.myTabs === undefined)) {
    url = url + "?tab_index=" + myTabs.get("activeIndex")
  }
  return url
}

function send_url_with_tab_index(url) {
  url = build_url_with_tab_index(url)
  location.replace(url)
}

function add_tab_index_to_action(form) {
  form.action = build_url_with_tab_index(form.action);
}<commit_msg>Make the back button work when using links that maintain the current tab.<commit_after>// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function mark_for_destroy(element) { 
  $(element).next('.should_destroy').value = 1 
  $(element).up('.role_membership').hide(); 
}

function toggle_investigator_forms(id_to_show) {
  
  id_to_hide = $("active_form").value
  id_to_hide = "form_investigate_" + id_to_hide
  
  $("active_form").value = id_to_show
  id_to_show = "form_investigate_" + id_to_show

  $(id_to_hide).hide()
  $(id_to_show).show()
  
}

function sendConditionRequest(element, event_id, question_element_id) {
  new Ajax.Request('../../question_elements/process_condition?question_element_id=' + question_element_id +'&response=' + element.value + '&event_id=' + event_id, {asynchronous:true, evalScripts:true})
}

function sendCoreConditionRequest(element, event_id, core_path) {
  new Ajax.Request('../../follow_up_elements/process_core_condition?core_path=' + core_path + '&response=' + element.value + '&event_id=' + event_id, {asynchronous:true, evalScripts:true})
}

function setUpSearchFields() {
  if (document.getElementById("name").value.length > 0) {
    document.getElementById("sw_first_name").disabled = true;
    document.getElementById("sw_last_name").disabled = true;
  }
  
  if (document.getElementById("sw_first_name").value.length > 0 || document.getElementById("sw_last_name").value.length > 0) {
    document.getElementById("name").disabled = true;
  }
}

function checkNameSearchFields(field) {
  if (field.id == "name") {
    if (field.value.length > 0) {
      document.getElementById("sw_first_name").disabled = true;
      document.getElementById("sw_last_name").disabled = true;
    }
    else {
      document.getElementById("sw_first_name").disabled = false;
      document.getElementById("sw_last_name").disabled = false;
    }
  }
  else if (field.id == "sw_first_name" || field.id == "sw_last_name") {
    first = document.getElementById("sw_first_name");
    last = document.getElementById("sw_last_name");
     
    if (first.value.length > 0 || last.value.length > 0) {
      document.getElementById("name").disabled = true;
    }
    else {
      document.getElementById("name").disabled = false;
    }
  }
}

function build_url_with_tab_index(url) {
  if (!(window.myTabs === undefined)) {
    url = url + "?tab_index=" + myTabs.get("activeIndex")
  }
  return url
}

function send_url_with_tab_index(url) {
  url = build_url_with_tab_index(url)
  //location.replace(url)
  location.href = url;
}

function add_tab_index_to_action(form) {
  form.action = build_url_with_tab_index(form.action);
}
{'fraction_non_alphanumeric': 0.1409284261142963, 'fraction_numerical': 0.0025892361753282783, 'mean_word_length': 4.70464135021097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5929385', 'n_tokens_mistral': 1760, 'n_tokens_neox': 1720, 'n_words': 284}