-//= require globals
-//= require browse
-//= require export
-//= require map
-//= require menu
-
-/*
- * Called as the user scrolls/zooms around to aniplate hrefs of the
- * view tab and various other links
- */
-function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,objid) {
- var decimals = Math.pow(10, Math.floor(zoom/3));
- var node;
-
- lat = Math.round(lat * decimals) / decimals;
- lon = Math.round(lon * decimals) / decimals;
-
- if (minlon) {
- minlon = Math.round(minlon * decimals) / decimals;
- minlat = Math.round(minlat * decimals) / decimals;
- maxlon = Math.round(maxlon * decimals) / decimals;
- maxlat = Math.round(maxlat * decimals) / decimals;
- }
-
- $(".geolink").each(function (index, link) {
- var args = getArgs(link.href);
-
- if ($(link).hasClass("llz")) {
- args.lat = lat;
- args.lon = lon;
- args.zoom = zoom;
- } else if (minlon && $(link).hasClass("bbox")) {
- args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat;
- }
-
- if (layers && $(link).hasClass("layers")) {
- args.layers = layers;
- }
-
- if (objtype && $(link).hasClass("object")) {
- args[objtype] = objid;
- }
-
- var classes = $(link).attr("class").split(" ");
-
- $(classes).each(function (index, classname) {
- if (match = classname.match(/^minzoom([0-9]+)$/)) {
- var minzoom = match[1];
- var name = link.id.replace(/anchor$/, "");
-
- $(link).off("click.minzoom");
-
- if (zoom >= minzoom) {
- $(link).attr("title", I18n.t("javascripts.site." + name + "_tooltip"));
- $(link).removeClass("disabled");
- } else {
- $(link).on("click.minzoom", function () { alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false; });
- $(link).attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"));
- $(link).addClass("disabled");
- }
- }
+//= require oauth
+//= require piwik
+//= require richtext
+//= require querystring
+
+var querystring = require('querystring-component');
+
+function remoteEditHandler(bbox, object) {
+ var loaded = false,
+ url = document.location.protocol === "https:" ?
+ "https://127.0.0.1:8112/load_and_zoom?" :
+ "http://127.0.0.1:8111/load_and_zoom?",
+ query = {
+ left: bbox.getWest() - 0.0001,
+ top: bbox.getNorth() + 0.0001,
+ right: bbox.getEast() + 0.0001,
+ bottom: bbox.getSouth() - 0.0001
+ };
+
+ if (object) query.select = object.type + object.id;
+
+ var iframe = $('<iframe>')
+ .hide()
+ .appendTo('body')
+ .attr("src", url + querystring.stringify(query))
+ .on('load', function() {
+ $(this).remove();
+ loaded = true;