Open map
This is a google map where you decide
what to do when someone clicks on it. Another way, this is an effort
to ease the development of maps and encourage their use as an
interface for web apps. That is, instead of using a text input
or select box, why not a map? So, I've abstracted out
the input interface portion of the map (i.e. the grunt work)
and left a hole for specifying interesting behavior on a mouse click.
The short: You supply a little bit of javascript that will get executed on every mouse click as a CGI variable. Here are two examples, the first simply prints hello on every click, the second prints the location on which you clicked. To get a feeling, I've clearly shown the full URL.
You can also type this code directly into the text box below the map and then click Set.
Usage
The long: To use this map you need to implement some behavior (as a string of
javascript as a CGI variable called onClick) for every
mouse click. This code has the following context:
- There is a version 2 Google Map called
map. - There a variable of type
Jeff.LocationcalledlocwhereJeff.Locationrepresents a locaiton with city, state, and zipcode, and has the following interface:// Void -> String[city]
If you don't undertstand this notation read HTDP, but, for example, the first one says "
getCity
// Void -> String[state]
getState
// Void -> String[zip]
getZip
// Void -> String[description]
toString
getCityis a function that takes no arguments and returns a String representing the city".
XSS
Yes, yes, this leaves a huge hole for cross site scripting. So, you can't use double-quotes in your code, nor can you escape at the end of a string, when passing the code via CGI. You can use these characters when simply typing into the text box below the map.
Short usage
So.......... to use
- Write some javascript, say code
- Pass that code as the value of the
onClickvariable to this page, ashttp://jeffpalm.com/openmap/?onClick=code
