Skip to content

Commit

Permalink
deploy: 5b0a27a
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTrizna committed Jan 9, 2023
1 parent 2c26a2d commit 45299fe
Show file tree
Hide file tree
Showing 22 changed files with 133 additions and 68 deletions.
4 changes: 2 additions & 2 deletions dist/reveal.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="slides"><section data-markdown><script type="text/template">


# Quarterly Data Carpentry Workshop
# Quarterly Carpentry (Library) Workshop

![SI Carpentries](images/si_carpentries.png)
</script></section><section data-markdown><script type="text/template">
Expand Down Expand Up @@ -76,13 +76,13 @@
</script></section><section data-markdown><script type="text/template">
## Course website

https://smithsonianworkshops.github.io/2022-autumn-smithsonian/
https://smithsonian.github.io/2023-01-09-smithsonian-online/
</script></section><section data-markdown><script type="text/template">
## Course EtherPad

A collaborative document think of it as a stripped-down version of Google Docs

https://pad.carpentries.org/2022-autumn-smithsonian
https://pad.carpentries.org/2023-01-09-smithsonian-online
</script></section><section data-markdown><script type="text/template">
## Your first challenge

Expand All @@ -94,18 +94,18 @@

We will be teaching you data organization, cleaning, and visualization skills, so that your analyses can be easily understoood and reproduced by your colleagues ... and your future self.
</script></section><section data-markdown><script type="text/template">
## Day One (October 18)
## Day One (Mon, January 9)

### Version Control with GitHub
### The Unix Shell
</script></section><section data-markdown><script type="text/template">
## Day Two (October 19)
## Day Two (Tue, January 10)

### Tidy Data Principles in Spreadsheets
### Regular Expressions
### OpenRefine for Data Cleaning
</script></section><section data-markdown><script type="text/template">
## Day Three and Four (October 25/26)
## Day Three (Wed, January 11)

### Introduction to R
### Version Control with GitHub

