Create pane button fn
This commit is contained in:
parent
8a02bd67d9
commit
71e7208a0a
4 changed files with 17 additions and 17 deletions
|
@ -5,11 +5,7 @@ L.OSM.key = function (options) {
|
|||
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);
|
||||
|
|
|
@ -7,12 +7,7 @@ L.OSM.layers = function (options) {
|
|||
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);
|
||||
|
|
|
@ -10,12 +10,7 @@ L.OSM.share = function (options) {
|
|||
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);
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue