Project Description
This plug-in encapsulates part of the Google AJAX Search API to streamline the process of Google Search integration.

This project represents my fulfillment of a computer science major at DePauw University.

The Google Search Services plug-in for jQuery is designed to unify the power of jQuery with the convenience of Google Ajax Search Services. In order to use this plug-in, you must already have access to a copy of jQuery (1.4.2+). In addition, the Google Search Services source code that I’ve created is available at gss.codeplex.com for free download. In your web page, you must correctly reference both jQuery and GSS. The scripts will look something like this:

<script src="http://www.google.com/jsapi?key=yourAPIkey" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
	google.load("search", "1");
	google.load("jquery", "1");
</script>
<script src="jquery.gss-0.1.3.js" type="text/javascript"></script>


This plug-in makes setting up a Google Search in your webpage as easy as:

$(“#myDiv”).GoogleWebSearch();

instead of

function OnLoad()  {
     // Create a search control
     var theSearchControl = new google.search.SearchControl();

     //create a searcher
     var theWebSearch = new google.search.WebSearch();

     //add searcher to search control
     theSearchControl.addSearcher(theWebSearch);

     // Tell the searcher to draw itself and tell it where to attach
     theSearchControl.draw(document.getElementById("searchcontrol"));

     // Execute an inital search
     theSearchControl.execute("Google");
}
google.setOnLoadCallback(OnLoad); 


However, there are also a number of modifiers that can be passed into the jQuery object in order to customize the look and feel of your website. For example, the following will execute the search query “DePauw University” on the Google Web Search immediately when page is loaded.

$(“#myDiv”).GoogleWebSearch({ execute : “DePauw University” });


Below is a list of all the possible modifiers and the appropriate arguments for them. Conveniently, you can string any number of modifiers together in order to customize the look, feel, and logic of your Google Search. Individual modifiers simply need to be separated by commas as follows.

$("#myDiv").GoogleWebSearch({
	noResultsString : "No results found...",
	drawMode : "tabbed",
	expandMode: "partial",
	searchFormRoot : $("#myOtherDiv")[0]
}); 


Presumably, you will run into problems. This is why I would suggest using Mozilla Firefox (http://www.firefox.com) coupled with Firebug (http://getfirebug.com), which is a very handy web development tool.
_

Thanks!

Andrew
porter.andrewsteven@gmail.com

Last edited Oct 31, 2010 at 3:35 PM by asporter, version 14