<commit_before>jQuery(document).ready(function() {
	var tc = new TopicController();
	$('#reply-post').one('focus', function(){
		$(this).wysihtml5({
			stylesheets: ['/css/editor.min.css'],
			scripts: 'http://platform.twitter.com/widgets.js'
		});
	});
	
	$('.edit-post').on('click', function(e) {
		e.preventDefault();
		$('.cancel-edit').trigger('click');
		var postID = $(this).parentsUntil('section').parent().attr('id').replace('post-', '');
	    var theDiv = $(this).parentsUntil('section').parent().find('.post-body');
		var theAuthor = $(this).parentsUntil('section').parent().find('.post-username').attr('id').split('-').pop();
	    var editableText = $("<div class = 'editing-post'><form method = 'post' action = '/post/edit/"+postID+"/' id = 'edit-post-form'><input id = 'edit-post-seq' name = 'edit-post-seq' type= 'hidden' value = '"+ theAuthor+"'/><textarea style = 'width: "+ theDiv.width() +"px; height: "+ theDiv.height()+"px' name = 'edited-text'>"+ theDiv.html() +"</textarea><div class = 'topic-post-actions'><button class = 'btn btn-danger cancel-edit'>Cancel</button><button class = 'btn btn-primary save-edit' type = 'submit'>Save</button></div></form>");
		theDiv.after("<div class = 'hide before-post-edit'>"+theDiv.html()+"</div>");
	    editableText.val(theDiv.html());
	    $(theDiv).replaceWith(editableText);
		editableText.after("");
	    editableText.focus();
		editableText.find('textarea').wysihtml5({
			stylesheets: ['/css/editor.min.css'],
			scripts: 'http://platform.twitter.com/widgets.js'
		});
	});
	
	$('body').on('click', '.cancel-edit', function(e) {
		e.preventDefault();
		var oldPost = $(this).parentsUntil('section').parent().find('.before-post-edit').html();
		$(this).parentsUntil('section').parent().find("iframe.wysihtml5-sandbox, input[name='_wysihtml5_mode']").remove();
		$(this).parentsUntil('section').parent().find('.editing-post').replaceWith("<div class = 'post-body'>"+oldPost +"</div>");
	});
	
	
	var pageUrl = document.location.pathname;
	var curPage = 1;
	var matches = pageUrl.match(/\/page\/(.*)\/$/);
	if (matches) {
	    curPage = matches[1];
	}
	
	pageUrl = pageUrl.replace(/\/page\/(.*)\/$/, '/');
	
	var jPagesOptions = {<commit_msg>Added required tag to edit textarea<commit_after>jQuery(document).ready(function() {
	var tc = new TopicController();
	$('#reply-post').one('focus', function(){
		$(this).wysihtml5({
			stylesheets: ['/css/editor.min.css'],
			scripts: 'http://platform.twitter.com/widgets.js'
		});
	});
	
	$('.edit-post').on('click', function(e) {
		e.preventDefault();
		$('.cancel-edit').trigger('click');
		var postID = $(this).parentsUntil('section').parent().attr('id').replace('post-', '');
	    var theDiv = $(this).parentsUntil('section').parent().find('.post-body');
		var theAuthor = $(this).parentsUntil('section').parent().find('.post-username').attr('id').split('-').pop();
	    var editableText = $("<div class = 'editing-post'><form method = 'post' action = '/post/edit/"+postID+"/' id = 'edit-post-form'><input id = 'edit-post-seq' name = 'edit-post-seq' type= 'hidden' value = '"+ theAuthor+"'/><textarea style = 'width: "+ theDiv.width() +"px; height: "+ theDiv.height()+"px' name = 'edited-text' required>"+ theDiv.html() +"</textarea><div class = 'topic-post-actions'><button class = 'btn btn-danger cancel-edit'>Cancel</button><button class = 'btn btn-primary save-edit' type = 'submit'>Save</button></div></form>");
		theDiv.after("<div class = 'hide before-post-edit'>"+theDiv.html()+"</div>");
	    editableText.val(theDiv.html());
	    $(theDiv).replaceWith(editableText);
		editableText.after("");
	    editableText.focus();
		editableText.find('textarea').wysihtml5({
			stylesheets: ['/css/editor.min.css'],
			scripts: 'http://platform.twitter.com/widgets.js'
		});
	});
	
	$('body').on('click', '.cancel-edit', function(e) {
		e.preventDefault();
		var oldPost = $(this).parentsUntil('section').parent().find('.before-post-edit').html();
		$(this).parentsUntil('section').parent().find("iframe.wysihtml5-sandbox, input[name='_wysihtml5_mode']").remove();
		$(this).parentsUntil('section').parent().find('.editing-post').replaceWith("<div class = 'post-body'>"+oldPost +"</div>");
	});
	
	
	var pageUrl = document.location.pathname;
	var curPage = 1;
	var matches = pageUrl.match(/\/page\/(.*)\/$/);
	if (matches) {
	    curPage = matches[1];
	}
	
	pageUrl = pageUrl.replace(/\/page\/(.*)\/$/, '/');
	
	var jPagesOptions = {
{'fraction_non_alphanumeric': 0.24926884139482564, 'fraction_numerical': 0.0026996625421822273, 'mean_word_length': 4.736774193548387, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '1274502', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1482, 'n_words': 224}