Difference between revisions of "Template:Marburg/scripts.js"

 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
<html><script>"use strict";var showMenu=!1,burger=document.getElementById("burger");function hide(e){$("#"+e).css("display","none")}function popup(e){$("#"+e).css("display","block"),$(document).keyup(function(s){27==s.keyCode&&hide(e)})}burger.onclick=function(){showMenu?($("#burger").removeClass("is-active"),$("#navbar").removeClass("is-active"),showMenu=!1):($("#burger").addClass("is-active"),$("#navbar").addClass("is-active"),showMenu=!0)};</script></html>
+
<html>
 +
  <script>
 +
    "use strict";
 +
    $("head").append('<meta name="viewport" content="width=device-width, initial-scale=1">');
 +
    var showMenu = !1, burger = document.getElementById("burger");
 +
    function popup(e) {
 +
      $("#" + e).css("display", "block");
 +
      location.hash = "#" + e;
 +
      $(document).keyup(function(evt) {
 +
        if (evt.keyCode === 27) {
 +
          hide(e);
 +
        }
 +
      });
 +
    }
 +
    function hide(e) {
 +
      $("#" + e).css("display", "none");
 +
      location.hash = "";
 +
    }
 +
    burger.onclick = function () {
 +
      showMenu
 +
        ? ($("#burger").removeClass("is-active"), $("#navbar").removeClass("is-active"), showMenu = !1)
 +
        : ($("#burger").addClass("is-active"), $("#navbar").addClass("is-active"), showMenu = !0)
 +
    };
 +
    window.onload = function () {
 +
      var hash = location.hash.substr(1);
 +
      if (hash === "") {
 +
        return;
 +
      }
 +
      popup(hash)
 +
    }
 +
  </script>
 +
</html>

Latest revision as of 20:23, 13 December 2019