Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/static/js/sample_search.js |
| diff --git a/chrome/common/extensions/docs/server2/static/js/sample_search.js b/chrome/common/extensions/docs/server2/static/js/sample_search.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..691ada42b083d6f6c46c2c844c774ed0be7e9be7 |
| --- /dev/null |
| +++ b/chrome/common/extensions/docs/server2/static/js/sample_search.js |
| @@ -0,0 +1,28 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this |
| +// source code is governed by a BSD-style license that can be found in the |
| +// LICENSE file. |
| + |
| +(function() { |
| + var search_box = document.getElementById('search_input'); |
| + var apis = document.getElementsByClassName('sample'); |
| + for (var i = 0; i < apis.length; ++i) |
| + apis[i].tags = apis[i].getAttribute('tags').toUpperCase(); |
| + |
| + function filterSamples() { |
| + var search_text = search_box.value.toUpperCase(); |
| + for (var i = 0; i < apis.length; ++i) { |
| + if (apis[i].tags.indexOf(search_text) < 0) |
| + apis[i].style.display = 'none'; |
| + else |
| + apis[i].style.display = 'block'; |
|
not at google - send to devlin
2012/07/24 01:09:55
This assumes that it was block. It might not be? S
cduvall
2012/07/24 20:14:47
Done.
|
| + } |
| + } |
| + |
| + function setFilter(text) { |
| + search_box.value = text; |
| + filterSamples(); |
| + } |
| + |
| + window.filterSamples = filterSamples; |
| + window.setFilter = setFilter; |
|
not at google - send to devlin
2012/07/24 01:09:55
see comment in the template. Use search_box.addEve
cduvall
2012/07/24 20:14:47
Done.
|
| +})() |