<commit_before>// global variables
cur_word_idx = -1
cur_word = ''

// chosen copy category.
// this will be used.. later
// 1 = literary passages, 2 = news, 3 = random words
copy_category = 1

// an array of words in the copy, filled by prepare_copy()
words = null

// an array of recently-typed characters, sorted from oldest to newest.
// this is digested by eval_next_in_queue().
// adding char codes to queue + polling > event-based checks, on some slower systems
check_queue = []

// stores the interval timer so that polling can stop once typing finishes
poll = null

// prevent continuous flashing when a typing error occurs
// (since the polling function would keep noticing the error until it was fixed)
can_show_error = true

// track start time and end time for calculating stats
start_time = null
end_time = null

// used to store DOM els rather than continually fetch them
// set @ $(document).ready()
type_area = null

// stats
stat_delta = null
stat_wpm = null
stat_cpm = null
done = false

function prepare_copy(words, note) {
	$.each(words, function(idx, word) {
		$('#copy').append('<span class="word">' + word + '</span>&nbsp;')
	})
	
	$('#note').text(note)
	
	words = $('#copy span.word')
	next_word()
}

function eval_next_in_queue() {
	if ( check_queue.length == 0 ) return;
	
	var code = check_queue.shift()
	var typed_text = type_area.val().split(' ')[0]
	var check = cur_word.substr(0, typed_text.length)
	
	if ( code == 32 ) // spacebar<commit_msg>avoid overwriting global vars if possible :)<commit_after>// global variables
cur_word_idx = -1
cur_word = ''

// chosen copy category.
// this will be used.. later
// 1 = literary passages, 2 = news, 3 = random words
copy_category = 1

// an array of words in the copy, filled by prepare_copy()
words = null

// an array of recently-typed characters, sorted from oldest to newest.
// this is digested by eval_next_in_queue().
// adding char codes to queue + polling > event-based checks, on some slower systems
check_queue = []

// stores the interval timer so that polling can stop once typing finishes
poll = null

// prevent continuous flashing when a typing error occurs
// (since the polling function would keep noticing the error until it was fixed)
can_show_error = true

// track start time and end time for calculating stats
start_time = null
end_time = null

// used to store DOM els rather than continually fetch them
// set @ $(document).ready()
type_area = null

// stats
stat_delta = null
stat_wpm = null
stat_cpm = null
done = false

function prepare_copy(words_arr, note) {
	$.each(words_arr, function(idx, word) {
		$('#copy').append('<span class="word">' + word + '</span>&nbsp;')
	})
	
	$('#note').text(note)
	
	words = $('#copy span.word')
	next_word()
}

function eval_next_in_queue() {
	if ( check_queue.length == 0 ) return;
	
	var code = check_queue.shift()
	var typed_text = type_area.val().split(' ')[0]
	var check = cur_word.substr(0, typed_text.length)
	
	if ( code == 32 ) // spacebar
{'fraction_non_alphanumeric': 0.11910337905654064, 'fraction_numerical': 0.006691201070592171, 'mean_word_length': 3.799357945425361, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '210782', 'n_tokens_mistral': 941, 'n_tokens_neox': 895, 'n_words': 351}