<commit_before><center><div id="player"></div></center>
<script src="http://www.youtube.com/iframe_api"></script>

<script>
    /*
     * Put your video IDs in this array
     */
    var videoIDs = [
        'i_kF4zLNKio', <%= @songs.html_safe %>
    ];

    var player, currentVideoId = 0;

    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
            height: '350',
            width: '425',
            events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
            }
        });
    }

    function onPlayerReady(event) {
        event.target.loadVideoById(videoIDs[currentVideoId]);
    }

    function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.ENDED) {
            currentVideoId++;
            if (currentVideoId < videoIDs.length) {
                player.loadVideoById(videoIDs[currentVideoId]);
            }
        }
    }
</script>
<center>

<%= form_tag do %>
  <%= submit_tag("skip", :id => "skip-song") %>
<% end %>

<p>
  <% if @playlist.locked %>
    <%= form_for @playlist, :url => {:controller => :playlists, action: :update} do |f| %>
      <%= f.hidden_field :locked, value: false %>
      <%= f.submit "Unlock Playlist", :id => "unlock_playlist" %>
    <% end %>
  <% else %>
    <%= form_for @playlist, :url => {:controller => :playlists, action: :update} do |f| %>
      <%= f.hidden_field :locked, value: true %>
      <%= f.submit "Lock Playlist", :id => "lock_playlist" %>
    <% end %>
  <% end %>
</p>

</center>

<div id="playlist" class="container col-xs-9 col-md-6 col-xs-offset-2 col-md-offset-2">
  <h1><%= @playlist.name %></h1>
  <table if="playlist-table">
    <% @playlist.requests.each do |request| %>
      <%= div_for request, class: "rowBox" do %>
          <div>
            <div class="voting" id="voting-<%= request.id%>">
              <h6 id="vote-count-<%= request.id%>"><%= request.vote_count %></h6>
              <% if !@playlist.locked %>
                <a class="upvote" id="upvote-<%= request.id%>"> upvote </a>
                <a class="downvote" id="downvote-<%= request.id%>">downvote</a>
                <a class="delete" id = "delete-<%=  request.id %>">delete</a>  
              <% end %>
            </div>
            <%= link_to "#{request.song.name}", request.song %>
          </div>
      <% end %>
    <% end %>
  </table>
  <% if !@playlist.locked %>
    <h2>What we want:</h2>
    <%= render 'add_song_form' %>
  <% end %>
</div>
<commit_msg>Only allow hosts to delete songs from playlist<commit_after><center><div id="player"></div></center>
<script src="http://www.youtube.com/iframe_api"></script>

<script>
    /*
     * Put your video IDs in this array
     */
    var videoIDs = [
        'i_kF4zLNKio', <%= @songs.html_safe %>
    ];

    var player, currentVideoId = 0;

    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
            height: '350',
            width: '425',
            events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
            }
        });
    }

    function onPlayerReady(event) {
        event.target.loadVideoById(videoIDs[currentVideoId]);
    }

    function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.ENDED) {
            currentVideoId++;
            if (currentVideoId < videoIDs.length) {
                player.loadVideoById(videoIDs[currentVideoId]);
            }
        }
    }
</script>
<center>

<%= form_tag do %>
  <%= submit_tag("skip", :id => "skip-song") %>
<% end %>

<p>
  <% if @playlist.locked %>
    <%= form_for @playlist, :url => {:controller => :playlists, action: :update} do |f| %>
      <%= f.hidden_field :locked, value: false %>
      <%= f.submit "Unlock Playlist", :id => "unlock_playlist" %>
    <% end %>
  <% else %>
    <%= form_for @playlist, :url => {:controller => :playlists, action: :update} do |f| %>
      <%= f.hidden_field :locked, value: true %>
      <%= f.submit "Lock Playlist", :id => "lock_playlist" %>
    <% end %>
  <% end %>
</p>

</center>

<div id="playlist" class="container col-xs-9 col-md-6 col-xs-offset-2 col-md-offset-2">
  <h1><%= @playlist.name %></h1>
  <table if="playlist-table">
    <% @playlist.requests.each do |request| %>
      <%= div_for request, class: "rowBox" do %>
          <div>
            <div class="voting" id="voting-<%= request.id%>">
              <h6 id="vote-count-<%= request.id%>"><%= request.vote_count %></h6>
              <% if !@playlist.locked %>
                <a class="upvote" id="upvote-<%= request.id%>"> upvote </a>
                <a class="downvote" id="downvote-<%= request.id%>">downvote</a>
                <% if current_user.id == @playlist.host_id %>
                  <a class="delete" id="delete-<%=  request.id %>">delete</a>
                <% end %>
              <% end %>
            </div>
            <%= link_to "#{request.song.name}", request.song %>
          </div>
      <% end %>
    <% end %>
  </table>
  <% if !@playlist.locked %>
    <h2>What we want:</h2>
    <%= render 'add_song_form' %>
  <% end %>
</div>

{'fraction_non_alphanumeric': 0.19127581547963712, 'fraction_numerical': 0.006948465547191662, 'mean_word_length': 2.177191906805641, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1535747', 'n_tokens_mistral': 1886, 'n_tokens_neox': 1717, 'n_words': 342}