From 3d1587c2e784bae0642f9d788d82936282ca61ea Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 6 Dec 2010 05:05:04 +0100 Subject: [PATCH] browser: search categories on uppercase form input --- browser.plp | 2 +- searchlocal.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/browser.plp b/browser.plp index 9adf10e..d623a34 100644 --- a/browser.plp +++ b/browser.plp @@ -172,7 +172,7 @@ sub saytitlecol { for ($row->{categories}) { my $cell = $_ ? lc $_->[0] : '-'; - print '', $cell; + printf '%s', join(' + ', @$_), $cell; } print '', map { diff --git a/searchlocal.js b/searchlocal.js index 4de1423..2993a4a 100644 --- a/searchlocal.js +++ b/searchlocal.js @@ -1,7 +1,8 @@ function filtertable(query, action) { var rows = document.getElementsByTagName('TBODY')[0].rows; for (var i = 0; i < rows.length; i++) { - var keep = rows[i].cells[1].textContent.match(query, query.match(/[A-Z]/) ? '' : 'i'); + var keep = query.match(/^[A-Z0-9 ]{2,}$/) ? rows[i].cells[0].title.match(query, 'i') + : rows[i].cells[1].textContent.match(query, query.match(/[A-Z]/) ? '' : 'i'); switch (action) { case 'focus': rows[i].classList[keep ? 'add' : 'remove'](action); -- 2.30.0