<commit_before>/**
 * file: general.js
 * Purpose: Groups together functions used by all the pages
 */

/**
 * Works on a bootstrap panel
 * @param message is added to the list of messages already in the Panel
 * @param elementId html element which contains a child element with class "panel-body"
 * which displays the message
 */
function showPanelMessage(elementId, message)
	{
		if(message!=null && message!="")
		{
			var currentText=$(elementId+" .panel-body").html();
			if(currentText!=null || currentText!="")
			{
				currentText=currentText+"<p>"+message+"</p>";
				$(elementId+" .panel-body").html(currentText);
			}
			else
			{
				$(elementId+" .panel-body").html("<p>"+message+"</p>");
			}
			$(document).click(function()
			{
				$(elementId).hide();
			});
			
			$(elementId).show();
		}
	}

/**
 * @param elementId Element which displays the message
 * @param message The message which is displayed to the user
 */
function showAlertMessage(elementId,message)
{
	if(message!=null && message!="")
	{
		$(elementId).html(message);
		$(document).click(function()
		{
			$(elementId).hide();
		});
		$(elementId).show();
	}
};

/* Hide Alert div if document is clicked */
$(document).ready(function(){
		
});<commit_msg>Moved checkPassword function from UserAddandEdit.jsp<commit_after>/**
 * file: general.js
 * Purpose: Groups together functions used by all the pages
 */

/**
 * Works on a bootstrap panel
 * @param message is added to the list of messages already in the Panel
 * @param elementId html element which contains a child element with class "panel-body"
 * which displays the message
 */
function showPanelMessage(elementId, message)
	{
		if(message!=null && message!="")
		{
			var currentText=$(elementId+" .panel-body").html();
			if(currentText!=null || currentText!="")
			{
				currentText=currentText+"<p>"+message+"</p>";
				$(elementId+" .panel-body").html(currentText);
			}
			else
			{
				$(elementId+" .panel-body").html("<p>"+message+"</p>");
			}
			$(document).click(function()
			{
				$(elementId).hide();
			});
			
			$(elementId).show();
		}
	}

/**
 * @param elementId Element which displays the message
 * @param message The message which is displayed to the user
 */
function showAlertMessage(elementId,message)
{
	if(message!=null && message!="")
	{
		$(elementId).html(message);
		$(document).click(function()
		{
			$(elementId).hide();
		});
		$(elementId).show();
	}
};

/**
 * 
 * @param inputElementOne html form input whose value contains a password
 * @param inputElementTwo html form input whose value contains a password
 * @returns true if the passwords are the same
 */
function checkPassword(inputElementOne,inputElementTwo)
{
	console.log("Check Password function called");
	var password1=document.getElementById(inputElementOne);
	var password2=document.getElementById(inputElementTwo);
	
	if(password1.value != password2.value)
	{
		console.log("Passwords aren't the same");
		alert("Passwords aren't the same");
		return false
	}
	else
	{
		console.log("Passwords are the same");
		return true;
	}
}

/* Hide Alert div if document is clicked */
$(document).ready(function(){
		
});
{'fraction_non_alphanumeric': 0.15896136795440152, 'fraction_numerical': 0.001266624445851805, 'mean_word_length': 4.070626003210273, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4202180', 'n_tokens_mistral': 1062, 'n_tokens_neox': 941, 'n_words': 257}