<commit_before>//TODO replace this with checking each toggle in form
var options = [ 
	{name: 'auto-login', text: 'Auto Login'}, 
	{name: 'course-reduce', text: 'Reduce Course List'}
];

document.addEventListener('DOMContentLoaded', function() {

	var options_form = document.getElementById("options");

	options.forEach(function(option) {

		var name = option.name;
		var input = createCheckBox(option);

		name = name.replace("-", "_");

		chrome.storage.sync.get(name, function(data) {
			data[name] ? input.checked = data[name] : input.checked = false;
		});

		input.addEventListener('change', function() {
			var obj = {};
			obj[name] = input.checked;
			chrome.storage.sync.set(obj);
		});
	});

	function createCheckBox(option) {
		var label = document.createElement('label');
		var input = document.createElement('input');

		input.id = option.name;
		input.name = option.name;
		input.type = 'checkbox';

		label.appendChild(input);
		label.appendChild(document.createTextNode(option.text))
		options_form.appendChild(label);
		options_form.appendChild(document.createElement('br'));

		return input;
	}

});

<commit_msg>added title (hover text) for settings options<commit_after>var options = [ 
	{name: 'auto-login', text: 'Auto Login'}, 
	{name: 'course-reduce', text: 'Reduce Course List'},
	{name: 'auto-popout', text: 'Popout Content Links', 
		help: 'pops out links in the content section instead of redirecting'
	}
];

document.addEventListener('DOMContentLoaded', function() {

	var options_form = document.getElementById("options");

	options.forEach(function(option) {
		var input = createCheckBox(option);
		var name = option.name.replace("-", "_");

		chrome.storage.sync.get(name, function(data) {
			data[name] ? input.checked = data[name] : input.checked = false;
		});

		input.addEventListener('change', function() {
			var obj = {};
			obj[name] = input.checked;
			chrome.storage.sync.set(obj);
		});
	});

	function createCheckBox(option) {
		var label = document.createElement('label');
		var input = document.createElement('input');

		input.id = option.name;
		input.name = option.name;
		input.type = 'checkbox';

		if (option.help) label.title = option.help;

		label.appendChild(input);
		label.appendChild(document.createTextNode(option.text))
		options_form.appendChild(label);
		options_form.appendChild(document.createElement('br'));

		return input;
	}

});


{'fraction_non_alphanumeric': 0.15647107781939243, 'fraction_numerical': 0.0, 'mean_word_length': 4.616822429906542, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3595534', 'n_tokens_mistral': 799, 'n_tokens_neox': 723, 'n_words': 156}