Skip to content

Commit

Permalink
fully hide the navbar when asked
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed May 17, 2020
1 parent 9e5627d commit 678ef29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
11 changes: 0 additions & 11 deletions copyparty/web/md.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ blink {
z-index: 10;
width: calc(100% - 1em);
}
#mn.undocked {
position: fixed;
padding: 1.7em 0 1.5em 1em;
box-shadow: 0 0 .5em rgba(0, 0, 0, 0.3);
background: #f7f7f7;
}
#mn a {
color: #444;
background: none;
Expand Down Expand Up @@ -440,11 +434,6 @@ blink {
html.dark #toc::-webkit-scrollbar-thumb {
background: #b80;
}
html.dark #mn.undocked {
box-shadow: 0 0 .5em #555;
border: none;
background: #0a0a0a;
}
}
@media screen and (min-width: 85.5em) {
#toc { width: 30em }
Expand Down
34 changes: 2 additions & 32 deletions copyparty/web/md.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,40 +395,10 @@ var redraw = (function () {


dom_navtgl.onclick = function () {
var timeout = null;
function show_nav(e) {
if (e && e.target == dom_hbar && e.pageX && e.pageX < dom_hbar.offsetWidth / 2)
return;

clearTimeout(timeout);
dom_nav.style.display = 'block';
}
function hide_nav() {
clearTimeout(timeout);
timeout = setTimeout(function () {
dom_nav.style.display = 'none';
}, 30);
}
var hidden = dom_navtgl.innerHTML == 'hide nav';
dom_navtgl.innerHTML = hidden ? 'show nav' : 'hide nav';
if (hidden) {
dom_nav.setAttribute('class', 'undocked');
dom_nav.style.display = 'none';
dom_nav.style.top = dom_hbar.offsetHeight + 'px';
dom_nav.onmouseenter = show_nav;
dom_nav.onmouseleave = hide_nav;
dom_hbar.onmouseenter = show_nav;
dom_hbar.onmouseleave = hide_nav;
}
else {
dom_nav.setAttribute('class', '');
dom_nav.style.display = 'block';
dom_nav.style.top = '0';
dom_nav.onmouseenter = null;
dom_nav.onmouseleave = null;
dom_hbar.onmouseenter = null;
dom_hbar.onmouseleave = null;
}
dom_nav.style.display = hidden ? 'none' : 'block';

if (window.localStorage)
localStorage.setItem('hidenav', hidden ? 1 : 0);

Expand Down

0 comments on commit 678ef29

Please sign in to comment.