<commit_before>(function() {
	loadOptions();
	submitHandler();
})();

function submitHandler() {
	var $submitButton = $('#submitButton');
	$submitButton.on('click', function() {
		console.log('Submit');

		var return_to = getQueryParam('return_to', 'pebblejs://close#');
		document.location = return_to + encodeURIComponent(JSON.stringify(getAndStoreConfigData()));
	});
}

var $submitButton = $('#submitButton');

$submitButton.on('click', function() {
	console.log('Submit');

	var return_to = getQueryParam('return_to', 'pebblejs://close#');
	document.location = return_to + encodeURIComponent(JSON.stringify(getAndStoreConfigData()));
});

function getAndStoreConfigData() {
	var $backgroundColorPicker = $('#backgroundColorPicker');
	var $blockOneColorPicker = $('#blockOneColorPicker');
	var $blockTwoColorPicker = $('#blockTwoColorPicker');
	var $blockThreeColorPicker = $('#blockThreeColorPicker');
	var $blockFourColorPicker = $('#blockFourColorPicker');
	var $blockFiveColorPicker = $('#blockFiveColorPicker');
	var $blockSixColorPicker = $('#blockSixColorPicker');
	var $blockSevenColorPicker = $('#blockSevenColorPicker');
	var $blockEightColorPicker = $('#blockEightColorPicker');
	var $blockNineColorPicker = $('#blockNineColorPicker');
	var $blockTenColorPicker = $('#blockTenColorPicker');
	var $blockElevenColorPicker = $('#blockElevenColorPicker');
	var $blockTwelveColorPicker = $('#blockTwelveColorPicker');

	var options = {
		backgroundColor : $backgroundColorPicker.val(),
		blockOneColor : $blockOneColorPicker.val(),
		blockTwoColor : $blockTwoColorPicker.val(),
		blockThreeColor : $blockThreeColorPicker.val(),
		blockFourColor : $blockFourColorPicker.val(),
		blockFiveColor : $blockFiveColorPicker.val(),
		blockSixColor : $blockSixColorPicker.val(),
		blockSevenColor : $blockSevenColorPicker.val(),
		blockEightColor : $blockEightColorPicker.val(),
		blockNineColor : $blockNineColorPicker.val(),
		blockTenColor : $blockTenColorPicker.val(),
		blockElevenColor : $blockElevenColorPicker.val(),
		blockTwelveColor : $blockTwelveColorPicker.val()
	};

	localStorage.backgroundColor = options.backgroundColor;
	localStorage.blockOneColor = options.blockOneColor;
	localStorage.blockTwoColor = options.blockTwoColor;
	localStorage.blockThreeColor = options.blockThreeColor;
	localStorage.blockFourColor = options.blockFourColor;
	localStorage.blockFiveColor = options.blockFiveColor;
	localStorage.blockSixColor = options.blockSixColor;
	localStorage.blockSevenColor = options.blockSevenColor;
	localStorage.blockEightColor = options.blockEightColor;
	localStorage.blockNineColor = options.blockNineColor;
	localStorage.blockTenColor = options.blockTenColor;
	localStorage.blockElevenColor = options.blockElevenColor;
	localStorage.blockTwelveColor = options.blockTwelveColor;

	console.log('Got Options: ' + JSON.stringify(options));
	return options;
}

