<commit_before>/**
 * The slide menu widget
 * 
 * @class Widgets.com.chariti.slideMenu
 * @uses core
 */
var APP = require("core"),

var sections = [];
var tabs = [];

/**
 * Initializes the slide menu
 * @param {Object} _params
 * @param {Object} _params.tabs The tab items to show in the side menu as defined by the JSON configuration file
 */
$.init = function(_params) {
	$.tabs = [];

	// Add the Settings tab
	_params.tabs.push({
		id: "settings",
		image: "/icons/white/settings.png",
		title: "Settings"
	});
	
	//creates a TableViewSection for each tab with a menuHeader property
	buildSections(_params.tabs);
	
	if(sections.length > 0) {
		var currentSection = -1;
	}

	for(var i = 0; i < _params.tabs.length; i++) {
		// Iterates through the created sections
		if(_params.tabs[i].menuHeader) {
			currentSection++;
		}

		var tab = Ti.UI.createTableViewRow({
			id: _params.tabs[i].id,
			height: "47dp",
			backgroundcolor: "#111",
			backgroundSelectedColor: "#222",
			selectedBackgroundColor: "#222"
		});

		var label = Ti.UI.createLabel({
			text: _params.tabs[i].title,
			top: "0dp",
			left: "47dp",
			right: "13dp",
			height: "46dp",
			font: {
				fontSize: "16dp",
				fontFamily: "HelveticaNeue-Light"
			},
			color: "#FFF",
			touchEnabled: false
		});

		if(_params.tabs[i].image) {
			var icon = Ti.UI.createImageView({
				image: _params.tabs[i].image,
				width: "21dp",
				height: "21dp",
				top: "13dp",
				left: "13dp",
				touchEnabled: false,
				preventDefaultImage: true
			});

			tab.add(icon);
		}

		tab.add(label);

		if(sections.length > 0) {
			sections[currentSection].add(tab);
			
			//If the last tab has been created and added to a section or
			//the next tab is a new header, append the current section to the TableView
			if(i + 1 !== _params.tabs.length) {
				if(_params.tabs[i+1].menuHeader) {
					$.Tabs.appendSection(sections[currentSection]);
				}
			} else {
				$.Tabs.appendSection(sections[currentSection]);
			}
		} else {
			tabs.push(tab);
		}
	}
	
	if(tabs.length > 0) {
		$.Tabs.setData(tabs);
	}
};

/**
 * Builds out the table sections
 * @param {Object} _tabs The tab items to show in the side menu
 * @private
 */<commit_msg>Beautifying and resolving issues from merges<commit_after>/**
 * The slide menu widget
 * 
 * @class Widgets.com.chariti.slideMenu
 * @uses core
 */
var APP = require("core");

var sections = [];
var tabs = [];

/**
 * Initializes the slide menu
 * @param {Object} _params
 * @param {Object} _params.tabs The tab items to show in the side menu as defined by the JSON configuration file
 */
$.init = function(_params) {
	$.tabs = [];

	// Add the Settings tab
	_params.tabs.push({
		id: "settings",
		image: "/icons/white/settings.png",
		title: "Settings"
	});

	//creates a TableViewSection for each tab with a menuHeader property
	buildSections(_params.tabs);

	if(sections.length > 0) {
		var currentSection = -1;
	}

	for(var i = 0; i < _params.tabs.length; i++) {
		// Iterates through the created sections
		if(_params.tabs[i].menuHeader) {
			currentSection++;
		}

		var tab = Ti.UI.createTableViewRow({
			id: _params.tabs[i].id,
			height: "47dp",
			backgroundcolor: "#111",
			backgroundSelectedColor: "#222",
			selectedBackgroundColor: "#222"
		});

		var label = Ti.UI.createLabel({
			text: _params.tabs[i].title,
			top: "0dp",
			left: "47dp",
			right: "13dp",
			height: "46dp",
			font: {
				fontSize: "16dp",
				fontFamily: "HelveticaNeue-Light"
			},
			color: "#FFF",
			touchEnabled: false
		});

		if(_params.tabs[i].image) {
			var icon = Ti.UI.createImageView({
				image: _params.tabs[i].image,
				width: "21dp",
				height: "21dp",
				top: "13dp",
				left: "13dp",
				touchEnabled: false,
				preventDefaultImage: true
			});

			tab.add(icon);
		}

		tab.add(label);

		if(sections.length > 0) {
			sections[currentSection].add(tab);

			//If the last tab has been created and added to a section or
			//the next tab is a new header, append the current section to the TableView
			if(i + 1 !== _params.tabs.length) {
				if(_params.tabs[i + 1].menuHeader) {
					$.Tabs.appendSection(sections[currentSection]);
				}
			} else {
				$.Tabs.appendSection(sections[currentSection]);
			}
		} else {
			tabs.push(tab);
		}
	}

	if(tabs.length > 0) {
		$.Tabs.setData(tabs);
	}
};

/**
 * Builds out the table sections
 * @param {Object} _tabs The tab items to show in the side menu
 * @private
 */
{'fraction_non_alphanumeric': 0.15197294250281848, 'fraction_numerical': 0.015783540022547914, 'mean_word_length': 3.099815157116451, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1367652', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1513, 'n_words': 406}