$('.leaflet-control .control-button').tooltip({placement: 'left', container: 'body'});
- map.on('moveend layeradd layerremove', updateLocation);
+ map.on('moveend layeradd layerremove', function() {
+ updatelinks(
+ map.getCenter().wrap(),
+ map.getZoom(),
+ map.getLayersCode(),
+ map.getBounds().wrap(),
+ map._object);
+
+ var expiry = new Date();
+ expiry.setYear(expiry.getFullYear() + 10);
+ $.cookie("_osm_location", cookieContent(map), { expires: expiry });
+
+ // Trigger hash update on layer changes.
+ map.hash.onMapMove();
+ });
if (OSM.PIWIK) {
map.on('layeradd', function (e) {
if ('undefined' !== typeof initializeChangesets) initializeChangesets(map);
});
-
-function updateLocation() {
- updatelinks(this.getCenter().wrap(),
- this.getZoom(),
- this.getLayersCode(),
- this.getBounds().wrap());
-
- var expiry = new Date();
- expiry.setYear(expiry.getFullYear() + 10);
- $.cookie("_osm_location", cookieContent(this), { expires: expiry });
-
- // Trigger hash update on layer changes.
- this.hash.onMapMove();
-}
before_filter :authorize_web
before_filter :set_locale
+ before_filter :redirect_browse_params, :only => :index
before_filter :redirect_map_params, :only => [:index, :edit, :export]
before_filter :require_user, :only => [:edit, :welcome]
before_filter :require_oauth, :only => [:index]
private
+ def redirect_browse_params
+ if params[:node]
+ redirect_to node_path(params[:node])
+ elsif params[:way]
+ redirect_to way_path(params[:way])
+ elsif params[:relation]
+ redirect_to relation_path(params[:relation])
+ elsif params[:note]
+ redirect_to browse_note_path(params[:note])
+ end
+ end
+
def redirect_map_params
anchor = []
anchor << "layers=N"
end
- if params[:node]
- redirect_to node_path(params[:node])
- elsif params[:way]
- redirect_to way_path(params[:way])
- elsif params[:relation]
- redirect_to relation_path(params[:relation])
- elsif params[:note]
- redirect_to browse_note_path(params[:note])
- elsif anchor.present?
+ if anchor.present?
redirect_to params.merge(:anchor => anchor.join('&'))
end
end