X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d6a8aaa3690a86820ecc6198f1d5455d8f6cbbe5..c3d1123965b2d9bc34299c3a6c64d186c62c0ed2:/app/assets/javascripts/sidebar.js?ds=sidebyside diff --git a/app/assets/javascripts/sidebar.js b/app/assets/javascripts/sidebar.js index 4ef379bf5..a5d906980 100644 --- a/app/assets/javascripts/sidebar.js +++ b/app/assets/javascripts/sidebar.js @@ -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(); }); -})(); +});