<commit_before>var app = {}
// set up some state
app.init = function () {
  app.state = {};
  app.state.location = window.location;
  app.state.page = app.state.location.pathname.replace('/','');
};

app.docs = new (function() {

  this.init = function() {
    this.$toc = $('.toc');
    this.$content = $('content .span8');
    this.giveSubIDs();
    this.registerScroll();
    this.registerMenu();
  };

  // register the collapsible menu
  this.registerMenu = function() {
    var self = this;
    this.$toc.find('ul > li').click(function(e) {
      var $el = $(this);
      self.$toc.find('.selected').removeClass('selected');
      $el.find('ul').addClass('selected');
      $el.find('a:first').addClass('selected');
    });
  };

  // register the scrolling menu
  this.registerScroll = function() {
    var self = this;
    $(window).scroll(function(e) {
      var newTop = $(this).scrollTop();
      // only scroll on screens larger than an iphone
      if (newTop > 462 && $(this).width() > 767) {
        self.$toc.offset({top: newTop + 20});<commit_msg>the docs page should have better scrolling functionality now<commit_after>var app = {}
// set up some state
app.init = function () {
  app.state = {};
  app.state.location = window.location;
  app.state.page = app.state.location.pathname.replace('/','');
};

app.docs = new (function() {

  this.init = function() {
    this.$toc = $('.toc');
    this.$content = $('content .span8');
    this.giveSubIDs();
    this.registerScroll();
    this.registerMenu();
  };

  // register the collapsible menu
  this.registerMenu = function() {
    var self = this;
    this.$toc.find('ul > li').click(function(e) {
      var $el = $(this);
      var $section = $el.find('a:first');
      var $subList = $el.find('ul');
      if ($section.hasClass('selected') && !$el.siblings('ul').legnth) {
        $section.removeClass('selected');
        $subList.removeClass('selected');
        self.noScroll = false;
      }
      else {
        self.$toc.find('.selected').removeClass('selected');
        $subList.addClass('selected');
        $section.addClass('selected');

        console.log(self.$toc.height(), $(window).height());

        if (self.$toc.height() > $(window).height()) {
          var time = setTimeout(function() {
            self.noScroll = true;
            clearTimeout(time);
          }, 10);
        }
     }
    });
  };

  // register the scrolling menu
  this.registerScroll = function() {
    var self = this;
    $(window).scroll(function(e) {

      if (self.noScroll) {
        return;
      }

      var newTop = $(this).scrollTop();
      // only scroll on screens larger than an iphone
      if (newTop > 462 && $(this).width() > 767) {
        self.$toc.offset({top: newTop + 20});
{'fraction_non_alphanumeric': 0.18634886240520043, 'fraction_numerical': 0.007222824124232575, 'mean_word_length': 2.602080624187256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '318270', 'n_tokens_mistral': 889, 'n_tokens_neox': 845, 'n_words': 180}