<commit_before>/* Application functionality */

var main = (function () {
"use strict";
	var main = {};

	// initalize the application
	main.init = function()
	{
		dataloader.init(); // initialize data load
	}

	//=================================================================================
	// JSON data loader
	var dataloader = (function(){
		var dataloader = {};

		var JSON; // loaded data

		var splashScreen;

		dataloader.init = function()
		{
			splashScreen = document.getElementById("splash-screen");
			
			var path = "/boilerplate/data/dbmock.json"; // load mock data
			$.getJSON(path, function(response){
			   JSON = response;
			})
			
			.success(function() { dataLoadedSuccess(); })
			.error(function() { dataLoadedError(); })
			.complete(function() { dataLoadedComplete(); });
		}

		// PRIVATE METHODS
		// functions for JSON loading success
		function dataLoadedSuccess()
		{
			console.log("data loaded successful!");
			$(splashScreen).fadeOut();
			search.init(); //initialize search form
		}
		
		function dataLoadedError()
		{
			console.log("error loading data!");
		}
		
		function dataLoadedComplete()
		{
			console.log("completed JSON call! (Regardless of success or failure!)");
		}

		// PUBLIC METHODS
		// return data based on query
		main.getData = function(query)
		{
			// currently the query does nothing, we just return the mock JSON object
			return JSON;
		}

		return dataloader;
	})();

	//=================================================================================
	// Search functionality - handles search queries
	var search = (function () {
		var search = {};

		var searchBtn;
		var mainContent;
		var searchTerm;

		// initalize the application
		search.init = function()
		{
			searchBtn = document.querySelector("#search-btn");
			mainContent = document.querySelector("#main-content")
			searchTerm = document.querySelector("#search-term");

			message.init(); // initialize message box
			
			searchBtn.addEventListener( "mousedown" , searchBtnClicked );
			searchTerm.addEventListener( "focus" , searchTermFocus );

			$(mainContent).fadeIn();
		}

		// PRIVATE METHODS
		// search button was clicked
		function searchBtnClicked(evt)
		{
			lookupData(main.getData(), searchTerm.value);
		}

		function lookupData(data,query)
		{
			var entry = data["000"]["name"];
			if ( entry == query )
			{
				console.log("Query Successful!");
			}
			else
			{
				message.display("Nothing matched your search! <br />Try another search term!");
			}
		}

		function searchTermFocus()
		{
			message.hide();
		}<commit_msg>Enabled submit on return key press<commit_after>/* Application functionality */

var main = (function () {
"use strict";
	var main = {};

	// initalize the application
	main.init = function()
	{
		dataloader.init(); // initialize data load
	}

	//=================================================================================
	// JSON data loader
	var dataloader = (function(){
		var dataloader = {};

		var JSON; // loaded data

		var splashScreen;

		dataloader.init = function()
		{
			splashScreen = document.getElementById("splash-screen");
			
			var path = "/boilerplate/data/dbmock.json"; // load mock data
			$.getJSON(path, function(response){
			   JSON = response;
			})
			
			.success(function() { dataLoadedSuccess(); })
			.error(function() { dataLoadedError(); })
			.complete(function() { dataLoadedComplete(); });
		}

		// PRIVATE METHODS
		// functions for JSON loading success
		function dataLoadedSuccess()
		{
			console.log("data loaded successful!");
			$(splashScreen).fadeOut();
			search.init(); //initialize search form
		}
		
		function dataLoadedError()
		{
			console.log("error loading data!");
		}
		
		function dataLoadedComplete()
		{
			console.log("completed JSON call! (Regardless of success or failure!)");
		}

		// PUBLIC METHODS
		// return data based on query
		main.getData = function(query)
		{
			// currently the query does nothing, we just return the mock JSON object
			return JSON;
		}

		return dataloader;
	})();

	//=================================================================================
	// Search functionality - handles search queries
	var search = (function () {
		var search = {};

		var searchBtn;
		var mainContent;
		var searchTerm;

		// initalize the application
		search.init = function()
		{
			searchBtn = document.querySelector("#search-btn");
			mainContent = document.querySelector("#main-content")
			searchTerm = document.querySelector("#search-term");

			message.init(); // initialize message box
			
			searchBtn.addEventListener( "mousedown" , searchBtnClicked , false );
			searchTerm.addEventListener( "focus" , searchTermFocus , false );
			searchTerm.addEventListener( "keyup" , returnPressed , false )

			$(mainContent).fadeIn();
		}

		// PRIVATE METHODS
		// search button was clicked
		function searchBtnClicked(evt)
		{
			lookupData(main.getData(), searchTerm.value);
		}

		function returnPressed(evt)
		{
			// if enter key was pressed, submit the form
			if (evt.which == 13)
				searchBtnClicked();
		}

		function lookupData(data,query)
		{
			var entry = data["000"]["name"];
			if ( entry == query )
			{
				console.log("Query Successful!");
			}
			else
			{
				message.display("Nothing matched your search! <br />Try another search term!");
			}
		}

		function searchTermFocus()
		{
			message.hide();
		}
{'fraction_non_alphanumeric': 0.18747684327528713, 'fraction_numerical': 0.0014820303816228233, 'mean_word_length': 3.4730737365368682, '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': '5805520', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1492, 'n_words': 387}