Hello folks,
I updated viam.xml (attached) so that it works back again, unfortunately
I have no CVS access atm. Can somebody upload it for me & append
something in the changelog ?
TIA
MLL
<search function="viam">
<name>Maps with viamichelin.com</name>
<category>People and Places</category>
<contributor>MLL</contributor>
<link>http://www.viamichelin.com/</link>
<description>
Find a map to any place in Europe with viamichelin.com
<div class="helpboxDescLabels">Optional switch:</div>
<table class="helpboxDescTable">
<tr><td>/size:{0|100|25|5|1}</td><td> - </td><td>map size (in km). Defaults to 0 (automatic).</td></tr>
</table>
<div class="helpboxDescLabels">Examples:</div>
<table class="helpboxDescTable">
<tr><td>viam place Berland, Bordeaux</td></tr>
<tr><td>viam rimini /size:100</td></tr>
</table>
</description>
<form name="viamf"
method="get"
action="http://www.viamichelin.com/viamichelin/fra/dyn/controller/mapPerformPage">
<input type="hidden" name="strAddress" value="" />
<input type="hidden" name="strCP" value="" />
<input type="hidden" name="strLocation" value="" />
<input type="hidden" name="strCountry" value="EUR" />
</form>
<script><![CDATA[
function viam(q)
{
/*
todo:
- add support for their very powerful driving directions
(but wonder if it's worth it : *lots* of switches needed)
*/
var args = parseArgs(q, "size");
if( nullArgs("viam", args.q) )
return;
var size = "0";
if( !( typeof args.switch_val["size"] == "undefined" || args.switch_val["size"] == "" ) )
{
size=args.switch_val["size"];
}
// What follows is a fairly "ergonomic" parser for addresses I got & simplified from mp.xml.
var address = "";
var city = "";
// detect leading ### w w w st
var res = q.match(/^\s*(\d+(\s+\w+)+\s+(st|ave|rd|ln|dr|blvd|cir|ct|pkwy|pl|way|aly|pk|sq|ter|plz|rue|bd))[\s\.,;]*(.*)$/i);
if (res && res[1])
{
address = res[1];
city = res[4];
}
// detect trailing comma or semicolon; prefer this way of finding city
res = q.match(/[\.,;]\s*([^\d][^,;]+)[\s\.,;]*$/i);
if (res && res[1])
{
city = res[1];
address = q.substring(0, res.index);
}
// last resorts: we really want a city
if (city == "")
{
// drop requirement for street number and precise abbreviation and look for street
res = q.match(/^\s*((\w+\s+)+(st|ave|rd|ln|dr|blvd|cir|ct|pkwy|pl|way|aly|pk|sq|ter|plz|street|avenue|road|lane|drive|boulevard|circle|court|parkway|place|loop|alley|park|square|terrace|plaza|mall))[\s\.,;]*(.*)$/i);
if (res && res[1])
{
address = res[1];
city = res[4];
}
// has a number: city is last word
else if (q.match(/^\s*\d/))
{
res = q.match(/(\w+)[\s\.,;]*$/);
city = res[1];
address = q.substring(0, res.index);
}
// otherwise, looks like it doesn't have a street; city is whole thing
else
{
city = q;
address = "";
}
}
document.viamf.strAddress.value = address;
document.viamf.strLocation.value = city;
submitForm(viamf);
}
]]></script>
<copyright>
The following applies if this file is included and distributed with Dave's Quick Search Deskbar:
Copyright (c) 2002 David Bau; Distributed under the terms of the GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
</copyright>
<created_by>
This search file was initially created on 10/14/02 at 15:04:31
by Dave's Quick Search Deskbar Search Wizard version 0.9.1 (beta),
Copyright (c) 2002 Glenn Carr; Distributed under the terms of the GNU General Public License, Version 2
</created_by>
</search>