<commit_before>var jQuery = jQuery;
var $ = jQuery;
var DO = DO;

(function ($namespace) {

    var setButtonsAction = function () {
        $(document).keydown(function (e) {
            if( e.keyCode === 27 )
                $namespace.modal.hide();
        });

        $('body').on('click', 'a.modal-btn-close', function () {
            $namespace.modal.hide();
        });

        // $(".modal-mask").click ->
        //   minimize()

    };

    $namespace.modal = {
        create: function (params) {
            var
                body = $('body'),
                url = null,
                format = null,
                wrapperModal,
                modalMask,
                modal,
                header,
                btnClose,
                content;

            if( params.url ) {
                url = params.url;
            }

            if( params.format ) {
                format = params.format;
            } else {
                format = 'html';
            }

            if( $('.wrapper-modal').length < 1) {

                wrapperModal = $('<div></div>').addClass('wrapper-modal');
                modalMask = $('<div></div>').addClass('modal-mask fixed transparent');
                modal = $('<div></div>').addClass('modal');
                header = $('<div></div>').addClass('modal-header');
                btnClose = $("<a href='#'></a>").addClass('modal-btn-close button');
                content = $('<div></div>').addClass('modal-content');

                body.append(wrapperModal);

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

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

                header.append(btnClose);
                modal.append(content);

                setButtonsAction();

            } else {
                wrapperModal = $('.wrapper-modal');
                modal = wrapperModal.find('.modal');
                modalMask = wrapperModal.find('.modal-mask');

                wrapperModal.show();
                modal.show();
            }

            // todas as linhas de um bloco function são executadas numa porrada só
            // executa somente quando estiver visível
            if( wrapperModal.is(":visible") ) {
                modalMask.replaceToggleClass('transparent', 'opacity-transition');
            }

            modal.centralizeOnScreen();

            if(params.load) {
                params.load(modal);
            }

        },

        hide: function () {
            var
               wrapperModal = $('.wrapper-modal'),
               mask = wrapperModal.find('.modal-mask'),
               time = 0;

            $('.modal').hide();

            mask.replaceToggleClass('transparent', 'opacity-transition');

            time = parseFloat( mask.css('transition-duration') ) * 1000;
            setTimeout(function () {
                $('.wrapper-modal').hide();
            }, time);
        },

    };

}(DO.ui));


var maximizeModal = function () {
    //wrapper-modal e modal ficam hide
    //trocar transparencia de wrapperModal
};

// minimize = ->
  // atribuir classe
  // colocar left: 0; bottom: 0 e mostrar só o header


// afterLoad = (url, execute)->
//   $(".modal").load url, -><commit_msg>ajusta modal nos devidos padrões js<commit_after>var jQuery = jQuery,
    $ = jQuery,
    DO = DO;

(function ($namespace) {

    var setButtonsAction = function () {
        $(document).keydown(function (e) {
            if (e.keyCode === 27) {
                $namespace.modal.hide();
            }
        });

        $("body").on("click", "a.modal-btn-close", function () {
            $namespace.modal.hide();
        });

        // $(".modal-mask").click ->
        //   minimize()

    };

    $namespace.modal = {
        create: function (params) {
            var
                body = $("body"),
                wrapperModal,
                modalMask,
                modal,
                header,
                btnClose,
                content;

            if ($(".wrapper-modal").length < 1) {

                wrapperModal = $("<div></div>")
                    .addClass("wrapper-modal");
                modalMask = $("<div></div>")
                    .addClass("modal-mask fixed transparent");
                modal = $("<div></div>").addClass("modal");
                header = $("<div></div>").addClass("modal-header");
                btnClose = $("<a href=\"#\"></a>")
                    .addClass("modal-btn-close button");
                content = $("<div></div>").addClass("modal-content");

                body.append(wrapperModal);

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

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

                header.append(btnClose);
                modal.append(content);

                setButtonsAction();

            } else {
                wrapperModal = $(".wrapper-modal");
                modal = wrapperModal.find(".modal");
                modalMask = wrapperModal.find(".modal-mask");

                wrapperModal.show();
                modal.show();
            }

            // todas as linhas de um bloco function são executadas
            // numa porrada só executa somente quando estiver visível
            if (wrapperModal.is(":visible")) {
                modalMask
                    .replaceToggleClass("transparent", "opacity-transition");
            }

            modal.centralizeOnScreen();

            if (params.load) {
                params.load(modal);
            }

        },

        hide: function () {
            var
               wrapperModal = $(".wrapper-modal"),
               mask = wrapperModal.find(".modal-mask"),
               time = 0;

            $(".modal").hide();

            mask.replaceToggleClass("transparent", "opacity-transition");

            time = parseFloat(mask.css("transition-duration")) * 1000;
            setTimeout(function () {
                $(".wrapper-modal").hide();
            }, time);
        }

    };

}(DO.ui));


//var maximizeModal = function () {
    //wrapper-modal e modal ficam hide
    //trocar transparencia de wrapperModal
//};

// minimize = ->
  // atribuir classe
  // colocar left: 0; bottom: 0 e mostrar só o header


// afterLoad = (url, execute)->
//   $(".modal").load url, ->
{'fraction_non_alphanumeric': 0.15059701492537314, 'fraction_numerical': 0.0029850746268656717, 'mean_word_length': 1.3003776175763817, 'pattern_counts': {'":': 4, '<': 29, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1877370', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1634, 'n_words': 330}