<commit_before>
/*-------------------------------------------------------------------------------------*/
$(document).on('page:change', function () {



  display_login_info();

  var e = document.getElementsByClassName('page_change');
  for (var i=0 ; i < e.length; i++)
  switch(e[i].getAttribute('data-run')){

    case 'competition':
      page_change_competition();
      break;
    case 'poet_lookup':
      page_change_poet_lookup();
      break;
    case 'view_lookup':
      page_change_view_lookup();
      break;
  }
});

/*-------------------------------------------------------------------------------------*/
function prepare_rounds() {

  for (var i=0; i<rounds.length; i++) {
    rounds[i].round_js = round_new(0); // FIXME: param wrong
    //rounds[i].performances = {};
  }

}
/*-------------------------------------------------------------------------------------*/
function page_change_competition() {

  prepare_rounds();

  if (get_login_info().is_logged_in) {


    var poets_competing = document.getElementById("poets_competing");
    poets_competing.removeAttribute('hidden');
    poets_competing.poet_names = [];

    var temp = do_log_out;
    do_log_out = function () {
      temp();
      document.getElementById("poets_competing").setAttribute("hidden", null);
      document.getElementById("poet_lookup").setAttribute("hidden", null);
      // We can make a class="hide on loggout"
    };

  }
  // Prepare Queue
  window.ajax_queue = [];
  window.web_sock_id = makeid(20);

  var interval = 10;
  setInterval(process_ajax_queue, interval);
  slam.local_event_number = 0;
  window.init_web_sock(); 
  setInterval(handle_unprocessed_events, 10);
}

/*------------------------------------------------------------------------------------*/
function page_change_poet_lookup() {

  var input = document.getElementById('suggestions_input');
  input.addEventListener('keydown', function(e) {
    if (e.keyCode === 38 || e.keyCode === 40) e.preventDefault();<commit_msg>experimenting with different interval for handling unprocessed events<commit_after>
/*-------------------------------------------------------------------------------------*/
$(document).on('page:change', function () {



  display_login_info();

  var e = document.getElementsByClassName('page_change');
  for (var i=0 ; i < e.length; i++)
  switch(e[i].getAttribute('data-run')){

    case 'competition':
      page_change_competition();
      break;
    case 'poet_lookup':
      page_change_poet_lookup();
      break;
    case 'view_lookup':
      page_change_view_lookup();
      break;
  }
});

/*-------------------------------------------------------------------------------------*/
function prepare_rounds() {

  for (var i=0; i<rounds.length; i++) {
    rounds[i].round_js = round_new(0); // FIXME: param wrong
    //rounds[i].performances = {};
  }

}
/*-------------------------------------------------------------------------------------*/
function page_change_competition() {

  prepare_rounds();

  if (get_login_info().is_logged_in) {


    var poets_competing = document.getElementById("poets_competing");
    poets_competing.removeAttribute('hidden');
    poets_competing.poet_names = [];

    var temp = do_log_out;
    do_log_out = function () {
      temp();
      document.getElementById("poets_competing").setAttribute("hidden", null);
      document.getElementById("poet_lookup").setAttribute("hidden", null);
      // We can make a class="hide on loggout"
    };

  }
  // Prepare Queue
  window.ajax_queue = [];
  window.web_sock_id = makeid(20);

  var interval = 1;
  setInterval(process_ajax_queue, interval);
  slam.local_event_number = 0;
  window.init_web_sock(); 
  setInterval(handle_unprocessed_events, interval);
}

/*------------------------------------------------------------------------------------*/
function page_change_poet_lookup() {

  var input = document.getElementById('suggestions_input');
  input.addEventListener('keydown', function(e) {
    if (e.keyCode === 38 || e.keyCode === 40) e.preventDefault();
{'fraction_non_alphanumeric': 0.2935507783543366, 'fraction_numerical': 0.006177415369409439, 'mean_word_length': 1.9461426491994178, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2348680', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1104, 'n_words': 194}