]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/sidebar.js
Sidebar work
[rails.git] / app / assets / javascripts / sidebar.js
index 4ef379bf5cef51055d3e1b48ae65470da08bb464..21a4380dc77aeb1eeef246fd43623a5ae74dcbf3 100644 (file)
@@ -1,40 +1,11 @@
-var openSidebar;
-
-(function () {
-  var onclose;
-
-  openSidebar = function(options) {
-    options = options || {};
-
-    if (onclose) {
-      onclose();
-      onclose = null;
-    }
-
-    if (options.title) { $("#sidebar_title").html(options.title); }
-
-    if (options.width) { $("#sidebar").width(options.width); }
-    else { $("#sidebar").width("30%"); }
-
-    $("#sidebar").css("display", "block");
-
-    $("#sidebar").trigger("opened");
-
-    onclose = options.onclose;
-  };
-
-  $(document).ready(function () {
-    $(".sidebar_close").click(function (e) {
-      $("#sidebar").css("display", "none");
-
-      $("#sidebar").trigger("closed");
-
-      if (onclose) {
-        onclose();
-        onclose = null;
-      }
-
-      e.preventDefault();
-    });
+function closeSidebar() {
+  $("#sidebar")
+    .trigger("closed");
+}
+
+$(document).ready(function () {
+  $(".sidebar_close").click(function (e) {
+    closeSidebar();
+    e.preventDefault();
   });
-})();
+});