]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/sidebar.js
Move piwik code to a static JS asset
[rails.git] / app / assets / javascripts / sidebar.js
index 4ef379bf5cef51055d3e1b48ae65470da08bb464..a5d90698010c20e3c81402993ad9eba4df55c2ba 100644 (file)
@@ -1,40 +1,24 @@
-var openSidebar;
+function openSidebar(options) {
+  options = options || {};
 
-(function () {
-  var onclose;
+  $("#sidebar").trigger("closed");
 
-  openSidebar = function(options) {
-    options = options || {};
+  if (options.title) { $("#sidebar_title").html(options.title); }
 
-    if (onclose) {
-      onclose();
-      onclose = null;
-    }
+  if (options.width) { $("#sidebar").width(options.width); }
+  else { $("#sidebar").width("30%"); }
 
-    if (options.title) { $("#sidebar_title").html(options.title); }
+  $("#sidebar").css("display", "block");
 
-    if (options.width) { $("#sidebar").width(options.width); }
-    else { $("#sidebar").width("30%"); }
+  $("#sidebar").trigger("opened");
+};
 
-    $("#sidebar").css("display", "block");
+$(document).ready(function () {
+  $(".sidebar_close").click(function (e) {
+    $("#sidebar").css("display", "none");
 
-    $("#sidebar").trigger("opened");
+    $("#sidebar").trigger("closed");
 
-    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();
-    });
+    e.preventDefault();
   });
-})();
+});