<commit_before>;(function () {
  /**
   * Torrent Manager
   * @constructor
  */
  function _Torrent () {
    var self = this
    $('.list').on('click', '.torrent', function () {
      $('.list .torrent').removeClass('selected')
      $(this).addClass('selected')
      self.setActions({
        name: $($(this).children('#name')).attr('data-file'),
        hash: $($(this).children('#name')).attr('hash')
      })
    })

    $('.left-menu .start').click(function () {
      var input = $('.left-menu .torrent-input input')
      if (input.val()) {
        self.download(input.val())
        input.val('')
        input.trigger('keyup')
      }
    })

    $('.left-menu .search').click(function () {
      var input = $('.left-menu .torrent-input input')
      App.SearchTorrent.search(input.val())
      App.LeftMenu.addInputList('torrent-input', input.val())
      input.val('')
    })
  }

  /**
   * Set the refresh interval of the directory
   * @param {bool} state - State of the refresh interval
   * @param {int} time - Time in millis of the interval refresh
  */
  _Torrent.prototype.setRefresh = function (state, time) {
    var self = this
    if (state) {
      clearInterval(self.interval)
      self.interval = setInterval(function () {
        self.getTorrents(function (tor) {
          self.append(tor)
        })
      }, time)
    } else {
      clearInterval(self.interval)
    }
  }

  /**
   * Get the current torrents infos from the server
   * @param {function} cb - Callback frunction with data
  */
  _Torrent.prototype.getTorrents = function (cb) {
    App.Loading.show('action')
    var self = this
    $.post('/list-t', function (torrents) {
      torrents = JSON.parse(torrents)
      if (torrents.err) {
        $.notify.error({
          title: 'Error',
          text: torrents.err
        })
      } else {
        App.Loading.hide('action')
        cb(torrents)
      }
    })
  }

  /**
   * Append torrents infos to List
   * @param {object} tor - torrent infos
  */
  _Torrent.prototype.append = function (tor) {
    var lines = []
    var i = 0
    $.each(tor, function (index, value) {
      lines.push({
        name: value.name,
        hash: value.hash,
        type: 'torrent',
        size: App.Format.size(value.size),
        progress: value.progress,
        percent: Math.round(value.progress * 100) + '%',
        timeRemaining: App.Format.time(value.timeRemaining),
        sdown: App.Format.speed(value.sdown),
        sup: App.Format.speed(value.sup)
      })

      i++
      if (i === Object.keys(tor).length) {<commit_msg>change % display<commit_after>;(function () {
  /**
   * Torrent Manager
   * @constructor
  */
  function _Torrent () {
    var self = this
    $('.list').on('click', '.torrent', function () {
      $('.list .torrent').removeClass('selected')
      $(this).addClass('selected')
      self.setActions({
        name: $($(this).children('#name')).attr('data-file'),
        hash: $($(this).children('#name')).attr('hash')
      })
    })

    $('.left-menu .start').click(function () {
      var input = $('.left-menu .torrent-input input')
      if (input.val()) {
        self.download(input.val())
        input.val('')
        input.trigger('keyup')
      }
    })

    $('.left-menu .search').click(function () {
      var input = $('.left-menu .torrent-input input')
      App.SearchTorrent.search(input.val())
      App.LeftMenu.addInputList('torrent-input', input.val())
      input.val('')
    })
  }

  /**
   * Set the refresh interval of the directory
   * @param {bool} state - State of the refresh interval
   * @param {int} time - Time in millis of the interval refresh
  */
  _Torrent.prototype.setRefresh = function (state, time) {
    var self = this
    if (state) {
      clearInterval(self.interval)
      self.interval = setInterval(function () {
        self.getTorrents(function (tor) {
          self.append(tor)
        })
      }, time)
    } else {
      clearInterval(self.interval)
    }
  }

  /**
   * Get the current torrents infos from the server
   * @param {function} cb - Callback frunction with data
  */
  _Torrent.prototype.getTorrents = function (cb) {
    App.Loading.show('action')
    var self = this
    $.post('/list-t', function (torrents) {
      torrents = JSON.parse(torrents)
      if (torrents.err) {
        $.notify.error({
          title: 'Error',
          text: torrents.err
        })
      } else {
        App.Loading.hide('action')
        cb(torrents)
      }
    })
  }

  /**
   * Append torrents infos to List
   * @param {object} tor - torrent infos
  */
  _Torrent.prototype.append = function (tor) {
    var lines = []
    var i = 0
    $.each(tor, function (index, value) {
      lines.push({
        name: value.name,
        hash: value.hash,
        type: 'torrent',
        size: App.Format.size(value.size),
        progress: value.progress,
        percent: Math.round(value.progress * 100) + ' %',
        timeRemaining: App.Format.time(value.timeRemaining),
        sdown: App.Format.speed(value.sdown),
        sup: App.Format.speed(value.sup)
      })

      i++
      if (i === Object.keys(tor).length) {
{'fraction_non_alphanumeric': 0.16402013942680094, 'fraction_numerical': 0.001549186676994578, 'mean_word_length': 2.1882716049382718, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2334689', 'n_tokens_mistral': 1652, 'n_tokens_neox': 1623, 'n_words': 339}