| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 | 4 |
| 5 var apiHandle; | 5 var apiHandle; |
| 6 var newTabPageHandle; | 6 var newTabPageHandle; |
| 7 var savedUserText = null; | 7 var savedUserText = null; |
| 8 var suggestionIndex = -1; | 8 var suggestionIndex = -1; |
| 9 var suggestions = ["result 1", "result 2", "result 3"]; | 9 var suggestions = ["result 1", "result 2", "http://www.google.com"]; |
| 10 var suggestion; | 10 var suggestion; |
| 11 var behavior = 2; | 11 var behavior = 2; |
| 12 var onMostVisitedChangedCalls = 0; | 12 var onMostVisitedChangedCalls = 0; |
| 13 var mostVisitedItemsCount = 0; | 13 var mostVisitedItemsCount = 0; |
| 14 var firstMostVisitedItemId = 0; | 14 var firstMostVisitedItemId = 0; |
| 15 var onNativeSuggestionsCalls = 0; | 15 var onNativeSuggestionsCalls = 0; |
| 16 var onChangeCalls = 0; | 16 var onChangeCalls = 0; |
| 17 var submitCount = 0; |
| 17 | 18 |
| 18 function getApiHandle() { | 19 function getApiHandle() { |
| 19 if (window.navigator && window.navigator.searchBox) | 20 if (window.navigator && window.navigator.searchBox) |
| 20 return window.navigator.searchBox; | 21 return window.navigator.searchBox; |
| 21 if (window.chrome && window.chrome.searchBox) | 22 if (window.chrome && window.chrome.searchBox) |
| 22 return window.chrome.searchBox; | 23 return window.chrome.searchBox; |
| 23 return null; | 24 return null; |
| 24 } | 25 } |
| 25 | 26 |
| 26 function getNewTabPageHandle() { | 27 function getNewTabPageHandle() { |
| 27 if (window.navigator && window.navigator.embeddedSearch && | 28 if (window.navigator && window.navigator.embeddedSearch && |
| 28 window.navigator.embeddedSearch.newTabPage) | 29 window.navigator.embeddedSearch.newTabPage) |
| 29 return window.navigator.embeddedSearch.newTabPage; | 30 return window.navigator.embeddedSearch.newTabPage; |
| 30 if (window.chrome && window.chrome.embeddedSearch && | 31 if (window.chrome && window.chrome.embeddedSearch && |
| 31 window.chrome.embeddedSearch.newTabPage) | 32 window.chrome.embeddedSearch.newTabPage) |
| 32 return window.chrome.embeddedSearch.newTabPage; | 33 return window.chrome.embeddedSearch.newTabPage; |
| 33 return null; | 34 return null; |
| 34 } | 35 } |
| 35 | 36 |
| 36 function handleNativeSuggestions() { | 37 function handleNativeSuggestions() { |
| 37 onNativeSuggestionsCalls++; | 38 onNativeSuggestionsCalls++; |
| 38 // Showing the loader at 100% height. | 39 // Showing the loader at 100% height. |
| 39 apiHandle.showOverlay(); | 40 apiHandle.showOverlay(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 function handleSubmit() { | 43 function handleSubmit() { |
| 43 location.hash = 'q=' + encodeURIComponent(apiHandle.value); | 44 location.hash = 'q=' + encodeURIComponent(apiHandle.value); |
| 45 submitCount++; |
| 44 } | 46 } |
| 45 | 47 |
| 46 function handleOnChange() { | 48 function handleOnChange() { |
| 47 onChangeCalls++; | 49 onChangeCalls++; |
| 48 savedUserText = apiHandle.value; | 50 savedUserText = apiHandle.value; |
| 49 suggestionIndex = -1; | 51 suggestionIndex = -1; |
| 50 apiHandle.setAutocompleteText(suggestion, behavior); | 52 apiHandle.setAutocompleteText(suggestion, behavior); |
| 51 } | 53 } |
| 52 | 54 |
| 53 function nextSuggestion() { | 55 function nextSuggestion() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 114 } |
| 113 | 115 |
| 114 setUp(); | 116 setUp(); |
| 115 | 117 |
| 116 </script> | 118 </script> |
| 117 </head> | 119 </head> |
| 118 <body> | 120 <body> |
| 119 <h1>Instant</h1> | 121 <h1>Instant</h1> |
| 120 </body> | 122 </body> |
| 121 </html> | 123 </html> |
| OLD | NEW |