OLD | NEW |
---|---|
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 Loading... | |
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"); | 31 // console.log("running enableAutoComplete"); |
not at google - send to devlin
2014/06/03 17:44:00
just delete it?
pearlchen
2014/06/03 22:52:14
sure
On 2014/06/03 17:44:00, kalman wrote:
| |
32 google.search.CustomSearchControl.attachAutoCompletionWithOptions( | 32 google.search.CustomSearchControl.attachAutoCompletionWithOptions( |
33 cx, searchInput, form, | 33 cx, searchInput, form, |
34 // set to true to prevent the search box form from being submitted, sinc e | 34 // 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. | 35 // the search control displaying the results is on the same page. |
36 {'preferOnSubmitToSubmit': true} | 36 {'preferOnSubmitToSubmit': true} |
37 ); | 37 ); |
38 }; | 38 }; |
39 | 39 |
40 var myAutocompleteCallback = function() { | 40 var myAutocompleteCallback = function() { |
41 // Search module is loaded. | 41 // Search module is loaded. |
42 if (document.readyState == 'complete') { | 42 if (document.readyState == 'complete') { |
43 enableAutoComplete(); | 43 enableAutoComplete(); |
44 } else { | 44 } else { |
45 google.setOnLoadCallback(enableAutoComplete, true); | 45 google.setOnLoadCallback(enableAutoComplete, true); |
46 } | 46 } |
47 }; | 47 }; |
48 | 48 |
49 window.__gcse = { | 49 window.__gcse = { |
50 callback: myAutocompleteCallback | 50 callback: myAutocompleteCallback |
51 }; | 51 }; |
52 | 52 |
53 })(); | 53 })(); |
54 | 54 |
55 // End of autocomplete | 55 // End of autocomplete |
OLD | NEW |