<commit_before>//TODO: repair clipboard.js refusing to work with certain elements (links, customUrls, ?)
const typingStoppedDelay = 500;//ms
const typingElementId = '#textfield00';
const emptyInputMessage = 'Input is empty';
const pleaseWaitMessage = 'Working...';

function onJQueryReady(method) {
    window.jQuery ? method() : setTimeout(function() { onJQueryReady(method) }, 50);
}

onJQueryReady(function(){watchTyping($(typingElementId), performAConvertion);});

function watchTyping(element, action){
    $element = $(element);
    let lastKeydown = 0;
    let actIfNoMoreKeystrokes = function() {
        if ((new Date).getTime() - lastKeydown >= typingStoppedDelay) {
            action($element.val());
        }
    };
    let onEachUpdate = function(){
        lastKeydown = (new Date).getTime();
        setTimeout(actIfNoMoreKeystrokes, typingStoppedDelay)
    };
    $element.on('keydown', onEachUpdate);
    $element.bind('paste', onEachUpdate);
}


function performAConvertion (argumentString) {
	if (argumentString == '')
	{
		renderStub();
	}
	else
	{
	let rq = new XMLHttpRequest(); // create query object
	rq.open('GET', '/api/arbitraryStringToSteamId?string=' +  encodeURIComponent(argumentString), true); // open connection back
	rq.onreadystatechange = function() {<commit_msg>Repaired keystroke tracker firing away on Ctrl, Alt and Meta<commit_after>//TODO: repair clipboard.js refusing to work with certain elements (links, customUrls, ?)
const typingStoppedDelay = 500;//ms
const typingElementId = '#textfield00';
const emptyInputMessage = 'Input is empty';
const pleaseWaitMessage = 'Working...';

function onJQueryReady(method) {
    window.jQuery ? method() : setTimeout(function() { onJQueryReady(method) }, 50);
}

onJQueryReady(function(){watchTyping($(typingElementId), performAConvertion);});

function watchTyping(element, action){
    $element = $(element);
    let lastKeydown = 0;
    let actIfNoMoreKeystrokes = function() {
        if ((new Date).getTime() - lastKeydown >= typingStoppedDelay) {
            action($element.val());
        }
    };
    let onEachUpdate = function(e){
        lastKeydown = (new Date).getTime();
	if((!e.altKey) && (!e.ctrlKey) && (!e.metaKey)) {  
            setTimeout(actIfNoMoreKeystrokes, typingStoppedDelay)
	}
    };
    $element.on('keydown', onEachUpdate);
    $element.bind('paste', onEachUpdate);
}


function performAConvertion (argumentString) {
	if (argumentString == '')
	{
		renderStub();
	}
	else
	{
	let rq = new XMLHttpRequest(); // create query object
	rq.open('GET', '/api/arbitraryStringToSteamId?string=' +  encodeURIComponent(argumentString), true); // open connection back
	rq.onreadystatechange = function() {
{'fraction_non_alphanumeric': 0.14059040590405905, 'fraction_numerical': 0.005904059040590406, 'mean_word_length': 4.336614173228346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3993180', 'n_tokens_mistral': 849, 'n_tokens_neox': 823, 'n_words': 184}