<commit_before>// How long to wait after a statusGood call to display statusBad, in milliseconds.
var waitTime = 5000;

var element = document.getElementById('status');
element.insertAdjacentHTML('beforeend', '<img id="status-icon" src="">');
var icon = document.getElementById('status-icon');
element.insertAdjacentHTML('beforeend', '<p id="message-div"></p>');
var messageDiv = document.getElementById('message-div');

function statusGood(message) {
  icon.src = 'check.svg';
  messageDiv.innerText = message;
}

function statusBad(message) {
  icon.src = 'error.svg';
  messageDiv.innerText = message;
}<commit_msg>Add statusBad when there have been now messages<commit_after>// How long to wait after a statusGood call to display statusBad, in seconds.
var waitTime = 5;
var lastStatus;

var element = document.getElementById('status');
element.insertAdjacentHTML('beforeend', '<img id="status-icon" src="">');
var icon = document.getElementById('status-icon');
element.insertAdjacentHTML('beforeend', '<p id="message-div"></p>');
var messageDiv = document.getElementById('message-div');

function statusGood(message) {
  lastStatus = new Date() / 1000;
  icon.src = 'check.svg';
  messageDiv.innerText = message;
}

function statusBad(message) {
  lastStatus = new Date() / 1000;
  icon.src = 'error.svg';
  messageDiv.innerText = message;
}

var intervalID = window.setInterval(check, 10000);

function check() {
  if (lastStatus > (new Date() / 1000) + waitTime) {
    statusBad('Disconnected');
  }
}
{'fraction_non_alphanumeric': 0.14920424403183025, 'fraction_numerical': 0.014588859416445624, 'mean_word_length': 5.476394849785407, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '5055363', 'n_tokens_mistral': 472, 'n_tokens_neox': 445, 'n_words': 120}