<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Pictures</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=panoramio"></script>
<script type="text/javascript">
function getPos(){};
function ParseParams(urlParams){
urlParams= urlParams||{};
var e,a= /\+/g,
r=/([^&=]+)=?([^&=]*)/g,
d=function(s){return decodeURIComponent(s.replace(a," "));},
q=window.location.search.substring(1);
while(e=r.exec(q))
urlParams[d(e[1])]=d(e[2]);
return urlParams;
};
function initialize(urlParams){
var pos = new google.maps.LatLng(urlParams.lat,urlParams.lng);
var myOptions = {
zoom: Number(urlParams.zoom),
center: pos,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// add panoramio layers, either users or tags
google.maps.Map.prototype.addLayers = function(paramsString, panoSetFn){
if(paramsString){// maybe don't add any at all
paramsString.split(",").forEach(function(param){// comma separated list
var panoramioLayer = new google.maps.panoramio.PanoramioLayer();
panoramioLayer.setMap(this);
panoSetFn.call(panoramioLayer,param);
}, this);
}
}
// useful fn to find location from browser's address line
getPos = function(){return "lat="+map.center.lat().toFixed(6)
+"&lng="+map.center.lng().toFixed(6)+"&zoom="+map.zoom;}
var map_canvas = document.getElementById("map_canvas");
var map = new google.maps.Map(map_canvas, myOptions);
map.addLayers(urlParams.tag, google.maps.panoramio.PanoramioLayer.prototype.setTag);
map.addLayers(urlParams.user, google.maps.panoramio.PanoramioLayer.prototype.setUserId);
}
</script>
</head>
<body onload="initialize(ParseParams({lat:51,lng:0,zoom:10}))">
<div id="map_canvas"></div>
</script>
</body>
</html> <iframe style="margin: 10px"
src="p1.html?lat=51&lng=0&zoom=10&user=2419040,1424012"
frameborder="0" width="400" height="400" marginwidth="0" marginheight="0"> </iframe> // fix the clipping of images in pop-up bug (possibly change title!)
google.maps.event.addListener(panoramioLayer, 'click', function(event){
var height = event.featureDetails.aspectRatio>1?240/event.featureDetails.aspectRatio:240;
var width = event.featureDetails.aspectRatio>1?240:240*event.featureDetails.aspectRatio;
event.infoWindowHtml=event.infoWindowHtml.replace("width: 300px; height: 180px;",
"width: "+width.toFixed()+"px;height: "
+height.toFixed()+"px;margin-left:auto; margin-right:auto;");
});
var panoramioNotice = document.getElementById('panoramio_Notice');
map.controls[google.maps.ControlPosition.BOTTOM].push(panoramioNotice);
<div id="panoramio_Notice" style="overflow-y: auto;overflow-x: hidden;width: 300px;font-size: 12px;font-family: Ariel;"><a href="http://www.panoramio.com" target="_blank"><img src="http://www.panoramio.com/img/header-logo.png" height="12"></a>Photos copyright their owners</div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Pictures</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=panoramio"></script>
<script type="text/javascript">
function getPos(){};// declare global function defined later
function ParseParams(urlParams){
urlParams= urlParams||{};
var e,a= /\+/g,
r=/([^&=]+)=?([^&=]*)/g,
d=function(s){return decodeURIComponent(s.replace(a," "));},
q=window.location.search.substring(1);
while(e=r.exec(q))
urlParams[d(e[1])]=d(e[2]);
return urlParams;
};
function initialize(urlParams){
var myOptions = {
zoom: Number(urlParams.zoom),
center: new google.maps.LatLng(urlParams.lat, urlParams.lng),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// add panoramio layers, either users or tags, panoSetFn="setUserId" or "setTag"
google.maps.Map.prototype.addLayers = function(paramsString, panoSetFn){
if(paramsString){// maybe don't add any at all
paramsString.split(",").forEach(function(param){// comma separated list
var panoramioLayer = new google.maps.panoramio.PanoramioLayer();
panoramioLayer.setMap(this);
panoramioLayer[panoSetFn](param);
// fix the clipping of images in pop-up bug (possibly change title!)
google.maps.event.addListener(panoramioLayer, 'click', function(event){
var height = event.featureDetails.aspectRatio>1?240/event.featureDetails.aspectRatio:240;
var width = event.featureDetails.aspectRatio>1?240:240*event.featureDetails.aspectRatio;
event.infoWindowHtml=event.infoWindowHtml.replace("width: 300px; height: 180px;",
"width: "+width.toFixed()+"px;height: "
+height.toFixed()+"px;margin-left:auto; margin-right:auto;");
});
}, this);// this = map, see map.addLayers
}
}
// useful fn to find location from browser's address line
getPos = function(){return "lat="+map.center.lat().toFixed(6)
+"&lng="+map.center.lng().toFixed(6)+"&zoom="+map.zoom;}
var mapCanvas = document.getElementById("map_Canvas");
var map = new google.maps.Map(mapCanvas, myOptions);
map.addLayers(urlParams.tag, "setTag");
map.addLayers(urlParams.user, "setUserId");
// place copyright notice on top of map
var panoramioNotice = document.getElementById('panoramio_Notice');
map.controls[google.maps.ControlPosition.BOTTOM].push(panoramioNotice);
}
</script>
</head>
<body onload='initialize(ParseParams({lat:51.497059,lng:-0.091668,zoom:12}))'>
<div id="map_Canvas"></div>
<div id="panoramio_Notice" style="overflow-y: auto;overflow-x: hidden;width: 300px;font-size: 12px;font-family: Ariel;">
<a href="http://www.panoramio.com" target="_blank">
<img src="http://www.panoramio.com/img/header-logo.png" height="12"></a>Photos copyright their owners</div>
</body>
</html>