<commit_before>function formatTime(num){
    var minute = '0' + String(Math.floor(num / 60));
    var second = '0' + String(num % 60);

    return minute.substr(-2) + ':' + second.substr(-2);
}

function count(current, maximum){
    if (current > maximum){
        return;
    }

    var timer = document.getElementById('timer');
    timer.innerText = formatTime(current);

    var timeoutId = window.setTimeout(count, 1000, current + 1, maximum);
    document.getElementById('stop').addEventListener('click', function(){
        window.clearTimeout(timeoutId);
    });
    if (current === maximum){
        timer.style.color = 'red';
    }
}

function resetTimer(){
    var timer = document.getElementById('timer');
    timer.innerText = '00:00';
    timer.style.color = 'lime';
}

window.onload = function(){
    document.getElementById('start').addEventListener('click', function(){
        resetTimer();
        var minute = Math.floor(document.getElementById('minute').value);
        var second = Math.floor(document.getElementById('second').value);
        count(0, minute * 60 + second);
    });
    document.getElementById('reset').addEventListener('click', function(){
        resetTimer();
    })
};<commit_msg>onloadを$に置き換えた<commit_after>function formatTime(num){
    var minute = '0' + String(Math.floor(num / 60));
    var second = '0' + String(num % 60);

    return minute.substr(-2) + ':' + second.substr(-2);
}

function count(current, maximum){
    if (current > maximum){
        return;
    }

    var timer = document.getElementById('timer');
    timer.innerText = formatTime(current);

    var timeoutId = window.setTimeout(count, 1000, current + 1, maximum);
    document.getElementById('stop').addEventListener('click', function(){
        window.clearTimeout(timeoutId);
    });
    if (current === maximum){
        timer.style.color = 'red';
    }
}

function resetTimer(){
    var timer = document.getElementById('timer');
    timer.innerText = '00:00';
    timer.style.color = 'lime';
}

$(function(){
    document.getElementById('start').addEventListener('click', function(){
        resetTimer();
        var minute = Math.floor(document.getElementById('minute').value);
        var second = Math.floor(document.getElementById('second').value);
        count(0, minute * 60 + second);
    });
    document.getElementById('reset').addEventListener('click', function(){
        resetTimer();
    })
});
{'fraction_non_alphanumeric': 0.16529605263157895, 'fraction_numerical': 0.01644736842105263, 'mean_word_length': 3.423636363636364, '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': '151869', 'n_tokens_mistral': 702, 'n_tokens_neox': 670, 'n_words': 137}