page.load = function(path, type, id) {
if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return;
- map.addObject({type: type, id: parseInt(id)}, {zoom: true});
+ map.addObject({type: type, id: parseInt(id)}, {zoom: window.location.hash == ""});
};
page.unload = function() {
OSM.Note = function(map) {
var noteLayer = map.noteLayer,
content = $('#sidebar_content'),
- page = {};
+ page = {},
+ marker;
var noteIcons = {
"new": L.icon({
page.load();
};
- page.load = function() {
+ page.load = function(path, id) {
var loadTimer = setTimeout(setLoading, 250);
$('#sidebar_content').load(window.location.pathname + "?xhr=1", function(a, b, xhr) {
if (xhr.getResponseHeader('X-Page-Title')) {
bind();
clearTimeout(loadTimer);
clearLoading();
+
+ if (!map.hasLayer(noteLayer)) map.addLayer(noteLayer);
+ if (window.location.hash == "") map.panTo($('.details').data().coordinates.split(','));
});
};
+ page.unload = function() {
+ if (marker) map.removeLayer(marker);
+ };
+
function setLoading() {
if($('#browse_status').is(':empty')) {
$('#browse_status').append($('<p></p>').text(I18n.t('browse.start_rjs.loading')));
</h2>
<div class="browse-section">
- <div class="details">
+ <div class="details" data-coordinates="<%= number_with_delimiter(@note.lat) %>,<%=number_with_delimiter(@note.lon) %>" data-status="<%= @note.status %>">
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
<br/>
<%= note_event('open', @note.created_at, @note.author) %>