Team:UCL London/Search

From 2010.igem.org

(Difference between revisions)
 
(2 intermediate revisions not shown)
Line 3: Line 3:
<link rel="stylesheet" href="http://www.google.com/cse/style/look/greensky.css" type="text/css" />
<link rel="stylesheet" href="http://www.google.com/cse/style/look/greensky.css" type="text/css" />
-
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
+
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
     <script type="text/javascript">
     <script type="text/javascript">
-
jQuery(document).ready(function() {
 
       google.load('search', '1');
       google.load('search', '1');
-
 
-
      /**
 
-
      * Extracts the users query from the URL.
 
-
      */
 
-
      function getQuery() {
 
-
        var url = '' + window.location;
 
-
        var queryStart = url.indexOf('?') + 1;
 
-
        if (queryStart > 0) {
 
-
          var parts = url.substr(queryStart).split('&');
 
-
          for (var i = 0; i < parts.length; i++) {
 
-
            if (parts[i].length > 2 && parts[i].substr(0, 2) == 'q=') {
 
-
              return decodeURIComponent(
 
-
                  parts[i].split('=')[1].replace(/\+/g, ' '));
 
-
            }
 
-
          }
 
-
        }
 
-
        return '';
 
-
      }
 
       function onLoad() {
       function onLoad() {
-
 
+
        // Create a custom search control that uses a CSE restricted to
-
         var customSearchControl = new google.search.CustomSearchControl('015037489037541248416:puabtvcdnqy');
+
        // code.google.com
 +
         var customSearchControl = new google.search.CustomSearchControl(
 +
            '015037489037541248416:puabtvcdnqy');
 +
 
         var drawOptions = new google.search.DrawOptions();
         var drawOptions = new google.search.DrawOptions();
         drawOptions.setAutoComplete(true);
         drawOptions.setAutoComplete(true);
 +
 +
        // Draw the control in content div
         customSearchControl.draw('results', drawOptions);
         customSearchControl.draw('results', drawOptions);
 +
        // Run a query
         customSearchControl.execute(getQuery());
         customSearchControl.execute(getQuery());
       }
       }
       google.setOnLoadCallback(onLoad);
       google.setOnLoadCallback(onLoad);
-
});
 
     </script>
     </script>
 +
     <div id="results">Loading...</div>
     <div id="results">Loading...</div>
 +
 +
</html>
</html>
{{:Team:UCL_London/templates/v2/footerFullWidth}}
{{:Team:UCL_London/templates/v2/footerFullWidth}}

Latest revision as of 14:52, 29 August 2010

UCL IGEM 2010

RETURN TO IGEM 2010

Loading...

Retrieved from "http://2010.igem.org/Team:UCL_London/Search"