Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="http://www.google.com/jsapi" type="text/javascript"></script>
- <script type="text/javascript">
- 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][0] == 'q') {
- return unescape(parts[i].split('=')[1]);
- }
- }
- }
- return '';
- }
- function onLoad() {
- // Create a custom search control that uses a CSE restricted to
- // code.google.com
- // var customSearchControl = new google.search.CustomSearchControl( '012157912978810372049:-cv6ao3zqua');
- // REMOVED, TRYING TO REPLACE WITH TABS
- // Set drawing options to use our hidden input box.
- // var drawOptions = new google.search.DrawOptions();
- //drawOptions.setInput(document.getElementById('hidden-input'));
- // Draw the control in content div
- //customSearchControl.draw('results', drawOptions);
- //ADDED from http://www.google.com/uds/samples/apidocs/tabbed.html
- // create a tabbed mode search control
- var tabbed = new google.search.SearchControl();
- tabbed.addSearcher(new google.search.LocalSearch());
- tabbed.addSearcher(new google.search.WebSearch());
- tabbed.addSearcher(new google.search.BlogSearch());
- tabbed.addSearcher(new google.search.NewsSearch());
- tabbed.addSearcher(new google.search.BookSearch());
- tabbed.addSearcher(new google.search.PatentSearch());
- // draw in tabbed layout mode
- var drawOptions = new google.search.DrawOptions();
- drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
- tabbed.draw(document.getElementById("search_control_tabbed"), drawOptions);
- // RESUME original script
- // Run a query
- // alert(getQuery())
- tabbed.execute(getQuery());
- }
- google.setOnLoadCallback(onLoad);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment