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

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

Issue 5989011: Add hotlinks to individual samples in extension samples directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/common/extensions/docs/build
Patch Set: Display tweaks Created 9 years, 12 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/samples.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/js/sample_search.js
diff --git a/chrome/common/extensions/docs/js/sample_search.js b/chrome/common/extensions/docs/js/sample_search.js
index 3b950947147ab4f39b77bb5677e77b6f8572b396..5d8737bdf4c963637170235eaf1d1089da91bd11 100644
--- a/chrome/common/extensions/docs/js/sample_search.js
+++ b/chrome/common/extensions/docs/js/sample_search.js
@@ -25,6 +25,7 @@ function filterSamples() {
return;
} else {
currentfilter = searchtext;
+ window.location.hash = searchinput.value;
}
noresults.style.display = 'none';
@@ -77,7 +78,13 @@ function initSearch() {
}
if (window.location.hash.length > 1) {
- setFilter(window.location.hash.substring(1));
+ var hash = window.location.hash.substring(1);
+ var elem = document.getElementById(hash);
+ if (elem) {
+ elem.scrollIntoView();
+ } else {
+ setFilter(hash);
+ }
}
};
« no previous file with comments | « no previous file | chrome/common/extensions/docs/samples.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698