<commit_before>/**
 * @class Displays informative messages to the user.
 * @author <NAME>
 */
UI.Messenger = {
	/**
	 * Displays a message.
	 * @param {string}  message  the message to be displayed
	 * @return {void}
	 */
	display: function display_message(message)
	{
		// It'd be nice to have a non-alert implementation of this someday. -EN
		alert(message);
	},
	
	/**
	 * Displays a message only once for the current user session.
	 * This works by setting a session cookie when the message is first
	 * displayed. If, when this function is called again, the cookie already
	 * exists, the message is not displayed.
	 * @param {string}  id       a fixed ID that can be used to identify this
	 *                           message in a cookie name
	 * @param {string}  message  the mesage to be displayed
	 * @return {boolean} true if the message was actually displayed, false if
	 *                   not
	 */
	display_once: function display_message_once_per_session(id, message)
	{
		var cookie_name = '_loki2_pmsg_' + id.replace(/\W+/, '_');
		
		if (Util.Cookie.get(cookie_name)) {
			// Already displayed this session.
			return false;
		}
		
		this.display(message);
		
		Util.Cookie.set(cookie_name, 'displayed');
		return true;
	}
}<commit_msg>Fixed the cleanup of message ID's in UI.Messenger.display_once, closing issue 63.<commit_after>/**
 * @class Displays informative messages to the user.
 * @author <NAME>
 */
UI.Messenger = {
	/**
	 * Displays a message.
	 * @param {string}  message  the message to be displayed
	 * @return {void}
	 */
	display: function display_message(message)
	{
		// It'd be nice to have a non-alert implementation of this someday. -EN
		alert(message);
	},
	
	/**
	 * Displays a message only once for the current user session.
	 * This works by setting a session cookie when the message is first
	 * displayed. If, when this function is called again, the cookie already
	 * exists, the message is not displayed.
	 * @param {string}  id       a fixed ID that can be used to identify this
	 *                           message in a cookie name
	 * @param {string}  message  the mesage to be displayed
	 * @return {boolean} true if the message was actually displayed, false if
	 *                   not
	 */
	display_once: function display_message_once_per_session(id, message)
	{
		var cookie_name = '_loki2_pmsg_' + id.replace(/\W+/g, '_');
		console.debug(cookie_name);
		
		if (Util.Cookie.get(cookie_name)) {
			// Already displayed this session.
			return false;
		}
		
		this.display(message);
		
		Util.Cookie.set(cookie_name, 'displayed');
		return true;
	}
}
{'fraction_non_alphanumeric': 0.09934790947449175, 'fraction_numerical': 0.0015343306482546988, 'mean_word_length': 2.8925373134328356, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3348307', 'n_tokens_mistral': 841, 'n_tokens_neox': 739, 'n_words': 287}