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

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

Issue 10821073: Extensions Docs Server: Filter APIs UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/filter.js
diff --git a/chrome/common/extensions/docs/server2/static/js/filter.js b/chrome/common/extensions/docs/server2/static/js/filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..351e145df1e9faf715805e2fbd5f57f14361ddbb
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/static/js/filter.js
@@ -0,0 +1,23 @@
+// 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.
+
not at google - send to devlin 2012/07/30 10:14:25 quick comment plz
cduvall 2012/07/30 20:05:38 Done.
+(function() {
+ var search_box = document.getElementById('api_search');
+ var filtered_apis = document.getElementById('filtered_apis');
+
+ function filterAPIs() {
+ var search_text = search_box.value.toLowerCase();
+ var apis = window.bootstrap.api_names;
+ filtered_apis.innerHTML = '';
not at google - send to devlin 2012/07/30 10:14:25 this is kind of wasteful? only need to clear it if
cduvall 2012/07/30 20:05:38 Done.
+ if (!search_text)
+ return;
not at google - send to devlin 2012/07/30 10:14:25 looks like clearing the search results doesn't lea
cduvall 2012/07/30 20:05:38 Are you talking about clearing the search box here
not at google - send to devlin 2012/07/30 20:19:09 I was being silly, never mind.
+ for (var i = 0; i < apis.length; ++i) {
+ if (apis[i].name.toLowerCase().indexOf(search_text) != -1)
+ filtered_apis.innerHTML += '<li class="filtered_item"><a href="' +
not at google - send to devlin 2012/07/30 10:14:25 It's possible that changing innerHTML like this re
cduvall 2012/07/30 20:05:38 Done.
+ apis[i].name + '.html">' + apis[i].name + '</a></li>'
not at google - send to devlin 2012/07/30 10:14:25 you'll also need to hide filtered_apis if it has n
cduvall 2012/07/30 20:05:38 Done.
+ }
+ }
+ search_box.addEventListener('search', filterAPIs);
+ search_box.addEventListener('keyup', filterAPIs);
+})();

Powered by Google App Engine
This is Rietveld 408576698