- function updateLocation() {
- var center = map.getCenter().wrap();
- var zoom = map.getZoom();
- var layers = getMapLayers();
- var extents = map.getBounds().wrap();
-
- updatelinks(center, zoom, layers, extents, params.object);
-
- var expiry = new Date();
- expiry.setYear(expiry.getFullYear() + 10);
- $.cookie("_osm_location", [center.lng, center.lat, zoom, layers].join("|"), {expires: expiry});
- }
-
- function remoteEditHandler() {
- var extent = map.getBounds();
- var loaded = false;
-
- $("#linkloader").load(function () { loaded = true; });
- $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + extent.getWest()
- + "&bottom=" + extent.getSouth()
- + "&right=" + extent.getEast()
- + "&top=" + extent.getNorth());
-
- setTimeout(function () {
- if (!loaded) alert(I18n.t('site.index.remote_failed'));
- }, 1000);
-
- return false;
- }
-
- $("a[data-editor=remote]").click(remoteEditHandler);
-
- if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) {
- remoteEditHandler();
- }
-
- $(window).resize(handleResize);
-
- $("#search_form").submit(function () {
- var bounds = map.getBounds();
-
- $("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
- $("#sidebar_content").load($(this).attr("action"), {
- query: $("#query").val(),
- minlon: bounds.getWest(),
- minlat: bounds.getSouth(),
- maxlon: bounds.getEast(),
- maxlat: bounds.getNorth()
- }, openSidebar);
-
- return false;