From: Matt Date: Tue, 16 Aug 2016 04:56:39 +0000 (+1000) Subject: Make the panel default to open and remember preference in local storage. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=799f09b311a34bdf23ea923190e1cbd153998a0a;p=mediagoblin.git Make the panel default to open and remember preference in local storage. --- diff --git a/mediagoblin/static/js/header_dropdown.js b/mediagoblin/static/js/header_dropdown.js index 3ee46228..c9a2d8a9 100644 --- a/mediagoblin/static/js/header_dropdown.js +++ b/mediagoblin/static/js/header_dropdown.js @@ -17,11 +17,27 @@ */ $(document).ready(function(){ - $("#header_dropdown").hide(); - $(".header_dropdown_up").hide(); + var panelclosed = localStorage.getItem("panelclosed"); + if (panelclosed === "true"){ + $("#header_dropdown").hide(); + $(".header_dropdown_up").hide(); + } + else { + $(".header_dropdown_down").hide(); + } + $(".header_dropdown_down,.header_dropdown_up").click(function() { + if (localStorage.getItem("panelclosed") === "true") { + localStorage.setItem("panelclosed", "false"); + } + else { + localStorage.setItem("panelclosed", "true"); + } $(".header_dropdown_down").toggle(); $(".header_dropdown_up").toggle(); $("#header_dropdown").slideToggle(); }); }); + + +