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

$(document).ready(function(){
	if($('div.banner').length == 0)
		return; // not index
	
	setInterval(function() {
		$.ajax({
			url: document.location,
			success: function(data) {
				$(data).find('div.post.reply').each(function() {
					var id = $(this).attr('id');
					if($('#' + id).length == 0) {
						$(this).insertAfter($('div.reply:last').next()).after('<br class="clear">');
					}
				});
			}
		});
	}, 6000);
});
<commit_msg>Don't check for new posts unless user is scrolled past the most recent one.<commit_after>/*
 * auto-reload.js
 * https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/auto-reload.js
 *
 * Brings AJAX to Tinyboard.
 *
 * Released under the MIT license
 * Copyright (c) 2012 <NAME> <<EMAIL>>
 *
 * Usage:
 *   $config['additional_javascript'][] = 'js/jquery.min.js';
 *   $config['additional_javascript'][] = 'js/auto-reload.js';
 *
 */

$(document).ready(function(){
	if($('div.banner').length == 0)
		return; // not index
	
	setInterval(function() {
		if($(window).scrollTop() + $(window).height() < $('div.post.reply:last').position().top + $('div.post.reply:last').height())
			return; // not scrolled past last reply
		
		$.ajax({
			url: document.location,
			success: function(data) {
				$(data).find('div.post.reply').each(function() {
					var id = $(this).attr('id');
					if($('#' + id).length == 0) {
						$(this).insertAfter($('div.reply:last').next()).after('<br class="clear">');
					}
				});
			}
		});
	}, 5000);
});

{'fraction_non_alphanumeric': 0.22729715206878023, 'fraction_numerical': 0.010746910263299301, 'mean_word_length': 3.5414634146341464, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, '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': '4777955', 'n_tokens_mistral': 743, 'n_tokens_neox': 634, 'n_words': 111}