]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/sidebar.js
Make titles in note popups link to the note
[rails.git] / app / assets / javascripts / sidebar.js
index a5d90698010c20e3c81402993ad9eba4df55c2ba..912197b9f2c380cfcc4732cf7033901d5b8987bf 100644 (file)
@@ -5,20 +5,17 @@ function openSidebar(options) {
 
   if (options.title) { $("#sidebar_title").html(options.title); }
 
-  if (options.width) { $("#sidebar").width(options.width); }
-  else { $("#sidebar").width("30%"); }
+  $("#sidebar").width(options.width || "30%");
+  $("#sidebar").css("display", "block").trigger("opened");
+}
 
-  $("#sidebar").css("display", "block");
-
-  $("#sidebar").trigger("opened");
-};
+function closeSidebar() {
+  $("#sidebar").css("display", "none").trigger("closed");
+}
 
 $(document).ready(function () {
   $(".sidebar_close").click(function (e) {
-    $("#sidebar").css("display", "none");
-
-    $("#sidebar").trigger("closed");
-
+    closeSidebar();
     e.preventDefault();
   });
 });