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

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: more 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 samples = document.getElementsByClassName('sample');
8
9 function filterSamples() {
10 var search_text = search_box.value.toLowerCase();
11 for (var i = 0; i < samples.length; ++i) {
12 var sample = samples[i]
13 if (sample.getAttribute('tags').indexOf(search_text) < 0)
14 sample.style.display = 'none';
15 else
16 sample.style.display = '';
17 }
18 }
19 search_box.addEventListener('search', filterSamples);
20 search_box.addEventListener('keyup', filterSamples);
21
22 var api_filter_items = document.getElementById('api_filter_items');
23 api_filter_items.addEventListener('click', function(event) {
24 if (event.target instanceof HTMLAnchorElement) {
25 search_box.value = 'chrome.' + event.target.innerText;
26 filterSamples();
27 }
28 });
29 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698