]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.key.js
Consistent JavaScript style
[rails.git] / app / assets / javascripts / leaflet.key.js
index 4cab964c9e178c0f166609247fef9b8f9dd89472..5756f0c4179b6572a0f1c2bf18e08d228b26bb79 100644 (file)
@@ -1,25 +1,19 @@
-L.OSM.Key = L.Control.extend({
-  onAdd: function (map) {
-    this._map = map;
-    this._initLayout();
-    return this.$container[0];
-  },
-
-  _initLayout: function () {
-    var map = this._map;
+L.OSM.key = function(options) {
+  var control = L.control(options);
 
-    this.$container = $('<div>')
+  control.onAdd = function (map) {
+    var $container = $('<div>')
       .attr('class', 'control-key');
 
-    var link = $('<a>')
+    $('<a>')
       .attr('class', 'control-button')
       .attr('href', '#')
       .attr('title', 'Map Key')
       .html('<span class="icon key"></span>')
-      .appendTo(this.$container);
-  }
-});
+      .appendTo($container);
 
-L.OSM.key = function(options) {
-  return new L.OSM.Key(options);
+    return $container[0];
+  };
+
+  return control;
 };