From: Ben Sturmfels Date: Sun, 11 Sep 2016 23:57:43 +0000 (+1200) Subject: Add documentation for header drop-down open/closed. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c2c9ed4a6c9d5c5a0c4ba62f17498d3ce80df7b5;p=mediagoblin.git Add documentation for header drop-down open/closed. --- diff --git a/mediagoblin/static/js/header_dropdown.js b/mediagoblin/static/js/header_dropdown.js index c9a2d8a9..979d2690 100644 --- a/mediagoblin/static/js/header_dropdown.js +++ b/mediagoblin/static/js/header_dropdown.js @@ -17,8 +17,12 @@ */ $(document).ready(function(){ - var panelclosed = localStorage.getItem("panelclosed"); - if (panelclosed === "true"){ + // The header drop-down header panel defaults to open until you explicitly + // close it. After that, the panel open/closed setting will persist across + // page loads. + + // Initialise the panel status when page is loaded. + if (localStorage.getItem("panel_closed")) { $("#header_dropdown").hide(); $(".header_dropdown_up").hide(); } @@ -26,18 +30,16 @@ $(document).ready(function(){ $(".header_dropdown_down").hide(); } - $(".header_dropdown_down,.header_dropdown_up").click(function() { - if (localStorage.getItem("panelclosed") === "true") { - localStorage.setItem("panelclosed", "false"); + // Toggle and persist the panel status. + $(".header_dropdown_down, .header_dropdown_up").click(function() { + if (localStorage.getItem("panel_closed")) { + localStorage.removeItem("panel_closed"); } else { - localStorage.setItem("panelclosed", "true"); + localStorage.setItem("panel_closed", "true"); } $(".header_dropdown_down").toggle(); $(".header_dropdown_up").toggle(); $("#header_dropdown").slideToggle(); }); }); - - -