<commit_before>


(function ( $ ) {
    $.fn.rooster = function(action, options) {
        /****************************************
         * Jquery Rooster!
         * A simple countdown timer.
         *
         * Currently does not accept date time formats
         *
         *****************************************/

        var INTERVAL = 100;

        var el = $(this);

        var defaults = {
            seconds: el.data('rooster-seconds') || 0,
            onComplete: el.data('rooster-oncomplete') || null,
            onStart: el.data('rooster-onstart') || null,
            onStop: el.data('rooster-onstop') || null
        };

        var opts = $.extend({}, defaults, options);

        var ms = opts.seconds * 1000;


        function updateTimer() {
            var minutes = Math.floor((ms/1000)/60);
            minutes = minutes.toString();
            while (minutes.length < 2) minutes = '0' + minutes;

            var seconds = Math.floor(ms/1000) % 60;
            seconds = seconds.toString();
            while (seconds.length < 2) seconds = '0' + seconds;

            var displayTime = minutes + ':' + seconds;

            el.html(displayTime);
        }

        var onInterval = function() {
            ms -= INTERVAL;
            updateTimer();
            if (ms > 0) {
                return;
            }
            clearInterval(el.countdown);
            if (opts.onComplete) {
                eval(opts.onComplete);
            }
        };

        switch (action) {
            case 'start':
                // Start the Timer
                el.countdown = setInterval(onInterval, INTERVAL);
                return this;
            default:
                // Initialize<commit_msg>Update onComplete handling to eval strings and execute functions<commit_after>


(function ( $ ) {
    $.fn.rooster = function(action, options) {
        /****************************************
         * Jquery Rooster!
         * A simple countdown timer.
         *
         * Currently does not accept date time formats
         *
         *****************************************/

        var INTERVAL = 100;

        var el = $(this);

        var defaults = {
            seconds: el.data('rooster-seconds') || 0,
            onComplete: el.data('rooster-oncomplete') || null,
            onStart: el.data('rooster-onstart') || null,
            onStop: el.data('rooster-onstop') || null
        };

        var opts = $.extend({}, defaults, options);

        var ms = opts.seconds * 1000;


        function updateTimer() {
            var minutes = Math.floor((ms/1000)/60);
            minutes = minutes.toString();
            while (minutes.length < 2) minutes = '0' + minutes;

            var seconds = Math.floor(ms/1000) % 60;
            seconds = seconds.toString();
            while (seconds.length < 2) seconds = '0' + seconds;

            var displayTime = minutes + ':' + seconds;

            el.html(displayTime);
        }

        var onInterval = function() {
            ms -= INTERVAL;
            updateTimer();
            if (ms > 0) {
                return;
            }
            clearInterval(el.countdown);
            if (opts.onComplete) {
                if (typeOf(otps.onComplete) == 'string') {
                    eval(opts.onComplete);
                } else if (typeOf(opts.onComplete) == 'function')
                    opts.onComplete();
                }
            }
        };

        switch (action) {
            case 'start':
                // Start the Timer
                el.countdown = setInterval(onInterval, INTERVAL);
                return this;
            default:
                // Initialize
{'fraction_non_alphanumeric': 0.15673050984623685, 'fraction_numerical': 0.013487995683841382, 'mean_word_length': 1.4475247524752475, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2818841', 'n_tokens_mistral': 1006, 'n_tokens_neox': 909, 'n_words': 225}