ties|gradle|srt|sql|lua|m3u8?)$/i;

function findNextPrevLink(link, regex, isBackwards) {
	if (!link) {
		return;
	}
	let item = findClosest(link, 'TR', 'file') || findClosest(link, 'DIV', 'entry');

	while(item = isBackwards ? item.previousElementSibling : item.nextElementSibling) {
		const a = item.querySelector('a');

		if (a && regex.test(a.getAttribute('href'))) {
			return a;
		}
	}
}

// keyboard navigation
document.onkeydown = function (e) {
	const v = document.querySelector('.popup video');
	const 