browser: search categories on uppercase form input
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 6 Dec 2010 04:05:04 +0000 (05:05 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000 (22:40 +0100)
browser.plp
searchlocal.js

index 9adf10ef5a53437b81f9d282c524abea3fcb6acb..d623a344535af64c343ed15718756ad67fd1440d 100644 (file)
@@ -172,7 +172,7 @@ sub saytitlecol {
 
        for ($row->{categories}) {
                my $cell = $_ ? lc $_->[0] : '-';
-               print '<th>', $cell;
+               printf '<th title="%s">%s', join(' + ', @$_), $cell;
        }
 
        print '<td>', map {
index 4de1423677d8e61b81e108a0b22c7e4d115e6b32..2993a4a96fa83261ac0833dede4132f3a4fc03cb 100644 (file)
@@ -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);