blob: 409b216d45b2181ff1ca46d7388f7d69480e0988 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
#map {
width: 512px;
height: 512px;
}
</style>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATfHumDbW3OmRByfquHd3SRTRERdeAiwZ9EeJWta3L_JZVS0bOBRQeZgr4K0xyVKzUdnnuFl8X9PX0w&sensor=false"
type="text/javascript"></script>
<script>
var maps_key = "ABQIAAAATfHumDbW3OmRByfquHd3SRTRERdeAiwZ9EeJWta3L_JZVS0bOBRQeZgr4K0xyVKzUdnnuFl8X9PX0w";
function gclient_geocode(address) {
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address, function(point) {
if (!point) {
console.log(address + " not found");
} else {
var latlng = point.toUrlValue();
var url = "http://maps.google.com/staticmap?center=" + latlng +
"&markers=" + latlng + "&zoom=14" +
"&size=512x512&sensor=false&key=" + maps_key;
var map = document.getElementById("map");
map.src = url;
}
});
}
function map() {
chrome.tabs.getSelected(null, function(tab) {
var port = chrome.tabs.connect(tab.id);
if (!port) {
console.log("no port");
} else {
port.onMessage.addListener(function(data) {
var address = data.values[0];
gclient_geocode(address);
});
port.postMessage({message: "hello tab: " + tab.id});
}
});
};
</script>
</head>
<body onload="map()">
<img id="map" onclick="window.close()">
</body>
|