Skip to content

Commit 78a7ba5

Browse files
author
IOHK
committed
Update gh-pages for 9e552b1
1 parent fb8db61 commit 78a7ba5

40 files changed

+571
-57
lines changed

404.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@
4242
<script src="toc.js"></script>
4343
</head>
4444
<body>
45+
<div id="mdbook-help-container">
46+
<div id="mdbook-help-popup">
47+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
48+
<div>
49+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
50+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
51+
<p>Press <kbd>?</kbd> to show this help</p>
52+
<p>Press <kbd>Esc</kbd> to hide this help</p>
53+
</div>
54+
</div>
55+
</div>
4556
<div id="body-container">
4657
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4758
<script>
@@ -119,7 +130,7 @@
119130
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
120131
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
121132
</ul>
122-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
133+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
123134
<i class="fa fa-search"></i>
124135
</button>
125136
</div>

architecture.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

book.js

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ aria-label="Show hidden lines"></button>';
623623

624624
(function chapterNavigation() {
625625
document.addEventListener('keydown', function(e) {
626-
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
626+
if (e.altKey || e.ctrlKey || e.metaKey) {
627627
return;
628628
}
629629
if (window.search && window.search.hasFocus()) {
@@ -643,6 +643,55 @@ aria-label="Show hidden lines"></button>';
643643
window.location.href = previousButton.href;
644644
}
645645
}
646+
function showHelp() {
647+
const container = document.getElementById('mdbook-help-container');
648+
const overlay = document.getElementById('mdbook-help-popup');
649+
container.style.display = 'flex';
650+
651+
// Clicking outside the popup will dismiss it.
652+
const mouseHandler = event => {
653+
if (overlay.contains(event.target)) {
654+
return;
655+
}
656+
if (event.button !== 0) {
657+
return;
658+
}
659+
event.preventDefault();
660+
event.stopPropagation();
661+
document.removeEventListener('mousedown', mouseHandler);
662+
hideHelp();
663+
};
664+
665+
// Pressing esc will dismiss the popup.
666+
const escapeKeyHandler = event => {
667+
if (event.key === 'Escape') {
668+
event.preventDefault();
669+
event.stopPropagation();
670+
document.removeEventListener('keydown', escapeKeyHandler, true);
671+
hideHelp();
672+
}
673+
};
674+
document.addEventListener('keydown', escapeKeyHandler, true);
675+
document.getElementById('mdbook-help-container')
676+
.addEventListener('mousedown', mouseHandler);
677+
}
678+
function hideHelp() {
679+
document.getElementById('mdbook-help-container').style.display = 'none';
680+
}
681+
682+
// Usually needs the Shift key to be pressed
683+
switch (e.key) {
684+
case '?':
685+
e.preventDefault();
686+
showHelp();
687+
break;
688+
}
689+
690+
// Rest of the keys are only active when the Shift key is not pressed
691+
if (e.shiftKey) {
692+
return;
693+
}
694+
646695
switch (e.key) {
647696
case 'ArrowRight':
648697
e.preventDefault();

changelog.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

css/chrome.css

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,24 @@ html:not(.sidebar-resizing) .sidebar {
474474

475475
.sidebar-resize-handle .sidebar-resize-indicator {
476476
width: 100%;
477-
height: 12px;
478-
background-color: var(--icons);
477+
height: 16px;
478+
color: var(--icons);
479479
margin-inline-start: var(--sidebar-resize-indicator-space);
480+
display: flex;
481+
align-items: center;
482+
justify-content: flex-start;
483+
}
484+
.sidebar-resize-handle .sidebar-resize-indicator::before {
485+
content: "";
486+
width: 2px;
487+
height: 12px;
488+
border-left: dotted 2px currentColor;
489+
}
490+
.sidebar-resize-handle .sidebar-resize-indicator::after {
491+
content: "";
492+
width: 2px;
493+
height: 16px;
494+
border-left: dotted 2px currentColor;
480495
}
481496

482497
[dir=rtl] .sidebar .sidebar-resize-handle {
@@ -641,3 +656,46 @@ html:not(.sidebar-resizing) .sidebar {
641656
margin-inline-start: -14px;
642657
width: 14px;
643658
}
659+
660+
/* The container for the help popup that covers the whole window. */
661+
#mdbook-help-container {
662+
/* Position and size for the whole window. */
663+
position: fixed;
664+
top: 0;
665+
left: 0;
666+
right: 0;
667+
bottom: 0;
668+
/* This uses flex layout (which is set in book.js), and centers the popup
669+
in the window.*/
670+
display: none;
671+
align-items: center;
672+
justify-content: center;
673+
z-index: 1000;
674+
/* Dim out the book while the popup is visible. */
675+
background: var(--overlay-bg);
676+
}
677+
678+
/* The popup help box. */
679+
#mdbook-help-popup {
680+
box-shadow: 0 4px 24px rgba(0,0,0,0.15);
681+
min-width: 300px;
682+
max-width: 500px;
683+
width: 100%;
684+
box-sizing: border-box;
685+
display: flex;
686+
flex-direction: column;
687+
align-items: center;
688+
background-color: var(--bg);
689+
color: var(--fg);
690+
border-width: 1px;
691+
border-color: var(--theme-popup-border);
692+
border-style: solid;
693+
border-radius: 8px;
694+
padding: 10px;
695+
}
696+
697+
.mdbook-help-title {
698+
text-align: center;
699+
/* mdbook's margin for h2 is way too large. */
700+
margin: 10px;
701+
}

css/variables.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
--copy-button-filter-hover: invert(68%) sepia(55%) saturate(531%) hue-rotate(341deg) brightness(104%) contrast(101%);
6565

6666
--footnote-highlight: #2668a6;
67+
68+
--overlay-bg: rgba(33, 40, 48, 0.4);
6769
}
6870

6971
.coal {
@@ -115,6 +117,8 @@
115117
--copy-button-filter-hover: invert(36%) sepia(70%) saturate(503%) hue-rotate(167deg) brightness(98%) contrast(89%);
116118

117119
--footnote-highlight: #4079ae;
120+
121+
--overlay-bg: rgba(33, 40, 48, 0.4);
118122
}
119123

120124
.light, html:not(.js) {
@@ -166,6 +170,8 @@
166170
--copy-button-filter-hover: invert(14%) sepia(93%) saturate(4250%) hue-rotate(243deg) brightness(99%) contrast(130%);
167171

168172
--footnote-highlight: #7e7eff;
173+
174+
--overlay-bg: rgba(200, 200, 205, 0.4);
169175
}
170176

171177
.navy {
@@ -217,6 +223,8 @@
217223
--copy-button-filter-hover: invert(46%) sepia(20%) saturate(1537%) hue-rotate(156deg) brightness(85%) contrast(90%);
218224

219225
--footnote-highlight: #4079ae;
226+
227+
--overlay-bg: rgba(33, 40, 48, 0.4);
220228
}
221229

222230
.rust {
@@ -266,6 +274,8 @@
266274
--copy-button-filter-hover: invert(77%) sepia(16%) saturate(1798%) hue-rotate(328deg) brightness(98%) contrast(83%);
267275

268276
--footnote-highlight: #d3a17a;
277+
278+
--overlay-bg: rgba(150, 150, 150, 0.25);
269279
}
270280

271281
@media (prefers-color-scheme: dark) {

dev/adding-new-ghc.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="../toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

dev/coverage.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="../toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

dev/dev-architecture.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="../toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

dev/hix.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="../toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

0 commit comments

Comments
 (0)