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

Unified Diff: chrome/common/extensions/docs/static/js/samples.js

Issue 23526077: [DocServer] Fixed Sample Links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed kalman's feedback Created 7 years, 3 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/static/js/samples.js
diff --git a/chrome/common/extensions/docs/static/js/samples.js b/chrome/common/extensions/docs/static/js/samples.js
index 6388205733b3ab368ca2e94556200a7eb642afce..76c09b599e1c5ef826ae98f9e2ade01f1946c053 100644
--- a/chrome/common/extensions/docs/static/js/samples.js
+++ b/chrome/common/extensions/docs/static/js/samples.js
@@ -9,8 +9,10 @@
function filterSamples() {
var search_text = search_box.value.toLowerCase();
for (var i = 0; i < samples.length; ++i) {
- var sample = samples[i]
- if (sample.getAttribute('tags').toLowerCase().indexOf(search_text) < 0)
+ var sample = samples[i];
+ var sample_title = samples[i].getElementsByTagName('h2')[0].innerText;
+ if (sample.getAttribute('tags').toLowerCase().indexOf(search_text) < 0 &&
+ sample_title.toLowerCase().indexOf(search_text) < 0)
sample.style.display = 'none';
else
sample.style.display = '';
@@ -26,4 +28,14 @@
filterSamples();
}
});
+
+ function onLoad() {
+ var search = window.location.hash.substr(1).replace(/-/g, ' ');
+ if (search) {
+ search_box.value = search;
+ filterSamples();
+ }
+ }
+
+ window.addEventListener('DOMContentLoaded', onLoad);
not at google - send to devlin 2013/09/23 15:59:51 the onLoad is hopefully unnecessary since the rele
François Beaufort 2013/09/24 09:24:49 Done.
})();

Powered by Google App Engine
This is Rietveld 408576698