<commit_before>$(function() {
	$(document).on('click', '.bw-modal', function(e) {
		e.preventDefault();
		bw.ajaxmodal($(this));
	});

	$(document).on('click', '.bw-ajaxlink', function(e) {
		e.preventDefault();
		bw.ajaxlink($(this));
	});
});

var bw = {
	ajaxmodal: function(link) {
		var id = link.data('modal-id') != null ? link.data('modal-id') : 'ajax-modal';
		var size = link.data('modal-size') != null ? ' modal-' + link.data('modal-size') + ' ' : '';

		var backdrop = link.data('modal-backdrop') != null ? link.data('modal-backdrop') : true;
		var keyboard = link.data('modal-keyboard') != null ? link.data('modal-keyboard') : true;

		var modal = $('<div id="' + id + '" class="modal fade loading" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog' + size + '"></div></div>');
		$('body').append(modal);

		modal.on('show.bs.modal', function() {
			modal.find('.modal-dialog').load(link.attr('href'), function() {
				modal.removeClass('loading');
			});
		}).on('hidden.bs.modal', function() {
			$(this).remove();
		}).modal({
			backdrop: backdrop,
			keyboard: keyboard
		});
	},
	ajaxlink: function(link) {
		if (link.data('confirm') == null) {
			doAjax()
		} else {
			bootbox.confirm(link.data('confirm'), function(result) {
				if (result) {
					doAjax();<commit_msg>hide modal if success is false<commit_after>$(function() {
	$(document).on('click', '.bw-modal', function(e) {
		e.preventDefault();
		bw.ajaxmodal($(this));
	});

	$(document).on('click', '.bw-ajaxlink', function(e) {
		e.preventDefault();
		bw.ajaxlink($(this));
	});
});

var bw = {
	ajaxmodal: function(link) {
		var id = link.data('modal-id') != null ? link.data('modal-id') : 'ajax-modal';
		var size = link.data('modal-size') != null ? ' modal-' + link.data('modal-size') + ' ' : '';

		var backdrop = link.data('modal-backdrop') != null ? link.data('modal-backdrop') : true;
		var keyboard = link.data('modal-keyboard') != null ? link.data('modal-keyboard') : true;

		var modal = $('<div id="' + id + '" class="modal fade loading" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog' + size + '"></div></div>');
		$('body').append(modal);

		modal.on('show.bs.modal', function() {
			$.ajax({
	            url: link.attr('href'),
	            type: 'get',
	            success: function (response) {
	                if (response.success == undefined) {
	                	modal.find('.modal-dialog').load(link.attr('href'), function() {
							modal.removeClass('loading');
						});
	                }
	            }
	        });			
		}).on('hidden.bs.modal', function() {
			$(this).remove();
		}).modal({
			backdrop: backdrop,
			keyboard: keyboard
		});
	},
	ajaxlink: function(link) {
		if (link.data('confirm') == null) {
			doAjax()
		} else {
			bootbox.confirm(link.data('confirm'), function(result) {
				if (result) {
					doAjax();
{'fraction_non_alphanumeric': 0.22953066118533744, 'fraction_numerical': 0.0, 'mean_word_length': 3.4108761329305137, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1626309', 'n_tokens_mistral': 1081, 'n_tokens_neox': 970, 'n_words': 173}