Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (67 sloc) 2.4 KB


This document roughly describes the API that is used between the doc-review Web server and the user's browser. This specification is not complete. I wrote it while attempting to reverse-engineer the API used by

General notes

If there is more than one page that is being commented on per server, the id namespace is the same between documents.

jQuery and jQuery form need to be loaded before this script




Load comment

GET /comments/single/<id>/ HTTP/1.1

HTTP/1.1 200 OK Content-type: text/html

<HTML fragment to display for a single comment>

There should be a span.comment_error present in order to do validation. The new comment form has to have controls with name="name" and name="comment" fields in order for the validation to pass. The submission button should have name="submit".

Load comment counts

GET /comments/chapter/<chapter id>/count/

HTTP/1.1 200 OK Content-type: text/json

<{<comment id>:<count>} :: {String:Integer}>

Add new comment


POST /comments/submit/<id>/ Content-type: x-www-urlencoded

<Required fields: id, comment, name>


HTTP/1.1 200 OK Content-type: text/html

<the new comment HTML. Should be the same as /comments/single/<id>>


Adds a "Load all comments" link following div.toc>p

Adds the chapter id to a#chapterfeed[@href]

Looks for the first existing one of the following elements to find the chapter id:

  • div.preface
  • div.chapter
  • div.appendix
  • div.bibliography

Adds comment nodes for each of:

  • .chapter p[@id]
  • .chapter table[@id].equation
  • .chapter pre[@id]

A comment node is identified by #comments_<comment id>

Loads the comment counts for each comment and replaces the loading message with the comment count. Any span.commenttoggle elements that do not have a count returned get the text "No comments". ids that are not found in the page are ignored.