Add support for "." to enter/exit blackout screen (#716)
* Add support for "." to enter/exit blackout screen - This is the default on Power Point - THis add support for remote controller presentation blackout key * Rename autoplay event call from resume to play
This commit is contained in:
committed by
Henrik Ingo
parent
6776a0dab7
commit
6db3f7c877
@@ -1419,7 +1419,7 @@
|
||||
/**
|
||||
* Blackout plugin
|
||||
*
|
||||
* Press Ctrl+b to hide all slides, and Ctrl+b again to show them.
|
||||
* Press b or . to hide all slides, and b or . again to show them.
|
||||
* Also navigating to a different slide will show them again (impress:stepleave).
|
||||
*
|
||||
* Copyright 2014 @Strikeskids
|
||||
@@ -1432,6 +1432,9 @@
|
||||
|
||||
var canvas = null;
|
||||
var blackedOut = false;
|
||||
var util = null;
|
||||
var root = null;
|
||||
var api = null;
|
||||
|
||||
// While waiting for a shared library of utilities, copying these 2 from main impress.js
|
||||
var css = function( el, props ) {
|
||||
@@ -1480,6 +1483,7 @@
|
||||
display: "block"
|
||||
} );
|
||||
blackedOut = false;
|
||||
util.triggerEvent( root, "impress:autoplay:play", {} );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1491,18 +1495,23 @@
|
||||
display: ( blackedOut = !blackedOut ) ? "none" : "block"
|
||||
} );
|
||||
blackedOut = true;
|
||||
util.triggerEvent( root, "impress:autoplay:pause", {} );
|
||||
}
|
||||
};
|
||||
|
||||
// Wait for impress.js to be initialized
|
||||
document.addEventListener( "impress:init", function( event ) {
|
||||
var api = event.detail.api;
|
||||
var root = event.target;
|
||||
api = event.detail.api;
|
||||
util = api.lib.util;
|
||||
root = event.target;
|
||||
canvas = root.firstElementChild;
|
||||
var gc = api.lib.gc;
|
||||
var util = api.lib.util;
|
||||
|
||||
gc.addEventListener( document, "keydown", function( event ) {
|
||||
if ( event.keyCode === 66 ) {
|
||||
|
||||
// Accept b or . -> . is sent by presentation remote controllers
|
||||
if ( event.keyCode === 66 || event.keyCode === 190 ) {
|
||||
event.preventDefault();
|
||||
if ( !blackedOut ) {
|
||||
blackout();
|
||||
@@ -1513,7 +1522,9 @@
|
||||
}, false );
|
||||
|
||||
gc.addEventListener( document, "keyup", function( event ) {
|
||||
if ( event.keyCode === 66 ) {
|
||||
|
||||
// Accept b or . -> . is sent by presentation remote controllers
|
||||
if ( event.keyCode === 66 || event.keyCode === 190 ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}, false );
|
||||
|
||||
Reference in New Issue
Block a user