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
|
* 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).
|
* Also navigating to a different slide will show them again (impress:stepleave).
|
||||||
*
|
*
|
||||||
* Copyright 2014 @Strikeskids
|
* Copyright 2014 @Strikeskids
|
||||||
@@ -1432,6 +1432,9 @@
|
|||||||
|
|
||||||
var canvas = null;
|
var canvas = null;
|
||||||
var blackedOut = false;
|
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
|
// While waiting for a shared library of utilities, copying these 2 from main impress.js
|
||||||
var css = function( el, props ) {
|
var css = function( el, props ) {
|
||||||
@@ -1480,6 +1483,7 @@
|
|||||||
display: "block"
|
display: "block"
|
||||||
} );
|
} );
|
||||||
blackedOut = false;
|
blackedOut = false;
|
||||||
|
util.triggerEvent( root, "impress:autoplay:play", {} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1491,18 +1495,23 @@
|
|||||||
display: ( blackedOut = !blackedOut ) ? "none" : "block"
|
display: ( blackedOut = !blackedOut ) ? "none" : "block"
|
||||||
} );
|
} );
|
||||||
blackedOut = true;
|
blackedOut = true;
|
||||||
|
util.triggerEvent( root, "impress:autoplay:pause", {} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait for impress.js to be initialized
|
// Wait for impress.js to be initialized
|
||||||
document.addEventListener( "impress:init", function( event ) {
|
document.addEventListener( "impress:init", function( event ) {
|
||||||
var api = event.detail.api;
|
api = event.detail.api;
|
||||||
var root = event.target;
|
util = api.lib.util;
|
||||||
|
root = event.target;
|
||||||
canvas = root.firstElementChild;
|
canvas = root.firstElementChild;
|
||||||
var gc = api.lib.gc;
|
var gc = api.lib.gc;
|
||||||
|
var util = api.lib.util;
|
||||||
|
|
||||||
gc.addEventListener( document, "keydown", function( event ) {
|
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();
|
event.preventDefault();
|
||||||
if ( !blackedOut ) {
|
if ( !blackedOut ) {
|
||||||
blackout();
|
blackout();
|
||||||
@@ -1513,7 +1522,9 @@
|
|||||||
}, false );
|
}, false );
|
||||||
|
|
||||||
gc.addEventListener( document, "keyup", function( event ) {
|
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();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}, false );
|
}, false );
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Blackout plugin
|
* 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).
|
* Also navigating to a different slide will show them again (impress:stepleave).
|
||||||
*
|
*
|
||||||
* Copyright 2014 @Strikeskids
|
* Copyright 2014 @Strikeskids
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
var canvas = null;
|
var canvas = null;
|
||||||
var blackedOut = false;
|
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
|
// While waiting for a shared library of utilities, copying these 2 from main impress.js
|
||||||
var css = function( el, props ) {
|
var css = function( el, props ) {
|
||||||
@@ -62,6 +65,7 @@
|
|||||||
display: "block"
|
display: "block"
|
||||||
} );
|
} );
|
||||||
blackedOut = false;
|
blackedOut = false;
|
||||||
|
util.triggerEvent( root, "impress:autoplay:play", {} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,18 +77,23 @@
|
|||||||
display: ( blackedOut = !blackedOut ) ? "none" : "block"
|
display: ( blackedOut = !blackedOut ) ? "none" : "block"
|
||||||
} );
|
} );
|
||||||
blackedOut = true;
|
blackedOut = true;
|
||||||
|
util.triggerEvent( root, "impress:autoplay:pause", {} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait for impress.js to be initialized
|
// Wait for impress.js to be initialized
|
||||||
document.addEventListener( "impress:init", function( event ) {
|
document.addEventListener( "impress:init", function( event ) {
|
||||||
var api = event.detail.api;
|
api = event.detail.api;
|
||||||
var root = event.target;
|
util = api.lib.util;
|
||||||
|
root = event.target;
|
||||||
canvas = root.firstElementChild;
|
canvas = root.firstElementChild;
|
||||||
var gc = api.lib.gc;
|
var gc = api.lib.gc;
|
||||||
|
var util = api.lib.util;
|
||||||
|
|
||||||
gc.addEventListener( document, "keydown", function( event ) {
|
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();
|
event.preventDefault();
|
||||||
if ( !blackedOut ) {
|
if ( !blackedOut ) {
|
||||||
blackout();
|
blackout();
|
||||||
@@ -95,7 +104,9 @@
|
|||||||
}, false );
|
}, false );
|
||||||
|
|
||||||
gc.addEventListener( document, "keyup", function( event ) {
|
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();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}, false );
|
}, false );
|
||||||
|
|||||||
Reference in New Issue
Block a user