From 7297474b2e683f6e6e382891b2ec36e7f22c0764 Mon Sep 17 00:00:00 2001
From: Greg Denehy
Date: Sun, 30 Apr 2017 15:23:04 +0930
Subject: Added programatic support for custom key bindings with optional
descriptions to be added to the help screen
---
plugin/notes/notes.js | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
(limited to 'plugin')
diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js
index 202e73b..8980fb4 100644
--- a/plugin/notes/notes.js
+++ b/plugin/notes/notes.js
@@ -106,19 +106,7 @@ var RevealNotes = (function() {
}
// Open the notes when the 's' key is hit
- document.addEventListener( 'keydown', function( event ) {
- // Disregard the event if the target is editable or a
- // modifier is present
- if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
-
- // Disregard the event if keyboard is disabled
- if ( Reveal.getConfig().keyboard === false ) return;
-
- if( event.keyCode === 83 ) {
- event.preventDefault();
- openNotes();
- }
- }, false );
+ Reveal.addKeyBinding({code: 83, key: 'S', description: 'Speaker notes'}, openNotes);
}
--
cgit v1.2.3
From e48e1e19b97d99de107966dd3f8c431a89457972 Mon Sep 17 00:00:00 2001
From: Greg Denehy
Date: Sun, 30 Apr 2017 16:35:35 +0930
Subject: Changed custom key binding config properties to use 'keyCode' instead
of 'code'
---
js/reveal.js | 4 ++--
plugin/notes/notes.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'plugin')
diff --git a/js/reveal.js b/js/reveal.js
index 9d4444f..328edb0 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1098,8 +1098,8 @@
* Add a custom key binding with optional description to be added to the help screen
*/
function addKeyBinding(binding, callback) {
- if (typeof binding === 'object' && binding.code) {
- registeredKeyBindings[binding.code] = {
+ if (typeof binding === 'object' && binding.keyCode) {
+ registeredKeyBindings[binding.keyCode] = {
callback: callback,
key: binding.key,
description: binding.description
diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js
index 8980fb4..6373d97 100644
--- a/plugin/notes/notes.js
+++ b/plugin/notes/notes.js
@@ -106,7 +106,7 @@ var RevealNotes = (function() {
}
// Open the notes when the 's' key is hit
- Reveal.addKeyBinding({code: 83, key: 'S', description: 'Speaker notes'}, openNotes);
+ Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes'}, openNotes);
}
--
cgit v1.2.3
From e16508477ab541314452997d20aa6bdb5a8b0862 Mon Sep 17 00:00:00 2001
From: Greg Denehy
Date: Sun, 30 Apr 2017 17:51:38 +0930
Subject: Fixed notes.js to account for upstream updates
---
plugin/notes/notes.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
(limited to 'plugin')
diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js
index 1a35110..3f00eb6 100644
--- a/plugin/notes/notes.js
+++ b/plugin/notes/notes.js
@@ -131,10 +131,9 @@ var RevealNotes = (function() {
}
// Open the notes when the 's' key is hit
- Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes'}, openNotes);
-
- // Show our keyboard shortcut in the reveal.js help overlay
- if( window.Reveal ) Reveal.registerKeyboardShortcut( 'S', 'Speaker notes view' );
+ Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes view'}, function() {
+ openNotes();
+ } );
}
--
cgit v1.2.3
From c0109d948f9d562899795abf15fae5c83c96f21e Mon Sep 17 00:00:00 2001
From: Thomas Weinert
Date: Sat, 12 Aug 2017 13:38:46 +0200
Subject: Block F5 in speaker notes window, avoid disconnects
---
plugin/notes/notes.html | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'plugin')
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 4c5b799..9922a29 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -427,10 +427,16 @@
* Forward keyboard events to the current slide window.
* This enables keyboard events to work even if focus
* isn't set on the current slide iframe.
+ *
+ * Block F5 default handling, it reloads and disconnects
+ * the speaker notes window.
*/
function setupKeyboard() {
document.addEventListener( 'keydown', function( event ) {
+ if (event.keyCode === 116) {
+ event.preventDefault();
+ }
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
} );
--
cgit v1.2.3
From 773569b4a2668be34b9993f718766d77100968ef Mon Sep 17 00:00:00 2001
From: John MacFarlane
Date: Wed, 29 Nov 2017 21:53:10 -0800
Subject: Allow tex2jax options to be passed into math plugin.
Closes #2026.
This does not change the default behavior of the math plugin,
but it allows $ delimiters to be disabled (which is usually
what you want, since otherwise normal uses of $ for currency get
treated as math delimiters).
To use:
Reveal.initialize({
math: {
tex2jax: { inlineMath: [['\\(','\\)']],
skipTags: ['script','noscript','style',
'textarea','pre'] }
},
etc.
});
---
plugin/math/math.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'plugin')
diff --git a/plugin/math/math.js b/plugin/math/math.js
index e3b4089..7867376 100755
--- a/plugin/math/math.js
+++ b/plugin/math/math.js
@@ -9,15 +9,15 @@ var RevealMath = window.RevealMath || (function(){
var options = Reveal.getConfig().math || {};
options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
options.config = options.config || 'TeX-AMS_HTML-full';
+ options.tex2jax = options.tex2jax || {
+ inlineMath: [['$','$'],['\\(','\\)']] ,
+ skipTags: ['script','noscript','style','textarea','pre'] };
loadScript( options.mathjax + '?config=' + options.config, function() {
MathJax.Hub.Config({
messageStyle: 'none',
- tex2jax: {
- inlineMath: [['$','$'],['\\(','\\)']] ,
- skipTags: ['script','noscript','style','textarea','pre']
- },
+ tex2jax: options.tex2jax,
skipStartupTypeset: true
});
--
cgit v1.2.3
From 7a0b4a56f9fb63f85d14be1913e3f4384ee8d32c Mon Sep 17 00:00:00 2001
From: Hakim El Hattab
Date: Mon, 4 Dec 2017 13:57:19 +0100
Subject: prevent cmd+r in notes window since reloading breaks the view #1958
---
plugin/notes/notes.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'plugin')
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 9922a29..5b75d73 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -434,8 +434,9 @@
function setupKeyboard() {
document.addEventListener( 'keydown', function( event ) {
- if (event.keyCode === 116) {
+ if( event.keyCode === 116 || ( event.metaKey && event.keyCode === 82 ) ) {
event.preventDefault();
+ return false;
}
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
} );
--
cgit v1.2.3
From 18e7dd21731d4eca92e062b25e07462531b5b380 Mon Sep 17 00:00:00 2001
From: Benjamin Tan
Date: Thu, 8 Feb 2018 11:22:01 +0800
Subject: Cleanup code style.
---
js/reveal.js | 14 ++--
plugin/print-pdf/print-pdf.js | 18 ++--
plugin/search/search.js | 188 +++++++++++++++++++++---------------------
3 files changed, 109 insertions(+), 111 deletions(-)
(limited to 'plugin')
diff --git a/js/reveal.js b/js/reveal.js
index e3ffeac..2439a05 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -403,13 +403,13 @@
}
- /**
- * Loads the dependencies of reveal.js. Dependencies are
- * defined via the configuration option 'dependencies'
- * and will be loaded prior to starting/binding reveal.js.
- * Some dependencies may have an 'async' flag, if so they
- * will load after reveal.js has been started up.
- */
+ /**
+ * Loads the dependencies of reveal.js. Dependencies are
+ * defined via the configuration option 'dependencies'
+ * and will be loaded prior to starting/binding reveal.js.
+ * Some dependencies may have an 'async' flag, if so they
+ * will load after reveal.js has been started up.
+ */
function load() {
var scripts = [],
diff --git a/plugin/print-pdf/print-pdf.js b/plugin/print-pdf/print-pdf.js
index 15ce43e..f62aedc 100644
--- a/plugin/print-pdf/print-pdf.js
+++ b/plugin/print-pdf/print-pdf.js
@@ -42,28 +42,26 @@ probePage.open( inputFile, function( status ) {
printPage.open( inputFile, function( status ) {
console.log( 'Export PDF: Preparing pdf [3/4]')
- printPage.evaluate(function() {
+ printPage.evaluate( function() {
Reveal.isReady() ? window.callPhantom() : Reveal.addEventListener( 'pdf-ready', window.callPhantom );
- });
+ } );
} );
- printPage.onCallback = function(data) {
+ printPage.onCallback = function( data ) {
// For some reason we need to "jump the queue" for syntax highlighting to work.
// See: http://stackoverflow.com/a/3580132/129269
- setTimeout(function() {
+ setTimeout( function() {
console.log( 'Export PDF: Writing file [4/4]' );
printPage.render( outputFile );
console.log( 'Export PDF: Finished successfully!' );
phantom.exit();
- }, 0);
+ }, 0 );
};
}
else {
- console.log( 'Export PDF: Unable to read reveal.js config. Make sure the input address points to a reveal.js page.' );
- phantom.exit(1);
+ console.log( 'Export PDF: Unable to read reveal.js config. Make sure the input address points to a reveal.js page.' );
+ phantom.exit( 1 );
- }
+ }
} );
-
-
diff --git a/plugin/search/search.js b/plugin/search/search.js
index f7e5c2f..6d694d2 100644
--- a/plugin/search/search.js
+++ b/plugin/search/search.js
@@ -19,92 +19,92 @@ var RevealSearch = (function() {
function Hilitor(id, tag)
{
- var targetNode = document.getElementById(id) || document.body;
- var hiliteTag = tag || "EM";
- var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
- var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
- var wordColor = [];
- var colorIdx = 0;
- var matchRegex = "";
- var matchingSlides = [];
-
- this.setRegex = function(input)
- {
- input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
- matchRegex = new RegExp("(" + input + ")","i");
- }
-
- this.getRegex = function()
- {
- return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
- }
-
- // recursively apply word highlighting
- this.hiliteWords = function(node)
- {
- if(node == undefined || !node) return;
- if(!matchRegex) return;
- if(skipTags.test(node.nodeName)) return;
-
- if(node.hasChildNodes()) {
- for(var i=0; i < node.childNodes.length; i++)
- this.hiliteWords(node.childNodes[i]);
- }
- if(node.nodeType == 3) { // NODE_TEXT
- if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
- //find the slide's section element and save it in our list of matching slides
- var secnode = node;
- while (secnode != null && secnode.nodeName != 'SECTION') {
- secnode = secnode.parentNode;
- }
-
- var slideIndex = Reveal.getIndices(secnode);
- var slidelen = matchingSlides.length;
- var alreadyAdded = false;
- for (var i=0; i < slidelen; i++) {
- if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
- alreadyAdded = true;
- }
- }
- if (! alreadyAdded) {
- matchingSlides.push(slideIndex);
- }
-
- if(!wordColor[regs[0].toLowerCase()]) {
- wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
- }
-
- var match = document.createElement(hiliteTag);
- match.appendChild(document.createTextNode(regs[0]));
- match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
- match.style.fontStyle = "inherit";
- match.style.color = "#000";
-
- var after = node.splitText(regs.index);
- after.nodeValue = after.nodeValue.substring(regs[0].length);
- node.parentNode.insertBefore(match, after);
- }
- }
- };
-
- // remove highlighting
- this.remove = function()
- {
- var arr = document.getElementsByTagName(hiliteTag);
- while(arr.length && (el = arr[0])) {
- el.parentNode.replaceChild(el.firstChild, el);
- }
- };
-
- // start highlighting at target node
- this.apply = function(input)
- {
- if(input == undefined || !input) return;
- this.remove();
- this.setRegex(input);
- this.hiliteWords(targetNode);
- return matchingSlides;
- };
+ var targetNode = document.getElementById(id) || document.body;
+ var hiliteTag = tag || "EM";
+ var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
+ var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
+ var wordColor = [];
+ var colorIdx = 0;
+ var matchRegex = "";
+ var matchingSlides = [];
+
+ this.setRegex = function(input)
+ {
+ input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
+ matchRegex = new RegExp("(" + input + ")","i");
+ }
+
+ this.getRegex = function()
+ {
+ return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
+ }
+
+ // recursively apply word highlighting
+ this.hiliteWords = function(node)
+ {
+ if(node == undefined || !node) return;
+ if(!matchRegex) return;
+ if(skipTags.test(node.nodeName)) return;
+
+ if(node.hasChildNodes()) {
+ for(var i=0; i < node.childNodes.length; i++)
+ this.hiliteWords(node.childNodes[i]);
+ }
+ if(node.nodeType == 3) { // NODE_TEXT
+ if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
+ //find the slide's section element and save it in our list of matching slides
+ var secnode = node;
+ while (secnode != null && secnode.nodeName != 'SECTION') {
+ secnode = secnode.parentNode;
+ }
+
+ var slideIndex = Reveal.getIndices(secnode);
+ var slidelen = matchingSlides.length;
+ var alreadyAdded = false;
+ for (var i=0; i < slidelen; i++) {
+ if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
+ alreadyAdded = true;
+ }
+ }
+ if (! alreadyAdded) {
+ matchingSlides.push(slideIndex);
+ }
+
+ if(!wordColor[regs[0].toLowerCase()]) {
+ wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
+ }
+
+ var match = document.createElement(hiliteTag);
+ match.appendChild(document.createTextNode(regs[0]));
+ match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
+ match.style.fontStyle = "inherit";
+ match.style.color = "#000";
+
+ var after = node.splitText(regs.index);
+ after.nodeValue = after.nodeValue.substring(regs[0].length);
+ node.parentNode.insertBefore(match, after);
+ }
+ }
+ };
+
+ // remove highlighting
+ this.remove = function()
+ {
+ var arr = document.getElementsByTagName(hiliteTag);
+ while(arr.length && (el = arr[0])) {
+ el.parentNode.replaceChild(el.firstChild, el);
+ }
+ };
+
+ // start highlighting at target node
+ this.apply = function(input)
+ {
+ if(input == undefined || !input) return;
+ this.remove();
+ this.setRegex(input);
+ this.hiliteWords(targetNode);
+ return matchingSlides;
+ };
}
@@ -150,7 +150,7 @@ function Hilitor(id, tag)
}
}
- if (matchedSlides) {
+ if (matchedSlides) {
//navigate to the next slide that has the keyword, wrapping to the first if necessary
if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) {
currentMatchedIndex = 0;
@@ -169,20 +169,20 @@ function Hilitor(id, tag)
var searchElement = document.createElement( 'div' );
searchElement.id = "searchinputdiv";
searchElement.classList.add( 'searchdiv' );
- searchElement.style.position = 'absolute';
- searchElement.style.top = '10px';
- searchElement.style.right = '10px';
+ searchElement.style.position = 'absolute';
+ searchElement.style.top = '10px';
+ searchElement.style.right = '10px';
searchElement.style.zIndex = 10;
- //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
+ //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
searchElement.innerHTML = '';
dom.wrapper.appendChild( searchElement );
}
- document.getElementById("searchbutton").addEventListener( 'click', function(event) {
+ document.getElementById( 'searchbutton' ).addEventListener( 'click', function(event) {
doSearch();
}, false );
- document.getElementById("searchinput").addEventListener( 'keyup', function( event ) {
+ document.getElementById( 'searchinput' ).addEventListener( 'keyup', function( event ) {
switch (event.keyCode) {
case 13:
event.preventDefault();
@@ -195,7 +195,7 @@ function Hilitor(id, tag)
}, false );
document.addEventListener( 'keydown', function( event ) {
- if( event.key == "F" && (event.ctrlKey || event.metaKey) ) {//Control+Shift+f
+ if( event.key == "F" && (event.ctrlKey || event.metaKey) ) { //Control+Shift+f
event.preventDefault();
toggleSearch();
}
--
cgit v1.2.3
From 5771ae39f091966e603d3e1e5e64fbc0f387be64 Mon Sep 17 00:00:00 2001
From: Hakim El Hattab
Date: Tue, 24 Apr 2018 14:23:28 +0200
Subject: speaker view has visible connection status, times out with error
after 5s
---
plugin/notes/notes.html | 26 ++++++++++++++++++++++++++
plugin/notes/notes.js | 5 +++++
2 files changed, 31 insertions(+)
(limited to 'plugin')
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 5b75d73..0c4eca5 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -34,6 +34,22 @@
z-index: 2;
}
+ #connection-status {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 20;
+ padding: 30% 20% 20% 20%;
+ font-size: 18px;
+ color: #222;
+ background: #fff;
+ text-align: center;
+ box-sizing: border-box;
+ line-height: 1.4;
+ }
+
.overlay-element {
height: 34px;
line-height: 34px;
@@ -288,6 +304,8 @@