<commit_before>// Author: <NAME> (<EMAIL>)

console.log("Loading Tridion Extension");

/*
	Listen to load of Tridion Dashboard and inject the extension
*/
chrome.webNavigation.onCompleted.addListener(
	function(tab)
	{
		console.debug('Loading Tridion Extension');

		var details = {runAt: "document_end"};
		details["file"] = "js/popup.js";
		chrome.tabs.executeScript( tab.tabId, details, msg_log("loaded tridion_ext"));
	}
	// URLfilter
	, {url:[{pathContains:"ListFilters/SearchListBar.aspx"}]}		
);

/*
	Click listener for extension button
*/
chrome.browserAction.onClicked.addListener(function(tab) {
	// No tabs or host permissions needed!
	console.log('browserAction');
	// chrome.tabs.executeScript({
	// 	code: 'document.body.style.backgroundColor="red"'
	// });
});

/*
	Handle messages from page
*/
chrome.runtime.onMessage.addListener(function(msg)
{
	console.debug("Background - Yo I got a message!");
	console.info(msg);

	switch (msg.action) {
		case 'init_levels':
			chrome.storage.local.get("all_levels", function(obj){
				if(obj == undefined){
					chrome.storage.local.set({'all_levels': msg.data}, function() {
						console.log('Settings saved');
					});
				}
				console.log("Levels already defined");
			})
			break;
		case 'open_item':
			chrome.tabs.create({ url: msg.url, active: false});
			break;
		default:
			break;
	}	
});

// UTILS
function msg_log(str)
{
  	console.info(str);
}<commit_msg>normalized options object<commit_after>// Author: <NAME> (<EMAIL>)

console.log("Loading Tridion Extension");

/*
	Listen to load of Tridion Dashboard and inject the extension
*/
chrome.webNavigation.onCompleted.addListener(
	function(tab)
	{
		console.debug('Loading Tridion Extension');

		var details = {runAt: "document_end"};
		details["file"] = "js/popup.js";
		chrome.tabs.executeScript( tab.tabId, details, msg_log("loaded tridion_ext"));
	}
	// URLfilter
	, {url:[{pathContains:"ListFilters/SearchListBar.aspx"}]}		
);

/*
	Click listener for extension button
*/
chrome.browserAction.onClicked.addListener(function(tab) {
	// No tabs or host permissions needed!
	console.log('browserAction');
	// chrome.tabs.executeScript({
	// 	code: 'document.body.style.backgroundColor="red"'
	// });
});

/*
	Handle messages from page
*/
chrome.runtime.onMessage.addListener(function(msg)
{
	console.debug("Background - Yo I got a message!");
	console.info(msg);

	switch (msg.action) {
		case 'init_levels':
			chrome.storage.local.get("main_batch", function(obj){
				if(obj.main_batch == undefined){
					var json = {
						'main_batch': {
							"levels": msg.data, 
							"config": []
						}
					};

					chrome.storage.local.set(json, function() {
						console.log('Settings saved');
					});
				}
				console.log("Levels already defined");
			})
			break;
		case 'open_item':
			chrome.tabs.create({ url: msg.url, active: false});
			break;
		default:
			break;
	}	
});

// UTILS
function msg_log(str)
{
  	console.info(str);
}
{'fraction_non_alphanumeric': 0.16396761133603238, 'fraction_numerical': 0.0, 'mean_word_length': 3.8686371100164205, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '2717629', 'n_tokens_mistral': 1125, 'n_tokens_neox': 981, 'n_words': 195}