<commit_before>var App;

window.dhtmlHistory.create({
	toJSON: function(o) {
		return JSON.stringify(o);
	}
	, fromJSON: function(s) {
		return JSON.parse(s);
	}
});

(function(){
	"use strict";
	var Main = function(){
		this.getConfig(function(r, t){
			var modules = r.modules;

			t.start(r);
		});
	}

	/**
	 * Gets the main site configuration
	 * @return {json} Configuration
	 */
	Main.prototype.getConfig = function(callback) {
		var t = this;
		new Vi({url:'config.json', 'response': 'object'}).server(function(r){
			if(typeof callback === 'function'){
				callback(r, t);
			}
		});
	};

	Main.prototype.start = function(r) {
		var lang = this.browserLanguage();
		var modules = {};

		var mods = Object.keys(r.modules);
		for(var i = 0, len = mods.length; i < len; i++){
			var k = mods[i];
			modules[k] = {nombre: k, url:r.modules_path};
		}

		var j = {name: 'Dress code', modules:modules, div:'#content', currentLang: lang};
		this.a = new AppSystem(j);
		App = this.a;

		this.a._data = r;
		var t = this;

		dhtmlHistory.initialize();
		dhtmlHistory.addListener(t.handleHistory);

		this.a.init(function(){
			var initialModule = dhtmlHistory.getCurrentLocation();
			var module = (initialModule === '') ? 'backend' : initialModule;
			t.verifyIdentity(function(r){
				switch(r.success){
					case true:
						t.loadCategory('backend', function(){
							if(module !== 'backend' && module !== 'login'){
								t.loadCategory(module);
							}
						});
					break;
					case false:
						t.loadCategory('login');
					break;
				}
			});
		});
	};

	Main.prototype.verifyIdentity = function(callback) {
		callback = (typeof callback === 'function') ? callback : function(){};
		var j = {
			url: this.a._data.rest+'Members/',
			mode: 'GET',
			div: undefined,
			cache: true,
			response: 'object',
			headerValue: 'application/json'
		}
		new Vi(j).ajax(callback);
	};

	Main.prototype.handleURL = function(url) {
		url = url.match(/([^/]+)/gi);
		return url;
	};

	Main.prototype.handleHistory = function(newLocation, historyData) {
		if(typeof Application.a.current === 'object'){
			Application.loadCategory(newLocation);
		}
	};

	Main.prototype.activeMenuCategory = function(category) {
		this.clearMenu();
		var el = document.querySelector('#side-menu>li>a[data-module="'+category+'"]');
		if(el !== null){
			el = el.parentNode;
			el.className = 'active';
		}
	};

	Main.prototype.clearMenu = function() {
		var elms = document.querySelectorAll('#side-menu>li');
		for(var i = 0, len = elms.length; i < len; i++){
			var el = elms[i];
			el.className = '';
		}
	};

	Main.prototype.loadCategory = function(category, callback) {
		console.log('category', category);
		var url = this.handleURL(category);
		if(category !== 'backend'){
			dhtmlHistory.add(category, {message: "Module " +url[0]});

			this.activeMenuCategory(url[0]);
		}

		switch(category){
			case 'backend':
			case 'login':
			case 'setup':
				this.a.div = '#content';
			break;
			default:
				this.a.div = '#modules-content';
			break;
		}

		this.a.getModule(url[0]);
		this.a.current._url = url;

		if(category !== 'backend'){
			var t = this;
			$(this.a.div).fadeOut('fast', function(){
				t.a.current.start(function(){
					$(t.a.div).fadeIn('fast', function(){
						if(typeof callback === 'function'){
							callback();
						}
					});
				});
			});
		}else{
			this.a.current.start(function(){
				if(typeof callback === 'function'){<commit_msg>Removed console log<commit_after>var App;

window.dhtmlHistory.create({
	toJSON: function(o) {
		return JSON.stringify(o);
	}
	, fromJSON: function(s) {
		return JSON.parse(s);
	}
});

(function(){
	"use strict";
	var Main = function(){
		this.getConfig(function(r, t){
			var modules = r.modules;

			t.start(r);
		});
	}

	/**
	 * Gets the main site configuration
	 * @return {json} Configuration
	 */
	Main.prototype.getConfig = function(callback) {
		var t = this;
		new Vi({url:'config.json', 'response': 'object'}).server(function(r){
			if(typeof callback === 'function'){
				callback(r, t);
			}
		});
	};

	Main.prototype.start = function(r) {
		var lang = this.browserLanguage();
		var modules = {};

		var mods = Object.keys(r.modules);
		for(var i = 0, len = mods.length; i < len; i++){
			var k = mods[i];
			modules[k] = {nombre: k, url:r.modules_path};
		}

		var j = {name: 'Dress code', modules:modules, div:'#content', currentLang: lang};
		this.a = new AppSystem(j);
		App = this.a;

		this.a._data = r;
		var t = this;

		dhtmlHistory.initialize();
		dhtmlHistory.addListener(t.handleHistory);

		this.a.init(function(){
			var initialModule = dhtmlHistory.getCurrentLocation();
			var module = (initialModule === '') ? 'backend' : initialModule;
			t.verifyIdentity(function(r){
				switch(r.success){
					case true:
						t.loadCategory('backend', function(){
							if(module !== 'backend' && module !== 'login'){
								t.loadCategory(module);
							}
						});
					break;
					case false:
						t.loadCategory('login');
					break;
				}
			});
		});
	};

	Main.prototype.verifyIdentity = function(callback) {
		callback = (typeof callback === 'function') ? callback : function(){};
		var j = {
			url: this.a._data.rest+'Members/',
			mode: 'GET',
			div: undefined,
			cache: true,
			response: 'object',
			headerValue: 'application/json'
		}
		new Vi(j).ajax(callback);
	};

	Main.prototype.handleURL = function(url) {
		url = url.match(/([^/]+)/gi);
		return url;
	};

	Main.prototype.handleHistory = function(newLocation, historyData) {
		if(typeof Application.a.current === 'object'){
			Application.loadCategory(newLocation);
		}
	};

	Main.prototype.activeMenuCategory = function(category) {
		this.clearMenu();
		var el = document.querySelector('#side-menu>li>a[data-module="'+category+'"]');
		if(el !== null){
			el = el.parentNode;
			el.className = 'active';
		}
	};

	Main.prototype.clearMenu = function() {
		var elms = document.querySelectorAll('#side-menu>li');
		for(var i = 0, len = elms.length; i < len; i++){
			var el = elms[i];
			el.className = '';
		}
	};

	Main.prototype.loadCategory = function(category, callback) {
		var url = this.handleURL(category);
		if(category !== 'backend'){
			dhtmlHistory.add(category, {message: "Module " +url[0]});
			this.activeMenuCategory(url[0]);
		}

		switch(category){
			case 'backend':
			case 'login':
			case 'setup':
				this.a.div = '#content';
			break;
			default:
				this.a.div = '#modules-content';
			break;
		}

		this.a.getModule(url[0]);
		this.a.current._url = url;

		if(category !== 'backend'){
			var t = this;
			$(this.a.div).fadeOut('fast', function(){
				t.a.current.start(function(){
					$(t.a.div).fadeIn('fast', function(){
						if(typeof callback === 'function'){
							callback();
						}
					});
				});
			});
		}else{
			this.a.current.start(function(){
				if(typeof callback === 'function'){
{'fraction_non_alphanumeric': 0.18671897704155768, 'fraction_numerical': 0.0014530659691950015, 'mean_word_length': 3.3207784055241683, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6829995', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2353, 'n_words': 465}