Sha256: b79b6f144dc120eeed1e89abbeba537ae9adca494994a2c7292029d53162ccb8

Contents?: true

Size: 1.65 KB

Versions: 23

Compression:

Stored size: 1.65 KB

Contents

var express   = require('express');
var fs        = require('fs');
var io        = require('socket.io');
var _         = require('underscore');
var Mustache  = require('mustache');

var app       = express.createServer();
var staticDir = express.static;

io            = io.listen(app);

var opts = {
	port :      1947,
	baseDir :   __dirname + '/../../'
};

io.sockets.on( 'connection', function( socket ) {

	socket.on( 'connect', function( data ) {
		socket.broadcast.emit( 'connect', data );
	});

	socket.on( 'statechanged', function( data ) {
		socket.broadcast.emit( 'statechanged', data );
	});

});

app.configure( function() {

	[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
		app.use( '/' + dir, staticDir( opts.baseDir + dir ) );
	});

});

app.get('/', function( req, res ) {

	res.writeHead( 200, { 'Content-Type': 'text/html' } );
	fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res );

});

app.get( '/notes/:socketId', function( req, res ) {

	fs.readFile( opts.baseDir + 'plugin/notes-server/notes.html', function( err, data ) {
		res.send( Mustache.to_html( data.toString(), {
			socketId : req.params.socketId
		}));
	});

});

// Actually listen
app.listen( opts.port || null );

var brown = '\033[33m',
	green = '\033[32m',
	reset = '\033[0m';

var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : '' );

console.log( brown + 'reveal.js - Speaker Notes' + reset );
console.log( '1. Open the slides at ' + green + slidesLocation + reset );
console.log( '2. Click on the link your JS console to go to the notes page' );
console.log( '3. Advance through your slides and your notes will advance automatically' );

Version data entries

23 entries across 22 versions & 7 rubygems

Version Path
slippery-0.4.2 assets/reveal.js/plugin/notes-server/index.js
reveal-ck-3.6.0 files/reveal.js/plugin/notes-server/index.js
reveal-ck-3.5.1 files/reveal.js/plugin/notes-server/index.js
reveal-ck-3.5.0 files/reveal.js/plugin/notes-server/index.js
reveal-ck-3.4.0 files/reveal.js/plugin/notes-server/index.js
reveal-ck-3.3.1 files/reveal.js/plugin/notes-server/index.js
dyndoc-ruby-0.3.0 share/etc/pandoc/extra/reveal.js-3.1.0/plugin/notes-server/index.js
dyndoc-ruby-0.3.0 share/etc/pandoc/extra/reveal.js-3.0.0/plugin/notes-server/index.js
reveal-ck-3.3.0 files/reveal.js/plugin/notes-server/index.js
reveal.rb-0.4.0 lib/reveal/templates/revealjs/plugin/notes-server/index.js
slidemgr-1.0.3 lib/template/reveal.js-3.0.0/plugin/notes-server/index.js
slidemgr-1.0.2 lib/template/reveal.js-3.0.0/plugin/notes-server/index.js
slidemgr-1.0.1 lib/template/reveal.js-3.0.0/plugin/notes-server/index.js
reveal-ck-3.2.0 files/reveal.js/plugin/notes-server/index.js
slideparts-0.0.1 lib/slide_template/plugin/notes-server/index.js
reveal-ck-3.1.0 files/reveal.js/plugin/notes-server/index.js
slide_hero-0.0.10 vendor/reveal.js/plugin/notes-server/index.js
reveal-ck-3.0.1 files/reveal.js/plugin/notes-server/index.js
slide_hero-0.0.9 vendor/reveal.js/plugin/notes-server/index.js
reveal-ck-3.0.0 files/reveal.js/plugin/notes-server/index.js