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

Side by Side Diff: chrome/common/extensions/docs/server2/static/js/samples.js

Issue 10809062: Extensions Docs Server: Samples search and icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file.
4
5 (function() {
6 var search_box = document.getElementById('search_input');
7 var apis = document.getElementsByClassName('sample');
8 for (var i = 0; i < apis.length; ++i)
9 apis[i].tags = apis[i].getAttribute('tags').toUpperCase();
10
11 function filterSamples() {
12 var search_text = search_box.value.toUpperCase();
13 for (var i = 0; i < apis.length; ++i) {
14 if (apis[i].tags.indexOf(search_text) < 0)
15 apis[i].style.display = 'none';
16 else
17 apis[i].style.display = '';
18 }
19 }
20
21 function setFilter() {
22 search_box.value = 'chrome.' + this.innerHTML;
23 filterSamples();
24 }
25
26 var api_filter_items = document.getElementsByClassName('api_filter_item');
27 for (var i = 0; i < api_filter_items.length; ++i)
28 api_filter_items[i].addEventListener('click', setFilter, true);
29
30 search_box.onsearch = filterSamples;
31 search_box.onkeyup = filterSamples;
32 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698