<commit_before>(function() {

    // Acts as a handler for all toasts - bringing them in 
    ALLOY.ToastRack = function() {

        var toasts = [];

        var config = {
            $container: $('body'),
            classes: {
                'toastrack' : 'toastrack'
            }
        };

        var addToast = function(t) {
            _createToastrack();

            _showToast(t);

            setTimeout(function() { _activateToast(t); }, t.config.transitionInterval);

            var hideTimeout;
            if (t.config.despawnInterval > 0) {
                hideTimeout = setTimeout(function() { _hideToast(t); }, t.config.transitionInterval + t.config.despawnInterval);
            }

            var $closebtn = t._getCloseButton();
            $closebtn.one('click', function(e) {
                e.preventDefault();
                if (hideTimeout !== undefined) { clearTimeout(hideTimeout); }
                _hideToast(t);
            });
        };

        var _showToast = function(t) {
            var $toastrack = _getToastRack();
            $toastrack.append(t.$toast);
            setTimeout(function() { t.$toast.addClass(t.config.classes.activating); });
            _pushToast(t);
        };

        var _pushToast = function(t) {
            var height = t.$toast.outerHeight() + parseInt(t.$toast.css("margin-top")) + parseInt(t.$toast.css("margin-bottom"));
            $.each(toasts, function() { 
                if (!this.$toast.hasClass(this.config.classes.deactivating)) { 
                    this.$toast.css({ "bottom": "+=" + height + "px" }); 
                } 
            });
            toasts.push(t);
        };

        var _activateToast = function(t) {
            t.$toast.removeClass(t.config.classes.activating).addClass(t.config.classes.active);
        };

        var _hideToast = function(t) {
            var currentBottom = t.$toast.css("bottom");
            t.$toast.removeClass(t.config.classes.active).removeClass(t.config.classes.activating).addClass(t.config.classes.deactivating).css({ "bottom" : "" });
            var wantedBottom = t.$toast.css("bottom");
            t.$toast.css({ "bottom" : currentBottom + "px" });
            setTimeout(function() { t.$toast.css({ "bottom" : wantedBottom + "px" }); });

            setTimeout(function() { _removeToast(t); }, t.config.transitionInterval);
        };

        var _removeToast = function(t) {
            t.$toast.remove();
            var index = toasts.indexOf(t);
            toasts.splice(index, 1);
        };

        var _createToastrack = function() {
            if (_getToastRack().length === 0) {
                config.$container.append('<div class="' + config.classes.toastrack + '"></div>');
            }
        };

        var _getToastRack = function() {
            return $("." + config.classes.toastrack);<commit_msg>Altered toast to handle multiples better<commit_after>(function() {

    // Acts as a handler for all toasts - bringing them in 
    ALLOY.ToastRack = function() {

        var processing = false;

        var toasts = [];

        var queue = [];

        var config = {
            $container: $('body'),
            limit: 5,
            classes: {
                'toastrack' : 'toastrack'
            }
        };

        var addToast = function(t) {
            if (toasts.length < config.limit && !processing) {
                _processToast(t);
            } else {
                queue.push(t);
            }
        };

        var _processToast = function(t) {
            processing = true;
            _createToastrack();

            _showToast(t);

            setTimeout(function() { _activateToast(t); }, t.config.transitionInterval);

            var hideTimeout;
            if (t.config.despawnInterval > 0) {
                hideTimeout = setTimeout(function() { _hideToast(t); }, t.config.transitionInterval + t.config.despawnInterval);
            }

            var $closebtn = t._getCloseButton();
            $closebtn.one('click', function(e) {
                e.preventDefault();
                if (hideTimeout !== undefined) { clearTimeout(hideTimeout); }
                _hideToast(t);
            });
        };

        var _showToast = function(t) {
            var $toastrack = _getToastRack();
            $toastrack.append(t.$toast);
            setTimeout(function() { t.$toast.addClass(t.config.classes.activating); });
            _pushToast(t);
        };

        var _pushToast = function(t) {
            var height = t.$toast.outerHeight() + parseInt(t.$toast.css("margin-top")) + parseInt(t.$toast.css("margin-bottom"));
            $.each(toasts, function() { 
                if (!this.$toast.hasClass(this.config.classes.deactivating)) { 
                    this.$toast.css({ "bottom": "+=" + height + "px" }); 
                } 
            });
            toasts.push(t);
        };

        var _activateToast = function(t) {
            t.$toast.removeClass(t.config.classes.activating).addClass(t.config.classes.active);
            processing = false;
        };

        var _hideToast = function(t) {
            var currentBottom = t.$toast.css("bottom");
            t.$toast.removeClass(t.config.classes.active).removeClass(t.config.classes.activating).addClass(t.config.classes.deactivating).css({ "bottom" : "" });
            var wantedBottom = t.$toast.css("bottom");
            t.$toast.css({ "bottom" : currentBottom + "px" });
            setTimeout(function() { t.$toast.css({ "bottom" : wantedBottom + "px" }); });

            setTimeout(function() { _removeToast(t); }, t.config.transitionInterval);
        };

        var _removeToast = function(t) {
            t.$toast.remove();
            var index = toasts.indexOf(t);
            toasts.splice(index, 1);
            _pushNext();
        };

        var _pushNext = function() {
            if (queue.length > 0) {
                var t = queue[0];
                queue.splice(0, 1);
                _processToast(t);
            }
        };

        var _createToastrack = function() {
            if (_getToastRack().length === 0) {
                config.$container.append('<div class="' + config.classes.toastrack + '"></div>');
            }
        };

        var _getToastRack = function() {
            return $("." + config.classes.toastrack);
{'fraction_non_alphanumeric': 0.14831107619795758, 'fraction_numerical': 0.0017282010997643363, 'mean_word_length': 1.7181895815542272, 'pattern_counts': {'":': 2, '<': 8, '<?xml version=': 0, '>': 10, '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': '3723376', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1792, 'n_words': 296}