X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5e9ab5bc5edb63b7ab7719fa989a18f52e3637a2..73eb8a5336ea14fa1ccc6de9442125b6475bf6bb:/app/assets/javascripts/leaflet.layers.js diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 09cf1cf60..443e47e76 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -1,82 +1,38 @@ -L.OSM.Layers = L.Control.extend({ - onAdd: function (map) { - this._map = map; - this._initLayout(); - return this.$container[0]; - }, - - _initLayout: function () { - var map = this._map, - layers = this.options.layers; - - this.$container = $('
') +L.OSM.layers = function(options) { + var control = L.control(options); + + control.onAdd = function (map) { + var layers = options.layers; + + var $container = $('
') .attr('class', 'control-layers'); - var link = $('') + var button = $('') .attr('class', 'control-button') .attr('href', '#') - .attr('title', 'Layers') + .attr('title', I18n.t('javascripts.map.layers.title')) .html('') - .appendTo(this.$container); - - if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') { - this.$ui = $('
') - .attr('class', 'layers-ui') - .appendTo(this.options.uiPane); - - $('

') - .text(I18n.t('javascripts.map.layers.header')) - .appendTo(this.$ui); - - var overlaySection = $('
') - .addClass('overlay-layers') - .appendTo(this.$ui); - - $('

') - .text(I18n.t('javascripts.map.layers.overlays')) - .appendTo(overlaySection); - - var list = $('

    ') - .appendTo(overlaySection); - - function addOverlay(layer, name) { - var item = $('
  • ') - .appendTo(list); - - var label = $('