<commit_before>/**
 * Triggered after a minute of inactivity
 * App.onInactive.add(callback);
 */

App._idleSince = null;

App._resetIdleTime = function() {
    App._idleSince = App.getTime();
};

App._checkIdle = function() {
    if (App._idleSince === null)
    {
        return;
    }

    var idleFor = App.getTime() - App._idleSince;
    if (idleFor > 60 * 1000)
    {
        App.onInactive.fire();
        App._idleSince = null;
    }
};


App._resetIdleTime();
App.onInactive = $.Callbacks();

$(document).mousemove(App._resetIdleTime);
$(document).keypress(App._resetIdleTime);

setInterval(App._checkIdle, 250);<commit_msg>fix inactivity ticker was running on all pages<commit_after>/**
 * Triggered after a minute of inactivity
 * App.onInactive.add(callback);
 */

(function() {
    var $exercise = $('[data-exercise]');
    if (!$exercise.length) {
        return;
    }

    App._idleSince = null;

    App._resetIdleTime = function() {
        App._idleSince = App.getTime();
    };

    App._checkIdle = function() {
        if (App._idleSince === null)
        {
            return;
        }

        var idleFor = App.getTime() - App._idleSince;
        if (idleFor > 60 * 1000)
        {
            App.onInactive.fire();
            App._idleSince = null;
        }
    };

    App._resetIdleTime();
    App.onInactive = $.Callbacks();

    $(document).mousemove(App._resetIdleTime);
    $(document).keypress(App._resetIdleTime);

    setInterval(App._checkIdle, 250);
})();
{'fraction_non_alphanumeric': 0.15240641711229946, 'fraction_numerical': 0.012032085561497326, 'mean_word_length': 2.5140845070422535, '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': '336574', 'n_tokens_mistral': 519, 'n_tokens_neox': 500, 'n_words': 89}