<commit_before>define([
  'lib/js/marked.min',
  'lib/js/nprogress'
], function(Marked, Nprogress) {
  var DEFAULTCONTENTS = 'synopsis';
  var ipc = require('ipc');

  return Backbone.Router.extend({
    routes: {
      'docs/:contents': 'contentsHandler',
      'quit': 'quitHandler',
      '*actions': 'defaultHandler'
    },

    initialize: function() {
      // Marked.setOptions({
      //   highlight: function (code) {
      //     return Highlight.highlightAuto(code).value;
      //   }
      // });

      Backbone.history.start();
    },

    contentsLoader: function(contents) {
      return Backbone.ajax({
        url: 'contents/'+contents+'.md',
        beforeSend: function(xhr) {
          Nprogress.start();
        }
      });
    },

    contentsRenderer: function(doc) {
      Backbone.$('.main')[0].innerHTML = Marked(doc);
      Nprogress.done();
    },

    contentsHandler: function(contents) {
      this.contentsLoader(contents).done(this.contentsRenderer);
    },

    quitHandler: function() {
      ipc.send('quit');
    },

    defaultHandler: function(action) {
      if(!action) {
        this.contentsLoader(DEFAULTCONTENTS).done(this.contentsRenderer);;
      }
    }
  });<commit_msg>사이드바 선택 상태 구현<commit_after>define([
  'lib/js/marked.min',
  'lib/js/nprogress'
], function(Marked, Nprogress) {
  var DEFAULTCONTENTS = 'synopsis';
  var ipc = require('ipc');

  return Backbone.Router.extend({
    routes: {
      'docs/:contents': 'contentsHandler',
      'quit': 'quitHandler',
      '*actions': 'defaultHandler'
    },

    initialize: function() {
      // Marked.setOptions({
      //   highlight: function (code) {
      //     return Highlight.highlightAuto(code).value;
      //   }
      // });
      this.current = null;

      Backbone.history.start();
    },

    toogleMenu: function(contents) {
      if(this.current != null) {
        this.current.parentNode.removeAttribute('class');
      }

      this.current = Backbone.$('a[href="#docs/'+contents+'"]')[0];
      this.current.parentNode.className = 'active';
    },

    contentsLoader: function(contents) {
      return Backbone.ajax({
        url: 'contents/'+contents+'.md',
        beforeSend: function(xhr) {
          Nprogress.start();
        }
      });
    },

    contentsRenderer: function(doc) {
      Backbone.$('.main')[0].innerHTML = Marked(doc);
      Nprogress.done();
    },

    contentsHandler: function(contents) {
      this.toogleMenu(contents);
      this.contentsLoader(contents).done(this.contentsRenderer);
    },

    quitHandler: function() {
      ipc.send('quit');
    },

    defaultHandler: function(action) {
      if(!action) {
        this.contentsLoader(DEFAULTCONTENTS).done(this.contentsRenderer);
        this.toogleMenu(DEFAULTCONTENTS);
      }
    }
  });
{'fraction_non_alphanumeric': 0.1631054131054131, 'fraction_numerical': 0.0010683760683760685, 'mean_word_length': 2.502493765586035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '870994', 'n_tokens_mistral': 883, 'n_tokens_neox': 869, 'n_words': 122}