<commit_before><?php
$language="enus";
include_once("js/jquery/RichTextEditor/locale/".$language.".php");
function getLabel($key,$language){
   global $label;
   return $label[$language][$key];
}

$headcommands='';
include('header.php');
include('vga_timeless.php');

set_log(__FILE__." called....");

?>

<link rel="Stylesheet" type="text/css" href="js/jquery/RichTextEditor/css/jqrte.css">
<link type="text/css" href="js/jquery/RichTextEditor/css/jqpopup.css" rel="Stylesheet">
<link rel="stylesheet" href="js/jquery/RichTextEditor/css/jqcp.css" type="text/css">
<!--
<script type="text/javascript" src="js/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/svg/jquery.svg.min.js"></script>
-->
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svg.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svgdom.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svganim.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.livequery.js"></script>
<script type="text/javascript" src="/js/sprintf-0.6.js"></script>
<script type="text/javascript" src="/js/cookies/jquery.cookie.js"></script>
<script type="text/javascript" src="/js/underscore.js"></script>  
<script type="text/javascript" src="/js/charCount.js"></script>
<script type="text/javascript" src="js/jquery/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jqDnR.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.jqpopup.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jquery.jqcp.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jquery.jqrte.min.js"></script>
<script type="text/javascript" src="js/vilfredo.php"></script>

<script type="text/javascript">
//Assumes id is passed in the URL
var recaptcha_public_key = '<?php echo $recaptcha_public_key;?>';
var votingcommentslist;
var userid = <?=json_encode($userid)?>;
var require_voting_comments = <?=json_encode($voting_settings['require_voting_comments'])?>;
var user_commentid;

var NOT_VOTED = <?=json_encode(NOT_VOTED)?>;
var AGREE = <?=json_encode(AGREE)?>;
var DISAGREE = <?=json_encode(DISAGREE)?>;
var NOT_UNDERSTAND = <?=json_encode(NOT_UNDERSTAND)?>;


function closeCommentsList(comments)
{	
	if (comments.is(':visible') == false)
	{
		return;
	}
	
	if (comments.siblings('.commentform').is(':visible'))
	{
		return;
	}
	
	var dislikecommentslist = comments.find('.dislikecommentslist');
	var confusedcommentslist = comments.find('.confusedcommentslist');
	
	dislikecommentslist.empty();
	confusedcommentslist.empty();
	comments.slideUp(500);
}

function toggleCommentsList(comments)
{
	if (comments.is(':visible') == false)
	{
		openCommentsList(comments);
	}
	else
	{
		closeCommentsList(comments);
	}
}

function openCommentsList(comments)
{	
	var dislikecommentslist = comments.find('.dislikecommentslist');
	var confusedcommentslist = comments.find('.confusedcommentslist');
	
	if (comments.is(':visible'))
	{
		return;
	}
	else
	{
		var pid;
		var el_with_id = comments.parents('tr.user_vote'); // FIXME
		if (el_with_id.length == 0)
		{
			el_with_id = comments.parents('.paretoproposal'); 
			if (el_with_id.length == 0)
			{
				return;
			}
			pid = parseInt(el_with_id.attr('id').replace(/[^0-9]/g, ''));
		}
		else
		{
			pid = parseInt(el_with_id.attr('id').replace(/[^0-9]/g, ''));
		}
		
		//alert(pid);
		
		if (typeof votingcommentslist[pid] != 'undefined')
		{
			var createLists = $.each(votingcommentslist[pid], function(i, usercomment) 
			{					
				var selected = ''
				if (user_commentid != null && 
					typeof user_commentid[pid] != 'undefined' && 
					user_commentid[pid] == usercomment['id'])
				{
					selected = 'checked="checked"';
				}
				if (usercomment['comment'] != '')
				{
					if (usercomment['type'] == 'dislike')
					{
						dislikecommentslist.append('<div class="comment">' + 
						'<div class="select_comment"><input type="radio" name="select_comment[' + pid + ']" value="' +
						usercomment["id"] + '"' + selected + '></div>' + 
						'<div class="text">' + usercomment['comment'] +
						'</div></div>');
					}
					if (usercomment['type'] == 'confused')
					{
						confusedcommentslist.append('<div class="comment">' + 
						'<div class="select_comment"><input type="radio" name="select_comment[' + pid + ']" value="' +
						usercomment["id"] + '"' + selected + '></div>' + 
						'<div class="text">' + usercomment['comment'] +
						'</div></div>');
					}
				}	
			});
			
			$.when(createLists).done(function()
			{
				comments.slideDown(500);
			});
		}
	}
}


