-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskip-fragments.js
45 lines (38 loc) · 1.25 KB
/
skip-fragments.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Press V to View all fragments in current slide
// Press C to hide (Conceal) all fragments in current slide
const SkipFragments = (function (Reveal) {
function showAll() {
let {h, v} = Reveal.getIndices();
Reveal.slide(h, v, +Infinity);
}
function hideAll() {
let {h, v} = Reveal.getIndices();
Reveal.slide(h, v, -1);
}
function installKeyBindings() {
const config = Reveal.getConfig();
if (!config.keyboard) {
return;
}
const shortcut = {
view: config.skipFragmentsShowShortcut || 'V',
hide: config.skipFragmentsHideShortcut || 'C'
};
const keyboard = config.keyboard === true ? {} : config.keyboard;
keyboard[shortcut.view.toUpperCase().charCodeAt(0)] = showAll;
keyboard[shortcut.hide.toUpperCase().charCodeAt(0)] = hideAll;
Reveal.registerKeyboardShortcut(shortcut.view, 'View slide fragments');
Reveal.registerKeyboardShortcut(shortcut.hide, 'Hide slide fragments');
Reveal.configure({
keyboard: keyboard
});
}
function install() {
installKeyBindings();
}
install();
return {
showAll: showAll,
hideAll: hideAll
};
})(Reveal);