<commit_before>//*****************************************
//	Filename: monsters.js
//
//	Authors: 
//		<NAME> <<EMAIL>>
//		<NAME> <<EMAIL>>
//
//*****************************************
'use strict'; 

function monsters()
{

}

//*****************************************
//	Function:
//		initialize
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.initialize = function()
{
	this.addEventListeners();
	this.doLoadMonster(bestiary[0]);
	$('#mgentabs').tabs();

	this.doExitMgen();
	console.log("monsters initialized");
}

//*****************************************
//	Function:
//		addEventListener
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.addEventListeners = function()
{
	$('#saveicon').click(function()
	{
		doSaveMonster(); 
	});

	$('#xicon').click(function()
	{
		doExitMgen();
	});
	$('#newmonster').click(function()
	{
		doNewMgen();
	});

	$('#m_name').keyup(function()
	{
		$('#monstertitle').html($('#m_name').val());
	});

	$('#tab-chat').click(function()
	{
		monsters.hideTabs(); 
		$('#chat').css('display', 'visible'); 
		//console.log("Showing chat");
	});
	//window.addEventListener('mousedown', this.onMouseDown.bind(this), false);
	$('#tab-objects').click(function()
	{
		this.hideTabs(); 
		$('#objects').css('display', 'visible'); 
		//console.log("Showing objects");
	}); 
	$('#tab-monsters').click(function()
	{
		this.hideTabs(); 
		$('#monsters').css('display', 'visible'); 
		//console.log("Showing monsters");
	});
	$('#tab-social').click(function()
	{
		this.hideTabs(); 
		$('#social').css('display', 'visible'); 
		//console.log("Showing social");
	});

}
//*****************************************
//	Function:
//		hideTabs
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.hideTabs = function()
{
	$('#chat').css('display', 'none'); 
	$('#objects').css('display', 'none'); 
	$('#social').css('display', 'none'); 
	$('#monsters').css('display', 'none'); 
}

//*****************************************
//	Function:
//		doSaveMonster
//
//	Description:
//		Grab the monster object from HTML
//		And save it into a JSON object 
//*****************************************
monsters.prototype.doSaveMonster = function()<commit_msg>Fixed event listeners to hook up via javascript so 'this' is correctly bound<commit_after>//*****************************************
//	Filename: monsters.js
//
//	Authors: 
//		<NAME> <<EMAIL>>
//		<NAME> <<EMAIL>>
//
//*****************************************
'use strict'; 

function monsters()
{

}

//*****************************************
//	Function:
//		initialize
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.initialize = function()
{
	this.addEventListeners();
	this.doLoadMonster(bestiary[0]);
	$('#mgentabs').tabs();
	this.hideTabs();
	this.doExitMgen();
	console.log("monsters initialized");
}

//*****************************************
//	Function:
//		addEventListener
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.addEventListeners = function()
{/*
	$('#saveicon').click(function()
	{
		doSaveMonster(); 
	});*/
	document.getElementById('saveicon').addEventListener('click', function(){
		this.doSaveMonster();
	}.bind(this), false);

	/*$('#xicon').click(function()
	{
		doExitMgen();
	});*/
	document.getElementById('xicon').addEventListener('click', function(){
		this.doExitMgen();
	}.bind(this), false);
	/*$('#newmonster').click(function()
	{
		doNewMgen();
	});*/
	document.getElementById('newmonster').addEventListener('click', function(){
			this.doNewMgen();
		}.bind(this), false);

	$('#m_name').keyup(function()
	{
		$('#monstertitle').html($('#m_name').val());
	});

/*
	$('#tab-chat').click(function()
	{
		monsters.hideTabs(); 
		$('#chat').css('display', 'visible'); 
		//console.log("Showing chat");
	});*/

	document.getElementById('tab-chat').addEventListener('click', function(){
		this.hideTabs(); 
		$('#chat').css('display', 'visible'); 
	}.bind(this), false);

	//window.addEventListener('mousedown', this.onMouseDown.bind(this), false);
	/*$('#tab-objects').click(function()
	{
		this.hideTabs(); 
		$('#objects').css('display', 'visible'); 
		//console.log("Showing objects");
	}); */
	document.getElementById('tab-objects').addEventListener('click', function(){
		this.hideTabs(); 
		$('#objects').css('display', 'visible'); 
	}.bind(this), false);

	/*$('#tab-monsters').click(function()
	{
		this.hideTabs(); 
		$('#monsters').css('display', 'visible'); 
		//console.log("Showing monsters");
	});*/
	document.getElementById('tab-monsters').addEventListener('click', function(){
		this.hideTabs(); 
		$('#monsters').css('display', 'visible'); 
	}.bind(this), false);
	/*
	$('#tab-social').click(function()
	{
		this.hideTabs(); 
		$('#social').css('display', 'visible'); 
		//console.log("Showing social");
	});
	*/
	document.getElementById('tab-social').addEventListener('click', function(){
			this.hideTabs(); 
			$('#social').css('display', 'visible'); 
		}.bind(this), false);
}
//*****************************************
//	Function:
//		hideTabs
//
//	Description:
//		Initialize monster generator fields, 
//		events, functions in the HTML. 
//*****************************************
monsters.prototype.hideTabs = function()
{
	$('#chat').css('display', 'none'); 
	$('#objects').css('display', 'none'); 
	$('#social').css('display', 'none'); 
	$('#monsters').css('display', 'none'); 
}

//*****************************************
//	Function:
//		doSaveMonster
//
//	Description:
//		Grab the monster object from HTML
//		And save it into a JSON object 
//*****************************************
monsters.prototype.doSaveMonster = function()
{'fraction_non_alphanumeric': 0.34104234527687294, 'fraction_numerical': 0.0003257328990228013, 'mean_word_length': 4.882183908045977, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4216379', 'n_tokens_mistral': 1970, 'n_tokens_neox': 1894, 'n_words': 297}