<commit_before>(function ($) {
    $.fn.autoSuggest = function (data, options) {
        var defaults = {
            allowAdd: true,
            allowAddMessage: "Please choose an existing tag",
            asHtmlID: false,
            startText: "Enter Name Here",
            emptyText: "No Results Found",
            preFill: {},
            limitText: "No More Selections Are Allowed",
            selectedItemProp: "value",
            selectedValuesProp: "value",
            searchObjProps: "value",
            queryParam: "q",
            retrieveLimit: false,
            extraParams: "",
            matchCase: false,
            minChars: 1,
            keyDelay: 400,
            resultsHighlight: true,
            neverSubmit: true,
            selectionLimit: false,
            showResultList: true,
            start: function () {},
            selectionClick: function (elem) {},
            selectionAdded: function (elem) {},
            selectionRemoved: function (elem) {
                elem.remove()
            },
            formatList: false,
            beforeRetrieve: function (string) {
                return string
            },
            retrieveComplete: function (data) {
                return data
            },
            resultClick: function (data) {},
            resultsComplete: function () {}
        };
        var opts = $.extend(defaults, options);
        var d_type = "object";
        var d_count = 0;
        if (typeof data == "string") {
            d_type = "string";
            var req_string = data
        } else {
            var org_data = data;
            for (k in data) if (data.hasOwnProperty(k)) d_count++
        }
        if ((d_type == "object" && d_count > 0) || d_type == "string") {
            return this.each(function (x) {
                if (!opts.asHtmlID) { /*x=x+""+Math.floor(Math.random()*100);*/
                    var x_id = "as-input-" + x
                } else {
                    x = opts.asHtmlID;
                    var x_id = x
                }
                opts.start.call(this);
                var input = $(this);
                input.attr("autocomplete", "off").addClass("as-input").attr("id", x_id).val(opts.startText);
                var input_focus = false;
                input.wrap('<ul class="as-selections" id="as-selections-' + x + '"></ul>').wrap('<li class="as-original" id="as-original-' + x + '"></li>');
                var selections_holder = $("#as-selections-" + x);
                var org_li = $("#as-original-" + x);
                var results_holder = $('<div class="as-results" id="as-results-' + x + '"></div>').hide();
                var results_ul = $('<ul class="as-list"></ul>');
                var values_input = $('<input type="hidden" class="tags" name="tags" id="tags" />') /*changed name of hidden input to work with begood*/
                ;
                var prefill_value = "";
                if (typeof opts.preFill == "string") {
                    var vals = opts.preFill.split(",");
                    for (var i = 0; i < vals.length; i++) {
                        var v_data = {};
                        v_data[opts.selectedValuesProp] = vals[i];
                        if (vals[i] != "") {
                            add_selected_item(v_data, "000" + i)
                        }<commit_msg>make autocomplete js compatible with fields not named 'tags'<commit_after>(function ($) {
    $.fn.autoSuggest = function (data, options) {
        var defaults = {
            allowAdd: true,
            allowAddMessage: "Please choose an existing tag",
            asHtmlID: false,
            startText: "Enter Name Here",
            emptyText: "No Results Found",
            preFill: {},
            limitText: "No More Selections Are Allowed",
            selectedItemProp: "value",
            selectedValuesProp: "value",
            searchObjProps: "value",
            queryParam: "q",
            retrieveLimit: false,
            extraParams: "",
            matchCase: false,
            minChars: 1,
            keyDelay: 400,
            resultsHighlight: true,
            neverSubmit: true,
            selectionLimit: false,
            showResultList: true,
            start: function () {},
            selectionClick: function (elem) {},
            selectionAdded: function (elem) {},
            selectionRemoved: function (elem) {
                elem.remove()
            },
            formatList: false,
            beforeRetrieve: function (string) {
                return string
            },
            retrieveComplete: function (data) {
                return data
            },
            resultClick: function (data) {},
            resultsComplete: function () {}
        };
        var opts = $.extend(defaults, options);
        var d_type = "object";
        var d_count = 0;
        if (typeof data == "string") {
            d_type = "string";
            var req_string = data
        } else {
            var org_data = data;
            for (k in data) if (data.hasOwnProperty(k)) d_count++
        }
        if ((d_type == "object" && d_count > 0) || d_type == "string") {
            return this.each(function (x) {
                if (!opts.asHtmlID) { /*x=x+""+Math.floor(Math.random()*100);*/
                    var x_id = "as-input-" + x
                } else {
                    x = opts.asHtmlID;
                    var x_id = x
                }
                opts.start.call(this);
                var input = $(this);
                input.attr("autocomplete", "off").addClass("as-input").attr("id", x_id).val(opts.startText);
                var input_focus = false;
                input.wrap('<ul class="as-selections" id="as-selections-' + x + '"></ul>').wrap('<li class="as-original" id="as-original-' + x + '"></li>');
                var selections_holder = $("#as-selections-" + x);
                var org_li = $("#as-original-" + x);
                var results_holder = $('<div class="as-results" id="as-results-' + x + '"></div>').hide();
                var results_ul = $('<ul class="as-list"></ul>');
                var values_input = $('<input type="hidden" class="tags" name="'+ $(this).attr('name').replace('_dummy', '') +'" id="tags" />') /*changed name of hidden input to work with begood*/
                ;
                var prefill_value = "";
                if (typeof opts.preFill == "string") {
                    var vals = opts.preFill.split(",");
                    for (var i = 0; i < vals.length; i++) {
                        var v_data = {};
                        v_data[opts.selectedValuesProp] = vals[i];
                        if (vals[i] != "") {
                            add_selected_item(v_data, "000" + i)
                        }
{'fraction_non_alphanumeric': 0.13914575077058564, 'fraction_numerical': 0.003816233670923235, 'mean_word_length': 1.4266381766381766, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3519937', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1766, 'n_words': 445}