(query)
| 53 | var pluginList = $('#plugins-list').data('plugin'); |
| 54 | |
| 55 | function search(query) { |
| 56 | var results = []; |
| 57 | if (query) { |
| 58 | pluginList.forEach(function(p) { |
| 59 | if (p[1].toLowerCase().startsWith(query.toLowerCase())) { |
| 60 | results.push(p); |
| 61 | } |
| 62 | }) |
| 63 | } else { |
| 64 | results = pluginList; |
| 65 | } |
| 66 | |
| 67 | pluginListPanel.empty(); |
| 68 | |
| 69 | if (results.length) { |
| 70 | results.forEach(function (p) { |
| 71 | resultTemplate.clone().find('.plugin-row') |
| 72 | .attr('id', 'plugin|'.concat(p[0])) |
| 73 | .text(p[1]) |
| 74 | .removeAttr('class') |
| 75 | .click(thisObject.menuClick) |
| 76 | .end().appendTo(pluginListPanel); |
| 77 | }); |
| 78 | } else { |
| 79 | pluginListPanel.append(noresultTemplate); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | searchInput.attr('placeholder', "{{_('Name of plugin')}}"); |
| 84 | searchInput.removeAttr('disabled'); |
no test coverage detected