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

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

Issue 291663002: Adjustments to the fatnav and sidenav, and other CSS updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor so tocOffsetTop is not global Created 6 years, 6 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
1 // Activate the search box: 1 // Activate the search box:
2 (function() { 2 (function() {
3 var form = document.getElementById('chrome-docs-cse-search-form'); 3 var form = document.getElementById('chrome-docs-cse-search-form');
4 var searchInput = document.getElementById('chrome-docs-cse-input'); 4 var searchInput = document.getElementById('chrome-docs-cse-input');
5 5
6 var cx = '010997258251033819707:7owyldxmpkc'; 6 var cx = '010997258251033819707:7owyldxmpkc';
7 7
8 var gcse = document.createElement('script'); 8 var gcse = document.createElement('script');
9 gcse.type = 'text/javascript'; 9 gcse.type = 'text/javascript';
10 gcse.async = true; 10 gcse.async = true;
(...skipping 10 matching lines...) Expand all
21 element.execute(searchInput.value); 21 element.execute(searchInput.value);
22 } 22 }
23 e.preventDefault(); 23 e.preventDefault();
24 return true; 24 return true;
25 } 25 }
26 26
27 form.addEventListener('submit', executeQuery); 27 form.addEventListener('submit', executeQuery);
28 28
29 // Attach autocomplete to the search box 29 // Attach autocomplete to the search box
30 var enableAutoComplete = function() { 30 var enableAutoComplete = function() {
31 console.log("running enableAutoComplete");
32 google.search.CustomSearchControl.attachAutoCompletionWithOptions( 31 google.search.CustomSearchControl.attachAutoCompletionWithOptions(
33 cx, searchInput, form, 32 cx, searchInput, form,
34 // set to true to prevent the search box form from being submitted, sinc e 33 // set to true to prevent the search box form from being submitted, sinc e
35 // the search control displaying the results is on the same page. 34 // the search control displaying the results is on the same page.
36 {'preferOnSubmitToSubmit': true} 35 {'preferOnSubmitToSubmit': true}
37 ); 36 );
38 }; 37 };
39 38
40 var myAutocompleteCallback = function() { 39 var myAutocompleteCallback = function() {
41 // Search module is loaded. 40 // Search module is loaded.
42 if (document.readyState == 'complete') { 41 if (document.readyState == 'complete') {
43 enableAutoComplete(); 42 enableAutoComplete();
44 } else { 43 } else {
45 google.setOnLoadCallback(enableAutoComplete, true); 44 google.setOnLoadCallback(enableAutoComplete, true);
46 } 45 }
47 }; 46 };
48 47
49 window.__gcse = { 48 window.__gcse = {
50 callback: myAutocompleteCallback 49 callback: myAutocompleteCallback
51 }; 50 };
52 51
53 })(); 52 })();
54 53
55 // End of autocomplete 54 // End of autocomplete
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698