Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b2125fd9f6
Fetching contributors…

Cannot retrieve contributors at this time

81 lines (71 sloc) 2.784 kb
@include = ->
@enable 'serve jquery'
@use @express.static __dirname
@include 'dotcloud'
db = @include 'db'
@get '/': ->
@response.contentType 'text/html'
@response.sendfile 'index.html'
@get '/start': -> @render 'start'
@get '/new': -> @response.redirect '/#' + require("uuid-pure").newId(10, 62)
@view start: ->
div id:"topnav_wrap", -> div id:"navigation"
div id:"intro-left", ->
h1 "EtherCalc"
h2 "EtherCalc is a web spreadsheet."
p "Your data is saved on the web, and people can edit the same document at the same time. Everybody's changes are instantly reflected on all screens."
p "Work together on inventories, survey forms, list management, brainstorming sessions and more!"
div id:"intro-links", ->
a id:"newpadbutton", href:"/new", alt: "Create Spreadsheet", ->
span "Create Spreadsheet"
br ""
small "No sign-up, start editing instantly"
@view layout: ->
html ->
head ->
title "EtherCalc"
link href:"/start.css", rel:"stylesheet", type:"text/css"
body id:"framedpagebody", class:"home", ->
div id:"top", -> @body
a href:"", ->
style:"z-order: 9999; position: absolute; top: 0; right: 0; border: 0"
alt:"Fork me on GitHub"
@on broadcast: ->
emit = (data) => @broadcast broadcast: data
{room, msg, user, ecell, cmdstr, type} = @data
switch type
when 'chat'
db.rpush "chat-#{room}", msg, => emit @data
when 'ask.ecells'
db.hgetall "ecell-#{room}", (err, values) => emit
type: 'ecells'
ecells: values
room: room
when 'my.ecell'
db.hset "ecell-#{room}", user, ecell
when 'execute'
db.rpush "log-#{room}", cmdstr, =>
emit @data
when 'ask.snapshot'
db.lrange "log-#{room}", 0, -1, (err, log) =>
db.lrange "chat-#{room}", 0, -1, (err, chat) => @emit broadcast:
type: 'log'
to: user
room: room
log: log
chat: chat
when 'stopHuddle'
db.del "log-#{room}", (err) =>
db.del "chat-#{room}", (err) =>
db.del "ecell-#{room}", (err) =>
emit @data
else emit @data
@include 'player'
@get '/:room': ->
@render room: { layout: no }
@view room: ->
coffeescript ->
window.location = '/#' + window.location.pathname.replace(/.*\//, '')
Jump to Line
Something went wrong with that request. Please try again.