<commit_before>'use strict';
var isHidden = true;

function createHtml(str) {
	var frag = document.createDocumentFragment();
	var temp = document.createElement('div');

	temp.innerHTML = str;

	while (temp.firstChild) {
		frag.appendChild(temp.firstChild);
	}

	return frag;
}

function toggleFiles() {
	var i = 0;

	[].forEach.call(document.querySelectorAll('.files tr'), function (el) {
		if (el.querySelector('.content a[title^="."')) {
			el.style.display = isHidden ? 'none' : 'table-row';
		} else if (++i === 1) {
			// remove top border
			el.classList.add('first');
		}
	});
}

function addToggleBtn() {
	var toggleBtn = createHtml('<a class="hide-files-btn btn btn-sm right">Show Dotfiles</a>');
	var btnContainer = document.querySelector('.file-navigation .breadcrumb');

	if (document.querySelector('.hide-files-btn')) {
		return;
	}

	// insert after
	btnContainer.parentNode.insertBefore(toggleBtn, btnContainer.nextSibling);

	document.querySelector('.hide-files-btn').addEventListener('click', function (e) {
		isHidden = !isHidden;
		this.textContent = isHidden ? 'Show Dotfiles' : 'Hide Dotfiles';
		toggleFiles();
	});
}

function trigger() {
	addToggleBtn();
	toggleFiles();
}

document.addEventListener('DOMContentLoaded', function () {
	trigger();

	new MutationObserver(trigger).observe(document.querySelector('#js-repo-pjax-container'), {childList: true});
});<commit_msg>Fix: error thrown when navigating to a PR page<commit_after>'use strict';
var isHidden = true;

function createHtml(str) {
	var frag = document.createDocumentFragment();
	var temp = document.createElement('div');

	temp.innerHTML = str;

	while (temp.firstChild) {
		frag.appendChild(temp.firstChild);
	}

	return frag;
}

function toggleFiles() {
	var i = 0;

	[].forEach.call(document.querySelectorAll('.files tr'), function (el) {
		if (el.querySelector('.content a[title^="."')) {
			el.style.display = isHidden ? 'none' : 'table-row';
		} else if (++i === 1) {
			// remove top border
			el.classList.add('first');
		}
	});
}

function addToggleBtn() {
	var toggleBtn = createHtml('<a class="hide-files-btn btn btn-sm right">Show Dotfiles</a>');
	var btnContainer = document.querySelector('.file-navigation .breadcrumb');

	if (document.querySelector('.hide-files-btn')) {
		return;
	}

	if (btnContainer) {
		// insert after
		btnContainer.parentNode.insertBefore(toggleBtn, btnContainer.nextSibling);

		document.querySelector('.hide-files-btn').addEventListener('click', function (e) {
			isHidden = !isHidden;
			this.textContent = isHidden ? 'Show Dotfiles' : 'Hide Dotfiles';
			toggleFiles();
		});
	}
}

function trigger() {
	addToggleBtn();
	toggleFiles();
}

document.addEventListener('DOMContentLoaded', function () {
	trigger();

	new MutationObserver(trigger).observe(document.querySelector('#js-repo-pjax-container'), {childList: true});
});
{'fraction_non_alphanumeric': 0.16771708683473388, 'fraction_numerical': 0.0014005602240896359, 'mean_word_length': 4.806910569105691, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4059545', 'n_tokens_mistral': 941, 'n_tokens_neox': 896, 'n_words': 186}