<commit_before>var queue = 0;
var toBeLoaded = 0;
var loaded = 0;

function setTitle() {
  $('#title').html(config.title);
  document.title = config.title;
}

function setNavbar() {
 if (document.width >= 1560) {
  for (var i = 0; i < config.navbar.length; i++) {
    var dom = '<a href="' + config.navbar[i].link + '" class="button">' + config.navbar[i].text + '</a>';
    if (i != 0)
      $('<span> • </span>').appendTo('#navbar');
    $(dom).appendTo('#navbar');
  }
  } else {
  for (var i = 0; i < config.navbarS.length; i++) {
    var dom = '<a href="' + config.navbar[i].link + '" class="button">' + config.navbar[i].text + '</a>'; //add S
    if (i != 0)
      $('<span> • </span>').appendTo('#navbar');
    $(dom).appendTo('#navbar');
  }
  }
}

function createPlaceholders() {
  for (var i = 0; i < config.atOnce; i++) {
    if (toBeLoaded != config.posts.length) {
      var dom = '<div id="post' + config.posts[toBeLoaded] + '"></div>';
      $(dom).appendTo('#posts');
      toBeLoaded++;
    } else
      break;
  }
}

function navbar_relocate() {
    var window_top = $(window).scrollTop();
    var div_top = $('#navbar-anchor').offset().top;
    if (window_top > div_top) {
        $('#navbar').addClass('stick');
        $('#navbar-anchor').height($('#navbar').outerHeight());
    } else {
        $('#navbar').removeClass('stick');
        $('#navbar-anchor').height(0);
    }
}

function loadPosts() {
  $('#loader').show();
  for (;loaded < toBeLoaded; loaded++) {
    queue ++;
    $.get('https://api.github.com/gists/' + config.posts[loaded], function (data) {
      var gist = '';
      for (var j in data.files)
        gist = gist + marked.parse(data.files[j].content);
      var dom = '<div class="post">' +
                '<div class="post-text">' + gist + '</div>' +
                //'<span class="date"><a href="' + data.html_url + '">' + new Date(data.updated_at) + '</a></span>' +
                '<span class="date">' + new Date(data.updated_at) + '</a></span>' +
                ' • <span class="author">Posted by ' + data.owner.login + '</span>' +
                //' • <span class="author">Posted by <a href="https://github.com/' + data.owner.login + '">' + data.owner.login + '</a></span>' +
                '</div><hr>';
      $(dom).appendTo('#post' + data.id);
    }, 'json').done(function() {
      queue --;
      if (queue == 0)
        $('#loader').hide();
    });
  }
}

function loadFooter() {
  $('#footer-text').html(config.footerText);
}

function loadOlder() {
  createPlaceholders();
  loadPosts();
  if (toBeLoaded == config.posts.length)
    $('#old-posts').hide();
}

$(function() {
    $(window).scroll(navbar_relocate);
    navbar_relocate();
});

$('#loader').hide();
setTitle();
setNavbar();
loadFooter();
$('#old-posts').bind('click', loadOlder);
createPlaceholders();
loadPosts();
if (toBeLoaded == config.posts.length)
  $('#old-posts').hide();
<commit_msg>Update grite.js<commit_after>var queue = 0;
var toBeLoaded = 0;
var loaded = 0;

function setTitle() {
  $('#title').html(config.title);
  document.title = config.title;
}

function setNavbar() {
 if (document.width >= 1560) {
  for (var i = 0; i < config.navbar.length; i++) {
    var dom = '<a href="' + config.navbar[i].link + '" class="button">' + config.navbar[i].text + '</a>';
    if (i != 0)
      $('<span> • </span>').appendTo('#navbar');
    $(dom).appendTo('#navbar');
  }
  } else {
  for (var i = 0; i < config.navbar.length; i++) { //add S
    var dom = '<a href="' + config.navbar[i].link + '" class="button">' + config.navbar[i].text + '</a>'; //add S
    if (i != 0)
      $('<span> • </span>').appendTo('#navbar');
    $(dom).appendTo('#navbar');
  }
  }
}

function createPlaceholders() {
  for (var i = 0; i < config.atOnce; i++) {
    if (toBeLoaded != config.posts.length) {
      var dom = '<div id="post' + config.posts[toBeLoaded] + '"></div>';
      $(dom).appendTo('#posts');
      toBeLoaded++;
    } else
      break;
  }
}

function navbar_relocate() {
    var window_top = $(window).scrollTop();
    var div_top = $('#navbar-anchor').offset().top;
    if (window_top > div_top) {
        $('#navbar').addClass('stick');
        $('#navbar-anchor').height($('#navbar').outerHeight());
    } else {
        $('#navbar').removeClass('stick');
        $('#navbar-anchor').height(0);
    }
}

function loadPosts() {
  $('#loader').show();
  for (;loaded < toBeLoaded; loaded++) {
    queue ++;
    $.get('https://api.github.com/gists/' + config.posts[loaded], function (data) {
      var gist = '';
      for (var j in data.files)
        gist = gist + marked.parse(data.files[j].content);
      var dom = '<div class="post">' +
                '<div class="post-text">' + gist + '</div>' +
                //'<span class="date"><a href="' + data.html_url + '">' + new Date(data.updated_at) + '</a></span>' +
                '<span class="date">' + new Date(data.updated_at) + '</a></span>' +
                ' • <span class="author">Posted by ' + data.owner.login + '</span>' +
                //' • <span class="author">Posted by <a href="https://github.com/' + data.owner.login + '">' + data.owner.login + '</a></span>' +
                '</div><hr>';
      $(dom).appendTo('#post' + data.id);
    }, 'json').done(function() {
      queue --;
      if (queue == 0)
        $('#loader').hide();
    });
  }
}

function loadFooter() {
  $('#footer-text').html(config.footerText);
}

function loadOlder() {
  createPlaceholders();
  loadPosts();
  if (toBeLoaded == config.posts.length)
    $('#old-posts').hide();
}

$(function() {
    $(window).scroll(navbar_relocate);
    navbar_relocate();
});

$('#loader').hide();
setTitle();
setNavbar();
loadFooter();
$('#old-posts').bind('click', loadOlder);
createPlaceholders();
loadPosts();
if (toBeLoaded == config.posts.length)
  $('#old-posts').hide();

{'fraction_non_alphanumeric': 0.2405539408445888, 'fraction_numerical': 0.004787143101384852, 'mean_word_length': 2.8767395626242545, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 63, 'https://': 4, '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': '5722037', 'n_tokens_mistral': 2029, 'n_tokens_neox': 1962, 'n_words': 395}