<commit_before>/*
 *expand.js
 * https://github.com/savetheinternet/Tinyboard/blob/master/js/expand.js
 *
 * Released under the MIT license
 * Copyright (c) 2012 <NAME> <<EMAIL>>
 *
 * Usage:
 *   $config['additional_javascript'][] = 'js/jquery.min.js';
 *   $config['additional_javascript'][] = 'js/expand.js';
 *
 */

$(document).ready(function(){
	if($('div.banner').length != 0)
		return; // not index
	
	$('div.post.op span.omitted').each(function() {
		$(this)
			.html($(this).text().replace(/Click reply to view\./, '<a href="javascript:void(0)">Click to expand</a>.'))
			.find('a').click(function() {
				var thread = $(this).parent().parent().parent();
				var id = thread.attr('id').replace(/^thread_/, '');
				$.ajax({
					url: thread.find('p.intro a.post_no:first').attr('href'),
					context: document.body,
					success: function(data) {
						var last_expanded = false;
						$(data).find('div.post.reply').each(function() {
							if($('#' + $(this).attr('id')).length == 0) {
								if(last_expanded) {
									$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
								} else {
									$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
								}
								last_expanded = $(this);
								
							}
						});
						$('<span class="omitted"><a href="javascript:void(0)">Hide expanded replies</a>.</span>')<commit_msg>expand.js: fix a weird bug - thread expand not always worked due to post being loaded in DOM, but not put in a right place in a thread, or so, so check if it has been loaded in a thread instead of if it exists in DOM<commit_after>/*
 *expand.js
 * https://github.com/savetheinternet/Tinyboard/blob/master/js/expand.js
 *
 * Released under the MIT license
 * Copyright (c) 2012 <NAME> <<EMAIL>>
 *
 * Usage:
 *   $config['additional_javascript'][] = 'js/jquery.min.js';
 *   $config['additional_javascript'][] = 'js/expand.js';
 *
 */

$(document).ready(function(){
	if($('div.banner').length != 0)
		return; // not index
	
	$('div.post.op span.omitted').each(function() {
		$(this)
			.html($(this).text().replace(/Click reply to view\./, '<a href="javascript:void(0)">Click to expand</a>.'))
			.find('a').click(function() {
				var thread = $(this).parent().parent().parent();
				var id = thread.attr('id').replace(/^thread_/, '');
				$.ajax({
					url: thread.find('p.intro a.post_no:first').attr('href'),
					context: document.body,
					success: function(data) {
						var last_expanded = false;
						$(data).find('div.post.reply').each(function() {
							if(thread.find('#' + $(this).attr('id')).length == 0) {
								if(last_expanded) {
									$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
								} else {
									$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
								}
								last_expanded = $(this);
								
							}
						});
						$('<span class="omitted"><a href="javascript:void(0)">Hide expanded replies</a>.</span>')
{'fraction_non_alphanumeric': 0.2159349593495935, 'fraction_numerical': 0.005203252032520325, 'mean_word_length': 3.4195402298850577, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '447333', 'n_tokens_mistral': 1240, 'n_tokens_neox': 989, 'n_words': 184}