<commit_before>﻿(function (factory) {
    if (typeof define === "function" && define.amd) {
        define('bforms-initUI', ['jquery', 'jquery-migrate', 'bootstrap', 'jquery-ui-core', 'bforms-datepicker-i18n', 'placeholder-shim'], factory);
    } else {
        factory(window.jQuery);
    }

})(function ($) {
    $.fn.bsInitUIDefaults = {
        select2: true,
        select2Selector: '.bs-dropdown:not(.no-initUI), .bs-dropdown-grouped:not(.no-initUI)',

        multiSelect2: true,
        multiSelect2Selector: '.bs-listbox:not(.no-initUI), .bs-listbox-grouped:not(.no-initUI)',

        autocomplete: true,
        autocompleteSelector: '.bs-autocomplete:not(.no-initUI)',

        radioButtons: true,
        radioButtonsSelector: '.bs-radio-list:not(.no-initUI)',

        checkBoxList: true,
        checkBoxListSelector: '.bs-checkbox-list:not(.no-initUI)',

        tagList: true,
        tagListSelector: '.bs-tag-list:not(.no-initUI)',

        datepicker: true,
        datepickerSelector: '.bs-date:not(.no-initUI)',

        timepicker: true,
        timepickerSelector: '.bs-time:not(.no-initUI)',

        datetimepicker: true,
        datetimepickerSelector: '.bs-datetime:not(.no-initUI)',

        datetimerange: true,
        datetimerangeSelector: '.bs-datetime-range:not(.no-initUI)',

        daterange: true,
        daterangeSelector: '.bs-date-range:not(.no-initUI)',

        timerange: true,
        timerangeSelector: '.bs-time-range:not(.no-initUI)',

        numberrange: true,
        numberrangeSelector: '.bs-number-range:not(.no-initUI)',

        singlenumberrange: true,
        singlenumberrangeSelector: '.bs-number-single_range',

        singlenumberrangeinline: true,
        singlenumberrangeinlineSelector: '.bs-number-single_range_inline',

        buttongroupdropdown: true,
        buttongroupdropdownSelector: '.bs-button-group',

        mixedbuttongroup: true,
        mixedbuttongroupSelector: '.bs-mixed-button-group',

        upload: true,
        uploadSelector: '.bs-file',

        loadingSelector: '.loading',
        loadingClass: 'loading',
        transformNumbers: true
    };

    $.fn.bsInitUI = function (opts) {
        return (new initUI($(this), $.extend(true, {}, $.fn.bsInitUIDefaults, opts))).promise;
    };

    var initUI = (function ($, undefined) {

        var InitUI = function ($elem, opts) {
            this.$elem = $elem;
            this.options = opts;

            this.deferredList = [];
            this.loadAMD = (typeof define === "function" && typeof define.amd !== "undefined");

            this.loadAllDeferred = $.Deferred();
            this.promise = this.loadAllDeferred.promise();

            this._applyStyles();

            $.when.apply(this, this.deferredList).done($.proxy(function () {
                this.loadAllDeferred.resolve();
                this._addTheme();
            }, this));
        };

        InitUI.prototype._getOptions = function (elem) {
            return $.extend(true, {}, $(elem).data('options'));
        };

        InitUI.prototype._removePlaceholder = function ($elem) {
            $elem.each(function () {
                if (typeof $(this).data('val-required') !== "undefined") {
                    $elem.find('option[value=""]').remove();
                }
            });
        };

        InitUI.prototype._addTheme = function () {
            var $themeSelect = $(".bs-selectTheme");
            if ($themeSelect.length) {
                var currentColor = $themeSelect.bsThemeSelect('getCurrentColorClass');
                $('.bs-datetime-picker, .bs-range-picker').addClass(currentColor);

            }
        };

        InitUI.prototype._applyStyles = function () {

            var self = this;

            //set ui i18n
            var uiLocale = $('html').attr('lang') !== "undefined" ? $('html').attr('lang') : 'en';
            if (requireConfig && requireConfig.locale) {
                var locale = requireConfig.locale;
                if (typeof moment.langData(locale) !== "undefined") {
                    uiLocale = locale;
                }
            }

            if (uiLocale != 'en' && typeof uiLocale !== "undefined") {
                //load external i18n files
                var localeDeferred = $.Deferred();
                this.deferredList.push(localeDeferred);<commit_msg>resolves #196<commit_after>﻿(function (factory) {
    if (typeof define === "function" && define.amd) {
        define('bforms-initUI', ['jquery', 'jquery-migrate', 'bootstrap', 'jquery-ui-core', 'bforms-datepicker-i18n', 'placeholder-shim'], factory);
    } else {
        factory(window.jQuery);
    }

})(function ($) {
    $.fn.bsInitUIDefaults = {
        select2: true,
        select2Selector: '.bs-dropdown:not(.no-initUI), .bs-dropdown-grouped:not(.no-initUI)',

        multiSelect2: true,
        multiSelect2Selector: '.bs-listbox:not(.no-initUI), .bs-listbox-grouped:not(.no-initUI)',

        autocomplete: true,
        autocompleteSelector: '.bs-autocomplete:not(.no-initUI)',

        radioButtons: true,
        radioButtonsSelector: '.bs-radio-list:not(.no-initUI)',

        checkBoxList: true,
        checkBoxListSelector: '.bs-checkbox-list:not(.no-initUI)',

        tagList: true,
        tagListSelector: '.bs-tag-list:not(.no-initUI)',

        datepicker: true,
        datepickerSelector: '.bs-date:not(.no-initUI)',

        timepicker: true,
        timepickerSelector: '.bs-time:not(.no-initUI)',

        datetimepicker: true,
        datetimepickerSelector: '.bs-datetime:not(.no-initUI)',

        datetimerange: true,
        datetimerangeSelector: '.bs-datetime-range:not(.no-initUI)',

        daterange: true,
        daterangeSelector: '.bs-date-range:not(.no-initUI)',

        timerange: true,
        timerangeSelector: '.bs-time-range:not(.no-initUI)',

        numberrange: true,
        numberrangeSelector: '.bs-number-range:not(.no-initUI)',

        singlenumberrange: true,
        singlenumberrangeSelector: '.bs-number-single_range',

        singlenumberrangeinline: true,
        singlenumberrangeinlineSelector: '.bs-number-single_range_inline',

        buttongroupdropdown: true,
        buttongroupdropdownSelector: '.bs-button-group',

        mixedbuttongroup: true,
        mixedbuttongroupSelector: '.bs-mixed-button-group',

        upload: true,
        uploadSelector: '.bs-file',

        loadingSelector: '.loading',
        loadingClass: 'loading',
        transformNumbers: true
    };

    $.fn.bsInitUI = function (opts) {
        return (new initUI($(this), $.extend(true, {}, $.fn.bsInitUIDefaults, opts))).promise;
    };

    var initUI = (function ($, undefined) {

        var InitUI = function ($elem, opts) {
            this.$elem = $elem;
            this.options = opts;

            this.deferredList = [];
            this.loadAMD = (typeof define === "function" && typeof define.amd !== "undefined");

            this.loadAllDeferred = $.Deferred();
            this.promise = this.loadAllDeferred.promise();

            this._applyStyles();

            $.when.apply(this, this.deferredList).done($.proxy(function () {
                this.loadAllDeferred.resolve();
                this._addTheme();
            }, this));
        };

        InitUI.prototype._getOptions = function (elem) {
            return $.extend(true, {}, $(elem).data('options'));
        };

        InitUI.prototype._removePlaceholder = function ($elem) {
            $elem.each(function () {
                if (typeof $(this).data('val-required') !== "undefined") {
                    $elem.find('option[value=""]').remove();
                }
            });
        };

        InitUI.prototype._addTheme = function () {
            var $themeSelect = $(".bs-selectTheme");
            if ($themeSelect.length && $themeSelect.data('bformsBsThemeSelect')) {
                var currentColor = $themeSelect.bsThemeSelect('getCurrentColorClass');
                $('.bs-datetime-picker, .bs-range-picker').addClass(currentColor);

            }
        };

        InitUI.prototype._applyStyles = function () {

            var self = this;

            //set ui i18n
            var uiLocale = $('html').attr('lang') !== "undefined" ? $('html').attr('lang') : 'en';
            if (requireConfig && requireConfig.locale) {
                var locale = requireConfig.locale;
                if (typeof moment.langData(locale) !== "undefined") {
                    uiLocale = locale;
                }
            }

            if (uiLocale != 'en' && typeof uiLocale !== "undefined") {
                //load external i18n files
                var localeDeferred = $.Deferred();
                this.deferredList.push(localeDeferred);
{'fraction_non_alphanumeric': 0.15206479580196214, 'fraction_numerical': 0.002623773671001597, 'mean_word_length': 2.1277202996789155, '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': '6739146', 'n_tokens_mistral': 2579, 'n_tokens_neox': 2435, 'n_words': 413}