<commit_before>;(function($){

    var $id = function(i){ return $('#'+i) };

    var getJsOptions = function(el){
        var data = el.data(), opts = {}, opt,
        excluded = ['adaptor', 'type', 'fieldid', 'plugin'];

        $.each(data, function(k, v){
            if ($.inArray(k.toLowerCase(), excluded) < 0) {
                opts[k] = v;
            }
        })
        return opts;
    };
    
    $.inherit = function(p, c) {
        for (var x in c) p[x] = c[x];
    };

    $.editlive = (function($) {
        $self = this;

        return {
            load: function(el) {
                (el && $(el).find('editlive') || $('editlive')).each(function(k, v){
                    $.editlive.loadWidget(v);
                });
            },

            getByFieldId: function(fieldId) {
                if (fieldId[0] == '#') fieldId = fieldId.slice(1);
                return $('editlive[data-field-id="'+ fieldId +'"]');
            },

            loadWidget: function(el){
                var el = $(el), initialized = el.data('initialized') || false;
                if (initialized) return true;
                else {
                    var widgetname = el.data('widget') || el.data('type');
                    if ($.isFunction($.editliveWidgets[widgetname])) {
                        var opts, options, input;
                        opts  = getJsOptions(el);
                        input = $id(el.data('field-id'));
<commit_msg>Fixed bug when two fields have the same id attribute<commit_after>;(function($){

    var $id = function(i){ return $('#'+i) };

    var getJsOptions = function(el){
        var data = el.data(), opts = {}, opt,
        excluded = ['adaptor', 'type', 'fieldid', 'plugin'];

        $.each(data, function(k, v){
            if ($.inArray(k.toLowerCase(), excluded) < 0) {
                opts[k] = v;
            }
        })
        return opts;
    };
    
    $.inherit = function(p, c) {
        for (var x in c) p[x] = c[x];
    };

    $.editlive = (function($) {
        $self = this;

        return {
            load: function(el) {
                (el && $(el).find('editlive') || $('editlive')).each(function(k, v){
                    $.editlive.loadWidget(v);
                });
            },

            getByFieldId: function(fieldId) {
                if (fieldId[0] == '#') fieldId = fieldId.slice(1);
                return $('editlive[data-field-id="'+ fieldId +'"]');
            },

            loadWidget: function(el){
                var el = $(el), initialized = el.data('initialized') || false;
                if (initialized) return true;
                else {
                    var widgetname = el.data('widget') || el.data('type');
                    if ($.isFunction($.editliveWidgets[widgetname])) {
                        var opts, options, input;
                        var opts  = getJsOptions(el);
                        input_id = $id(el.data('field-id'));

                        // We start by checking for a close match. Theorically there
                        // shouldn't be two fields with the same id, but in reality it
                        // does happens and it does fuck up editlive.
                        input = el.prev(input_id);
                        if (!input.get(0)) input = el.closest(input_id);
                        else if (!input.get(0)) input = el.parent().find(input_id);
                        else input = $(input_id);

{'fraction_non_alphanumeric': 0.15911059774761768, 'fraction_numerical': 0.002310135720473578, 'mean_word_length': 1.4173063503140264, 'pattern_counts': {'":': 0, '<': 5, '<?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': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1076544', 'n_tokens_mistral': 998, 'n_tokens_neox': 950, 'n_words': 230}