<commit_before>//

function Forum()
{
	this.conf = config('global').Forum;
	this.onTopicPage = window.location.search.match(/^\?action=viewtopic/)!=null;
	this.topicId = location.search.replace(/.+topicid=(\d+).+/,'$1');
	this.forumId = ($('.pageContainer h1 a[href*="action=viewforum"]:eq(0)').attr('href') || '').replace(/.+forumid=(\d+).*/,'$1');
}

Forum.prototype.run = function()
{
	this.postsLog();
	this.uncensored();
	this.likeOwnPosts();
	this.imgFitOnComments();
	this.imgZoom();
};

Forum.prototype.uncensored = function()
{
	if(!this.onTopicPage || !(this.conf['Censored Post'].showUncensoreButton || this.conf['Censored Post'].showUncensoreAllButton || this.conf['Censored Post'].autoResolveAllCensoredPost || this.conf['Censored Post'].mofHideCensored))
		return;

	var
		$trComment = $()
		, $showPosts = $()
		, self = this
	;


	$$('.forumPostName').each(function()
	{
		var
			$table = $(this)
			, $tdComment = $table.next().find('.comment[align="center"]')
			, $trMof = $table.next().find('tr[style="background-color:#FAEBE2"]')
			, isCensored = $tdComment.length && /(Cenzurat)|(Зацензурено)/.test($tdComment.text().trim())
			, isMOFCensored = self.conf['Censored Post'].mofHideCensored && $trMof.length
		;

		//ensuring that this is a censored post
		if(isCensored || isMOFCensored)
		{
			var
				userID = $table.find('a[href*="userdetails.php?id="]').attr('href').replace(/.*id=/, "")
				, postID = $table.prev().attr('name')==='last' ? $table.prevAll(':eq(1)').attr('name') : $table.prev().attr('name')
				, $showPost = $('<a></a>',{text:__('Show post'), 'class':'showPost', 'postID':postID, 'userID':userID}).data('$tr', isMOFCensored ? $trMof : $tdComment.parent())
				, $showAllPost = $('<a></a>',{text:__('Show all posts'), 'class':'showAllPost'})
				, _append = []
			;

			if(self.conf['Censored Post'].showUncensoreButton)
			{
				_append.push('[',$showPost,']');
			}

			if(self.conf['Censored Post'].showUncensoreAllButton)
			{
				var _p = _append.length ? ' &nbsp;&nbsp; - &nbsp;&nbsp; [' : '[';
				_append.push(_p,$showAllPost,']');
			}

			if(isMOFCensored)
			{
				//clear avatar
				$trMof.find('td').eq(0).empty();
				$tdComment = $trMof.find('.comment');
			}

			$tdComment.empty().append.apply($tdComment, _append).parent().addClass('decenzureaza');
			$showPosts = $showPosts.add($showPost);
		}
	});


	$(document.body).on('click', 'a.showPost', function()
	{
		var
			$tr = $(this).data('$tr') || (function(a)
			{
				return $tr = $(a).closest('tr')
			})(this)
			, $td = $tr.find('.comment').html('<img src="/pic/loading2.gif" />')
			, userID = $(this).attr('userID')
			, postID = $(this).attr('postID')
			, pageNb=0
			, __cacheId = 'u.'+userID+'.posts'
			, _cacheUserPosts = _cache(__cacheId) || {}
			, $tmp = $('<div></div>')
		;<commit_msg>bugfix: Forum-> Censored Posts -> auto resolve -> append $showPost<commit_after>//

function Forum()
{
	this.conf = config('global').Forum;
	this.onTopicPage = window.location.search.match(/^\?action=viewtopic/)!=null;
	this.topicId = location.search.replace(/.+topicid=(\d+).+/,'$1');
	this.forumId = ($('.pageContainer h1 a[href*="action=viewforum"]:eq(0)').attr('href') || '').replace(/.+forumid=(\d+).*/,'$1');
}

Forum.prototype.run = function()
{
	this.postsLog();
	this.uncensored();
	this.likeOwnPosts();
	this.imgFitOnComments();
	this.imgZoom();
};

Forum.prototype.uncensored = function()
{
	if(!this.onTopicPage || !(this.conf['Censored Post'].showUncensoreButton || this.conf['Censored Post'].showUncensoreAllButton || this.conf['Censored Post'].autoResolveAllCensoredPost || this.conf['Censored Post'].mofHideCensored))
		return;

	var
		$trComment = $()
		, $showPosts = $()
		, self = this
	;


	$$('.forumPostName').each(function()
	{
		var
			$table = $(this)
			, $tdComment = $table.next().find('.comment[align="center"]')
			, $trMof = $table.next().find('tr[style="background-color:#FAEBE2"]')
			, isCensored = $tdComment.length && /(Cenzurat)|(Зацензурено)/.test($tdComment.text().trim())
			, isMOFCensored = self.conf['Censored Post'].mofHideCensored && $trMof.length
		;

		//ensuring that this is a censored post
		if(isCensored || isMOFCensored)
		{
			var
				userID = $table.find('a[href*="userdetails.php?id="]').attr('href').replace(/.*id=/, "")
				, postID = $table.prev().attr('name')==='last' ? $table.prevAll(':eq(1)').attr('name') : $table.prev().attr('name')
				, $showPost = $('<a></a>',{text:__('Show post'), 'class':'showPost', 'postID':postID, 'userID':userID}).data('$tr', isMOFCensored ? $trMof : $tdComment.parent())
				, $showAllPost = $('<a></a>',{text:__('Show all posts'), 'class':'showAllPost'})
				, _append = []
			;

			if(self.conf['Censored Post'].showUncensoreButton)
			{
				_append.push('[',$showPost,']');
			}

			if(self.conf['Censored Post'].showUncensoreAllButton)
			{
				var _p = _append.length ? ' &nbsp;&nbsp; - &nbsp;&nbsp; [' : '[';
				_append.push(_p,$showAllPost,']');
			}

			/**
			 * append $showPost but hide it, this is needed to proper work with other extensions that breaks the dom
			 */
			if(!self.conf['Censored Post'].showUncensoreButton && (self.conf['Censored Post'].autoResolveAllCensoredPost || self.conf['Censored Post'].showUncensoreAllButton))
			{
				_append.push($showPost.hide());
			}

			if(isMOFCensored)
			{
				//clear avatar
				$trMof.find('td').eq(0).empty();
				$tdComment = $trMof.find('.comment');
			}

			$tdComment.empty().append.apply($tdComment, _append).parent().addClass('decenzureaza');
			$showPosts = $showPosts.add($showPost);
		}
	});


	$(document.body).on('click', 'a.showPost', function()
	{
		var
			$tr = $(this).data('$tr') || (function(a)
			{
				return $tr = $(a).closest('tr')
			})(this)
			, $td = $tr.find('.comment').html('<img src="/pic/loading2.gif" />')
			, userID = $(this).attr('userID')
			, postID = $(this).attr('postID')
			, pageNb=0
			, __cacheId = 'u.'+userID+'.posts'
			, _cacheUserPosts = _cache(__cacheId) || {}
			, $tmp = $('<div></div>')
		;
{'fraction_non_alphanumeric': 0.23841169629506562, 'fraction_numerical': 0.0029905299883701613, 'mean_word_length': 4.289982425307557, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, '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': '3675946', 'n_tokens_mistral': 2541, 'n_tokens_neox': 2259, 'n_words': 292}