(column)
| 31 | } |
| 32 | |
| 33 | function handleFind(column) { |
| 34 | if (!column.length) { |
| 35 | return false; |
| 36 | } |
| 37 | var ed = $('#mergely'); |
| 38 | var find = column.find('.find'); |
| 39 | var input = find.find('input[type="text"]'); |
| 40 | var side = column.attr('id').indexOf('-lhs') > 0 ? 'lhs' : 'rhs'; |
| 41 | var origautoupdate = ed.mergely('options').autoupdate; |
| 42 | find.slideDown('fast', function() { |
| 43 | input.focus(); |
| 44 | // disable autoupdate, clear both sides of diff |
| 45 | ed.mergely('options', {autoupdate: false}); |
| 46 | ed.mergely('unmarkup'); |
| 47 | }); |
| 48 | find.find('.find-prev').click(function() { |
| 49 | ed.mergely('search', side, input.val(), 'prev'); |
| 50 | }); |
| 51 | find.find('.find-next').click(function() { |
| 52 | ed.mergely('search', side, input.val(), 'next'); |
| 53 | }); |
| 54 | find.find('.find-close').click(function() { |
| 55 | find.css('display', 'none') |
| 56 | ed.mergely('options', {autoupdate: origautoupdate}); |
| 57 | }); |
| 58 | |
| 59 | input.keydown(function(evt) { |
| 60 | if (evt.which != 13 && evt.which != 27) return true; |
| 61 | if (evt.which == 27) { |
| 62 | find.css('display', 'none'); |
| 63 | ed.mergely('options', {autoupdate: origautoupdate}); |
| 64 | } |
| 65 | ed.mergely('search', side, input.val()); |
| 66 | return false; |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | $(document).keydown(function(event) { |
| 71 | if (!( String.fromCharCode(event.which).toLowerCase() == 'f' && event.ctrlKey)) return true; |
no test coverage detected