<commit_before>var media = (function() {
  // Adds a string to the notification thing---meant for notifications
  // to the user.  To print debug statements, use window.console.log().
  function notify(str) {
    document.getElementById("notification").innerHTML = str;
  }

  function inspect(obj) {
    var out = '';
    for (var p in obj) {
      out += p + ': ' + obj[p] + '\n';
    }
    window.console.log(out);
  }

  function get_ith_media(i) {
    var meds = document.getElementById("media").childNodes;
    if (meds.length > i) {
      return meds[i];
    } else {
      return null;
    }
  }

  function play(elem) {
    var playing = document.getElementsByClassName("playing");
    if (playing.length > 0) {
      playing[0].setAttribute("class", "media");
    }

    var path = elem.getAttribute("path");
    var player = document.getElementById("player");

    var title = document.getElementById("page-title");
    var th = document.getElementById("title-header");
    title.innerHTML = elem.innerHTML;
    th.innerHTML = '<h1 class="header">Now Playing:</h1>\n' +
                      '<div class="title">' + elem.innerHTML; + "</div>";

    elem.setAttribute("class", "media playing");
    player.setAttribute("src", path);
    player.play();
  }

  function playRandomSong(meds) {
    if (!!meds && meds.length > 0) {
      media.i = Math.floor(Math.random() * meds.length);
      play(meds[media.i]);
    }
  }

  function shouldLoop() {
    return document.getElementById("loop").checked;
  }

  function shouldShuffle() {
    return document.getElementById("shuf").checked;
  }

  return {
    i : 0,  // index of playing media

    init : function(e) {
      var player = document.getElementById("player");
      player.addEventListener("play", function(e) {
        media.onplay(player);
      }, true);
      player.addEventListener("ended", media.onended, true);
      player.addEventListener("timeupdate", media.onprogress, true);

      document.getElementById("prev").onclick = media.prev;
      document.getElementById("next").onclick = media.next;<commit_msg>Don't play the same song twice when shuffle is on.<commit_after>var media = (function() {
  // Adds a string to the notification thing---meant for notifications
  // to the user.  To print debug statements, use window.console.log().
  function notify(str) {
    document.getElementById("notification").innerHTML = str;
  }

  function inspect(obj) {
    var out = '';
    for (var p in obj) {
      out += p + ': ' + obj[p] + '\n';
    }
    window.console.log(out);
  }

  function get_ith_media(i) {
    var meds = document.getElementById("media").childNodes;
    if (meds.length > i) {
      return meds[i];
    } else {
      return null;
    }
  }

  function play(elem) {
    var playing = document.getElementsByClassName("playing");
    if (playing.length > 0) {
      playing[0].setAttribute("class", "media");
    }

    var path = elem.getAttribute("path");
    var player = document.getElementById("player");

    var title = document.getElementById("page-title");
    var th = document.getElementById("title-header");
    title.innerHTML = elem.innerHTML;
    th.innerHTML = '<h1 class="header">Now Playing:</h1>\n' +
                      '<div class="title">' + elem.innerHTML; + "</div>";

    elem.setAttribute("class", "media playing");
    player.setAttribute("src", path);
    player.play();
  }

  function playRandomSong(meds) {
    if (!!meds && meds.length > 0) {
      var j = media.i;
      while ((j = Math.floor(Math.random() * meds.length)) == media.i);
      media.i = j;
      play(meds[media.i]);
    }
  }

  function shouldLoop() {
    return document.getElementById("loop").checked;
  }

  function shouldShuffle() {
    return document.getElementById("shuf").checked;
  }

  return {
    i : 0,  // index of playing media

    init : function(e) {
      var player = document.getElementById("player");
      player.addEventListener("play", function(e) {
        media.onplay(player);
      }, true);
      player.addEventListener("ended", media.onended, true);
      player.addEventListener("timeupdate", media.onprogress, true);

      document.getElementById("prev").onclick = media.prev;
      document.getElementById("next").onclick = media.next;
{'fraction_non_alphanumeric': 0.15481758652946678, 'fraction_numerical': 0.002806361085126286, 'mean_word_length': 2.94921514312096, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, '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': '28634', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1249, 'n_words': 283}