cmd/present: show navigational help text on page load
Change-Id: I35e7cbec56a0617540316f0205c5a92e7532c491 Reviewed-on: https://go-review.googlesource.com/4910 Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
229cb67603
commit
753a094e8a
|
@ -49,3 +49,8 @@ a:link:after, a:visited:after {
|
||||||
body {
|
body {
|
||||||
background: rgb(255,255,255) !important;
|
background: rgb(255,255,255) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#help {
|
||||||
|
display: none;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
|
@ -134,6 +134,10 @@ if (objCtr.defineProperty) {
|
||||||
|
|
||||||
/* Slide movement */
|
/* Slide movement */
|
||||||
|
|
||||||
|
function hideHelpText() {
|
||||||
|
$('#help').hide();
|
||||||
|
};
|
||||||
|
|
||||||
function getSlideEl(no) {
|
function getSlideEl(no) {
|
||||||
if ((no < 0) || (no >= slideEls.length)) {
|
if ((no < 0) || (no >= slideEls.length)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -201,6 +205,7 @@ function updateSlides() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function prevSlide() {
|
function prevSlide() {
|
||||||
|
hideHelpText();
|
||||||
if (curSlide > 0) {
|
if (curSlide > 0) {
|
||||||
curSlide--;
|
curSlide--;
|
||||||
|
|
||||||
|
@ -209,6 +214,7 @@ function prevSlide() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function nextSlide() {
|
function nextSlide() {
|
||||||
|
hideHelpText();
|
||||||
if (curSlide < slideEls.length - 1) {
|
if (curSlide < slideEls.length - 1) {
|
||||||
curSlide++;
|
curSlide++;
|
||||||
|
|
||||||
|
@ -392,6 +398,10 @@ function handleBodyKeyDown(event) {
|
||||||
var inCode = event.target.classList.contains("code");
|
var inCode = event.target.classList.contains("code");
|
||||||
|
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
|
case 72: // 'H' hides the help text
|
||||||
|
if (!inCode) hideHelpText();
|
||||||
|
break;
|
||||||
|
|
||||||
case 39: // right arrow
|
case 39: // right arrow
|
||||||
case 13: // Enter
|
case 13: // Enter
|
||||||
case 32: // space
|
case 32: // space
|
||||||
|
@ -466,6 +476,9 @@ function addPrintStyle() {
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function showHelpText() {
|
||||||
|
};
|
||||||
|
|
||||||
function handleDomLoaded() {
|
function handleDomLoaded() {
|
||||||
slideEls = document.querySelectorAll('section.slides > article');
|
slideEls = document.querySelectorAll('section.slides > article');
|
||||||
|
|
||||||
|
|
|
@ -459,3 +459,21 @@ figcaption {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#help {
|
||||||
|
font-family: 'Open Sans', Arial, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
background: #000;
|
||||||
|
opacity: 0.5;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 25px;
|
||||||
|
left: 50px;
|
||||||
|
right: 50px;
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
border-radius: 10px;
|
||||||
|
-o-border-radius: 10px;
|
||||||
|
-moz-border-radius: 10px;
|
||||||
|
-webkit-border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,12 @@
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div id="help">
|
||||||
|
Use the left and right arrow keys or click the left and right
|
||||||
|
edges of the page to navigate between slides.<br>
|
||||||
|
(Press 'H' or navigate to hide this message.)
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
{{if .PlayEnabled}}
|
{{if .PlayEnabled}}
|
||||||
<script src='/play.js'></script>
|
<script src='/play.js'></script>
|
||||||
|
|
Loading…
Reference in New Issue