<commit_before>﻿///<reference path="../lib/jquery/dist/jquery.js" />
///<reference path="../lib/knockout/dist/knockout.js" />

var HTBox = HTBox || {};
(function() {
    "use strict";
    //
    // This is a wrapper around the Bootstrap modal dialog that encapsulates the Bootstrap modal with a Knockout view model,
    // providing a clear separation of concerns between the view model and UI.
    //
    var showModal = function (options) {
        var self = this;
        if (typeof options === "undefined") throw new Error("An options argument is required.");
        if (typeof options.viewModel !== "object") throw new Error("options.viewModel is required.");
        if (typeof options.onClose !== "function") throw new Error("options.onClose is required.");
        if (!options.modalId) throw new Error("options.modalId is required.");

        var viewModel = options.viewModel;
        var modalId = options.modalId;
        var $modalElement = $("#" + modalId);

        ko.cleanNode($modalElement[0]);
        ko.applyBindings(viewModel, $modalElement[0]);
        showTwitterBootstrapModal($modalElement);

        var hide = function () {
            this.$modalElement.modal("hide");
        }

        var show = function() {
            $modalElement.modal("show");
        }

        return {
            $modalElement: $modalElement,
            hide: hide,
            show: show,
            onClose: options.onClose
        }
    };

    function showTwitterBootstrapModal($ui) {
        $ui.modal({
            // Clicking the backdrop, or pressing Escape, shouldn't automatically close the modal by default.
            // The view model should remain in control of when to close.
            backdrop: "static",
            keyboard: false
        });
    };
    
    HTBox.showModal = showModal;
}());<commit_msg>showModal bug fix<commit_after>﻿///<reference path="../lib/jquery/dist/jquery.js" />
///<reference path="../lib/knockout/dist/knockout.js" />

var HTBox = HTBox || {};
(function() {
    "use strict";
    //
    // This is a wrapper around the Bootstrap modal dialog that encapsulates the Bootstrap modal with a Knockout view model,
    // providing a clear separation of concerns between the view model and UI.
    //
    var showModal = function (options) {
        var self = this;
        if (typeof options === "undefined") throw new Error("An options argument is required.");
        if (typeof options.viewModel !== "object") throw new Error("options.viewModel is required.");
        if (typeof options.onClose !== "function") throw new Error("options.onClose is required.");
        if (!options.modalId) throw new Error("options.modalId is required.");

        var viewModel = options.viewModel;
        var modalId = options.modalId;
        var $modalElement = $("#" + modalId);

        ko.cleanNode($modalElement[0]);
        ko.applyBindings(viewModel, $modalElement[0]);
        showTwitterBootstrapModal($modalElement);

        var hide = function () {
            this.$modalElement.modal("hide");
        }

        var show = function() {
            this.$modalElement.modal("show");
        }

        return {
            $modalElement: $modalElement,
            hide: hide,
            show: show,
            onClose: options.onClose
        }
    };

    function showTwitterBootstrapModal($modalelement) {
        $modalelement.modal({
            // Clicking the backdrop, or pressing Escape, shouldn't automatically close the modal by default.
            // The view model should remain in control of when to close.
            backdrop: "static",
            keyboard: false
        });
    };
    
    HTBox.showModal = showModal;
}());
{'fraction_non_alphanumeric': 0.1231473996227432, 'fraction_numerical': 0.0010778765831312314, 'mean_word_length': 2.27336860670194, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '410483', 'n_tokens_mistral': 977, 'n_tokens_neox': 948, 'n_words': 296}