web/iframe/injected-iframe.js
function diffTable(results) {
  var curRefs = $('.references-list li').text().toString().split('\n').map(function(r) { return r.trim(); });
  $('#sbResults').html('<table><thead><tr><th>Title</th><th>Created</th><th>Source</th></tr></thead><tbody></tbody></table>');
  console.log('diffResults', results);
  if (results && results.hits.total > 0) {
    var t, created;
    t += '<tr><th colspan="4">Included</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) < new Date(2013, 4)) {
          if (curRefs.indexOf(r.title) > -1) {
            created = a.typed.Date;
          }
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults table').append(t);
    });

    t += '<tr><th colspan="4">Not included</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) < new Date(2013, 4)) {
          if (curRefs.indexOf(r.title) < 0) {
            created = a.typed.Date;
          }
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults tbody').append(t);
    });

    t += '<tr><th colspan="4">New</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) > new Date(2013, 3)) {
          created = a.typed.Date;
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults table').html(t);
    });
  }
}
function diffTable(results) {
  var curRefs = $('.references-list li').text().toString().split('\n').map(function(r) { return r.trim(); });
  $('#sbResults').html('<table><thead><tr><th>Title</th><th>Created</th><th>Source</th></tr></thead><tbody></tbody></table>');
  console.log('diffResults', results);
  if (results && results.hits.total > 0) {
    var t, created;
    t += '<tr><th colspan="4">Included</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) < new Date(2013, 4)) {
          if (curRefs.indexOf(r.title) > -1) {
            created = a.typed.Date;
          }
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults table').append(t);
    });

    t += '<tr><th colspan="4">Not included</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) < new Date(2013, 4)) {
          if (curRefs.indexOf(r.title) < 0) {
            created = a.typed.Date;
          }
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults tbody').append(t);
    });

    t += '<tr><th colspan="4">New</th></tr>';
    _.pluck(results.hits.hits, '_source').forEach(function(r) {
      created = false;
      // included annos

      r.annotations.forEach(function(a) {
        if (a.key === 'DateCreated' && new Date(a.typed.Date) > new Date(2013, 3)) {
          created = a.typed.Date;
        }
      });
      if (created) {
        r.created = created;
        t += _.template('<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>', r);
      }
      $('#sbResults table').html(t);
    });
  }
}
function diffTable ( results ) { var curRefs = $ ( '.references-list li' ) . text ( ) . toString ( ) . split ( '\n' ) . map ( function ( r ) { return r . trim ( ) ; } ) ; $ ( '#sbResults' ) . html ( '<table><thead><tr><th>Title</th><th>Created</th><th>Source</th></tr></thead><tbody></tbody></table>' ) ; console . log ( 'diffResults' , results ) ; if ( results && results . hits . total > 0 ) { var t , created ; t += '<tr><th colspan="4">Included</th></tr>' ; _ . pluck ( results . hits . hits , '_source' ) . forEach ( function ( r ) { created = false ; // included annos r . annotations . forEach ( function ( a ) { if ( a . key === 'DateCreated' && new Date ( a . typed . Date ) < new Date ( 2013 , 4 ) ) { if ( curRefs . indexOf ( r . title ) > - 1 ) { created = a . typed . Date ; } } } ) ; if ( created ) { r . created = created ; t += _ . template ( '<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>' , r ) ; } $ ( '#sbResults table' ) . append ( t ) ; } ) ; t += '<tr><th colspan="4">Not included</th></tr>' ; _ . pluck ( results . hits . hits , '_source' ) . forEach ( function ( r ) { created = false ; // included annos r . annotations . forEach ( function ( a ) { if ( a . key === 'DateCreated' && new Date ( a . typed . Date ) < new Date ( 2013 , 4 ) ) { if ( curRefs . indexOf ( r . title ) < 0 ) { created = a . typed . Date ; } } } ) ; if ( created ) { r . created = created ; t += _ . template ( '<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>' , r ) ; } $ ( '#sbResults tbody' ) . append ( t ) ; } ) ; t += '<tr><th colspan="4">New</th></tr>' ; _ . pluck ( results . hits . hits , '_source' ) . forEach ( function ( r ) { created = false ; // included annos r . annotations . forEach ( function ( a ) { if ( a . key === 'DateCreated' && new Date ( a . typed . Date ) > new Date ( 2013 , 3 ) ) { created = a . typed . Date ; } } ) ; if ( created ) { r . created = created ; t += _ . template ( '<tr><td><a href="<%= uri %>"><%= title %></a></td><td><%= created %></td><td><div class="ui tiny buttons"><div class="ui basic tiny button">PubMed</div></td></tr>' , r ) ; } $ ( '#sbResults table' ) . html ( t ) ; } ) ; } }
for a demo. sigh.
for a demo . sigh .