<commit_before>//= require ./support/jquery
//= require esphinx_ui
//= require esphinx/ajax
//= require esphinx/support/function
//= require esphinx/support/array
//= require esphinx/observer

"use strict";

var
    jQuery,
    esPhinx,
    Singleton;

(function ($module) {

    $module.extend({
        modal: function () {

            // aparentemente o var realmente faz com que variáveis locais sejam atributos privados de classe, visto que seus valores são mantidos
            // this.domObject = this.domObject || null;

            // global scope (public)
            // runtime set
            this.close = function () {
                // o objeto deveria ser detruído da memória??
                modal.hide();

                modalMask.replaceToggleClass("basicss-transparent", "basicss-opacity-transition");

                time = parseFloat(
                    modalMask.css("transition-duration")
                ) * 1000;
                setTimeout(function () {
                    wrapperModal.remove();
                }, time);

                self.deleteSingleton();
            };

            this.hide = function () {
                modal.hide();

                modalMask.replaceToggleClass("basicss-transparent", "basicss-opacity-transition");

                wrapperModal.css("zIndex", -1);

            };

            this.show = function () {
                // debugger;
                // wrapperModal = wrapperModal || self.domObject;
                wrapperModal.css("zIndex", 0);
                modalMask
                    .replaceToggleClass("basicss-transparent",
                        "basicss-opacity-transition");

                modal.show();
            };

            var
                self = this,
                $ = jQuery,
                args = arguments[0],
                body = $("body"),
                time = 0,

                wrapperModal,
                modalMask,
                modal,
                header,
                headerActions,
                btnClose,
                content,
                btnHide,

                setButtonsAction = function () {

                    $(document).off("keydown").on("keydown", function (e) {
                        if (e.keyCode === 27) {
                            self.hide();
                        }
                    });

                    btnHide.click(function () {
                        self.hide();
                    });

                    btnClose.click(function () {
                        self.close();
                    });

                },

                observeContent = function () {
                    esPhinx(content[0]).observe({
                        config: {
                            childList: true
                        },
                        done: function () {
                            modal.centralizeOn($(document));
                        }
                    });
                },

                create = function () {
                    wrapperModal = $("<div></div>")
                        .addClass("esphinx-ui-wrapper-modal");
                    modalMask = $("<div></div>")
                        .addClass("esphinx-ui-modal-mask basicss-fixed" +
                            " basicss-transparent");
                    modal = $("<div></div>").addClass("esphinx-ui-modal" +
                        " basicss-hidden");
                    header = $("<div></div>")
                        .addClass("esphinx-ui-modal-header");
                    headerActions = $("<div></div>")
                        .addClass("esphinx-ui-modal-header-actions");
                    btnClose = $("<a href=\"#\"></a>")
                        .addClass("esphinx-ui-modal-btn-close button");
                    btnHide = $("<a href=\"#\"></a>")
                        .addClass("esphinx-ui-modal-btn-hide button");
                    content = $("<div></div>")
                        .addClass("esphinx-ui-modal-content");

                    body.append(wrapperModal);

                    wrapperModal
                        .append(modalMask)
                        .append(modal);

                    modal
                        .append(header)
                        .css({
                            "max-height": $(window).height(),
                            "max-width": $(document).width()
                        });

                    header.append(headerActions);

                    headerActions.append(btnClose);
                    headerActions.append(btnHide);

                    modal.append(content);

                    setButtonsAction();

                    observeContent();

                    if (args.url) {
                        esPhinx.ajax.get({
                            url: args.url,
                            readyStateChange: function (xhr) {
                                if (args.load) {
                                    args.load(modal, xhr);
                                }
                            }
                        }).done(function (answer) {
                            content.append(answer);
                            self.show();
                        });
                    }

                    // self.domObject = wrapperModal;

                };

            if (!(this instanceof esPhinx.ui.modal)) {
                self = Singleton.instanceExists<commit_msg>adequa nome de chave<commit_after>//= require ./support/jquery
//= require esphinx_ui
//= require esphinx/ajax
//= require esphinx/support/function
//= require esphinx/support/array
//= require esphinx/observer

"use strict";

var
    jQuery,
    esPhinx,
    Singleton;

(function ($module) {

    $module.extend({
        modal: function () {

            // aparentemente o var realmente faz com que variáveis locais sejam atributos privados de classe, visto que seus valores são mantidos
            // this.domObject = this.domObject || null;

            // global scope (public)
            // runtime set
            this.close = function () {
                // o objeto deveria ser detruído da memória??
                modal.hide();

                modalMask.replaceToggleClass("basicss-transparent", "basicss-opacity-transition");

                time = parseFloat(
                    modalMask.css("transition-duration")
                ) * 1000;
                setTimeout(function () {
                    wrapperModal.remove();
                }, time);

                self.deleteSingleton();
            };

            this.hide = function () {
                modal.hide();

                modalMask.replaceToggleClass("basicss-transparent", "basicss-opacity-transition");

                wrapperModal.css("zIndex", -1);

            };

            this.show = function () {
                // debugger;
                // wrapperModal = wrapperModal || self.domObject;
                wrapperModal.css("zIndex", 0);
                modalMask
                    .replaceToggleClass("basicss-transparent",
                        "basicss-opacity-transition");

                modal.show();
            };

            var
                self = this,
                $ = jQuery,
                args = arguments[0],
                body = $("body"),
                time = 0,

                wrapperModal,
                modalMask,
                modal,
                header,
                headerActions,
                btnClose,
                content,
                btnHide,

                setButtonsAction = function () {

                    $(document).off("keydown").on("keydown", function (e) {
                        if (e.keyCode === 27) {
                            self.hide();
                        }
                    });

                    btnHide.click(function () {
                        self.hide();
                    });

                    btnClose.click(function () {
                        self.close();
                    });

                },

                observeContent = function () {
                    esPhinx(content[0]).observe({
                        config: {
                            childList: true
                        },
                        done: function () {
                            modal.centralizeOn($(document));
                        }
                    });
                },

                create = function () {
                    wrapperModal = $("<div></div>")
                        .addClass("esphinx-ui-wrapper-modal");
                    modalMask = $("<div></div>")
                        .addClass("esphinx-ui-modal-mask basicss-fixed" +
                            " basicss-transparent");
                    modal = $("<div></div>").addClass("esphinx-ui-modal" +
                        " basicss-hidden");
                    header = $("<div></div>")
                        .addClass("esphinx-ui-modal-header");
                    headerActions = $("<div></div>")
                        .addClass("esphinx-ui-modal-header-actions");
                    btnClose = $("<a href=\"#\"></a>")
                        .addClass("esphinx-ui-modal-btn-close button");
                    btnHide = $("<a href=\"#\"></a>")
                        .addClass("esphinx-ui-modal-btn-hide button");
                    content = $("<div></div>")
                        .addClass("esphinx-ui-modal-content");

                    body.append(wrapperModal);

                    wrapperModal
                        .append(modalMask)
                        .append(modal);

                    modal
                        .append(header)
                        .css({
                            "max-height": $(window).height(),
                            "max-width": $(document).width()
                        });

                    header.append(headerActions);

                    headerActions.append(btnClose);
                    headerActions.append(btnHide);

                    modal.append(content);

                    setButtonsAction();

                    observeContent();

                    if (args.url) {
                        esPhinx.ajax.get({
                            url: args.url,
                            processing: function (xhr) {
                                if (args.loading) {
                                    args.loading(modal, xhr);
                                }
                            }
                        }).done(function (answer) {
                            content.append(answer);
                            self.show();
                        });
                    }

                    // self.domObject = wrapperModal;

                };

            if (!(this instanceof esPhinx.ui.modal)) {
                self = Singleton.instanceExists
{'fraction_non_alphanumeric': 0.11398774128625011, 'fraction_numerical': 0.0020126246455036134, 'mean_word_length': 0.9105207969241524, 'pattern_counts': {'":': 4, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '240729', 'n_tokens_mistral': 2601, 'n_tokens_neox': 2349, 'n_words': 410}