<commit_before>// helper functions
Array.prototype.contains = function (needle) {
	for (i in this) {
		if (this[i] == needle) return true;
	}
	return false;
}

// back to the main site link on navbar
$('#forumTitle').before('<a id="back-to-the-main-site" style="position:absolute;top:40px;color:white;" href="http://dev.opensprites.x10.mx/">Back to the main site</a>');
$('#forumTitle').attr('style', 'padding-top:10px;padding-bottom:20px;');

// themes
$('#ftr-content .menu').append('<li id="theme"></li>');
$('#theme').append('Theme: <select id="theme-select" style="border-radius:5px;outline:none;"><option>Regular</option><option>Dark</option></select>');

// when theme selection is changed
$('#theme-select').on('change', function() {
	var newt = $(this).val();
	localStorage['os-theme'] = newt;
	window.location.reload();
});

// is theme defined / valid?
var themes = ['Regular', 'Dark'];
if(typeof localStorage['os-theme'] === 'undefined' || !themes.contains(localStorage['os-theme'])) {
	console.log('wrong theme');
	localStorage['os-theme'] = 'Regular';
}

// set selection to the saved theme
$('#theme-select').val(localStorage['os-theme']);
<commit_msg>Update custom.js<commit_after>// back to the main site link on navbar
$('#forumTitle').before('<a id="back-to-the-main-site" style="position:absolute;top:40px;color:white;" href="http://dev.opensprites.x10.mx/">Back to the main site</a>');
$('#forumTitle').attr('style', 'padding-top:10px;padding-bottom:20px;');

// themes
$('#ftr-content .menu').append('<li id="theme"></li>');
$('#theme').append('Theme: <select id="theme-select" style="border-radius:5px;outline:none;"><option>Regular</option><option>Dark</option></select>');

// when theme selection is changed
$('#theme-select').on('change', function() {
	var newt = $(this).val();
	localStorage['os-theme'] = newt;
	window.location.reload();
});

// is theme defined / valid?
var themes = ['Regular', 'Dark'];
if(typeof localStorage['os-theme'] === 'undefined' || themes.indexOf(localStorage['os-theme']) === -1) {
	console.log('wrong theme');
	localStorage['os-theme'] = 'Regular';
}

// set selection to the saved theme
$('#theme-select').val(localStorage['os-theme']);

{'fraction_non_alphanumeric': 0.23350022758306782, 'fraction_numerical': 0.00864815657715066, 'mean_word_length': 6.022364217252396, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '5363260', 'n_tokens_mistral': 728, 'n_tokens_neox': 713, 'n_words': 144}