<commit_before>/**
 * Filters (show-hide filter tags) module
 */

var Filters = (function () {

	function toggle(event) {
		event.preventDefault();
		var button = event.target;
		var expandtarget = document.getElementsByClassName('js-expandtarget')[0];
		var expandparent = expandtarget.parentNode;

		if(expandparent.classList.contains('is-closed')) {
			expandparent.removeChild(button);
			button.textContent = 'Less −';
			expandtarget.appendChild(button);
			expandparent.classList.remove('is-closed');
			expandparent.classList.add('is-open');
		}
		else {
			expandtarget.removeChild(button);
			button.textContent = 'More +';
			expandparent.insertBefore(button, expandtarget);
			expandparent.classList.remove('is-open');
			expandparent.classList.add('is-closed');
		}
	}

	function init() {
		var expandtarget = document.getElementsByClassName('js-expandtarget')[0];

		if(expandtarget) {
			var expandparent = expandtarget.parentNode;
			var button       = expandtarget.parentNode.getElementsByTagName('button')[0];
			var lastItem     = expandtarget.lastElementChild;

			if(expandparent.classList.contains('is-open')) {
				expandtarget.removeChild(button);
				expandparent.classList.remove('is-open');
			}
			else {

				if(isVisible(lastItem)) {
					expandparent.classList.add('is-visible');

					if(button) {
						button.remove();
						expandparent.classList.remove('is-closed');
					}
				}
				else {

					if(!button) {
						var newButton = document.createElement('button');
						// newButton.classList.add('js-exapndbutton');
						newButton.setAttribute('aria-hidden', true);
						newButton.textContent = 'More +';
						expandparent.classList.add('is-closed');
						expandparent.classList.remove('is-visible');
						expandparent.insertBefore(newButton, expandtarget);
						newButton.addEventListener('click', Filters.toggle, false);
					}
				}
			}
		}
	}

	// Debounced (delayed) callback of `init` function after resize!
	window.addEventListener('resize', debounce(init), false);

	/**
	 * Return public methods
	 */
	return {
		toggle: toggle,
		init: init
	};
})();<commit_msg>Clean-up.<commit_after>/**
 * Filters (show-hide filter tags) module
 */

var Filters = (function () {

	function toggle(event) {
		event.preventDefault();
		var button = event.target;
		var expandtarget = document.querySelector('.js-filters');
		var expandparent = expandtarget.parentNode;

		if (expandparent.classList.contains('is-closed')) {
			expandparent.removeChild(button);
			button.textContent = 'Less −';
			expandtarget.appendChild(button);
			expandparent.classList.remove('is-closed');
			expandparent.classList.add('is-open');
		}
		else {
			expandtarget.removeChild(button);
			button.textContent = 'More +';
			expandparent.insertBefore(button, expandtarget);
			expandparent.classList.remove('is-open');
			expandparent.classList.add('is-closed');
		}
	}

	function init() {
		var expandtarget = document.querySelector('.js-filters');

		if (expandtarget) {
			var expandparent = expandtarget.parentNode;
			var button = expandtarget.parentNode.getElementsByTagName('button')[0];
			var lastItem = expandtarget.lastElementChild;

			if (expandparent.classList.contains('is-open')) {
				expandtarget.removeChild(button);
				expandparent.classList.remove('is-open');
			}
			else {

				if (isVisible(lastItem)) {
					expandparent.classList.add('is-visible');

					if (button) {
						button.remove();
						expandparent.classList.remove('is-closed');
					}
				}
				else {

					if (!button) {
						var newButton = document.createElement('button');
						newButton.setAttribute('aria-hidden', true);
						newButton.textContent = 'More +';
						expandparent.classList.add('is-closed');
						expandparent.classList.remove('is-visible');
						expandparent.insertBefore(newButton, expandtarget);
						newButton.addEventListener('click', Filters.toggle, false);
					}
				}
			}
		}
	}

	// Debounced (delayed) callback of `init` function after resize!
	window.addEventListener('resize', debounce(init), false);

	/**
	 * Return public methods
	 */
	return {
		toggle: toggle,
		init: init
	};
})();
{'fraction_non_alphanumeric': 0.14523522316043425, 'fraction_numerical': 0.0009650180940892642, 'mean_word_length': 3.798611111111111, 'pattern_counts': {'":': 0, '<': 3, '<?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': '241722', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1238, 'n_words': 199}