<commit_before>(function($) {
	$.fn.extend( {
		limiter: function(limit, elem) {
			$(this).on("keyup focus", function() {
				setCount(this, elem);
			});
			function setCount(src, elem) {
				var chars = src.value.length;
				if (chars > limit) {
					src.value = src.value.substr(0, limit);
					chars = limit;
				}
				elem.html( limit - chars );
			}
			setCount($(this)[0], elem);
		}
	});
})(jQuery);

$(document).ready(function() {
	// Prevent Form Enter Submit
	$('input,select').keypress(function(event) { return event.keyCode != 13; });

	// Limit Message
	var elem = $("#chars");
	$("#message").limiter(120, elem);

	// Email + Title
	$('#type\\[email\\]').change(function() {
		if($(this).is(":checked")) {
			$('#rowTitle').show();
		} else {
			$('#rowTitle').hide();
		}
	});
	if($('#type\\[email\\]').is(":checked")) {
		$('#rowTitle').show();
	}

	// Next Button
	$('#btnNext').click(function() {
		$("a[href='#panel2']").click();
		
		$.post("<?php echo URL::site().'messages/ajax_calculate'; ?>",
			$("form").serialize(),
			function(data) {
				$('#rowCalculating').hide();
				$('#rowConfirm').show();
				$('#txtMessage').html($('form #message').val());
				$('#txtSMS').html(data.sms);
				$('#txtEmail').html(data.email);
				$('#txtCost').html(data.cost);
			}, "json"
		);

		return false;
	});
});<commit_msg>Tab Switch on Expense Calculation<commit_after>(function($) {
	$.fn.extend( {
		limiter: function(limit, elem) {
			$(this).on("keyup focus", function() {
				setCount(this, elem);
			});
			function setCount(src, elem) {
				var chars = src.value.length;
				if (chars > limit) {
					src.value = src.value.substr(0, limit);
					chars = limit;
				}
				elem.html( limit - chars );
			}
			setCount($(this)[0], elem);
		}
	});
})(jQuery);

$(document).ready(function() {
	// Prevent Form Enter Submit
	$('input,select').keypress(function(event) { return event.keyCode != 13; });

	// Limit Message
	var elem = $("#chars");
	$("#message").limiter(120, elem);

	// Email + Title
	$('#type\\[email\\]').change(function() {
		if($(this).is(":checked")) {
			$('#rowTitle').show();
		} else {
			$('#rowTitle').hide();
		}
	});
	if($('#type\\[email\\]').is(":checked")) {
		$('#rowTitle').show();
	}

	// Next Button
	$('#btnNext').click(function() {
		$("a[href='#panel2']").click();
		calculate();
		return false;
	});
	$("a[href='#panel2']").click(function() {
		calculate();
	});
});

function calculate(){
	$.post("<?php echo URL::site().'messages/ajax_calculate'; ?>",
		$("form").serialize(),
		function(data) {
			$('#rowCalculating').hide();
			$('#rowConfirm').show();
			$('#txtMessage').html($('form #message').val());
			$('#txtSMS').html(data.sms);
			$('#txtEmail').html(data.email);
			$('#txtCost').html(data.cost);
		}, "json"
	);
}
{'fraction_non_alphanumeric': 0.27315147164393394, 'fraction_numerical': 0.006101938262742283, 'mean_word_length': 3.691919191919192, 'pattern_counts': {'":': 4, '<': 5, '<?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': '6529786', 'n_tokens_mistral': 1137, 'n_tokens_neox': 996, 'n_words': 157}