<commit_before>/* Better Table Search
 * Written by GrygrFlzr
 */

var $rows = $('#example tbody tr');
$('#searchnames').css('display','inline');
$('#searchauthors').css('display','inline');
$('#searchcompatible').css('display','inline');

$('#searchnames').keyup(function() {
	$('#searchauthors').val('');
	$('#searchcompatible').val('all');
    var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
    
    $rows.show().filter(function() {
        var text = $('td:nth-of-type(1)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
        return !~text.indexOf(val);
    }).hide();
});

$('#searchauthors').keyup(function() {
	$('#searchnames').val('');
	$('#searchcompatible').val('all');
    var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
    
    $rows.show().filter(function() {
        var text = $('td:nth-of-type(3)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
        return !~text.indexOf(val);
    }).hide();
});

$('#searchcompatible').change(function() {
	$('#searchauthors').val('');
	$('#searchnames').val('');
	var selectVal = $('#searchcompatible :selected').val();
	var selected = '';
	switch(selectVal) {
	case 'fc':
		selected = 'forge compatible';
		break;
	case 'fr':
		selected = 'forge required';
		break;
	case 'nfc':
		selected = 'not forge compatible';
		break;
	default:
		selected = '';
		break;
	}
	if(selected === '') {
		$rows.show();
	} else {
		$rows.show().filter(function() {
			var text = $('td:nth-of-type(5)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
			//return !~text.indexOf(selected);
			return text !== selected;
		}).hide();
	}
});<commit_msg>Made compoundable search (use multiple fields at once)<commit_after>/* Better Table Search
 * Written by GrygrFlzr
 */

var $rows = $('#example tbody tr');
$('#searchnames').css('display','inline');
$('#searchauthors').css('display','inline');
$('#searchcompatible').css('display','inline');

function search() {
    var valn = $.trim($('#searchnames').val()).replace(/ +/g, ' ').toLowerCase();
    var vala = $.trim($('#searchauthors').val()).replace(/ +/g, ' ').toLowerCase();
	var selectVal = $('#searchcompatible :selected').val();
	var selected = '';
	switch(selectVal) {
	case 'fc':
		selected = 'forge compatible';
		break;
	case 'fr':
		selected = 'forge required';
		break;
	case 'nfc':
		selected = 'not forge compatible';
		break;
	default:
		selected = '';
		break;
	}
    
    $rows.show().filter(function() {
        var textn = $('td:nth-of-type(1)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
        var texta = $('td:nth-of-type(3)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
		if(selected !== '') {
			var textc = $('td:nth-of-type(5)', $(this)).text().replace(/\s+/g, ' ').toLowerCase();
			return !~textn.indexOf(valn) || !~texta.indexOf(vala) || textc !== selected;
		} else {
			return !~textn.indexOf(valn) || !~texta.indexOf(vala);
		}
    }).hide();
}

$('#searchnames').keyup(search);
$('#searchauthors').keyup(search);
$('#searchcompatible').change(search);
{'fraction_non_alphanumeric': 0.26557377049180325, 'fraction_numerical': 0.0019672131147540984, 'mean_word_length': 4.242268041237113, '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': '5543614', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1035, 'n_words': 189}