Ver Fonte

Worked on YouTube playlist importer and fixed issue with auto-fill when adding songs.

KrisVos130 há 9 anos atrás
pai
commit
244df29a3e
3 ficheiros alterados com 27 adições e 6 exclusões
  1. 8 0
      app/client/app.css
  2. 9 6
      app/client/client.js
  3. 10 0
      app/client/templates/room.html

+ 8 - 0
app/client/app.css

@@ -1545,4 +1545,12 @@ input[type="checkbox"]:checked + #two-label:after {
     cursor: not-allowed;
     opacity: 1;
     background-color: rgba(235, 235, 228, 0.5) !important;
+}
+
+#youtube-playlist-button {
+    background-color: rgba(220, 25, 43, 1);
+    margin-right: auto;
+    margin-left: auto;
+    color: rgba(253, 253, 254, 1);
+    display: block;
 }

+ 9 - 6
app/client/client.js

@@ -800,14 +800,12 @@ Template.room.events({
                                 "</div>" +
                             "</div>"
                         );
-                        console.log(data.items[i]);
-                        //$("#song-results").append("<p>" + data.items[i].snippet.title + "</p>");
-                        ytArr.push({title: data.items[i].snippet.title, id: data.items[i].id.videoId});
+                        ytArr.push({title: item.snippet.title, id: item.id.videoId});
                     }
-                    $("#song-results div").click(function(){
+                    $("#song-results > div").click(function(){
                         $("#search-info").hide();
                         $("#add-info").show();
-                        var title = $(this).text();
+                        var title =  $(this).find("div > .song-result-title").text();
                         for(var i in ytArr){
                             if(ytArr[i].title === title){
                                 var songObj = {
@@ -1034,6 +1032,9 @@ Template.alerts.helpers({
 });
 
 Template.room.helpers({
+    singleVideo: function() {
+        return true;
+    },
     chat: function() {
         Meteor.setTimeout(function() {
             var elem = document.getElementById('chat');
@@ -1858,7 +1859,7 @@ Template.playlist.events({
     "click #pl-item": function(){
         console.log($(this).text());
     }
-})
+});
 
 Meteor.subscribe("rooms");
 
@@ -1893,6 +1894,8 @@ Template.room.onCreated(function () {
     var firstScriptTag = document.getElementsByTagName('script')[0];
     firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
 
+    Session.set("singleVideo", true);
+
     var currentSong = undefined;
     var currentSongR = undefined;
 

+ 10 - 0
app/client/templates/room.html

@@ -165,6 +165,11 @@
                             <h4 class="modal-title">Search for a song</h4>
                         </div>
                         <div class="modal-body">
+                            <!--select name="si_or_pl" id="si_or_pl" class="song-input-select">
+                                <option name="single" id="select_single" title="Add a single video to the queue.">Single Video</option>
+                                <option name="playlist" id="select_playlist" title="Add all video's in a playlist to the queue.">Playlist</option>
+                            </select-->
+
                             <div id="search-info">
                                 <select name="type" id="search_type" class="song-input-select">
                                     <option name="youtube" id="search_youtube">YouTube</option>
@@ -191,6 +196,11 @@
                                 <input class="song-input" name="img" id="img" type="text" />
                                 <button type="button" id="add-song-button" class="button">Add Song</button>
                             </div>
+
+                            <!--div id="playlist-buttons">
+                                <button id="youtube-playlist-button" class="button">Import YouTube Playlist</button>
+                            </div-->
+
                             <!--small id="search-alert">Searching for a song fills out the above fields automatically, but you will still have to verify them.</small-->
                         </div>
                     </div>