Skip to content

Commit

Permalink
formatting and tweaks for hakimel#2104
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Oct 4, 2018
1 parent 49c96a0 commit f2ca469
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 34 deletions.
23 changes: 3 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,8 @@
<body>
<div class="reveal">
<div class="slides">
<section data-timing="6">
Slide 1

<aside>
these are not notes
</aside>
<aside class="notes">
these are notes for the first slide
</aside>
</section>
<section>
Slide 2

<aside class="notes">
these are the nodes for the second slide
</aside>
</section>
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>

Expand All @@ -57,9 +42,7 @@
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
],
controlsTutorial: false,
defaultTiming: 3
]
});
</script>
</body>
Expand Down
18 changes: 10 additions & 8 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4099,18 +4099,20 @@
}

/**
* Returns an array of objects where each object represents the attributes on its respective slide.
* Returns an array of objects where each object represents the
* attributes on its respective slide.
*/
function getSlidesMetaInfo() {
function getSlidesAttributes() {

var slides = getSlides();
return slides.map( function (slide) {
var meta = {};
return getSlides().map( function( slide ) {

var attributes = {};
for( var i = 0; i < slide.attributes.length; i++ ) {
var attribute = slide.attributes[ i ];
meta[ attribute.name ] = attribute.value;
attributes[ attribute.name ] = attribute.value;
}
return meta;
return attributes;

} );

}
Expand Down Expand Up @@ -5473,7 +5475,7 @@

// Returns an Array of objects representing the attributes on
// the slides
getSlidesMetaInfo: getSlidesMetaInfo,
getSlidesAttributes: getSlidesAttributes,

// Returns the total number of slides
getTotalSlides: getTotalSlides,
Expand Down
8 changes: 5 additions & 3 deletions plugin/notes/notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ <h4 class="label">Notes</h4>
* Asynchronously calls the Reveal.js API of the main frame.
*/
function callRevealApi( methodName, methodArguments, callback ) {

var callId = ++lastRevealApiCallId;
pendingCalls[callId] = callback;
window.opener.postMessage( JSON.stringify( {
Expand All @@ -417,6 +418,7 @@ <h4 class="label">Notes</h4>
methodName: methodName,
arguments: methodArguments
} ), '*' );

}

/**
Expand Down Expand Up @@ -535,7 +537,7 @@ <h4 class="label">Notes</h4>

function getTimings( callback ) {

callRevealApi( 'getSlidesMetaInfo', [], function ( slides ) {
callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) {
callRevealApi( 'getConfig', [], function ( config ) {
var defaultTiming = config.defaultTiming;
if (defaultTiming == null) {
Expand All @@ -544,8 +546,8 @@ <h4 class="label">Notes</h4>
}

var timings = [];
for ( var i in slides ) {
var slide = slides[ i ];
for ( var i in slideAttributes ) {
var slide = slideAttributes[ i ];
var timing = defaultTiming;
if( slide.hasOwnProperty( 'data-timing' )) {
var t = slide[ 'data-timing' ];
Expand Down
8 changes: 5 additions & 3 deletions plugin/notes/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ var RevealNotes = (function() {
}

/**
* Calls the specified Reveal.js method with the provided argument and then pushes the result to the notes
* frame.
* Calls the specified Reveal.js method with the provided argument
* and then pushes the result to the notes frame.
*/
function callRevealApi( methodName, methodArguments, callId ) {
var result = Reveal[methodName].call(Reveal, methodArguments);

var result = Reveal[methodName].call( Reveal, methodArguments );
notesPopup.postMessage( JSON.stringify( {
namespace: 'reveal-notes',
type: 'return',
result: result,
callId: callId
} ), '*' );

}

/**
Expand Down

0 comments on commit f2ca469

Please sign in to comment.