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

Unified 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: Added missing copyright license. Fixed bad indentation on search.js 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/static/js/article.js ('k') | chrome/common/extensions/docs/static/js/site.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/static/js/search.js
diff --git a/chrome/common/extensions/docs/static/js/search.js b/chrome/common/extensions/docs/static/js/search.js
index 9abcd07640cfd960b9fb4c7dc08b4acf232ba625..601689e5285c8b2844a7b06cfe1ffdc83df00c2b 100644
--- a/chrome/common/extensions/docs/static/js/search.js
+++ b/chrome/common/extensions/docs/static/js/search.js
@@ -1,55 +1,56 @@
- // Activate the search box:
- (function() {
- var form = document.getElementById('chrome-docs-cse-search-form');
- var searchInput = document.getElementById('chrome-docs-cse-input');
-
- var cx = '010997258251033819707:7owyldxmpkc';
-
- var gcse = document.createElement('script');
- gcse.type = 'text/javascript';
- gcse.async = true;
- gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
- '//www.google.com/cse/cse.js?cx=' + cx;
- var s = document.getElementsByTagName('script')[0];
- s.parentNode.insertBefore(gcse, s);
-
- var executeQuery = function(e) {
- var element = google.search.cse.element.getElement('results');
- if (searchInput.value == '') {
- element.clearAllResults();
- } else {
- element.execute(searchInput.value);
- }
- e.preventDefault();
- return true;
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Activate the search box:
+(function() {
+ var form = document.getElementById('chrome-docs-cse-search-form');
+ var searchInput = document.getElementById('chrome-docs-cse-input');
+
+ var cx = '010997258251033819707:7owyldxmpkc';
+
+ var gcse = document.createElement('script');
+ gcse.type = 'text/javascript';
+ gcse.async = true;
+ gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
+ '//www.google.com/cse/cse.js?cx=' + cx;
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(gcse, s);
+
+ var executeQuery = function(e) {
+ var element = google.search.cse.element.getElement('results');
+ if (searchInput.value == '') {
+ element.clearAllResults();
+ } else {
+ element.execute(searchInput.value);
}
+ e.preventDefault();
+ return true;
+ }
+
+ form.addEventListener('submit', executeQuery);
+
+ // Attach autocomplete to the search box
+ var enableAutoComplete = function() {
+ google.search.CustomSearchControl.attachAutoCompletionWithOptions(
+ cx, searchInput, form,
+ // set to true to prevent the search box form from being submitted, since
+ // the search control displaying the results is on the same page.
+ {'preferOnSubmitToSubmit': true}
+ );
+ };
+
+ var myAutocompleteCallback = function() {
+ // Search module is loaded.
+ if (document.readyState == 'complete') {
+ enableAutoComplete();
+ } else {
+ google.setOnLoadCallback(enableAutoComplete, true);
+ }
+ };
+
+ window.__gcse = {
+ callback: myAutocompleteCallback
+ };
- form.addEventListener('submit', executeQuery);
-
- // Attach autocomplete to the search box
- var enableAutoComplete = function() {
- console.log("running enableAutoComplete");
- google.search.CustomSearchControl.attachAutoCompletionWithOptions(
- cx, searchInput, form,
- // set to true to prevent the search box form from being submitted, since
- // the search control displaying the results is on the same page.
- {'preferOnSubmitToSubmit': true}
- );
- };
-
- var myAutocompleteCallback = function() {
- // Search module is loaded.
- if (document.readyState == 'complete') {
- enableAutoComplete();
- } else {
- google.setOnLoadCallback(enableAutoComplete, true);
- }
- };
-
- window.__gcse = {
- callback: myAutocompleteCallback
- };
-
- })();
-
- // End of autocomplete
+})();
« no previous file with comments | « chrome/common/extensions/docs/static/js/article.js ('k') | chrome/common/extensions/docs/static/js/site.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698