var $container = $("<div>")
.attr("class", "control-key");
- var button = $("<a>")
- .attr("class", "control-button")
- .attr("href", "#")
- .html("<span class=\"icon key\"></span>")
- .on("click", toggle)
+ var button = this.makeButton("key", null, toggle)
.appendTo($container);
var $ui = this.makeUI("key-ui", "javascripts.key.title", toggle);
var $container = $("<div>")
.attr("class", "control-layers");
- var button = $("<a>")
- .attr("class", "control-button")
- .attr("href", "#")
- .attr("title", I18n.t("javascripts.map.layers.title"))
- .html("<span class=\"icon layers\"></span>")
- .on("click", toggle)
+ var button = this.makeButton("layers", "javascripts.map.layers.title", toggle)
.appendTo($container);
var $ui = this.makeUI("layers-ui", "javascripts.map.layers.header", toggle);
var $container = $("<div>")
.attr("class", "control-share");
- var button = $("<a>")
- .attr("class", "control-button")
- .attr("href", "#")
- .attr("title", I18n.t("javascripts.share.title"))
- .html("<span class=\"icon share\"></span>")
- .on("click", toggle)
+ var button = this.makeButton("share", "javascripts.share.title", toggle)
.appendTo($container);
var $ui = this.makeUI("share-ui", "javascripts.share.title", toggle);
L.OSM.sidebarPane = function (options) {
var control = L.control(options);
+ control.makeButton = function (buttonClass, buttonTitle, toggle) {
+ var button = $("<a>")
+ .attr("class", "control-button")
+ .attr("href", "#")
+ .html("<span class=\"icon " + buttonClass + "\"></span>")
+ .on("click", toggle);
+
+ if (buttonTitle) {
+ button.attr("title", I18n.t(buttonTitle))
+ }
+
+ return button;
+ };
+
control.makeUI = function (uiClass, paneTitle, toggle) {
var $ui = $("<div>")
.attr("class", uiClass);