</script></section><section data-markdown><script type="text/template">
> We will be teaching you a lot of valuable skills on a demo dataset, but you won't be able to add these tools to your *toolbag* until you work through how to apply them to your own data.
Expand Down Expand Up @@ -142,6 +142,7 @@
history: true,
center: true,
transition: 'default', // none/fade/slide/convex/concave/zoom
slideNumber: true,
plugins: [
RevealMarkdown,
RevealHighlight,
Expand Down
19 changes: 10 additions & 9 deletions intro_slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="slides"><section data-markdown><script type="text/template">


# Quarterly Data Carpentry Workshop
# Quarterly Carpentry (Library) Workshop

![SI Carpentries](images/si_carpentries.png)
</script></section><section data-markdown><script type="text/template">
Expand Down Expand Up @@ -76,13 +76,13 @@
</script></section><section data-markdown><script type="text/template">
## Course website

https://smithsonianworkshops.github.io/2022-autumn-smithsonian/
https://smithsonian.github.io/2023-01-09-smithsonian-online/
</script></section><section data-markdown><script type="text/template">
## Course EtherPad

A collaborative document think of it as a stripped-down version of Google Docs

https://pad.carpentries.org/2022-autumn-smithsonian
https://pad.carpentries.org/2023-01-09-smithsonian-online
</script></section><section data-markdown><script type="text/template">
## Your first challenge

Expand All @@ -94,18 +94,18 @@

We will be teaching you data organization, cleaning, and visualization skills, so that your analyses can be easily understoood and reproduced by your colleagues ... and your future self.
</script></section><section data-markdown><script type="text/template">
## Day One (October 18)
## Day One (Mon, January 9)

### Version Control with GitHub
### The Unix Shell
</script></section><section data-markdown><script type="text/template">
## Day Two (October 19)
## Day Two (Tue, January 10)

### Tidy Data Principles in Spreadsheets
### Regular Expressions
### OpenRefine for Data Cleaning
</script></section><section data-markdown><script type="text/template">
## Day Three and Four (October 25/26)
## Day Three (Wed, January 11)

### Introduction to R
### Version Control with GitHub

</script></section><section data-markdown><script type="text/template">
> We will be teaching you a lot of valuable skills on a demo dataset, but you won't be able to add these tools to your *toolbag* until you work through how to apply them to your own data.
Expand Down Expand Up @@ -142,6 +142,7 @@
history: true,
center: true,
transition: 'default', // none/fade/slide/convex/concave/zoom
slideNumber: true,
plugins: [
RevealMarkdown,
RevealHighlight,
Expand Down
4 changes: 2 additions & 2 deletions plugin/highlight/highlight.esm.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions plugin/highlight/highlight.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/highlight/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Plugin = {
hljs,

/**
* Highlights code blocks withing the given deck.
* Highlights code blocks within the given deck.
*
* Note that this can be called multiple times if
* there are multiple presentations on one page.
Expand Down
8 changes: 7 additions & 1 deletion plugin/markdown/markdown.esm.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion plugin/markdown/markdown.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion plugin/math/math.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/math/math.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/notes/notes.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/notes/notes.js

Large diffs are not rendered by default.

53 changes: 39 additions & 14 deletions plugin/notes/plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import speakerViewHTML from './speaker-view.html';
import speakerViewHTML from './speaker-view.html'

import { marked } from 'marked';

Expand Down Expand Up @@ -108,7 +108,7 @@ const Plugin = () => {
function post( event ) {

let slideElement = deck.getCurrentSlide(),
notesElement = slideElement.querySelector( 'aside.notes' ),
notesElements = slideElement.querySelectorAll( 'aside.notes' ),
fragmentElement = slideElement.querySelector( '.current-fragment' );

let messageData = {
Expand All @@ -130,36 +130,61 @@ const Plugin = () => {
if( fragmentElement ) {
let fragmentNotes = fragmentElement.querySelector( 'aside.notes' );
if( fragmentNotes ) {
notesElement = fragmentNotes;
messageData.notes = fragmentNotes.innerHTML;
messageData.markdown = typeof fragmentNotes.getAttribute( 'data-markdown' ) === 'string';

// Ignore other slide notes
notesElements = null;
}
else if( fragmentElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = fragmentElement.getAttribute( 'data-notes' );
messageData.whitespace = 'pre-wrap';

// In case there are slide notes
notesElement = null;
notesElements = null;
}
}

// Look for notes defined in an aside element
if( notesElement ) {
messageData.notes = notesElement.innerHTML;
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
if( notesElements ) {
messageData.notes = Array.from(notesElements).map( notesElement => notesElement.innerHTML ).join( '\n' );
messageData.markdown = notesElements[0] && typeof notesElements[0].getAttribute( 'data-markdown' ) === 'string';
}

speakerWindow.postMessage( JSON.stringify( messageData ), '*' );

}

function onPostMessage( event ) {
/**
* Check if the given event is from the same origin as the
* current window.
*/
function isSameOriginEvent( event ) {

let data = JSON.parse( event.data );
if( data && data.namespace === 'reveal-notes' && data.type === 'connected' ) {
clearInterval( connectInterval );
onConnected();
try {
return window.location.origin === event.source.location.origin;
}
catch ( error ) {
return false;
}
else if( data && data.namespace === 'reveal-notes' && data.type === 'call' ) {
callRevealApi( data.methodName, data.arguments, data.callId );

}

function onPostMessage( event ) {

// Only allow same-origin messages
// (added 12/5/22 as a XSS safeguard)
if( isSameOriginEvent( event ) ) {

let data = JSON.parse( event.data );
if( data && data.namespace === 'reveal-notes' && data.type === 'connected' ) {
clearInterval( connectInterval );
onConnected();
}
else if( data && data.namespace === 'reveal-notes' && data.type === 'call' ) {
callRevealApi( data.methodName, data.arguments, data.callId );
}

}

}
Expand Down
29 changes: 18 additions & 11 deletions plugin/notes/speaker-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ <h4 class="label">Notes</h4>
layoutDropdown,
pendingCalls = {},
lastRevealApiCallId = 0,
connected = false,
whitelistedWindows = [window.opener];
connected = false

var connectionStatus = document.querySelector( '#connection-status' );

var SPEAKER_LAYOUTS = {
'default': 'Default',
Expand All @@ -362,17 +363,25 @@ <h4 class="label">Notes</h4>

setupLayout();

var connectionStatus = document.querySelector( '#connection-status' );
let openerOrigin;

try {
openerOrigin = window.opener.location.origin;
}
catch ( error ) { console.warn( error ) }

// In order to prevent XSS, the speaker view will only run if its
// opener has the same origin as itself
if( window.location.origin !== openerOrigin ) {
connectionStatus.innerHTML = 'Cross origin error.<br>The speaker window can only be opened from the same origin.';
return;
}

var connectionTimeout = setTimeout( function() {
connectionStatus.innerHTML = 'Error connecting to main window.<br>Please try closing and reopening the speaker view.';
}, 5000 );
;
window.addEventListener( 'message', function( event ) {

// Validate the origin of this message to prevent XSS
if( window.location.origin !== event.origin && whitelistedWindows.indexOf( event.source ) === -1 ) {
return;
}
window.addEventListener( 'message', function( event ) {

clearTimeout( connectionTimeout );
connectionStatus.style.display = 'none';
Expand Down Expand Up @@ -539,8 +548,6 @@ <h4 class="label">Notes</h4>
upcomingSlide.setAttribute( 'src', upcomingURL );
document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );

whitelistedWindows.push( currentSlide.contentWindow, upcomingSlide.contentWindow );

}

/**
Expand Down
Loading

0 comments on commit 45299fe

Please sign in to comment.