Skip to content

Instantly share code, notes, and snippets.

/x
Created Apr 17, 2009

Embed
What would you like to do?
/* Socialight command. */
function getData(kmlUrl) {
return "var tURL = '" + kmlUrl + "'; " + <r><![CDATA[
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Sicialight KML Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAxf7TtjMwMjT9Hs4imJPyFBR26EVGtzYpOEGW6W2HpjrJiRKlLRTObx8hZ3b0zk-i0Neo8pqpkqDZQA" type="text/javascript">
</script>
<script type="text/javascript">
var map;
var geoXml;
function initialize() {
if (GBrowserIsCompatible()) {
geoXml = new GGeoXml(tURL);
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(41.875696,-87.624207), 11);
map.addControl(new GLargeMapControl());
map.addControl(new GLargeMapControl());
map.addOverlay(geoXml);
}
}
</script>
<body onload="initialize()">
<div id="map_canvas" style="width: 640px; height: 480px; float:left; border: 1px solid black;"></div>
</body>
</html>
]]></r>;
}
CmdUtils.CreateCommand({
name: "socialight",
icon: "http://socialight.com/favicon.ico",
homepage: "http://socialight.com/",
author: { name: "Michele Mostarda", email: "michele.mostarda@gmail.com"},
license: "GPL",
description: "Socialight search command.",
help: "socialight <address>",
takes: {"address": noun_arb_text},
preview: function( pblock, input ) {
pblock.innerHTML = "socialight <address>";
},
execute: function(address) {
CmdUtils.geocodeAddress(
address.html,
function(points) {
var url = "http://socialight.com/api/layer?appid=9d81d60c7923d62dc715d275e2ec7b65e8deba1c&latitude=${lat}&longitude=${lon}&limit=10&format=kml";
var localizedUrl = CmdUtils.renderTemplate(url, {"lat": points[0].lat , "lon" : points[0].lon });
Utils.openUrlInBrowser(localizedUrl);
Utils.reportWarning("getData(localizedUrl): " + getData(localizedUrl));
var win = window.open('chrome:',"KML Map","height=480,width=640,top=10,left=10,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
win.document.write( getData(localizedUrl) );
}
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.