<commit_before>function Export() {
    var self = this;
    var exportType = null;

    this.initiate = function() {
        $('a.export').on('click', function(event) {
            self.exportType = $(event.target).attr('data');
            self.startExport();
        });

        $('#open-export-modal').on('shown', function() {
            $('#export-textarea').focus();
        });

        $("#export-textarea").focus(function() {
            $(this).select();

            $(this).mouseup(function() {
                $(this).unbind("mouseup");
                return false;
            });
        });
    };

    this.startExport = function() {
        if (self.exportType == "url") {
            this.startExportUrl();
        }
    };

    this.startExportUrl = function() {
        var slotStates = this.collectAllSlotStates();
        console.log(slotStates);
        $('#export-textarea').html(window.location.href + '?calc=' + btoa(slotStates));
    };

    this.collectAllSlotStates = function() {
        var slotStates = '';
        for (var i = 0; i < template_data.slots.length; i++) {
            slotStates += this.collectSlotState(template_data.slots[i].id_prefix);
            if (i < (template_data.slots.length - 1)) {
                slotStates += '&';
            }
        }
        return slotStates;
    };

    this.collectSlotState = function(slotId) {
        var slotState = slotId + '=';
        var suffixes = ['-ql', '-role', '-glyph-ql', '-primary-glyph', '-secondary-glyph'];
        for (var i = 0; i < suffixes.length; i++) {
            var val = $('#' + slotId + suffixes[i]).val();
            if (val == null || val == 'none') {
                val = 0;
            }
            slotState += self.stripQL(val);
            if (i < (suffixes.length - 1)) {
                slotState += ',';
            }
        }
        return slotState;
    };

    this.stripQL = function(val) {
        var pattern = /\d+\.\d/;
        if (val != 0 && val.match(pattern)) {
            return val.split('.')[1];
        } else {
            return val;
        }
    };
};<commit_msg>Fetching slot dist<commit_after>function Export() {
    var self = this;
    var exportType = null;

    this.initiate = function() {
        $('a.export').on('click', function(event) {
            self.exportType = $(event.target).attr('data');
            self.startExport();
        });

        $('#open-export-modal').on('shown', function() {
            $('#export-textarea').focus();
        });

        $("#export-textarea").focus(function() {
            $(this).select();

            $(this).mouseup(function() {
                $(this).unbind("mouseup");
                return false;
            });
        });
    };

    this.startExport = function() {
        if (self.exportType == "url") {
            this.startExportUrl();
        }
    };

    this.startExportUrl = function() {
        var slotStates = this.collectAllSlotStates();
        console.log(slotStates);
        $('#export-textarea').html(window.location.href + '?calc=' + btoa(slotStates));
    };

    this.collectAllSlotStates = function() {
        var slotStates = '';
        for (var i = 0; i < template_data.slots.length; i++) {
            slotStates += this.collectSlotState(template_data.slots[i].id_prefix);
            if (i < (template_data.slots.length - 1)) {
                slotStates += '&';
            }
        }
        return slotStates;
    };

    this.collectSlotState = function(slotId) {
        var slotState = slotId + '=';
        var suffixes = ['-ql', '-role', '-glyph-ql', '-primary-glyph', '-secondary-glyph'];
        for (var i = 0; i < suffixes.length; i++) {
            var val = $('#' + slotId + suffixes[i]).val();
            if (val == null || val == 'none') {
                val = 0;
            }
            slotState += self.stripQL(val);
            slotState += ',';
        }
        slotState += buttonHandler[slotId].getActiveDist(slotId, 'primary-glyph').innerHTML + ',';
        slotState += buttonHandler[slotId].getActiveDist(slotId, 'secondary-glyph').innerHTML;
        return slotState;
    };

    this.stripQL = function(val) {
        var pattern = /\d+\.\d/;
        if (val != 0 && val.match(pattern)) {
            return val.split('.')[1];
        } else {
            return val;
        }
    };
};
{'fraction_non_alphanumeric': 0.17497712717291858, 'fraction_numerical': 0.0029734675205855443, 'mean_word_length': 1.7178371659415785, 'pattern_counts': {'":': 0, '<': 10, '<?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': '1986461', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1253, 'n_words': 228}