<commit_before>/*!
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This file contains code covered by:
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.1 beta 1
 */

/**
 * This file contains javascript associated with the user profile
 */

$(document).ready(function() {
	// Profile options changing karma
	$('#karma_good, #karma_bad').keyup(function() {
		var good = parseInt($('#karma_good').val()),
			bad = parseInt($('#karma_bad').val());

		$('#karmaTotal').text((isNaN(good) ? 0 : good) - (isNaN(bad) ? 0 : bad));
	});
	$('.toggle_notify').change(function() {
		if (this.checked)
			$('#' + this.id + '_method').fadeIn('fast');
		else
			$('#' + this.id + '_method').fadeOut('fast');
	}).change();
});

/**
 * Function to detect the time offset and populate the offset box
 *
 * @param {string} currentTime
 */
var localTime = new Date();
function autoDetectTimeOffset(currentTime)
{
	var serverTime;

	if (typeof(currentTime) !== 'string')
		serverTime = currentTime;
	else<commit_msg>! move JS to script file and out of controller<commit_after>/*!
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This file contains code covered by:
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.1 beta 1
 */

/**
 * This file contains javascript associated with the user profile
 */

$(document).ready(function() {
	// Profile options changing karma
	$('#karma_good, #karma_bad').keyup(function() {
		var good = parseInt($('#karma_good').val()),
			bad = parseInt($('#karma_bad').val());

		$('#karmaTotal').text((isNaN(good) ? 0 : good) - (isNaN(bad) ? 0 : bad));
	});
	$('.toggle_notify').change(function() {
		if (this.checked)
			$('#' + this.id + '_method').fadeIn('fast');
		else
			$('#' + this.id + '_method').fadeOut('fast');
	}).change();
});

function start_tabs() {
	$("#tabs").tabs({
		// Called before tab content is loaded with href
		beforeLoad: function (event, ui) {
			// The ubiquitous ajax spinner
			ui.panel.html('<div class="centertext"><i class="fa fa-2x fa-spinner"></i></div>');

			// Ajax call failed to retrieve content
			ui.jqXHR.fail(function () {
				ui.panel.html('<div></div>');
				if ('console' in window) {
					window.console.info(event);
					window.console.info(ui);
				}
			});
		},
	});
}

/**
 * Function to detect the time offset and populate the offset box
 *
 * @param {string} currentTime
 */
var localTime = new Date();
function autoDetectTimeOffset(currentTime)
{
	var serverTime;

	if (typeof(currentTime) !== 'string')
		serverTime = currentTime;
	else
{'fraction_non_alphanumeric': 0.17797783933518005, 'fraction_numerical': 0.007271468144044321, 'mean_word_length': 3.8800675675675675, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1765373', 'n_tokens_mistral': 1009, 'n_tokens_neox': 927, 'n_words': 244}