Skip to content

Commit

Permalink
[js/annotations.js][s]: fix this up for new version of annotator sche…
Browse files Browse the repository at this point in the history
…ma and lib.
  • Loading branch information
rufuspollock committed Mar 19, 2011
1 parent 81cd457 commit 7adf87a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions shakespeare/public/js/annotations.js
@@ -1,13 +1,14 @@
jQuery(document).ready(function($) {
var $mydiv = $('#latest-annotations');
var mytmpl = '<li><a href="/work/annotate/${uri}">${work}</a>: ${snippet}</li>';
var url = 'http://annotateit.org/api/search?limit=5&all_fields=1';
var mytmpl = '<li><a href="${uri}">${work}</a>: ${snippet}</li>';
var url = 'http://annotateit.org/api/search?limit=5';
$.getJSON(url, function(data) {
$.each(data.rows, function(idx, row) {
var _t = row['text'];
row['snippet'] = _t.length < 75 ? _t : _t.slice(0, 75) + '...';
var _uri = row['uri'];
row['work'] = _uri[0].toUpperCase() + _uri.slice(1).replace('_', ' ');
var _name = row['uri'].split('/');
var _name = _name[_name.length-1];
row['work'] = _name[0].toUpperCase() + _name.slice(1).replace(/_/g, ' ');
});
$mydiv.find('.total').html(data.total);
$mydiv.find('ul').html($.tmpl(mytmpl, data.rows));
Expand Down

0 comments on commit 7adf87a

Please sign in to comment.