$(function() {
	
	$('.kpreadcomment').live("click", function(event){
		var kpcomment = $(this).siblings('.kpcomment');
		
		if (kpcomment.is(":visible"))
		{
			kpcomment.slideUp(1000);
			$(this).html("(Show Comment)");
		}
		else
		{
			kpcomment.slideDown(1000);
			$(this).html("(Hide Comment)");
		}
	});
	
	// Display messages on icon click
	//
	$('.usrmsgpic').live("click", function(event){
		
		var paretoproposal = $(this).parent('.paretoproposal');
		var the_comments = paretoproposal.siblings('.comments');
		
		var comments = $(this).parent('.paretoproposal').siblings('.comments');
		if (comments.length == 0)
		{
			comments = $(this).parent('.paretoproposal').find('.comments');
		}

		toggleCommentsList(comments);
		return;<commit_msg>Speed up key player comment display in KP list.<commit_after><?php
$language="enus";
include_once("js/jquery/RichTextEditor/locale/".$language.".php");
function getLabel($key,$language){
   global $label;
   return $label[$language][$key];
}

$headcommands='';
include('header.php');
include('vga_timeless.php');

set_log(__FILE__." called....");

?>

<link rel="Stylesheet" type="text/css" href="js/jquery/RichTextEditor/css/jqrte.css">
<link type="text/css" href="js/jquery/RichTextEditor/css/jqpopup.css" rel="Stylesheet">
<link rel="stylesheet" href="js/jquery/RichTextEditor/css/jqcp.css" type="text/css">
<!--
<script type="text/javascript" src="js/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/svg/jquery.svg.min.js"></script>
-->
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svg.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svgdom.min.js"></script>
<script type="text/javascript" src="js/<?=SVG_DIR?>/jquery.svganim.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.livequery.js"></script>
<script type="text/javascript" src="/js/sprintf-0.6.js"></script>
<script type="text/javascript" src="/js/cookies/jquery.cookie.js"></script>
<script type="text/javascript" src="/js/underscore.js"></script>  
<script type="text/javascript" src="/js/charCount.js"></script>
<script type="text/javascript" src="js/jquery/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jqDnR.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.jqpopup.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jquery.jqcp.min.js"></script>
<script type="text/javascript" src="js/jquery/RichTextEditor/jquery.jqrte.min.js"></script>
<script type="text/javascript" src="js/vilfredo.php"></script>

<script type="text/javascript">
//Assumes id is passed in the URL
var recaptcha_public_key = '<?php echo $recaptcha_public_key;?>';
var votingcommentslist;
var userid = <?=json_encode($userid)?>;
var require_voting_comments = <?=json_encode($voting_settings['require_voting_comments'])?>;
var user_commentid;

var NOT_VOTED = <?=json_encode(NOT_VOTED)?>;
var AGREE = <?=json_encode(AGREE)?>;
var DISAGREE = <?=json_encode(DISAGREE)?>;
var NOT_UNDERSTAND = <?=json_encode(NOT_UNDERSTAND)?>;


function closeCommentsList(comments)
{	
	if (comments.is(':visible') == false)
	{
		return;
	}
	
	if (comments.siblings('.commentform').is(':visible'))
	{
		return;
	}
	
	var dislikecommentslist = comments.find('.dislikecommentslist');
	var confusedcommentslist = comments.find('.confusedcommentslist');
	
	dislikecommentslist.empty();
	confusedcommentslist.empty();
	comments.slideUp(500);
}

function toggleCommentsList(comments)
{
	if (comments.is(':visible') == false)
	{
		openCommentsList(comments);
	}
	else
	{
		closeCommentsList(comments);
	}
}

function openCommentsList(comments)
{	
	var dislikecommentslist = comments.find('.dislikecommentslist');
	var confusedcommentslist = comments.find('.confusedcommentslist');
	
	if (comments.is(':visible'))
	{
		return;
	}
	else
	{
		var pid;
		var el_with_id = comments.parents('tr.user_vote'); // FIXME
		if (el_with_id.length == 0)
		{
			el_with_id = comments.parents('.paretoproposal'); 
			if (el_with_id.length == 0)
			{
				return;
			}
			pid = parseInt(el_with_id.attr('id').replace(/[^0-9]/g, ''));
		}
		else
		{
			pid = parseInt(el_with_id.attr('id').replace(/[^0-9]/g, ''));
		}
		
		//alert(pid);
		
		if (typeof votingcommentslist[pid] != 'undefined')
		{
			var createLists = $.each(votingcommentslist[pid], function(i, usercomment) 
			{					
				var selected = ''
				if (user_commentid != null && 
					typeof user_commentid[pid] != 'undefined' && 
					user_commentid[pid] == usercomment['id'])
				{
					selected = 'checked="checked"';
				}
				if (usercomment['comment'] != '')
				{
					if (usercomment['type'] == 'dislike')
					{
						dislikecommentslist.append('<div class="comment">' + 
						'<div class="select_comment"><input type="radio" name="select_comment[' + pid + ']" value="' +
						usercomment["id"] + '"' + selected + '></div>' + 
						'<div class="text">' + usercomment['comment'] +
						'</div></div>');
					}
					if (usercomment['type'] == 'confused')
					{
						confusedcommentslist.append('<div class="comment">' + 
						'<div class="select_comment"><input type="radio" name="select_comment[' + pid + ']" value="' +
						usercomment["id"] + '"' + selected + '></div>' + 
						'<div class="text">' + usercomment['comment'] +
						'</div></div>');
					}
				}	
			});
			
			$.when(createLists).done(function()
			{
				comments.slideDown(500);
			});
		}
	}
}


$(function() {
	
	$('.kpreadcomment').live("click", function(event){
		var kpcomment = $(this).siblings('.kpcomment');
		
		if (kpcomment.is(":visible"))
		{
			kpcomment.slideUp(500);
			$(this).html("(Show Comment)");
		}
		else
		{
			kpcomment.slideDown(500);
			$(this).html("(Hide Comment)");
		}
	});
	
	// Display messages on icon click
	//
	$('.usrmsgpic').live("click", function(event){
		
		var paretoproposal = $(this).parent('.paretoproposal');
		var the_comments = paretoproposal.siblings('.comments');
		
		var comments = $(this).parent('.paretoproposal').siblings('.comments');
		if (comments.length == 0)
		{
			comments = $(this).parent('.paretoproposal').find('.comments');
		}

		toggleCommentsList(comments);
		return;
{'fraction_non_alphanumeric': 0.20497060395510422, 'fraction_numerical': 0.005344735435595938, 'mean_word_length': 4.658770161290323, 'pattern_counts': {'":': 2, '<': 137, '<?xml version=': 0, '>': 137, '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': '1499045', 'n_tokens_mistral': 4360, 'n_tokens_neox': 3863, 'n_words': 555}