X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/5aa09fbfd069faf1eb04d4be201a6a1f1eca6cd9..726db77827fa71133cc9762c3bf295189269ebb5:/app/assets/javascripts/application.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e40465f06..cecceaf35 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,256 +1,137 @@ //= require jquery //= require jquery_ujs -//= require jquery.autogrowtextarea //= require jquery.timers -//= require openlayers +//= require jquery.cookie +//= require jquery.throttle-debounce +//= require bootstrap.tooltip +//= require bootstrap.dropdown +//= require augment +//= require osm +//= require leaflet +//= require leaflet.osm +//= require leaflet.hash +//= require leaflet.zoom +//= require leaflet.extend +//= require leaflet.locationfilter //= require i18n/translations -//= require globals -//= require browse -//= require export +//= require oauth +//= require piwik //= require map -//= require menu +//= require richtext +//= require querystring -/* - * 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$/, ""); +var querystring = require('querystring-component'); - $(link).off("click.minzoom"); +function zoomPrecision(zoom) { + return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); +} - 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"); - } - } +function remoteEditHandler(bbox, select) { + var loaded = false, + query = { + left: bbox.getWest() - 0.0001, + top: bbox.getNorth() + 0.0001, + right: bbox.getEast() + 0.0001, + bottom: bbox.getSouth() - 0.0001 + }; + + if (select) query.select = select; + + var iframe = $('