<commit_before>/*
 * runner.js - the script runner
 */

(function (runner) {

    var $animScreen,
        elements;

    runner.init = function () {
        $animScreen = $("article.anim-screen");
    };

    runner.hideScreen = function () {
        $animScreen.style.display = "none";
    };

    runner.showScreen = function () {
        $animScreen.style.display = "block";
    };

    runner.run = function (code) {
        try {
            (new Function ("create", "start", "done", "fail", code)).call(
                {},
                runner.create,
                runner.start,
                runner.done,
                runner.fail
            );
        } catch(err) {
            alert(err);
            setTimeout(runner.done, 10);
        }
    };

    runner.create = function (definitions) {
        var el, attr;
        elements = [];
        definitions.forEach(function (def) {
            el = DOM("div");
            el.style.width = "100px";
            el.style.height = "100px";
            el.style.position = "absolute";
            el.style.backgroundColor = "rgb(118, 189, 255)";
            el.style.zIndex = 10000;
            for(attr in def) {
                el.style[attr] = def[attr];
            }
            elements.push(el);
            document.body.appendChild(el);
        });
        return elements;
    };

    runner.start = function (el) {
        $animScreen.style.display = "block";
        return Q.delay(200)
                .then(Zanimo.f($animScreen))
                .then(Zanimo.transitionf("opacity", 1, 200))
                .then(function () { return el; });
    };

    runner.done = function () {
        elements.forEach(function (el) {
            window.document.body.removeChild(el);
        });
        return Zanimo.transition($animScreen, "opacity", 0, 100)
                     .then(runner.hideScreen, runner.hideScreen);<commit_msg>reset animation elements on runner start<commit_after>/*
 * runner.js - the script runner
 */

(function (runner) {

    var $animScreen,
        elements;

    runner.init = function () {
        $animScreen = $("article.anim-screen");
    };

    runner.hideScreen = function () {
        $animScreen.style.display = "none";
    };

    runner.showScreen = function () {
        $animScreen.style.display = "block";
    };

    runner.run = function (code) {
        try {
            elements = [];
            (new Function ("create", "start", "done", "fail", code)).call(
                {},
                runner.create,
                runner.start,
                runner.done,
                runner.fail
            );
        } catch(err) {
            alert(err);
            setTimeout(runner.done, 10);
        }
    };

    runner.create = function (definitions) {
        var el, attr;
        definitions.forEach(function (def) {
            el = DOM("div");
            el.style.width = "100px";
            el.style.height = "100px";
            el.style.position = "absolute";
            el.style.backgroundColor = "rgb(118, 189, 255)";
            el.style.zIndex = 10000;
            for(attr in def) {
                el.style[attr] = def[attr];
            }
            elements.push(el);
            document.body.appendChild(el);
        });
        return elements;
    };

    runner.start = function (el) {
        $animScreen.style.display = "block";
        return Q.delay(200)
                .then(Zanimo.f($animScreen))
                .then(Zanimo.transitionf("opacity", 1, 200))
                .then(function () { return el; });
    };

    runner.done = function () {
        elements.forEach(function (el) {
            window.document.body.removeChild(el);
        });
        return Zanimo.transition($animScreen, "opacity", 0, 100)
                     .then(runner.hideScreen, runner.hideScreen);
{'fraction_non_alphanumeric': 0.1406696080975863, 'fraction_numerical': 0.017129509473137815, 'mean_word_length': 1.5321944809461234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6914547', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1057, 'n_words': 202}