Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5452)

Unified Diff: chrome/common/extensions/docs/server2/static/js/sample_search.js

Issue 10809062: Extensions Docs Server: Samples search and icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
+})()

Powered by Google App Engine
This is Rietveld 408576698