<commit_before>;
( function ( root, doc, factory ) {
    if ( typeof define === "function" && define.amd ) {
        // AMD
        define( [ 'backbone', 'underscore', 'jquery', 'bootstrap' ], function ( Backbone, _, $ ) {
            factory( $, root, doc );
            return Backbone.View.extend( {
                render: function () {
                    this.$el.button( this.options );
                    return this;
                }
            } );
        } );
    } else {
        // None AMD
        factory( root.jQuery, root, doc );
    }
} ( window, document, function ( $, window, document ) {
    /*
     토글 버튼 이벤트 확장 : 토글시 이벤트 발생;
     */
    var Button = function () {};

    Button = $.fn.button.Constructor;

    Button.prototype.toggle = function () {

        var self = this.$element;
        var $parent = self.closest('[data-toggle="buttons"]')

        if ($parent.length) {
            var $old = $parent.find('.active')
            var $input = self.find('input').prop('checked', !self.hasClass('active'))

            if ($input.prop('type') === 'radio') {
                $old.length && $parent.trigger( 'toggleOff.cs.button', $old );
                $parent.find('.active').removeClass('active')
                self.toggleClass('active')
                $parent.trigger( 'toggleOn.cs.button', self );
            } else {
                var flag = self.hasClass('active');
                self.toggleClass('active');
                flag ? $parent.trigger( 'toggleOff.cs.button', self ) : $parent.trigger( 'toggleOn.cs.button', self );
            }
        } else {
            var flag = self.hasClass('active');
            self.toggleClass('active');
            flag ? self.trigger( $.Event( 'toggleOff.cs.button' ) ) : self.trigger( $.Event( 'toggleOn.cs.button' ) );
        }
    };

    $.fn.button.Constructor = Button;
} ) );<commit_msg>Widget Button을 위한 백본 글로벌에 추가하는 기능 구현 및 코드 리팩토링<commit_after>;(function (root, factory) {

    // Require.js가 있을 경우
    if (typeof define === 'function' && define.amd)
        define([ "jquery", "underscore", "backbone", "bootstrap" ], factory);
    else
        root.Button = factory(root.$, root._, root.Backbone);

}(window, function ($, _, Backbone) {
    /*
     토글 버튼 이벤트 확장 : 토글시 이벤트 발생;
     */
    var Button = $.fn.button.Constructor;

    Button.prototype.toggle = function () {

        var flag;
        var self = this.$element;
        var $parent = self.closest('[data-toggle="buttons"]');

        if ($parent.length) {
            var $old = $parent.find('.active');
            var $input = self.find('input').prop('checked', !self.hasClass('active'));

            if ($input.prop('type') === 'radio') {
                $old.length && $parent.trigger('toggleOff.cs.button', $old);
                $parent.find('.active').removeClass('active');
                self.toggleClass('active');
                $parent.trigger('toggleOn.cs.button', self);
            } else {
                flag = self.hasClass('active');
                self.toggleClass('active');
                flag ? $parent.trigger('toggleOff.cs.button', self) : $parent.trigger('toggleOn.cs.button', self);
            }
        } else {
            flag = self.hasClass('active');
            self.toggleClass('active');
            flag ? self.trigger($.Event('toggleOff.cs.button')) : self.trigger($.Event('toggleOn.cs.button'));
        }
    };

    $.fn.button.Constructor = Button;

    return Backbone ? Backbone.View.extend({
        render: function () {
            this.$el.button(this.options);
            return this;
        }
    }) : Button;
}));
{'fraction_non_alphanumeric': 0.169002473206925, 'fraction_numerical': 0.0, 'mean_word_length': 1.8549019607843138, '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': '4104472', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1116, 'n_words': 209}