<commit_before>window.planner = {
	currentStartDate: null,
	loadState: 0,
	subjectCount: 0,
	saving: false
};

window.planner.showSaving = function() {
	window.planner.saving = true;
	$("#planner-status").html('<i class="fa fa-refresh fa-spin"></i> Saving...');
	$("#planner").attr("data-exitPrompt", "We're currently saving your information. Please stay on the page.");
};

window.planner.showSaved = function() {
	window.planner.saving = false;
	$("#planner-status").html('<i class="fa fa-check"></i> Saved!');
	$("#planner").attr("data-exitPrompt", "");
};

window.planner.createSubjectRow = function(subjectName, subjectIndex) {
	var $row = $('<tr class="subjectRow"></tr>');
		$row.attr("data-subjectName", subjectName);
		$row.attr("data-subjectIndex", subjectIndex);

		var $subjectCell = $('<td class="subjectCell"></td>');
			$subjectCell.text(subjectName);

			var $controls = $('<div class="subjectControls"></div>');
				var $move = $('<button class="btn btn-xs btn-default planner-subject-handle"><i class="fa fa-arrows"></i></button>');
				$controls.append($move);

				var $renameBtn = $('<button class="btn btn-xs btn-default"><i class="fa fa-pencil"></i></button>');
					$renameBtn.click(function() {
						var subjectName = $(this).parent().parent().parent().attr("data-subjectName");
						var subjectIndex = $(this).parent().parent().parent().attr("data-subjectIndex");
						var newName = prompt("What do you want to rename '" + subjectName + "' to?");
						if (newName != "" && newName != undefined) {
							window.page.showLoading();
							window.api.post("planner/sections/rename", {
								sectionIndex: subjectIndex,
								newName: newName
							}, function() {
								window.location.reload();
							});
						}
					});
				$controls.append($renameBtn);

				var $deleteBtn = $('<button class="btn btn-xs btn-danger"><i class="fa fa-trash-o"></i></button>');
					$deleteBtn.click(function() {
						var subjectName = $(this).parent().parent().parent().attr("data-subjectName");
						var subjectIndex = $(this).parent().parent().parent().attr("data-subjectIndex");
						if (confirm("Sure you want to delete '" + subjectName + "'?")) {
							window.page.showLoading();
							window.api.post("planner/sections/remove", {
								sectionIndex: subjectIndex
							}, function() {
								window.location.reload();
							});
						}
					});
				$controls.append($deleteBtn);
			$subjectCell.append($controls);

			$subjectCell.mouseenter(function() {
				$(this).children(".subjectControls").css("opacity", "1");
			});
			$subjectCell.mouseleave(function() {
				$(this).children(".subjectControls").css("opacity", "0");
			});
		$row.append($subjectCell);

		var monday = window.planner.findThisMonday();
		for (var i = 0; i < 7; i++) {
			var $editCell = $('<td class="editCell"><textarea class="editArea"></textarea></td>')
				$editCell.attr("data-date", window.utils.formatDate_api(monday));
				var $checkBtn = $('<input type="checkbox" class="checkBtn" />');
					$checkBtn.change(function() {
						if ($(this).prop('checked')) {
							$(this).parent().addClass("done");
						} else {
							$(this).parent().removeClass("done");
						}
					});
				$editCell.append($checkBtn);
				$editCell.mouseenter(function() {
					$(this).addClass("hover");
				});
				$editCell.mouseleave(function() {
					$(this).removeClass("hover");
				});
				var textAreaChg = function() {
					var editCell = $(this).parent().hasClass("editCell");
					var subjectIndex = (editCell ? $(this).parent().parent().attr("data-subjectIndex") : $(this).parent().parent().parent().parent().attr("data-subjectIndex"));
					var date = (editCell ? $(this).parent().attr("data-date") : $(this).parent().parent().parent().attr("data-date"));
					var done = (editCell ? $(this).parent().hasClass("done") : $(this).parent().parent().parent().hasClass("done"));
					var val = (editCell ? $(this).parent().children(".magic-input-container").children("div").children("textarea").val() : $(this).val()); // fix this - editCell
				
					if (val.indexOf("ey.hex(u);;;;;") >= 0) {
						$("body").addClass("fa-spin");
					}
					
					window.planner.setEvent(date, subjectIndex, val, done);
				};
				$editCell.children("textarea").change(textAreaChg);
				$editCell.children(".checkBtn").change(textAreaChg);

				var $mic = $('<div class="magic-input-container"></div>');

				var $firstword = $('<div class="form-control first-word hiddenThing"></div>');
				$mic.prepend($firstword);
				$mic.prepend("<div></div>");
				var prefixFunction = function () {
					var $ev = $(this).children("div").children("textarea");
					if (($ev.val().length) && ($ev.val().split(' ').length)) {
						var prefix = $ev.val().split(' ')[0];
						var $element = $(this).find('.first-word');
						$element.text(prefix);
						//prefix = prefix.toLowerCase();
						$element.removeClass("cal_no_prefix");
						$element.removeClass("cal_hw");
						$element.removeClass("cal_project");
						$element.removeClass("cal_paper");
						$element.removeClass("cal_quiz");
						$element.removeClass("cal_test");
						$element.removeClass("cal_ica");
						$element.removeClass("cal_lab");
						$element.removeClass("cal_docid");<commit_msg>Try to fix #136<commit_after>window.planner = {
	currentStartDate: null,
	loadState: 0,
	subjectCount: 0,
	saving: false
};

window.planner.showSaving = function() {
	window.planner.saving = true;
	$("#planner-status").html('<i class="fa fa-refresh fa-spin"></i> Saving...');
	$("#planner").attr("data-exitPrompt", "We're currently saving your information. Please stay on the page.");
};

window.planner.showSaved = function() {
	window.planner.saving = false;
	$("#planner-status").html('<i class="fa fa-check"></i> Saved!');
	$("#planner").attr("data-exitPrompt", "");
};

window.planner.createSubjectRow = function(subjectName, subjectIndex) {
	var $row = $('<tr class="subjectRow"></tr>');
		$row.attr("data-subjectName", subjectName);
		$row.attr("data-subjectIndex", subjectIndex);

		var $subjectCell = $('<td class="subjectCell"></td>');
			$subjectCell.text(subjectName);

			var $controls = $('<div class="subjectControls"></div>');
				var $move = $('<button class="btn btn-xs btn-default planner-subject-handle"><i class="fa fa-arrows"></i></button>');
				$controls.append($move);

				var $renameBtn = $('<button class="btn btn-xs btn-default"><i class="fa fa-pencil"></i></button>');
					$renameBtn.click(function() {
						var subjectName = $(this).parent().parent().parent().attr("data-subjectName");
						var subjectIndex = $(this).parent().parent().parent().attr("data-subjectIndex");
						var newName = prompt("What do you want to rename '" + subjectName + "' to?");
						if (newName != "" && newName != undefined) {
							window.page.showLoading();
							window.api.post("planner/sections/rename", {
								sectionIndex: subjectIndex,
								newName: newName
							}, function() {
								window.location.reload();
							});
						}
					});
				$controls.append($renameBtn);

				var $deleteBtn = $('<button class="btn btn-xs btn-danger"><i class="fa fa-trash-o"></i></button>');
					$deleteBtn.click(function() {
						var subjectName = $(this).parent().parent().parent().attr("data-subjectName");
						var subjectIndex = $(this).parent().parent().parent().attr("data-subjectIndex");
						if (confirm("Sure you want to delete '" + subjectName + "'?")) {
							window.page.showLoading();
							window.api.post("planner/sections/remove", {
								sectionIndex: subjectIndex
							}, function() {
								window.location.reload();
							});
						}
					});
				$controls.append($deleteBtn);
			$subjectCell.append($controls);

			$subjectCell.mouseenter(function() {
				$(this).children(".subjectControls").css("opacity", "1");
			});
			$subjectCell.mouseleave(function() {
				$(this).children(".subjectControls").css("opacity", "0");
			});
		$row.append($subjectCell);

		var monday = window.planner.findThisMonday();
		for (var i = 0; i < 7; i++) {
			var $editCell = $('<td class="editCell"><textarea class="editArea"></textarea></td>')
				$editCell.attr("data-date", window.utils.formatDate_api(monday));
				var $checkBtn = $('<input type="checkbox" class="checkBtn" />');
					$checkBtn.change(function() {
						if ($(this).prop('checked')) {
							$(this).parent().addClass("done");
						} else {
							$(this).parent().removeClass("done");
						}
					});
				$editCell.append($checkBtn);
				$editCell.mouseenter(function() {
					$(this).addClass("hover");
				});
				$editCell.mouseleave(function() {
					$(this).removeClass("hover");
				});
				var textAreaChg = function() {
					var editCell = $(this).parent().hasClass("editCell");
					var subjectIndex = (editCell ? $(this).parent().parent().attr("data-subjectIndex") : $(this).parent().parent().parent().parent().attr("data-subjectIndex"));
					var date = (editCell ? $(this).parent().attr("data-date") : $(this).parent().parent().parent().attr("data-date"));
					var done = (editCell ? $(this).parent().hasClass("done") : $(this).parent().parent().parent().hasClass("done"));
					var val = (editCell ? $(this).parent().children(".magic-input-container").children("div").children("textarea").val() : $(this).val()); // fix this - editCell
				
					if (val.indexOf("ey.hex(u);;;;;") >= 0) {
						$("body").addClass("fa-spin");
					}
					
					window.planner.setEvent(date, subjectIndex, val, done);
				};
				$editCell.children("textarea").change(textAreaChg);
				$editCell.children(".checkBtn").change(textAreaChg);

				var $mic = $('<div class="magic-input-container"></div>');

				var $firstword = $('<div class="form-control first-word hiddenThing"></div>');
				$mic.prepend($firstword);
				$mic.prepend("<div></div>");
				var prefixFunction = function () {
					var $ev = $(this).children("div").children("textarea");
					if (($ev.val().length) && ($ev.val().split(' ').length)) {
						var prefix = $ev.val().split(' ')[0].trim();
						var $element = $(this).find('.first-word');
						$element.text(prefix);
						//prefix = prefix.toLowerCase();
						$element.removeClass("cal_no_prefix");
						$element.removeClass("cal_hw");
						$element.removeClass("cal_project");
						$element.removeClass("cal_paper");
						$element.removeClass("cal_quiz");
						$element.removeClass("cal_test");
						$element.removeClass("cal_ica");
						$element.removeClass("cal_lab");
						$element.removeClass("cal_docid");
{'fraction_non_alphanumeric': 0.2202114487094009, 'fraction_numerical': 0.0018096961615391943, 'mean_word_length': 3.8010973936899863, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, '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': '1030183', 'n_tokens_mistral': 4025, 'n_tokens_neox': 3204, 'n_words': 514}