<commit_before>window.onload = function() {

	/* UTILS API  Section */
	// UTILS.ajax('data/notification.txt', {
	// done: function(response) {
	// 		//console.log(response);
	// 		var text = document.createTextNode(response);
	// 		var paragraph = document.createElement("p");
	// 		var notification = UTILS.qs('.notifications');
	// 		paragraph.appendChild(text);
	// 		notification.appendChild(paragraph);
	// 	},

	// fail: function(err) {
	// 	document.querySelector('#xhr');
	// 	}
	// });

	/**
	 * Tabs Section
	 */
	var tab = UTILS.qsa(".tab"),
		activeTab,
		switchTab;

	switchTab = function(e) {
		var target = e.currentTarget;
		activeTab = UTILS.qs('.active-tab');
		UTILS.removeClass(activeTab, 'active-tab');
		UTILS.addClass(target, 'active-tab');
	};

	for ( var i = 0; i < tab.length; i++ ) {
		UTILS.addEvent(tab[i], 'click', switchTab);
		UTILS.addEvent(tab[i], 'focus', switchTab);
	}

	var menus = UTILS.qsa('.action-list');
	var menuItems = UTILS.qsa('.action-list a');
	// Takes last item in each submenu to listen for blur event
	// when jumping to the next submenu
	var lastItem = UTILS.qsa('.action-list li:last-child a');

	/* Function open categories submenus on focus and highlighting currently
	 selected list items */
	var showMenu = function(e) {
		var target = e.target,
		parent = target.parentNode,
		activeParent;

		activeItem = UTILS.qs('.active-item');

		if ( activeItem !== null ) {
			UTILS.removeClass(activeItem, 'active-item');
		};

		UTILS.addClass(target, 'active-item');

		if ( UTILS.hasClass(parent.parentNode, 'active-menu') === false ) {
			UTILS.addClass(parent.parentNode, 'active-menu');
		}
	};

	/* Function closes categories */
	var closeMenu = function(e) {
		var target = e.target,
		parent = target.parentNode;
		UTILS.removeClass(parent.parentNode, 'active-menu');
	}

	for ( var i = 0; i < menuItems.length; i++ ) {
		UTILS.addEvent(menuItems[i], 'focus', showMenu);
	}

	for ( var i = 0; i < lastItem.length; i++ ) {
		UTILS.addEvent(lastItem[i], 'blur', closeMenu);
	}


	/**
	 * Reports section
	 */
	var reportsBtn = UTILS.qsa('.reports-btn'),
		buttons = UTILS.qsa(),
		// Finding "Select" element on the Quick Reports Tab
		sitesDropDown = UTILS.qs('#qs-sites-list'),
		selectedOpt = sitesDropDown.querySelector('option[selected="selected"]');


	// Check if the Reports window in current tab is displayed and show it if needed
	var openReports = function(e) {
		var reports;

		// Checks if the Event trigger is "Save" or "Cancel" button
		if (event.currentTarget.nodeName === 'BUTTON') {
			reports = event.currentTarget.parentNode;
			UTILS.toggle(reports, 'active-window');
		console.log(e.type);
			loadFrame(e);
		// If not, the trigger was "Reports" button
		} else {
			reports = event.currentTarget.parentNode.querySelector(".reports");
			UTILS.toggle(reports, 'active-window');
		}
	};

	var loadFrame = function (e) {
		var iframe = UTILS.qs('#qs-iframe');
		// Solves the issue when user choose another option from the sites dropdown list
		if (e.type === 'change') {
			index = e.currentTarget.selectedIndex;
			selectedOpt = e.currentTarget.options[index];
		} else {
			// Finding the newly selected option
			selectedOpt = sitesDropDown.querySelector('option[selected="selected"]');
		}
		// Changing iframe src to the choosed or currently added site
		iframe.setAttribute('src', selectedOpt.value);


	};

	// Function that checks what event triggered and if on keypress "Enter" was clicked
	var checkEvent = function(event) {
		if ( event.type === "click" ) {
			openReports(event);
		} else if ( event.type === "keypress" &&  event.keyCode === 13 ) {<commit_msg>Updating loadFrame func with onchange attribute change<commit_after>window.onload = function() {

	/* UTILS API  Section */
	// UTILS.ajax('data/notification.txt', {
	// done: function(response) {
	// 		//console.log(response);
	// 		var text = document.createTextNode(response);
	// 		var paragraph = document.createElement("p");
	// 		var notification = UTILS.qs('.notifications');
	// 		paragraph.appendChild(text);
	// 		notification.appendChild(paragraph);
	// 	},

	// fail: function(err) {
	// 	document.querySelector('#xhr');
	// 	}
	// });

	/**
	 * Tabs Section
	 */
	var tab = UTILS.qsa(".tab"),
		activeTab,
		switchTab;

	switchTab = function(e) {
		var target = e.currentTarget;
		activeTab = UTILS.qs('.active-tab');
		UTILS.removeClass(activeTab, 'active-tab');
		UTILS.addClass(target, 'active-tab');
	};

	for ( var i = 0; i < tab.length; i++ ) {
		UTILS.addEvent(tab[i], 'click', switchTab);
		UTILS.addEvent(tab[i], 'focus', switchTab);
	}

	var menus = UTILS.qsa('.action-list');
	var menuItems = UTILS.qsa('.action-list a');
	// Takes last item in each submenu to listen for blur event
	// when jumping to the next submenu
	var lastItem = UTILS.qsa('.action-list li:last-child a');

	/* Function open categories submenus on focus and highlighting currently
	 selected list items */
	var showMenu = function(e) {
		var target = e.target,
		parent = target.parentNode,
		activeParent;

		activeItem = UTILS.qs('.active-item');

		if ( activeItem !== null ) {
			UTILS.removeClass(activeItem, 'active-item');
		};

		UTILS.addClass(target, 'active-item');

		if ( UTILS.hasClass(parent.parentNode, 'active-menu') === false ) {
			UTILS.addClass(parent.parentNode, 'active-menu');
		}
	};

	/* Function closes categories */
	var closeMenu = function(e) {
		var target = e.target,
		parent = target.parentNode;
		UTILS.removeClass(parent.parentNode, 'active-menu');
	}

	for ( var i = 0; i < menuItems.length; i++ ) {
		UTILS.addEvent(menuItems[i], 'focus', showMenu);
	}

	for ( var i = 0; i < lastItem.length; i++ ) {
		UTILS.addEvent(lastItem[i], 'blur', closeMenu);
	}


	/**
	 * Reports section
	 */
	var reportsBtn = UTILS.qsa('.reports-btn'),
		buttons = UTILS.qsa(),
		// Finding "Select" element on the Quick Reports Tab
		sitesDropDown = UTILS.qs('#qs-sites-list'),
		selectedOpt = sitesDropDown.querySelector('option[selected="selected"]');


	// Check if the Reports window in current tab is displayed and show it if needed
	var openReports = function(e) {
		var reports;

		// Checks if the Event trigger is "Save" or "Cancel" button
		if (event.currentTarget.nodeName === 'BUTTON') {
			reports = event.currentTarget.parentNode;
			UTILS.toggle(reports, 'active-window');
			loadFrame(e);
		// If not, the trigger was "Reports" button
		} else {
			reports = event.currentTarget.parentNode.querySelector(".reports");
			UTILS.toggle(reports, 'active-window');
		}
	};

	var loadFrame = function (e) {
		var iframe = UTILS.qs('#qs-iframe'),
			// Finding previously selected item
			prevSelect = selectedOpt;

		// Change iframe when user choose another option from the sites dropdown list
		if (e.type === 'change') {
			// Removes "selected" attribute from the previously selected item
			prevSelect.removeAttribute('selected');
			index = e.currentTarget.selectedIndex;
			newSelect = e.currentTarget.options[index];
			newSelect.setAttribute('selected', 'selected');
		}

		// Finding the newly selected option
		selectedOpt = sitesDropDown.querySelector('option[selected="selected"]');
		// Changing iframe src to the choosed or currently added site
		iframe.setAttribute('src', selectedOpt.value);


	};

	// Function that checks what event triggered and if on keypress "Enter" was clicked
	var checkEvent = function(event) {
		if ( event.type === "click" ) {
			openReports(event);
		} else if ( event.type === "keypress" &&  event.keyCode === 13 ) {
{'fraction_non_alphanumeric': 0.1535605357379658, 'fraction_numerical': 0.0013260840737302744, 'mean_word_length': 3.646950092421442, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '1584671', 'n_tokens_mistral': 2721, 'n_tokens_neox': 2459, 'n_words': 610}