This update to the google search adds Google's Local search (http://local.google.com) to search for businesses and services near a given location. Sorry, it only works for addresses in the USA right now. For the sake of simplicity, I commandeered the /local switch and changed the Locale switch to /locale. Hopefully, this isn't too much of an incovenience for anyone accustomed to the original /local(e) switch. I have tested this search to my own satisfaction, but someone please double check my work before its checked into CVS.
Regards, Gregory Krohne -------------------------------------- Protect yourself from spam, use http://sneakemail.com -- cut here gg.xml -- <search function="gg"> <name>Google</name> <description> Google is reputed to be the web's fastest and most versatile search engine.<br/> <div class="helpboxDescLabels">Switches:</div> <table class="helpboxDescTable"> <tr><td>/ifl</td><td> - </td><td>"I'm Feeling Lucky": Go directly to Google's top-ranked result.</td></tr> <tr><td>/advanced</td><td> - </td><td>Use the Google Advanced Search page.</td></tr> <tr><td>/groups</td><td> - </td><td>Search Google's newsgroup archive.</td></tr> <tr><td>/directory</td><td> - </td><td>Search Google's copy of the DMOZ open directory.</td></tr> <tr><td>/images</td><td> - </td><td>Search for images.</td></tr> <tr><td>/news</td><td> - </td><td>Search for news (<i>warning : still in beta, .com/english only</i>).</td></tr> <tr><td>/froogle</td><td> - </td><td>Find products for sale online(<i>warning : still in beta, .com/english only</i>).</td></tr> <tr><td>/glossary</td><td> - </td><td>Find definitions for words, phrases and acronyms(<i>warning : still in beta, .com/english only</i>).</td></tr> <tr><td>/define</td><td> - </td><td>Find Google's own definitions for words, phrases and acronyms(<i>warning : english only</i>).</td></tr> <tr><td>/keys</td><td> - </td><td>Navigate search results without using your mouse (<i>warning : still in beta, .com/english only</i>).</td></tr> <tr><td>/since:days</td><td> - </td><td>Search pages based on when they were indexed. Use either a number to specify when, or <div style="padding: 0 0 0 20px"> /since:t - indexed today<br/> /since:y - indexed yesterday<br/> /since:w - indexed in the last 7 days<br/> /since:m - indexed in the last 30 days </div> </td></tr> <tr><td>/cache</td><td> - </td><td>Given a URL, loads Google's cached copy of the web page.</td></tr> <tr><td>/related</td><td> - </td><td>Given a URL, finds other sites closely related.</td></tr> <tr><td>/link</td><td> - </td><td>Given a URL, finds other sites that link to it.</td></tr> </table> <div class="helpboxDescLabels">Locales:</div> <table class="helpboxDescTable"> <tr><td>/locale</td><td> - </td><td>Limits search results to the specified locale.</td></tr> <tr><td>/canada</td><td> - </td><td>Use the localized canadian version of Google.</td></tr> <tr><td>/deutschland</td><td> - </td><td>Use the localized german version of Google.</td></tr> <tr><td>/france</td><td> - </td><td>Use the localized french version of Google.</td></tr> <tr><td>/italia</td><td> - </td><td>Use the localized italian version of Google.</td></tr> <tr><td>/uk</td><td> - </td><td>Use the localized United Kingdom version of Google.</td></tr> </table> <div class="helpboxDescLabels">Language:</div> <table class="helpboxDescTable"> <tr><td colspan="3">Display Google tips and messages in...</td></tr> <tr><td>/language:de</td><td> - </td><td>german</td></tr> <tr><td>/language:es</td><td> - </td><td>spanish</td></tr> <tr><td>/language:fr</td><td> - </td><td>french</td></tr> <tr><td>/language:it</td><td> - </td><td>italian</td></tr> <tr><td colspan="3">and many more... see <a href="http://www.google.com/help/customize.html#displang" target="_new">www.google.com/help/customize.html#displang</a></td></tr> </table> <div class="helpboxDescLabels">Local: (USA only)</div> <table class="helpboxDescTable"> <tr><td>/local</td><td> - </td><td>Find local businesses and services</td></tr> <tr><td>/near:location</td><td> - </td><td>Use address, city and state, or zip separated by underscores</td></tr> <tr><td>near location</td><td> - </td><td>Use address separated by spaces</td></tr> <tr><td>/save</td><td> - </td><td>Save the /near address for next time</td></tr> </table> <div class="helpboxDescLabels">Examples:</div> <table class="helpboxDescTable"> <tr><td>gg dqsd /images</td></tr> <tr><td>gg tony blair /uk /directory</td></tr> <tr><td>gg /froogle cd clock radio</td></tr> <tr><td>gg /glossary wrt</td></tr> <tr><td>gg /define wrt</td></tr> <tr><td>gg /local /save hotels near 30 Rockefeller Center, New York, NY</td></tr> <tr><td>gg /local hot dogs</td></tr> <tr><td>gg /local /save high school /near:90210</td></tr> <tr><td>gg /local mall</td></tr> </table> </description> <category>Search the Web</category> <link>http://www.google.com/</link> <contributor>Ryan Edwards, David Bau, news and language switches by MLL, local switches by Gregory Krohne</contributor> <form name="ggf" action="http://www.google.com/search" method="get"> <input type="hidden" name="hl" value=""/> <input type="hidden" name="cat" value=""/> <input type="hidden" name="meta" value=""/> <input type="hidden" name="q"/> </form> <form name="ggf_adv" action="http://www.google.com/advanced_search" method="get"> <input type="hidden" name="hl" value=""/> <input type="hidden" name="q"/> </form> <form name="ggf_ifl" action="http://www.google.com/search" method="get"> <input type="hidden" name="hl" value=""/> <input type="hidden" name="q"/> <input type="hidden" name="meta" value=""/> <input type="hidden" name="btnI" value="I'm Feeling Lucky"/> </form> <form name="ggf_image" action="http://images.google.com/images" method="get"> <input type="hidden" name="hl" value=""/> <input type="hidden" name="q"/> </form> <form name="ggf_groups" action="http://groups.google.com/groups" method="get"> <input type="hidden" name="hl" value=""/> <input type="hidden" name="q"/> </form> <form name="ggf_news" action="http://news.google.com/news" method="get"> <!-- commented out for test <input type="hidden" name="hl" value="en"/> --> <input type="hidden" name="hl" value=""/> <input type="hidden" name="q"/> </form> <form name="ggf_fresh" action="http://www.researchbuzz.com/cgi-bin/goofresh.cgi" method="get"> <input type="hidden" Name="query" /> <input type="hidden" name="datemod" value="0" /> </form> <form name="ggf_froogle" method="get" action="http://froogle.google.com/froogle"> <input type="hidden" name="q" value="" /> </form> <form name="ggf_glossary" method="get" action="http://labs.google.com/glossary"> <input type="hidden" name="q" value="" /> </form> <form name="ggf_keys" method="get" action="http://labs.google.com/cgi-bin/keys"> <input type="hidden" name="q" value="" /> </form> <form name="ggf_local" method="get" action="http://local.google.com/local"> <input type="hidden" name="sc" /> <input type="hidden" name="q" value="" /> <input type="hidden" name="near" /> <input type="hidden" name="sl" /> </form> <script><![CDATA[ function gg(q) //by MLL: warning : news service is still in beta stage, so URLs below may change { var args = parseArgs(q, "ifl, advanced, groups, directory, images, news, since, cache, related, link, froogle, glossary, define, keys, local, near, save, locale, canada, deutschland, france, italia, uk, language"); var mode, locale, locale_meta = "", locale_tld = "com", msglang = "", save_location, near_location; if( nullArgs( "gg", q ) ) return false; // Establish the locale and mode the search will run in. if( args.switches.length > 0 ) { for( var j=0; j<args.switches.length; j++ ) { switch( args.switches[j].name ) { case "canada": locale_tld = "ca"; locale_meta = "cr=countryCA"; break; case "deutschland": locale_tld = "de"; locale_meta = "cr=countryDE"; break; case "france": locale_tld = "fr"; locale_meta = "cr=countryFR"; break; case "italia": locale_tld = "it"; locale_meta = "cr=countryIT"; break; case "uk": locale_tld = "co.uk"; locale_meta = "cr=countryUK|countryGB"; break; case "locale": locale = true; break; case "language": msglang = args.switch_val["language"]; break; case "since": break; case "save": save_location = true; break; case "near": re = /_/g; near_location = args.switch_val["near"].replace(re, ' '); break; default: if(mode) // multiple 'modes' have been specified { nullArgs("gg","?"); return false; } else mode = args.switches[j].name; break; } } } // Change the form data to use the correct locale document.ggf.action = document.ggf_ifl.action = "http://www.google." + locale_tld + "/search"; document.ggf_adv.action = "http://www.google." + locale_tld + "/advanced_search"; document.ggf_image.action = "http://images.google." + locale_tld + "/images"; document.ggf_groups.action = "http://groups.google." + locale_tld + "/groups"; document.ggf_news.action = "http://news.google." + locale_tld + "/news"; // If the user specified to search localized content only, restrict it now. if(locale) document.ggf.meta.value = document.ggf_ifl.meta.value = locale_meta; else document.ggf.meta.value = document.ggf_ifl.meta.value = ""; // No parameters, so go to the appropriate web page. if( args.q == "" ) { var googleURL = "http://www.google." + locale_tld; switch( mode ) { case "ifl": googleURL = "http://www.google." + locale_tld + "/help/features.html#lucky"; break; case "advanced": googleURL = "http://www.google." + locale_tld + "/advanced_search"; break; case "images": googleURL = "http://images.google." + locale_tld; break; case "directory": googleURL = "http://images.google." + locale_tld + "/dirhp"; break; case "groups": googleURL = "http://www.google." + locale_tld + "/grphp"; break; case "news": googleURL = "http://www.google." + locale_tld + "/news"; break; case "froogle": googleURL = "http://froogle.google.com/froogle"; break; case "glossary": googleURL = "http://labs.google.com/glossary"; break; case "define": googleURL = "http://www.google." + locale_tld + "/help/operators.html#define"; break; case "keys": googleURL = "http://labs.google.com/keys"; break; case "local": googleURL = "http://local.google.com/local"; break; default: } openSearchWindow( googleURL ); return; } else { //apply the daterange specification if( args.switch_val["since"] == "" ) { nullArgs("gg","?"); return false; } if( typeof args.switch_val["since"] != "undefined" ) { var today = new Date(); var todayj = julian(today.getYear(),today.getMonth()+1,today.getDate()); var deltadays; switch ( args.switch_val["since"] ) { case "t": deltadays = 0; break; case "y": deltadays = 1; break; case "w": deltadays = 7; break; case "m": deltadays = 30; break; default: deltadays = args.switch_val["since"]; break; } if( isNaN(deltadays) ) { nullArgs("gg","?"); return false; } var sincej = todayj - deltadays; args.q = args.q + " daterange:" + sincej + "-" + todayj; } if( mode ) { // Perform a validity check on the specified switch if((mode == "related" || mode == "cache" || mode == "link") && !isURL(args.q)) { nullArgs("gg","?"); return false; } switch( mode ) { case "ifl": document.ggf_ifl.q.value = args.q; document.ggf_ifl.hl.value = msglang; submitForm(ggf_ifl); break; case "advanced": document.ggf_adv.q.value = args.q; document.ggf_adv.hl.value = msglang; submitForm(ggf_adv); break; case "directory": document.ggf.q.value = args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = "gwd/Top"; submitForm(ggf); break; case "images": document.ggf_image.q.value = args.q; document.ggf_image.hl.value = msglang; submitForm(ggf_image); break; case "related": document.ggf.q.value="related:" + args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = ""; submitForm(ggf); break; case "cache": document.ggf.q.value="cache:" + args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = ""; submitForm(ggf); break; case "link": document.ggf.q.value="link:" + args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = ""; submitForm(ggf); break; case "groups": document.ggf_groups.q.value = args.q; document.ggf_groups.hl.value = msglang; submitForm(ggf_groups); break; case "news": document.ggf_news.q.value = args.q; document.ggf_news.hl.value = msglang; submitForm(ggf_news); break; case "froogle": document.ggf_froogle.q.value = args.q; submitForm(ggf_froogle); break; case "glossary": document.ggf_glossary.q.value = args.q; submitForm(ggf_glossary); break; case "define": document.ggf.q.value = "define:" + args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = ""; submitForm(ggf); break; case "keys": document.ggf_keys.q.value = args.q; submitForm(ggf_keys); break; case "local": if ( typeof near_location == "undefined" ) { parsedquery = args.q.split(" near "); if (typeof parsedquery[1] != 'undefined') { search_for = parsedquery[0]; near_location = parsedquery[1]; } else { search_for = parsedquery[0]; } } else { search_for = args.q; } document.ggf_local.q.value = search_for; if ( typeof near_location != 'undefined' ) document.ggf_local.near.value = near_location; if (save_location) { document.ggf_local.sl.value = 1; document.ggf_local.sc.value = 1; } submitForm(ggf_local); break; } } else { document.ggf.q.value = args.q; document.ggf.hl.value = msglang; document.ggf.cat.value = ""; submitForm(ggf); } } } function julian(Y,M,D) { //inspired from http://pacific.commerce.ubc.ca/xr/julian.html //(did not check it toroughly, but seems to work) with (Math) { jd=367*Y-floor(7*(Y+floor((M+9)/12))/4) -floor(3*(floor((Y+(M-9)/7)/100)+1)/4) +floor(275*M/9)+D+1721028; } return jd; } function gg_keypressHook(keypressEvent) { switch(keypressEvent.keyCode){ //CTRL+D doesn't work because it's trapped by IE //case 4: // CTRL+D : Definitions // return gg(document.deff.q.value + " /define"); case 6: // CTRL+F : Froogle return gg(document.deff.q.value + " /froogle"); case 9: // CTRL+I : Images return gg(document.deff.q.value + " /images"); case 12: // CTRL+L : I'm Feeling Lucky return gg(document.deff.q.value + " /ifl"); //CTRL+N doesn't work because it's trapped by IE //case 14: // CTRL+N : News // return gg(document.deff.q.value + " /news"); case 19: // CTRL+S : Stock Quotes return gg("stocks: " + document.deff.q.value); case 20: // CTRL+T : Thesaurus return gg(document.deff.q.value + " /glossary"); case 21: // CTRL+U : Google Groups return gg(document.deff.q.value + " /groups"); default: return false; } } function gg_keypressHook_okp() { if (okp() == false) { return false; } else { return (gg_keypressHook(window.event) == false) ? true : false; } } //register google hot-keys if (typeof registerKeypressHook == "function") { registerKeypressHook(gg_keypressHook); } else { document.onkeypress = gg_keypressHook_okp; } ]]></script> <copyright> Copyright (c) 2002 David Bau Distributed under the terms of the GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt) </copyright> </search> ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ To unsubscribe visit: https://lists.sourceforge.net/lists/listinfo/dqsd-users [EMAIL PROTECTED] http://sourceforge.net/mailarchive/forum.php?forum_id=8601