From 799f09b311a34bdf23ea923190e1cbd153998a0a Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 16 Aug 2016 14:56:39 +1000 Subject: [PATCH] Make the panel default to open and remember preference in local storage. --- mediagoblin/static/js/header_dropdown.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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(); }); }); + + + -- 2.25.1