example template from erica, deploy instructions
Use documents with title and contents

Basic change to the example app. Now the form has a title field and a
textarea for contents, as well as a submit button.

Also removed dependency on /_utils/script/sha1.js since it didn't seem
to be used.
Implement individual document view and links

Documents can now be viewed at index.html#<id>.
The documents list contains only the titles, as links.
filter for changes to specific doc
remove old logging
Implement changes feed for document view

Documents are refreshed as changes arrive.
Implement editing and saving in document view

Currently using contentEditable for the text, with explicit "Save"
button.  Will experiment with auto-saving soon.
Implement live updates

Updates are sent one second after the last keypress.
I tried sending on every keypress, but that was too fast, and led to
update conflicts for some reason.  Probably the updated ids from each
save weren't coming back fast enough.

I guess there's a hole here where you could write for hours without ever
taking a one-second break, and your work won't be saved.  We could add
alternate savers to cover that.

Linebreaks are not handled well yet.  That's next.
Also, OT for changes which come in while we're writing.
remove explicit save button
Support multi-line documents

Document contents is now an array of strings.  It's rendered by
including a <br> between each string.

This matches reasonably well with the contentEditable behavior in
Firefox.  Safari does some more fancy things with divs.

Reading the modified buffer into an array of strings: we keep text
nodes, and recurse into others.  In addition, we check for repeated <br>
tags (or <br> tags inside divs) and add an empty line so they will be
reconstituted.
logo links to home
Create documents from home

Current flow: there's a title field on home.  Enter text and press
return, and this creates your document and jumps to its view/edit page.
The document is pre-filled with the text "Click here to edit this document".

Future: title field isn't always there, only appears on clicking "New"?
Filter changes for doclist, only creation

Changes feed used on home page now only looks at _rev = 1-(...)
This means we're tracking only new document creation, not every update.
Fix redraw when returning to a document

The `doc` object was not cleared on return to home, so following the
path (page1 -> home -> page1) we thought we already had the current
revision displayed, and didn't change anything.  This left us displaying
the home page while looking at #page1.

Fixed by setting doc=null when drawing home.
use keydown event rather than keypress
Abort old change polls

Previously, we had no method to abort changelist longpolls.  This led to
their connections clogging the browser's list of max parallel
connections, making the app unresponsive.

This requires adding our own version of jquery.couch.js, using a patch
by Fedor Indutny (@indutny).

We keep track of the last change handler used, in order to stop it when
we start a new change.
include changesets.js
commenting tweak to changesets
Implement OT updates

When updates come in for the active document, use changesets.js to
transform them against our (uncommitted) changes.

Document format in the DB is back to a single string, with embedded "\n"
characters for linebreaks.  The content paragraph has style
"white-space: pre" so these get rendered correctly.  Differing
contentEditable insertion behavior in Gecko and Webkit makes this the
best choice, I think.

A big chunk of this was maintaining cursor position across the change.
This is done by adding a "\xff" character at the cursor position,
running the change, and finding the character afterward.  To set the
cursor location, we transform the \xff into an empty span with an id.

Many bugs may still lurk.  Currently, selection location isn't checked,
so if the cursor is outside the editable region we have problems.
At the moment, we run the transform immediately.  If this causes trouble
while typing quickly, we can change to only running once the save pause
occurs.
TODO: if a save fails due to conflicts, pull & transform and try again.
Maintain two-sided selections when transforming

"Real" selections, not just cursor position.
If multiple regions are selected, only the first remains. We could
support more, but it's not worth the effort right now. Chrome doesn't
even let me make such selections, though Firefox does.

Two different markers are inserted ('\x00' and '\x01') to mark the
endpoints, so the endpoints are transformed. For example, someone can
insert new text in the middle of your selection, which transforms
appropriately.
(For basic cursor selections, we now use '\x00' too; an improvement on
'\xff' since folks might want to type ÿ at some point)

I discovered that the (old) version of Safari that I can run has a bug
with Node.contains, so I'm just dropping support.  We could implement a
workaround, but ehh...

Also committed some debug logging which I've been using for a while.