function loadOptions() {
	var $backgroundColorPicker = $('#backgroundColorPicker');
	var $blockOneColorPicker = $('#blockOneColorPicker');
	var $blockTwoColorPicker = $('#blockTwoColorPicker');
	var $blockThreeColorPicker = $('#blockThreeColorPicker');
	var $blockFourColorPicker = $('#blockFourColorPicker');
	var $blockFiveColorPicker = $('#blockFiveColorPicker');
	var $blockSixColorPicker = $('#blockSixColorPicker');
	var $blockSevenColorPicker = $('#blockSevenColorPicker');
	var $blockEightColorPicker = $('#blockEightColorPicker');
	var $blockNineColorPicker = $('#blockNineColorPicker');
	var $blockTenColorPicker = $('#blockTenColorPicker');
	var $blockElevenColorPicker = $('#blockElevenColorPicker');
	var $blockTwelveColorPicker = $('#blockTwelveColorPicker');

	if (localStorage.backgroundColor) {
		$backgroundColorPicker[0].value = localStorage.backgroundColor;
		$blockOneColorPicker[0].value = localStorage.blockOneColor;
		$blockTwoColorPicker[0].value = localStorage.blockTwoColor;
		$blockThreeColorPicker[0].value = localStorage.blockThreeColor;
		$blockFourColorPicker[0].value = localStorage.blockFourColor;
		$blockFiveColorPicker[0].value = localStorage.blockFiveColor;
		$blockSixColorPicker[0].value = localStorage.blockSixColor;
		$blockSevenColorPicker[0].value = localStorage.blockSevenColor;
		$blockEightColorPicker[0].value = localStorage.blockEightColor;
		$blockNineColorPicker[0].value = localStorage.blockNineColor;
		$blockTenColorPicker[0].value = localStorage.blockTenColor;
		$blockElevenColorPicker[0].value = localStorage.blockElevenColor;
		$blockTwelveColorPicker[0].value = localStorage.blockTwelveColor;
	}
}

