home *** CD-ROM | disk | FTP | other *** search
- <search function="yp">
- <name>Yahoo! Yellow Pages</name>
- <description>Search Yahoo Yellow Pages
- <div class="helpboxDescLabels">Examples:</div>
- <table class="helpboxDescTable">
- <tr>
- <td>yp business" (uses personalization variables or last location)</td>
- </tr>
- <tr>
- <td>yp cubby, 1060 W. Addison Street, Chicago, IL</td>
- </tr>
- <tr>
- <td>yp cubby, 1060 W. Addison Street, Chicago IL</td>
- </tr>
- <tr>
- <td>yp cubby, Chicago, IL</td>
- </tr>
- <tr>
- <td>yp cubby, Chicago IL</td>
- </tr>
- <tr>
- <td>yp cubby, 60613</td>
- </tr>
- </table>
- </description>
- <category>People and Places</category>
- <link>http://yp.yahoo.com/</link>
- <form name="ypf" method="get" action="http://yp.yahoo.com/py/yploc.py">
- <input type="hidden" name="stp" value="a"/>
- <input type="hidden" name="clr" value="ypResults"/>
- <input type="hidden" name="stx" value=""/>
- <input type="hidden" name="addr_in" value=""/>
- <input type="hidden" name="csz_in" value=""/>
- <input type="hidden" name="country_in" value="us"/>
- <input type="hidden" name="newFL" value="NONE"/>
- <input type="hidden" name="submit_field" value="1"/>
- </form>
- <script><![CDATA[
-
- // TODO: Support Canada. Biggest annoyance is the user interface.
- // Best option seems like it would be to recognize Canadian
- // province names/abbreviations & post codes, and use that to
- // specify Canada, with the ability to override with a switch.
-
- // TODO: Support searches like "yp cubby, 1060 W. Addison St, 60613"
- // Probably distinguished by 3 argument case where last field is a zip
- // code (not a state) and second field has digits in it (to distinguish
- // from "yp cubby, Chicago IL, 60613".
-
- function yp(q) {
- document.ypf.submit_field.name = "submit";
-
- if (nullArgs("yp", q)) {
- return false;
- }
-
- if (q == "") {
- openSearchWindow("http://yp.yahoo.com");
- } else {
- var param = q.split(",");
-
- document.ypf.stx.value = param[0];
-
- // One parameter: fill in address from variables,
- // unless we don't have variables, in which case
- // don't change the address from last time used.
- if (param.length == 1) {
- var csz = "";
- if (typeof user_city != "undefined" && user_city != "" &&
- typeof user_state != "undefined" && user_state != "") {
- csz = user_city + " " + user_state;
- }
- if (typeof user_zip != "undefined" && user_zip != "") {
- if (csz != "") {
- csz = csz + " ";
- }
- csz = csz + user_zip;
- }
- if (csz != "") {
- document.ypf.csz_in.value = csz;
- }
- if (typeof user_address != "undefined" && user_address != "") {
- document.ypf.addr_in.value = user_address;
- } else if (csz != "") { // So we don't use an old address with constant city & state
- document.ypf.addr_in.value = "";
- }
- } else if (param.length == 2) {
- // Two parameters: Second must be city/state/zip
- document.ypf.addr_in.value = "";
- document.ypf.csz_in.value = param[1];
- } else if (param.length == 3) {
- // Three parameters: Tricky case; could be City, State or Addr, City State
- if (param[2].search(/^\s*\w+\s*$/) != -1) { // It's one word: a state
- document.ypf.addr_in.value = "";
- document.ypf.csz_in.value = param[1] + " " + param[2];
- } else {
- document.ypf.addr_in.value = param[1];
- document.ypf.csz_in.value = param[2];
- }
- } else if (param.length == 4) {
- // Four parameters: Must be Addr, City, State
- document.ypf.addr_in.value = param[1];
- document.ypf.csz_in.value = param[2] + " " + param[3];
- } else {
- // More than four: what to do??
- // Use last two or three for addr, city, state; concatentate the rest with commas for the query.
- var csz;
- csz = param.pop();
- if (csz.search(/^\s*\w+\s*$/) != -1) { // It's one word: a state
- csz = param.pop() + " " + csz;
- }
- document.ypf.csz_in.value = csz;
- document.ypf.addr_in.value = param.pop();
- document.ypf.stx.value = param.join(",");
- }
- submitForm(ypf);
- }
- }
- ]]></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>
-