diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/multiplex/index.js | 10 | ||||
-rw-r--r-- | plugin/multiplex/package.json | 19 | ||||
-rw-r--r-- | plugin/zoom-js/zoom.js | 12 |
3 files changed, 39 insertions, 2 deletions
diff --git a/plugin/multiplex/index.js b/plugin/multiplex/index.js index 40c1661..8195f04 100644 --- a/plugin/multiplex/index.js +++ b/plugin/multiplex/index.js @@ -31,7 +31,15 @@ io.on( 'connection', function( socket ) { app.get("/", function(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); - fs.createReadStream(opts.baseDir + '/index.html').pipe(res); + + var stream = fs.createReadStream(opts.baseDir + '/index.html'); + stream.on('error', function( error ) { + res.write('<style>body{font-family: sans-serif;}</style><h2>reveal.js multiplex server.</h2><a href="/token">Generate token</a>'); + res.end(); + }); + stream.on('readable', function() { + stream.pipe(res); + }); }); app.get("/token", function(req,res) { diff --git a/plugin/multiplex/package.json b/plugin/multiplex/package.json new file mode 100644 index 0000000..368bfd6 --- /dev/null +++ b/plugin/multiplex/package.json @@ -0,0 +1,19 @@ +{ + "name": "reveal-js-multiplex", + "version": "1.0.0", + "description": "reveal.js multiplex server", + "homepage": "http://lab.hakim.se/reveal-js", + "scripts": { + "start": "node index.js" + }, + "engines": { + "node": "~4.1.1" + }, + "dependencies": { + "express": "~4.13.3", + "grunt-cli": "~0.1.13", + "mustache": "~2.2.1", + "socket.io": "~1.3.7" + }, + "license": "MIT" +} diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js index 95093e0..8738083 100644 --- a/plugin/zoom-js/zoom.js +++ b/plugin/zoom-js/zoom.js @@ -11,7 +11,17 @@ if( event[ modifier ] && isEnabled ) { event.preventDefault(); - var bounds = event.target.getBoundingClientRect(); + var bounds; + var originalDisplay = event.target.style.display; + + // Get the bounding rect of the contents, not the containing box + if( window.getComputedStyle( event.target ).display === 'block' ) { + event.target.style.display = 'inline-block'; + bounds = event.target.getBoundingClientRect(); + event.target.style.display = originalDisplay; + } else { + bounds = event.target.getBoundingClientRect(); + } zoom.to({ x: ( bounds.left * revealScale ) - zoomPadding, |