<commit_before>function reloadrooms() {
  if (!document.getElementById('roomlist')) {
    console.log("Not login yet.")
    return
  }
  $.get('/rooms', function(data) {
    $('#roomlist').empty()
    console.log(data);

    data.forEach(function(room) {
      console.log(room)
      $('#roomlist').append(
        '<li><a href="/message/'+room._id+'">'+room.name+'</a></li>'
      )
    })
  })
}

$(document).ready(function() {
  reloadrooms();
})

function createroom() {
  var name = prompt("Room name plz:")
  if (name === null) {  // User cancelled creating room.
    return;
  } else if (name == '') {
    alert("No empty room name!!!")
    return;
  } else if (/^[a-zA-Z0-9- ]*$/.test(name)) {
    alert("Only english and number are acceptable.");
    return;
  }

  var index = 0;
  var list = [];
  var curuser = "";
  while (true) {
    var curuser = prompt(
      "Invite user #"+index+" to join chat! "+
      "(empty string for end of user list)"
    )
    if (curuser === null) {
      console.log("User cancelled creating room.")
      return;
    } else if (curuser == "") {
      break;
    }
    list.push(curuser)
    index += 1;
  }

  console.log("Room:", name)
  console.log("Users:", list)<commit_msg>Fix weird room name input checking bug again<commit_after>function reloadrooms() {
  if (!document.getElementById('roomlist')) {
    console.log("Not login yet.")
    return
  }
  $.get('/rooms', function(data) {
    $('#roomlist').empty()
    console.log(data);

    data.forEach(function(room) {
      console.log(room)
      $('#roomlist').append(
        '<li><a href="/message/'+room._id+'">'+room.name+'</a></li>'
      )
    })
  })
}

$(document).ready(function() {
  reloadrooms();
})

function createroom() {
  var name = prompt("Room name plz:")
  if (name === null) {  // User cancelled creating room.
    return;
  } else if (name == '') {
    alert("No empty room name!!!")
    return;
  } else if (!(/^[a-zA-Z0-9- ]*$/.test(name)) {
    alert("Only english and number are acceptable.");
    return;
  }

  var index = 0;
  var list = [];
  var curuser = "";
  while (true) {
    var curuser = prompt(
      "Invite user #"+index+" to join chat! "+
      "(empty string for end of user list)"
    )
    if (curuser === null) {
      console.log("User cancelled creating room.")
      return;
    } else if (curuser == "") {
      break;
    }
    list.push(curuser)
    index += 1;
  }

  console.log("Room:", name)
  console.log("Users:", list)
{'fraction_non_alphanumeric': 0.19476861167002013, 'fraction_numerical': 0.0032193158953722333, 'mean_word_length': 2.634502923976608, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '58408', 'n_tokens_mistral': 836, 'n_tokens_neox': 821, 'n_words': 200}