page.title=Search Results | |
@jd:body | |
<script src="http://www.google.com/jsapi" type="text/javascript"></script> | |
<script type="text/javascript"> | |
google.load('search', '1'); | |
function OnLoad() { | |
document.getElementById("search_autocomplete").style.color = "#000"; | |
// create search control | |
searchControl = new google.search.SearchControl(); | |
// use our existing search form and use tabs when multiple searchers are used | |
drawOptions = new google.search.DrawOptions(); | |
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED); | |
drawOptions.setInput(document.getElementById("search_autocomplete")); | |
// configure search result options | |
searchOptions = new google.search.SearcherOptions(); | |
searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN); | |
searchOptions.setRoot(document.getElementById("leftSearchControl")); | |
// configure searcher options | |
searcher = new google.search.WebSearch(); | |
searcher.setUserDefinedLabel("Android Developers"); | |
searcher.setSiteRestriction("001283715400630100512:ggqrtvkztwm"); | |
searchControl.addSearcher(searcher, searchOptions); | |
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); | |
searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); | |
searchControl.setNoResultsString(google.search.SearchControl.NO_RESULTS_DEFAULT_STRING); | |
// upon ajax search, refresh the url and search title | |
searchControl.setSearchStartingCallback(this, function(control, searcher, query) { | |
temp = location.href.split('#'); | |
url = temp ? temp[0] : location.href; | |
location.href = url + '#q=' + query; | |
document.getElementById("searchTitle").innerHTML = "search results for <em>" + query + "</em>" | |
}); | |
searchControl.draw(null, drawOptions); | |
// execute a search upon page load, from url hash query | |
if (location.href.indexOf("#q=") != -1) { | |
url = location.href.split("#q="); | |
searchControl.execute(decodeURI(url[1])); | |
} | |
} | |
google.setOnLoadCallback(OnLoad, true); | |
</script> | |
<div id="mainBodyFixed" style="width:auto; margin:20px"> | |
<h2 id="searchTitle">search results</h2> | |
<img src="{@docRoot}assets/images/hr_gray_main.jpg" /> | |
<div><br /></div> | |
<div id="leftSearchControl" class="search-control">Loading...</div> | |
</div> |