highlight, math, notes and zoom plugins now register via Reveal.registerPlugin
This commit is contained in:
parent
d780352b7f
commit
c40e9819a2
@ -402,7 +402,7 @@ Reveal.addEventListener( 'customevent', function() {
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||||
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||||
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
|
{ src: 'plugin/highlight/highlight.js', async: true },
|
||||||
{ src: 'plugin/search/search.js', async: true },
|
{ src: 'plugin/search/search.js', async: true },
|
||||||
{ src: 'plugin/zoom-js/zoom.js', async: true },
|
{ src: 'plugin/zoom-js/zoom.js', async: true },
|
||||||
{ src: 'plugin/notes/notes.js', async: true }
|
{ src: 'plugin/notes/notes.js', async: true }
|
||||||
|
File diff suppressed because one or more lines are too long
@ -20,28 +20,6 @@ var RevealMath = window.RevealMath || (function(){
|
|||||||
skipStartupTypeset: true
|
skipStartupTypeset: true
|
||||||
};
|
};
|
||||||
|
|
||||||
defaults( options, defaultOptions );
|
|
||||||
defaults( options.tex2jax, defaultOptions.tex2jax );
|
|
||||||
options.mathjax = options.config = null;
|
|
||||||
|
|
||||||
loadScript( url, function() {
|
|
||||||
|
|
||||||
MathJax.Hub.Config( options );
|
|
||||||
|
|
||||||
// Typeset followed by an immediate reveal.js layout since
|
|
||||||
// the typesetting process could affect slide height
|
|
||||||
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
|
|
||||||
MathJax.Hub.Queue( Reveal.layout );
|
|
||||||
|
|
||||||
// Reprocess equations in slides when they turn visible
|
|
||||||
Reveal.addEventListener( 'slidechanged', function( event ) {
|
|
||||||
|
|
||||||
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
function defaults( options, defaultOptions ) {
|
function defaults( options, defaultOptions ) {
|
||||||
|
|
||||||
for ( var i in defaultOptions ) {
|
for ( var i in defaultOptions ) {
|
||||||
@ -81,4 +59,37 @@ var RevealMath = window.RevealMath || (function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: function() {
|
||||||
|
|
||||||
|
defaults( options, defaultOptions );
|
||||||
|
defaults( options.tex2jax, defaultOptions.tex2jax );
|
||||||
|
options.mathjax = options.config = null;
|
||||||
|
|
||||||
|
loadScript( url, function() {
|
||||||
|
|
||||||
|
MathJax.Hub.Config( options );
|
||||||
|
|
||||||
|
// Typeset followed by an immediate reveal.js layout since
|
||||||
|
// the typesetting process could affect slide height
|
||||||
|
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
|
||||||
|
MathJax.Hub.Queue( Reveal.layout );
|
||||||
|
|
||||||
|
// Reprocess equations in slides when they turn visible
|
||||||
|
Reveal.addEventListener( 'slidechanged', function( event ) {
|
||||||
|
|
||||||
|
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
// lofi xbrowser Promise.resolve()
|
||||||
|
return { then: function( resolve ) { resolve(); }};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
Reveal.registerPlugin( 'math', RevealMath );
|
||||||
|
@ -168,7 +168,8 @@ var RevealNotes = (function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
// lofi xbrowser Promise.resolve()
|
||||||
|
return { then: function( resolve ) { resolve(); }};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,29 +1,37 @@
|
|||||||
// Custom reveal.js integration
|
// Custom reveal.js integration
|
||||||
(function(){
|
var RevealZoom = (function(){
|
||||||
var revealElement = document.querySelector( '.reveal' );
|
|
||||||
if( revealElement ) {
|
|
||||||
|
|
||||||
revealElement.addEventListener( 'mousedown', function( event ) {
|
return {
|
||||||
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
|
init: function() {
|
||||||
|
|
||||||
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
|
Reveal.getRevealElement().addEventListener( 'mousedown', function( event ) {
|
||||||
var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
|
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
|
||||||
|
|
||||||
if( event[ modifier ] && !Reveal.isOverview() ) {
|
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
|
||||||
event.preventDefault();
|
var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
|
||||||
|
|
||||||
zoom.to({
|
if( event[ modifier ] && !Reveal.isOverview() ) {
|
||||||
x: event.clientX,
|
event.preventDefault();
|
||||||
y: event.clientY,
|
|
||||||
scale: zoomLevel,
|
|
||||||
pan: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
zoom.to({
|
||||||
|
x: event.clientX,
|
||||||
|
y: event.clientY,
|
||||||
|
scale: zoomLevel,
|
||||||
|
pan: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// lofi xbrowser Promise.resolve()
|
||||||
|
return { then: function( resolve ) { resolve(); }};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
Reveal.registerPlugin( 'zoom', RevealZoom );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* zoom.js 0.3 (modified for use with reveal.js)
|
* zoom.js 0.3 (modified for use with reveal.js)
|
||||||
* http://lab.hakim.se/zoom-js
|
* http://lab.hakim.se/zoom-js
|
||||||
|
Loading…
Reference in New Issue
Block a user