Make the panel default to open and remember preference in local storage.
authorMatt <deal.sy@hotmail.com>
Tue, 16 Aug 2016 04:56:39 +0000 (14:56 +1000)
committerMatt <deal.sy@hotmail.com>
Tue, 16 Aug 2016 04:56:39 +0000 (14:56 +1000)
mediagoblin/static/js/header_dropdown.js

index 3ee46228f20fed1ad8703df3448cd563d0b5aff5..c9a2d8a9668934aa2e971cc36e58191e2320ca82 100644 (file)
  */
 
 $(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();
   });
 });
+
+
+