<commit_before>/**
 * Copyright(c) 2015 <NAME> <<EMAIL>>
 */

$(function () {
  'use strict';
  var socket = io();

  function buildQueueTable (tracks) {
    $('#table_playlist').empty();

    for (var i = 0; i < tracks.length; i++) {
      var tableRow = document.createElement('tr');

      var songDetailsCell = document.createElement('td');
      $(songDetailsCell).text(tracks[i].artist + ' - ' + tracks[i].name);

      $(tableRow).append(songDetailsCell);
      $('#table_playlist').append(tableRow);
    };
  }


  function trackInfo(divName, track) {
    var div = document.getElementById(divName);
    $(div).empty();
    $(div).text(track.artist + ' - ' + track.name);
    if (divName === 'currentTrack') {
      $('#nextTrack').empty();
    };
  }


  socket.on('ping', function (message) {
    console.log(message);
  });


  socket.on('nextTracks', function(nextTracks) {
    buildQueueTable(nextTracks);
  });

  // Track info (current & next)
  socket.on('currentTrack', function (track) {
    trackInfo('currentTrack', track);
    console.log(track);
  });<commit_msg>added voting button (no function yet)<commit_after>/**
 * Copyright(c) 2015 <NAME> <<EMAIL>>
 */

$(function () {
  'use strict';
  var socket = io();

  function buildQueueTable (tracks) {
    $('#table_playlist').empty();

    for (var i = 0; i < tracks.length; i++) {
      var tableRow = document.createElement('tr');

      var songDetailsCell = document.createElement('td');
      $(songDetailsCell).text(tracks[i].artist + ' - ' + tracks[i].name);

      var buttonCell = document.createElement('td');
      var voteButton = document.createElement('button');
      $(voteButton)
        .attr('id', tracks[i].uri)
        .html('<span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>')
        .addClass('btn btn-default btn-lg');
      $(buttonCell).append(voteButton);

      $(tableRow).append(songDetailsCell, buttonCell);
      $('#table_playlist').append(tableRow);
    };
  }


  function trackInfo(divName, track) {
    var div = document.getElementById(divName);
    $(div).empty();
    $(div).text(track.artist + ' - ' + track.name);
    if (divName === 'currentTrack') {
      $('#nextTrack').empty();
    };
  }


  socket.on('ping', function (message) {
    console.log(message);
  });


  socket.on('nextTracks', function(nextTracks) {
    buildQueueTable(nextTracks);
  });

  // Track info (current & next)
  socket.on('currentTrack', function (track) {
    trackInfo('currentTrack', track);
    console.log(track);
  });
{'fraction_non_alphanumeric': 0.18978388998035364, 'fraction_numerical': 0.003929273084479371, 'mean_word_length': 3.3595890410958904, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '2440079', 'n_tokens_mistral': 828, 'n_tokens_neox': 789, 'n_words': 147}