<commit_before>Galleon = new Meteor.Collection('expensive_data');

if (Meteor.is_client) {

	Meteor.startup(function () {
		$('.container').hide().eq(0).show();
	});

	var toggleContainersHandler = function (event) {

		event.preventDefault();

		var toggleElementID = '#' + $(event.target).data('toggle');

		$(event.target).parents('.container').slideUp();
		$(toggleElementID).slideDown();
	};

	var listTags = function () {
		var tags = [];

		Galleon.find().forEach(function (data) {
			$.each(data.tags, function (index, value) {
				($.inArray(value, tags) === -1) && tags.push(value);
			});
		})

		return tags.sort();
	};

	// ---- Main (home) Page ----
	Template.main.events = {

		'click .container-toggle': toggleContainersHandler,

		// Check if amount is a number and also evaluate simple arithmetic for amounts
		// (may cause deterioration in mental math skills)
		'blur #amount': function (event) {

			var $amount = $(event.target);
			var amountVal = $amount.val();

			// Reset if amount is empty
			if (!amountVal) {
				$amount.data('expression-value', '')
					.removeClass('success error');
				return;
			}

			// Parse for arithmetic if it isn't
			var evalRegex = /^=(?:\d+(?:\.\d+)?|(?:\.\d+))(?:[+-](?:\d+(?:\.\d+)?|(?:\.\d+)))?$/;
			var mathExpression = amountVal.match(evalRegex);

			if (mathExpression) {

				$amount.data('expression-value', mathExpression[0])
					.val(eval(mathExpression[1]))
					.removeClass('error')
					.addClass('success');
			}

			else if (!isNaN(amountVal)) {

				amountVal = Math.abs(amountVal);
				$amount.data('expression-value', amountVal)
					.val(amountVal)
					.removeClass('error')
					.addClass('success');
			}
<commit_msg>[#1488889110313] Not all arithmetic is being parsed correctly<commit_after>Galleon = new Meteor.Collection('expensive_data');

if (Meteor.is_client) {

	Meteor.startup(function () {
		$('.container').hide().eq(0).show();
	});

	var toggleContainersHandler = function (event) {

		event.preventDefault();

		var toggleElementID = '#' + $(event.target).data('toggle');

		$(event.target).parents('.container').slideUp();
		$(toggleElementID).slideDown();
	};

	var listTags = function () {
		var tags = [];

		Galleon.find().forEach(function (data) {
			$.each(data.tags, function (index, value) {
				($.inArray(value, tags) === -1) && tags.push(value);
			});
		})

		return tags.sort();
	};

	// ---- Main (home) Page ----
	Template.main.events = {

		'click .container-toggle': toggleContainersHandler,

		// Check if amount is a number and also evaluate simple arithmetic for amounts
		// (may cause deterioration in mental math skills)
		'blur #amount': function (event) {

			var $amount = $(event.target);
			var amountVal = $amount.val();

			// Reset if amount is empty
			if (!amountVal) {
				$amount.data('expression-value', '')
					.removeClass('success error');
				return;
			}

			// Parse for arithmetic if it isn't
			var evalRegex = /^=((?:\d+(?:\.\d+)?|(?:\.\d+))(?:[+-](?:\d+(?:\.\d+)?|(?:\.\d+)))?)$/;
			var mathExpression = amountVal.match(evalRegex);

			if (mathExpression) {

				$amount.data('expression-value', mathExpression[0])
					.val(eval(mathExpression[1]))
					.removeClass('error')
					.addClass('success');
			}

			else if (!isNaN(amountVal)) {

				amountVal = Math.abs(amountVal);
				$amount.data('expression-value', amountVal)
					.val(amountVal)
					.removeClass('error')
					.addClass('success');
			}

{'fraction_non_alphanumeric': 0.20225694444444445, 'fraction_numerical': 0.006076388888888889, 'mean_word_length': 3.3982188295165394, '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': '1134836', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1104, 'n_words': 229}