var http=require("http"),express=require("express"),fs=require("fs"),io=require("socket.io"),Mustache=require("mustache"),app=express(),staticDir=express.static,server=http.createServer(app);io=io(server);var opts={port:1947,baseDir:__dirname+"/../../"};io.on("connection",function(e){e.on("new-subscriber",function(t){e.broadcast.emit("new-subscriber",t)}),e.on("statechanged",function(t){delete t.state.overview,e.broadcast.emit("statechanged",t)}),e.on("statechanged-speaker",function(t){delete t.state.overview,e.broadcast.emit("statechanged-speaker",t)})}),["css","js","images","plugin","lib"].forEach(function(e){app.use("/"+e,staticDir(opts.baseDir+e))}),app.get("/",function(e,t){t.writeHead(200,{"Content-Type":"text/html"}),fs.createReadStream(opts.baseDir+"/index.html").pipe(t)}),app.get("/notes/:socketId",function(e,t){fs.readFile(opts.baseDir+"plugin/notes-server/notes.html",function(o,r){t.send(Mustache.to_html(r.toString(),{socketId:e.params.socketId}))})}),server.listen(opts.port||null);var brown="\x1B[33m",green="\x1B[32m",reset="\x1B[0m",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 in your JS console to go to the notes page"),console.log("3. Advance through your slides and your notes will advance automatically");
