<commit_before>/*!
 * Modified by vlad
 *
 * Popup dialog boxes for Bootstrap - http://www.bootpopup.tk
 * Copyright (C) 2016  rigon<<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


var INPUT_SHORTCUT_TYPES = [ "text", "color", "url", "password", "hidden", "file", "number", "email", "reset", "date", "checkbox", "radio" ];


function bootpopup(options)
{
    // Create a new instance if this is not
    if (!(this instanceof bootpopup)) return new bootpopup(Array.prototype.slice.call(arguments));

    var self = this;
    // Create a global random ID for the form
    this.formid = "bootpopup-form" + String(Math.random()).substr(2);

    this.options = {
        id: "",
        self: self,
        title: document.title,
        show_close: true,
        show_header: true,
        size: "normal",
        size_label: "col-sm-4",
        size_input: "col-sm-8",
        content: [],
        footer: [],
        onsubmit: "close",
        buttons: ["close"],
        class_modal: "modal fade",
        class_dialog: "modal-dialog",
        class_title: "modal-title",
        class_content: "modal-content",
        class_body: "modal-body",
        class_header: "modal-header",
        class_footer: "modal-footer",
        class_group: "form-group",
        class_options: "options text-center text-md-right",
        class_x: "",
        class_form: "",
        class_label: "",
        class_ok: "btn btn-primary",
        class_yes: "btn btn-primary",
        class_no: "btn btn-primary",
        class_cancel: "btn btn-default btn-secondary",
        class_close: "btn btn-primary",
        text_ok: "OK",
        text_yes: "Yes",
        text_no: "No",
        text_cancel: "Cancel",
        text_close: "Close",
        icon_ok: "",
        icon_yes: "",
        icon_no: "",
        icon_cancel: "",
        icon_close: "",
        centered: false,
        horizontal: true,

        before: function() {},
        dismiss: function() {},
        close: function() {},
        ok: function() {},
        cancel: function() {},
        yes: function() {},
        no: function() {},
        shown: function() {},
        complete: function() {},
        submit: function(e) {
            self.callback(self.options.onsubmit, e);
            return false;    // Cancel form submision
        }
    }

    this.addOptions = function(options) {
        if (Array.isArray(options)) {
            options = options.reduce(function(x, y) {
                for (var p in y) x[p] = y[p];
                return x;
            }, {});
        }
        for (var key in options) {
            if (key in this.options) this.options[key] = options[key];
        }
        // Determine what is the best action if none is given
        if (typeof options.onsubmit !== "string") {
            if (this.options.buttons.indexOf("close") > 0) this.options.onsubmit = "close"; else
            if (this.options.buttons.indexOf("ok") > 0) this.options.onsubmit = "ok"; else
            if (this.options.buttons.indexOf("yes") > 0) this.options.onsubmit = "yes";
        }
        return this.options;
    }

    this.create = function() {
        var bs4 = window.bootstrap;
        // Option for modal dialog size
        var class_dialog = this.options.class_dialog;
        if (this.options.size == "xlarge") class_dialog += " modal-xl";
        if (this.options.size == "large") class_dialog += " modal-lg";
        if (this.options.size == "small") class_dialog += " modal-sm";
        if (this.options.centered) class_dialog += " modal-dialog-centered";

        // Create HTML elements for modal dialog
        this.modal = $('<div></div>', { class: this.options.class_modal, id: this.options.id || "", tabindex: "-1", role: "dialog", "aria-labelledby": "bootpopup-title", "aria-hidden": true });
        this.dialog = $('<div></div>', { class: class_dialog, role: "document" });
        this.content = $('<div></div>', { class: this.options.class_content });
        this.dialog.append(this.content);
        this.modal.append(this.dialog);

        // Header
        if (this.options.show_header && this.options.title) {
            this.header = $('<div></div>', { class: this.options.class_header });
            var title = $('<h5></h5>', { class: this.options.class_title, id: "bootpopup-title" });
            title.append(this.options.title);
            this.header.append(title);

            if (this.options.show_close) {
                var close = $('<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>');
                $('<span></span>', { class: this.options.class_x, "aria-hidden": "true" }).append("&times;").appendTo(close);
                if (bs4) this.header.append(close); else close.insertBefore(title);
            }
            this.content.append(this.header);
        }

        // Body
        var class_form = this.options.class_form;
        if (!class_form && this.options.horizontal) class_form = "form-horizontal";
        this.body = $('<div></div>', { class: this.options.class_body });
        this.form = $("<form></form>", { id: this.formid, class: class_form, role: "form", submit: function(e) { return self.options.submit(e); } });
        this.body.append(this.form);
        this.content.append(this.body);
<commit_msg>scrollable<commit_after>/*!
 * Modified by vlad
 *
 * Popup dialog boxes for Bootstrap - http://www.bootpopup.tk
 * Copyright (C) 2016  rigon<<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


var INPUT_SHORTCUT_TYPES = [ "text", "color", "url", "password", "hidden", "file", "number", "email", "reset", "date", "checkbox", "radio" ];


function bootpopup(options)
{
    // Create a new instance if this is not
    if (!(this instanceof bootpopup)) return new bootpopup(Array.prototype.slice.call(arguments));

    var self = this;
    // Create a global random ID for the form
    this.formid = "bootpopup-form" + String(Math.random()).substr(2);

    this.options = {
        id: "",
        self: self,
        title: document.title,
        show_close: true,
        show_header: true,
        size: "normal",
        size_label: "col-sm-4",
        size_input: "col-sm-8",
        content: [],
        footer: [],
        onsubmit: "close",
        buttons: ["close"],
        class_modal: "modal fade",
        class_dialog: "modal-dialog",
        class_title: "modal-title",
        class_content: "modal-content",
        class_body: "modal-body",
        class_header: "modal-header",
        class_footer: "modal-footer",
        class_group: "form-group",
        class_options: "options text-center text-md-right",
        class_x: "",
        class_form: "",
        class_label: "",
        class_ok: "btn btn-primary",
        class_yes: "btn btn-primary",
        class_no: "btn btn-primary",
        class_cancel: "btn btn-default btn-secondary",
        class_close: "btn btn-primary",
        text_ok: "OK",
        text_yes: "Yes",
        text_no: "No",
        text_cancel: "Cancel",
        text_close: "Close",
        icon_ok: "",
        icon_yes: "",
        icon_no: "",
        icon_cancel: "",
        icon_close: "",
        center: false,
        scroll: false,
        horizontal: true,

        before: function() {},
        dismiss: function() {},
        close: function() {},
        ok: function() {},
        cancel: function() {},
        yes: function() {},
        no: function() {},
        shown: function() {},
        complete: function() {},
        submit: function(e) {
            self.callback(self.options.onsubmit, e);
            return false;    // Cancel form submision
        }
    }

    this.addOptions = function(options) {
        if (Array.isArray(options)) {
            options = options.reduce(function(x, y) {
                for (var p in y) x[p] = y[p];
                return x;
            }, {});
        }
        for (var key in options) {
            if (key in this.options) this.options[key] = options[key];
        }
        // Determine what is the best action if none is given
        if (typeof options.onsubmit !== "string") {
            if (this.options.buttons.indexOf("close") > 0) this.options.onsubmit = "close"; else
            if (this.options.buttons.indexOf("ok") > 0) this.options.onsubmit = "ok"; else
            if (this.options.buttons.indexOf("yes") > 0) this.options.onsubmit = "yes";
        }
        return this.options;
    }

    this.create = function() {
        var bs4 = window.bootstrap;
        // Option for modal dialog size
        var class_dialog = this.options.class_dialog;
        if (this.options.size == "xlarge") class_dialog += " modal-xl";
        if (this.options.size == "large") class_dialog += " modal-lg";
        if (this.options.size == "small") class_dialog += " modal-sm";
        if (this.options.center) class_dialog += " modal-dialog-centered";
        if (this.options.scroll) class_dialog += " modal-dialog-scrollable";

        // Create HTML elements for modal dialog
        this.modal = $('<div></div>', { class: this.options.class_modal, id: this.options.id || "", tabindex: "-1", role: "dialog", "aria-labelledby": "bootpopup-title", "aria-hidden": true });
        this.dialog = $('<div></div>', { class: class_dialog, role: "document" });
        this.content = $('<div></div>', { class: this.options.class_content });
        this.dialog.append(this.content);
        this.modal.append(this.dialog);

        // Header
        if (this.options.show_header && this.options.title) {
            this.header = $('<div></div>', { class: this.options.class_header });
            var title = $('<h5></h5>', { class: this.options.class_title, id: "bootpopup-title" });
            title.append(this.options.title);
            this.header.append(title);

            if (this.options.show_close) {
                var close = $('<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>');
                $('<span></span>', { class: this.options.class_x, "aria-hidden": "true" }).append("&times;").appendTo(close);
                if (bs4) this.header.append(close); else close.insertBefore(title);
            }
            this.content.append(this.header);
        }

        // Body
        var class_form = this.options.class_form;
        if (!class_form && this.options.horizontal) class_form = "form-horizontal";
        this.body = $('<div></div>', { class: this.options.class_body });
        this.form = $("<form></form>", { id: this.formid, class: class_form, role: "form", submit: function(e) { return self.options.submit(e); } });
        this.body.append(this.form);
        this.content.append(this.body);

{'fraction_non_alphanumeric': 0.15160667841261852, 'fraction_numerical': 0.0026847889923651315, 'mean_word_length': 2.341743762265209, 'pattern_counts': {'":': 6, '<': 45, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6772917', 'n_tokens_mistral': 3483, 'n_tokens_neox': 3437, 'n_words': 916}