<commit_before>// update the local timeline from a Comet server
//

var updater = function()
{
     var _cometd;

     return {
          init: function(server, timeline)
          {
               _cometd = $.cometd; // Uses the default Comet object
               _cometd.setLogLevel('debug');
               _cometd.init(server);
               _cometd.subscribe(timeline, receive);
               $(window).unload(leave);
          }
     }

     function leave()
     {
          _cometd.disconnect();
     }

     function receive(message)
     {
          var noticeItem = makeNoticeItem(message.data);
          $("#notices_primary .notices").prepend(noticeItem, true);
          $("#notices_primary .notice:first").css({display:"none"});
          $("#notices_primary .notice:first").fadeIn(2500);
          NoticeHover();
          NoticeReply();
     }

     function makeNoticeItem(data)
     {<commit_msg>Don't add a notice if it already exists on the page<commit_after>// update the local timeline from a Comet server
//

var updater = function()
{
     var _cometd;

     return {
          init: function(server, timeline)
          {
               _cometd = $.cometd; // Uses the default Comet object
               _cometd.setLogLevel('debug');
               _cometd.init(server);
               _cometd.subscribe(timeline, receive);
               $(window).unload(leave);
          }
     }

     function leave()
     {
          _cometd.disconnect();
     }

     function receive(message)
     {
          id = message.data.id;

          // Don't add it if it already exists

          if ($("#notice-"+id).length > 0) {
               return;
          }

          var noticeItem = makeNoticeItem(message.data);
          $("#notices_primary .notices").prepend(noticeItem, true);
          $("#notices_primary .notice:first").css({display:"none"});
          $("#notices_primary .notice:first").fadeIn(2500);
          NoticeHover();
          NoticeReply();
     }

     function makeNoticeItem(data)
     {
{'fraction_non_alphanumeric': 0.12426326129666011, 'fraction_numerical': 0.0044204322200392925, 'mean_word_length': 1.8019257221458047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4988242', 'n_tokens_mistral': 595, 'n_tokens_neox': 568, 'n_words': 121}