<commit_before>(function(){
  setTimeout(function(){
    $("ul.logs li").each(function(){
      var nickField = $(this).children(".nick");
      var colorCode = parseInt(md5(nickField.text()).substring(0,6),16) & 0x7F7F7F;
      nickField.css("color","#"+(colorCode < 0x100000 ? '0' : '')+colorCode.toString(16));
    })
  }, 100);	
})()

var strftime = function(date) {
  var hour = date.getHours(),
      min  = date.getMinutes(),
      sec  = date.getSeconds();

  if (hour < 10) { hour = "0" + hour; }
  if ( min < 10) {  min = "0" +  min; }
  if ( sec < 10) {  sec = "0" +  sec; }

  return hour + ":" + min + ":" + sec;
};

var link = function(klass, href, title) {
  return $('<a class="' + klass + '" href="' + href
    + '" target="_self" title="' + title + '">');
};

var lastTimestamp = undefined;
var seenTimestamp = {};
var pollNewMsg = function(isWidget) {
  var isWidget = (isWidget == null) ? false : isWidget;
  var time = lastTimestamp || (new Date()).getTime() / 1000.0;
  $.ajax({
    url: "/comet/poll/" + channel + "/" + time + "/updates.json",
    type: "get",
    async: true,
    cache: false,
    timeout: 60000,

    success: function (data) {
      var msgs = JSON.parse(data || '[]');
      for (var i = 0; i < msgs.length; i++) {
        var msg = msgs[i];
        if (seenTimestamp[msg.time]) { continue; }
        seenTimestamp[msg.time] = true;
        var date = new Date(parseFloat(msg["time"]) * 1000);
        var lis  = $(".logs > li").length;
        var url  = $("#today").text();
        var colorCode = parseInt(md5(msg["nick"]).substring(0,6),16) & 0x7F7F7F;
        // $("#today").text() gets nothing automatically when isWidget
        var msgElement = $("<li id=\"" + lis + "\">").addClass("new-arrival")
          .append(link('time', url + '#' + lis, '#' + lis)
                    .text(strftime(date)))
          .append(link('nick', url + '/' + lis, msg['nick'])
                    .text(msg['nick'])
                    .css("color",'#'+(colorCode < 0x100000 ? '0' : '')+colorCode.toString(16)))
          .append($("<span class=\"msg wordwrap\">").html(msg["msg"]));
        if (isWidget) {
          $(".logs").prepend(msgElement);
        }
        else {
          $(".logs").append(msgElement);
        }
      }

      // there's new message
      if (msgs.length > 0) {
        if (isWidget) {
          // widget layout
          $(document).scrollTop(0);
        }
        else {
          // desktop or mobile layout, there's a switch to turn off auto-scrolling
          if (window.can_scroll) {
            $(document).scrollTop($(document).height());
          }
        }

        // if we're in desktop version
        if (typeof Cocoa !== "undefined" && Cocoa !== null) {<commit_msg>add a better mask<commit_after>(function(){
  setTimeout(function(){
    $("ul.logs li").each(function(){
      var nickField = $(this).children(".nick");

    var frag = parseInt(md5(nickField.text()).substring(0,6), 16);
    
    var colorCode = (frag | 0x808080) & 0xdfdfdf;
      
      nickField.css("color","#"+(colorCode < 0x100000 ? '0' : '')+colorCode.toString(16));
    })
  }, 100);	
})()

var strftime = function(date) {
  var hour = date.getHours(),
      min  = date.getMinutes(),
      sec  = date.getSeconds();

  if (hour < 10) { hour = "0" + hour; }
  if ( min < 10) {  min = "0" +  min; }
  if ( sec < 10) {  sec = "0" +  sec; }

  return hour + ":" + min + ":" + sec;
};

var link = function(klass, href, title) {
  return $('<a class="' + klass + '" href="' + href
    + '" target="_self" title="' + title + '">');
};

var lastTimestamp = undefined;
var seenTimestamp = {};
var pollNewMsg = function(isWidget) {
  var isWidget = (isWidget == null) ? false : isWidget;
  var time = lastTimestamp || (new Date()).getTime() / 1000.0;
  $.ajax({
    url: "/comet/poll/" + channel + "/" + time + "/updates.json",
    type: "get",
    async: true,
    cache: false,
    timeout: 60000,

    success: function (data) {
      var msgs = JSON.parse(data || '[]');
      for (var i = 0; i < msgs.length; i++) {
        var msg = msgs[i];
        if (seenTimestamp[msg.time]) { continue; }
        seenTimestamp[msg.time] = true;
        var date = new Date(parseFloat(msg["time"]) * 1000);
        var lis  = $(".logs > li").length;
        var url  = $("#today").text();
        var frag = parseInt(md5(msg['nick']).substring(0,6), 16);
        var colorCode = (frag | 0x808080) & 0xdfdfdf;
        // $("#today").text() gets nothing automatically when isWidget
        var msgElement = $("<li id=\"" + lis + "\">").addClass("new-arrival")
          .append(link('time', url + '#' + lis, '#' + lis)
                    .text(strftime(date)))
          .append(link('nick', url + '/' + lis, msg['nick'])
                    .text(msg['nick'])
                    .css("color",'#'+(colorCode < 0x100000 ? '0' : '')+colorCode.toString(16)))
          .append($("<span class=\"msg wordwrap\">").html(msg["msg"]));
        if (isWidget) {
          $(".logs").prepend(msgElement);
        }
        else {
          $(".logs").append(msgElement);
        }
      }

      // there's new message
      if (msgs.length > 0) {
        if (isWidget) {
          // widget layout
          $(document).scrollTop(0);
        }
        else {
          // desktop or mobile layout, there's a switch to turn off auto-scrolling
          if (window.can_scroll) {
            $(document).scrollTop($(document).height());
          }
        }

        // if we're in desktop version
        if (typeof Cocoa !== "undefined" && Cocoa !== null) {
{'fraction_non_alphanumeric': 0.19989272304666547, 'fraction_numerical': 0.025388878955837656, 'mean_word_length': 2.220495106505469, 'pattern_counts': {'":': 4, '<': 21, '<?xml version=': 0, '>': 13, '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': '6307136', 'n_tokens_mistral': 1939, 'n_tokens_neox': 1801, 'n_words': 421}