function getQueryParam(variable, defaultValue) {
	var query = location.search.substring(1);
	var vars = query.split('&');
	for (var i = 0; i < vars.length; i++) {
		var pair = vars[i].split('=');
		if (pair[0] === variable) {
			return decodeURIComponent(pair[1]);
		}
	}
	return defaultValue || false;<commit_msg>variable names must be unique in localstorage<commit_after>(function() {
	loadOptions();
	submitHandler();
})();

function submitHandler() {
	var $submitButton = $('#submitButton');
	$submitButton.on('click', function() {
		console.log('Submit');

		var return_to = getQueryParam('return_to', 'pebblejs://close#');
		document.location = return_to + encodeURIComponent(JSON.stringify(getAndStoreConfigData()));
	});
}

var $submitButton = $('#submitButton');

$submitButton.on('click', function() {
	console.log('Submit');

	var return_to = getQueryParam('return_to', 'pebblejs://close#');
	document.location = return_to + encodeURIComponent(JSON.stringify(getAndStoreConfigData()));
});

function getAndStoreConfigData() {
	var $backgroundColorPicker = $('#backgroundColorPicker');
	var $blockOneColorPicker = $('#blockOneColorPicker');
	var $blockTwoColorPicker = $('#blockTwoColorPicker');
	var $blockThreeColorPicker = $('#blockThreeColorPicker');
	var $blockFourColorPicker = $('#blockFourColorPicker');
	var $blockFiveColorPicker = $('#blockFiveColorPicker');
	var $blockSixColorPicker = $('#blockSixColorPicker');
	var $blockSevenColorPicker = $('#blockSevenColorPicker');
	var $blockEightColorPicker = $('#blockEightColorPicker');
	var $blockNineColorPicker = $('#blockNineColorPicker');
	var $blockTenColorPicker = $('#blockTenColorPicker');
	var $blockElevenColorPicker = $('#blockElevenColorPicker');
	var $blockTwelveColorPicker = $('#blockTwelveColorPicker');

	var options = {
		backgroundColor : $backgroundColorPicker.val(),
		blockOneColor : $blockOneColorPicker.val(),
		blockTwoColor : $blockTwoColorPicker.val(),
		blockThreeColor : $blockThreeColorPicker.val(),
		blockFourColor : $blockFourColorPicker.val(),
		blockFiveColor : $blockFiveColorPicker.val(),
		blockSixColor : $blockSixColorPicker.val(),
		blockSevenColor : $blockSevenColorPicker.val(),
		blockEightColor : $blockEightColorPicker.val(),
		blockNineColor : $blockNineColorPicker.val(),
		blockTenColor : $blockTenColorPicker.val(),
		blockElevenColor : $blockElevenColorPicker.val(),
		blockTwelveColor : $blockTwelveColorPicker.val()
	};

	localStorage.willdorfblockyroundbackgroundColor = options.backgroundColor;
	localStorage.willdorfblockyroundblockOneColor = options.blockOneColor;
	localStorage.willdorfblockyroundblockTwoColor = options.blockTwoColor;
	localStorage.willdorfblockyroundblockThreeColor = options.blockThreeColor;
	localStorage.willdorfblockyroundblockFourColor = options.blockFourColor;
	localStorage.willdorfblockyroundblockFiveColor = options.blockFiveColor;
	localStorage.willdorfblockyroundblockSixColor = options.blockSixColor;
	localStorage.willdorfblockyroundblockSevenColor = options.blockSevenColor;
	localStorage.willdorfblockyroundblockEightColor = options.blockEightColor;
	localStorage.willdorfblockyroundblockNineColor = options.blockNineColor;
	localStorage.willdorfblockyroundblockTenColor = options.blockTenColor;
	localStorage.willdorfblockyroundblockElevenColor = options.blockElevenColor;
	localStorage.willdorfblockyroundblockTwelveColor = options.blockTwelveColor;

	console.log('Got Options: ' + JSON.stringify(options));
	return options;
}

function loadOptions() {
	var $backgroundColorPicker = $('#backgroundColorPicker');
	var $blockOneColorPicker = $('#blockOneColorPicker');
	var $blockTwoColorPicker = $('#blockTwoColorPicker');
	var $blockThreeColorPicker = $('#blockThreeColorPicker');
	var $blockFourColorPicker = $('#blockFourColorPicker');
	var $blockFiveColorPicker = $('#blockFiveColorPicker');
	var $blockSixColorPicker = $('#blockSixColorPicker');
	var $blockSevenColorPicker = $('#blockSevenColorPicker');
	var $blockEightColorPicker = $('#blockEightColorPicker');
	var $blockNineColorPicker = $('#blockNineColorPicker');
	var $blockTenColorPicker = $('#blockTenColorPicker');
	var $blockElevenColorPicker = $('#blockElevenColorPicker');
	var $blockTwelveColorPicker = $('#blockTwelveColorPicker');

	if (localStorage.backgroundColor) {
		$backgroundColorPicker[0].value = localStorage.willdorfblockyroundbackgroundColor;
		$blockOneColorPicker[0].value = localStorage.willdorfblockyroundblockOneColor;
		$blockTwoColorPicker[0].value = localStorage.willdorfblockyroundblockTwoColor;
		$blockThreeColorPicker[0].value = localStorage.willdorfblockyroundblockThreeColor;
		$blockFourColorPicker[0].value = localStorage.willdorfblockyroundblockFourColor;
		$blockFiveColorPicker[0].value = localStorage.willdorfblockyroundblockFiveColor;
		$blockSixColorPicker[0].value = localStorage.willdorfblockyroundblockSixColor;
		$blockSevenColorPicker[0].value = localStorage.willdorfblockyroundblockSevenColor;
		$blockEightColorPicker[0].value = localStorage.willdorfblockyroundblockEightColor;
		$blockNineColorPicker[0].value = localStorage.willdorfblockyroundblockNineColor;
		$blockTenColorPicker[0].value = localStorage.willdorfblockyroundblockTenColor;
		$blockElevenColorPicker[0].value = localStorage.willdorfblockyroundblockElevenColor;
		$blockTwelveColorPicker[0].value = localStorage.willdorfblockyroundblockTwelveColor;
	}
}

function getQueryParam(variable, defaultValue) {
	var query = location.search.substring(1);
	var vars = query.split('&');
	for (var i = 0; i < vars.length; i++) {
		var pair = vars[i].split('=');
		if (pair[0] === variable) {
			return decodeURIComponent(pair[1]);
		}
	}
	return defaultValue || false;
{'fraction_non_alphanumeric': 0.12954279015240328, 'fraction_numerical': 0.0033216100039077765, 'mean_word_length': 8.214221422142215, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4964376', 'n_tokens_mistral': 3200, 'n_tokens_neox': 2980, 'n_words': 459}