<commit_before>HN.settings.LS_AUTODARK_KEY = 'Local Storage Key for automatically changing to dark theme at night';
HN.settings.LS_USER_THEME_KEY = 'Local Storage Key user selected theme';

HN.settings.initSettingsPage = function(){
	var ls = window.localStorage;
	if(ls.getItem(HN.settings.LS_AUTODARK_KEY) === 'true'){
		document.getElementById('autodark_checkbox').checked = true;
	}
	var userTheme = HN.settings.getUserTheme();

	HN.settings.themeNames.map(function(theme) {
		var themeRadio = document.getElementById(HN.settings.themeIdPrefix + theme);
		if(theme === userTheme){
			themeRadio.checked = true;
		}
		themeRadio.onclick = function(){
			document.documentElement.className = theme;
		};
	});
};

HN.settings.getUserTheme = function(){
	var ls = window.localStorage;
	var userTheme = ls.getItem(HN.settings.LS_USER_THEME_KEY);
	if(HN.settings.themeNames.indexOf(userTheme) < 0){
		userTheme = HN.settings.themeNames[0];
	}
	return userTheme;
};

HN.settings.initSettings = function(){
	document.documentElement.className = HN.settings.getUserTheme();
	var ls = window.localStorage;
	if(ls.getItem(HN.settings.LS_AUTODARK_KEY) === 'true'){
		HN.settings.darkAtNight();
	}
};

HN.settings.darkAtNight = function(){
	var currentDate = new Date();
	var currentHour = currentDate.getHours();
	if(currentHour >= 23 || currentHour < 6){
		document.documentElement.className = 'dark';
	}
};

HN.settings.save = function(){
	var ls = window.localStorage;
	ls.setItem(HN.settings.LS_AUTODARK_KEY, document.getElementById('autodark_checkbox').checked);
	var userTheme = document.querySelector('input[name="' + HN.settings.userThemeFormName + '"]:checked').value;
	if(HN.settings.themeNames.indexOf(userTheme) >= 0){
		ls.setItem(HN.settings.LS_USER_THEME_KEY, userTheme);
	}
	window.location.href = document.querySelector('form').action;
};<commit_msg>change js to change to dark mode at 10pm<commit_after>HN.settings.LS_AUTODARK_KEY = 'Local Storage Key for automatically changing to dark theme at night';
HN.settings.LS_USER_THEME_KEY = 'Local Storage Key user selected theme';

HN.settings.initSettingsPage = function(){
	var ls = window.localStorage;
	if(ls.getItem(HN.settings.LS_AUTODARK_KEY) === 'true'){
		document.getElementById('autodark_checkbox').checked = true;
	}
	var userTheme = HN.settings.getUserTheme();

	HN.settings.themeNames.map(function(theme) {
		var themeRadio = document.getElementById(HN.settings.themeIdPrefix + theme);
		if(theme === userTheme){
			themeRadio.checked = true;
		}
		themeRadio.onclick = function(){
			document.documentElement.className = theme;
		};
	});
};

HN.settings.getUserTheme = function(){
	var ls = window.localStorage;
	var userTheme = ls.getItem(HN.settings.LS_USER_THEME_KEY);
	if(HN.settings.themeNames.indexOf(userTheme) < 0){
		userTheme = HN.settings.themeNames[0];
	}
	return userTheme;
};

HN.settings.initSettings = function(){
	document.documentElement.className = HN.settings.getUserTheme();
	var ls = window.localStorage;
	if(ls.getItem(HN.settings.LS_AUTODARK_KEY) === 'true'){
		HN.settings.darkAtNight();
	}
};

HN.settings.darkAtNight = function(){
	var currentDate = new Date();
	var currentHour = currentDate.getHours();
	if(currentHour >= 22 || currentHour < 6){
		document.documentElement.className = 'dark';
	}
};

HN.settings.save = function(){
	var ls = window.localStorage;
	ls.setItem(HN.settings.LS_AUTODARK_KEY, document.getElementById('autodark_checkbox').checked);
	var userTheme = document.querySelector('input[name="' + HN.settings.userThemeFormName + '"]:checked').value;
	if(HN.settings.themeNames.indexOf(userTheme) >= 0){
		ls.setItem(HN.settings.LS_USER_THEME_KEY, userTheme);
	}
	window.location.href = document.querySelector('form').action;
};
{'fraction_non_alphanumeric': 0.14419225634178906, 'fraction_numerical': 0.003738317757009346, 'mean_word_length': 5.560420315236427, 'pattern_counts': {'":': 0, '<': 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': '2042696', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1219, 'n_words': 210}