<commit_before>var genres = [
  {
    name: 'all',
    route: '/',
    active: true
  },
  {
    name: 'popular',
    route: '/'
  },
  {
    name: 'productivity',
    route: '/'
  },
  {
    name: 'publishing',
    route: '/'
  },
  {
    name: 'games',
    route: '/'
  },
  {
    name: 'email',
    route: '/'
  },
  {
    name: 'science',
    route: '/'
  },
  {
    name: 'media',
    route: '/'
  },
  {
    name: 'social',
    route: '/'
  }
];

function resizeTopbar(template) {

  template.$('.genres').css('visibility', 'hidden');
  template.genreCount.set(Genres.getAll().length);

  var availableWidth = template.$('.genre-holder').width() - 1;

  Tracker.afterFlush(function() {
    template.autorun(function(comp) {

      var currentCount = template.genreCount.get();

      if (template.$('.genres').width() > availableWidth && currentCount > 1)
        Tracker.afterFlush(function() {
          template.genreCount.set(currentCount - 1);
        });
      else {
        template.$('.genres').css('visibility', 'visible');
        comp.stop();
      }

    });
  });

}

Template.Topbar.onCreated(function() {

  this.genreCount = new ReactiveVar(100);
  this.moreOpen = new ReactiveVar(false);

});

Template.Topbar.helpers({
  genres: function() {

    var genres = Genres.getAll(),
        template = Template.instance();

    return genres.slice(0, template.genreCount.get());

  },

  extraGenres: function() {

    var genres = Genres.getAll(),
        template = Template.instance();

    return genres.slice(template.genreCount.get());

  },

  moreOpen: function() {

    return Template.instance().moreOpen.get();

  }
});

Template.Topbar.onRendered(function() {

  resizeTopbar(this);
  $(window).on('resize', _.debounce(resizeTopbar.bind(window, this), 250));
<commit_msg>made topbar genres activate<commit_after>function resizeTopbar(template) {

  template.$('.genres').css('visibility', 'hidden');
  template.genreCount.set(Genres.getAll().length);

  var availableWidth = template.$('.genre-holder').width() - 1;

  Tracker.afterFlush(function() {
    template.autorun(function(comp) {

      var currentCount = template.genreCount.get();

      if (template.$('.genres').width() > availableWidth && currentCount > 1)
        Tracker.afterFlush(function() {
          template.genreCount.set(currentCount - 1);
        });
      else {
        template.$('.genres').css('visibility', 'visible');
        comp.stop();
      }

    });
  });

}

Template.Topbar.onCreated(function() {

  this.genreCount = new ReactiveVar(100);
  this.moreOpen = new ReactiveVar(false);

});

Template.Topbar.helpers({
  genres: function() {

    var genres = Genres.getAll(),
        template = Template.instance();

    return genres.slice(0, template.genreCount.get());

  },

  extraGenres: function() {

    var genres = Genres.getAll(),
        template = Template.instance();

    return genres.slice(template.genreCount.get());

  },

  moreOpen: function() {

    return Template.instance().moreOpen.get();

  },

  active: function() {

    var path = /\/genres\/(.*)/.exec(FlowRouter.reactiveCurrent().path);
    return path && path.length && path[1] === this.name;

  }
});

Template.Topbar.onRendered(function() {

  resizeTopbar(this);
  $(window).on('resize', _.debounce(resizeTopbar.bind(window, this), 250));

{'fraction_non_alphanumeric': 0.1828793774319066, 'fraction_numerical': 0.0062855432505237955, 'mean_word_length': 2.931764705882353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6947722', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1070, 'n_words': 170}