code cleaning
This commit is contained in:
@@ -118,6 +118,10 @@ oSpot.pageInit = function(asHash)
|
||||
oMarker.addListener('mouseout', function(){
|
||||
oInfoWindow.close(oMap, oMarker);
|
||||
});
|
||||
oMarker.addListener('click', function(){
|
||||
self.tmp('map').panTo(oMarker.getPosition());
|
||||
self.tmp('map').setZoom(15);
|
||||
});
|
||||
});
|
||||
|
||||
//Recenter map once loaded to be at the center of 70% (iMapRatio) of the page
|
||||
@@ -239,10 +243,10 @@ function getPost(asPost) {
|
||||
{
|
||||
case 'message':
|
||||
$Body = $('<div>')
|
||||
.append($('<p>').addIcon('fa-compass', true).append(asPost.latitude+' | '+asPost.longitude))
|
||||
.append($('<p>').addIcon('fa-compass', true).append('Latitude '+asPost.latitude+', Longitude '+asPost.longitude))
|
||||
.append($('<p>').addIcon('fa-clock-o', true).append(sAbsTime))
|
||||
.append(
|
||||
$('<img>', {'class':'staticmap', src:'https://maps.googleapis.com/maps/api/staticmap?center='+asPost.latitude+','+asPost.longitude+'&zoom=13&size=400x300&maptype=satellite&markers=color:green|label:|'+asPost.latitude+','+asPost.longitude+'&key='+self.vars('google_api')})
|
||||
$('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getStaticMapUrl(asPost.latitude, asPost.longitude)})
|
||||
.data('lat', asPost.latitude)
|
||||
.data('lng', asPost.longitude)
|
||||
.click(function(){
|
||||
@@ -260,8 +264,8 @@ function getPost(asPost) {
|
||||
break;
|
||||
case 'post':
|
||||
$Body = $('<div>')
|
||||
.append($('<p>', {'class':'message'}).text(asPost.post))
|
||||
.append($('<p>', {'class':'signature'}).text('-- '+asPost.name));
|
||||
.append($('<p>', {'class':'message'}).text(asPost.content))
|
||||
.append($('<p>', {'class':'signature'}).text('-- '+asPost.formatted_name));
|
||||
sClass = 'comment';
|
||||
break;
|
||||
case 'poster':
|
||||
@@ -278,10 +282,24 @@ function getPost(asPost) {
|
||||
.append($('<span>', {'class':'time', 'title':sAbsTime}).text(sRelTime)))
|
||||
.append($('<div>', {'class':'body'}).append($Body));
|
||||
|
||||
if(asPost.id) $Post.find('.index').append(' '+asPost.id);
|
||||
if(asPost.displayed_id) $Post.find('.index').append(' '+asPost.displayed_id);
|
||||
|
||||
//if(asPost.type=='picture' && asPost.rotate!='0') $Body.height($Image.height());
|
||||
|
||||
return $Post;
|
||||
}
|
||||
|
||||
function getStaticMapUrl(oCenterLat, oCenterLng){
|
||||
var sDomain = 'https://maps.googleapis.com/maps/api/staticmap';
|
||||
var asParams = {
|
||||
center: oCenterLat+','+oCenterLng,
|
||||
zoom: '13',
|
||||
size: '400x300',
|
||||
maptype: 'satellite',
|
||||
markers: 'color:green|label:|'+oCenterLat+','+oCenterLng,
|
||||
key: self.vars('google_api')
|
||||
};
|
||||
|
||||
return sDomain+'?'+Object.keys(asParams).map(k => k+'='+asParams[k]).join('&');
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user