<commit_before>var updater = new UpdaterAPI();
var updateTask = null;
var seenStatus = false;
function setState(state, options) {
	options = options || {};
	var icon = $('#icon');
	var body = $('body');
	switch(state) {
		case 'busy':
			icon.removeClass().addClass('fa fa-10x fa-cog fa-spin-5x');
			body.removeClass().addClass('status-busy');						
			break;
		case 'success':
			icon.removeClass().addClass('fa fa-10x fa-check-circle')
			body.removeClass().addClass('status-success');			
			break;
		case 'failed':
			icon.removeClass().addClass('fa fa-10x fa-exclamation-circle')
			body.removeClass().addClass('status-failed');			
			break;
		case 'idle':
		default:
			icon.removeClass().addClass('fa fa-10x fa-circle-o')
			body.removeClass().addClass('status-idle');			
			break;
	}
	if(options.title) {
		$('#title').html(options.title);
	}

	if(options.message) {
		$('#message').html(options.message);
	}

	if(options.message2) {
		$('#message2').html(options.message2);
	}

}

function fail(err) {
	return setState('failed', {
		title : 'Update Failed.',
		message : 'System update could not complete' + (err ? (': ' + err) : '.') + '<br/><br/>' + '<a href="' + document.referrer + '">Click here to exit the updater.</a>',
		message2 :  '<a href="/log" class="logdl"><i class="fa fa-file"></i> Error Log</a>'
	});
}

function succeed() {
	return setState('success', {
		title : 'Update was Successful!',
		message : '<a href="' + document.referrer + '">Click here to exit the updater.</a>'
	});	
}

$(document).ready(function() {
	setState('idle');

	updater.on('status', function(status) {
		if(!updateTask) {
			// First status report, no update task has been started
			if(status.state === 'idle') {
				if(status.updates.length == 0) {
					return setState('success', {
						title : 'Your system is up to date!',
						message : 'No new updates are available.  <a href="' + document.referrer + '">Click here to exit the updater.</a>'
					})
				}
				updater.applyUpdate(function(err, data) {
					if(err) {
						return fail(err);
					}
					updateTask = (data || {}).task;
					setState('busy', {
						title : 'System is Updating',
						message : 'Please wait while your system is updated.'
					});
				});			
			}<commit_msg>Aesthetic improvement<commit_after>var updater = new UpdaterAPI();
var updateTask = null;
var seenStatus = false;
function setState(state, options) {
	options = options || {};
	var icon = $('#icon');
	var body = $('body');
	switch(state) {
		case 'busy':
			icon.removeClass().addClass('fa fa-10x fa-cog fa-spin-5x');
			body.removeClass().addClass('status-busy');						
			break;
		case 'success':
			icon.removeClass().addClass('fa fa-10x fa-check-circle')
			body.removeClass().addClass('status-success');			
			break;
		case 'failed':
			icon.removeClass().addClass('fa fa-10x fa-exclamation-circle')
			body.removeClass().addClass('status-failed');			
			break;
		case 'idle':
		default:
			icon.removeClass().addClass('fa fa-10x fa-circle-o')
			body.removeClass().addClass('status-idle');			
			break;
	}
	if(options.title) {
		$('#title').html(options.title);
	}

	if(options.message) {
		$('#message').html(options.message);
	}

	if(options.message2) {
		$('#message2').html(options.message2);
	}

}

function fail(err) {
	return setState('failed', {
		title : 'Update Failed.',
		message : 'System update could not complete' + (err ? (': ' + err) : '.') + '<br/><br/>' + '<a href="' + document.referrer + '">Click here to exit the updater.</a>',
		message2 :  '<a href="/log" class="logdl"><i class="fa fa-file"></i> Error Log</a>'
	});
}

function succeed() {
	return setState('success', {
		title : 'Update was Successful!',
		message : '<a href="' + document.referrer + '">Click here to exit the updater.</a>'
	});	
}

$(document).ready(function() {
	setState('idle');

	updater.on('status', function(status) {
		if(!updateTask) {
			// First status report, no update task has been started
			if(status.state === 'idle') {
				if(status.updates.length == 0) {
					return setState('success', {
						title : 'Your system is up to date!',
						message : 'No new updates are available.<br /><a href="' + document.referrer + '">Click here to exit the updater.</a>'
					})
				}
				updater.applyUpdate(function(err, data) {
					if(err) {
						return fail(err);
					}
					updateTask = (data || {}).task;
					setState('busy', {
						title : 'System is Updating',
						message : 'Please wait while your system is updated.'
					});
				});			
			}
{'fraction_non_alphanumeric': 0.19029685423128045, 'fraction_numerical': 0.006202924235711121, 'mean_word_length': 3.4178082191780823, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, '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': '791736', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1510, 'n_words': 345}