Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added powerpoint 'b' functionality to insta-hide the screen #372

Open
wants to merge 1 commit into from

1 participant

@Strikeskids

Hiding is automatically removed by switching to a new slide. This allows the presenter to go on tangents, returning focus to them instead of the irrelevant slides

@Strikeskids Strikeskids Added powerpoint 'b' functionality to insta-hide the screen
Hiding is automatically removed by switching to a new slide. This allows
the presenter to go on tangents, returning focus to them instead of the
irrelevant slides
3530cf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 7, 2014
  1. @Strikeskids

    Added powerpoint 'b' functionality to insta-hide the screen

    Strikeskids authored
    Hiding is automatically removed by switching to a new slide. This allows
    the presenter to go on tangents, returning focus to them instead of the
    irrelevant slides
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 5 deletions.
  1. +28 −5 js/impress.js
View
33 js/impress.js
@@ -259,7 +259,9 @@
// root presentation elements
var root = byId( rootId );
var canvas = document.createElement("div");
-
+
+ var blackedOut = false;
+
var initialized = false;
// STEP EVENTS
@@ -421,11 +423,13 @@
// `goto` API function that moves to step given with `el` parameter (by index, id or element),
// with a transition `duration` optionally given as second parameter.
var goto = function ( el, duration ) {
-
+
if ( !initialized || !(el = getStep(el)) ) {
// presentation not initialized or given element is not a step
return false;
}
+
+ removeBlackout()
// Sometimes it's possible to trigger focus on first link with some keyboard action.
// Browser in such a case tries to scroll the page to make this element visible
@@ -547,7 +551,22 @@
return el;
};
-
+
+ var removeBlackout = function() {
+ if (blackedOut) {
+ css(canvas, {
+ display: 'block'
+ })
+ blackedOut = false
+ }
+ }
+
+ var blackout = function() {
+ css(canvas, {
+ display: (blackedOut = !blackedOut) ? 'none' : 'block'
+ })
+ }
+
// `prev` API function goes to previous step (in document order)
var prev = function () {
var prev = steps.indexOf( activeStep ) - 1;
@@ -632,6 +651,7 @@
// store and return API for given impress.js root element
return (roots[ "impress-root-" + rootId ] = {
+ blackout: blackout,
init: init,
goto: goto,
next: next,
@@ -681,7 +701,7 @@
// Prevent default keydown action when one of supported key is pressed.
document.addEventListener("keydown", function ( event ) {
- if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
+ if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode === 66) {
event.preventDefault();
}
}, false);
@@ -702,7 +722,7 @@
// as another way to moving to next step... And yes, I know that for the sake of
// consistency I should add [shift+tab] as opposite action...
document.addEventListener("keyup", function ( event ) {
- if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
+ if ( event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode === 66) {
switch( event.keyCode ) {
case 33: // pg up
case 37: // left
@@ -716,6 +736,9 @@
case 40: // down
api.next();
break;
+ case 66: // b key
+ api.blackout()
+ break
}
event.preventDefault();
Something went wrong with that request. Please try again.