Fixes for suggested-showing of soundcloud objects

This commit is contained in:
Kasper Rynning-Tønnesen
2018-05-04 22:25:43 +02:00
parent dfe37df77c
commit d9283a33b5
3 changed files with 30 additions and 13 deletions

View File

@@ -633,7 +633,7 @@ var List = {
success: function(resp) {
},
error: function(error) {
console.log(error);
console.error(error);
}
});
}
@@ -645,7 +645,7 @@ var List = {
}
});
}, error: function(e) {
console.log(e);
console.error(e);
}
})
},
@@ -822,7 +822,7 @@ var List = {
List.addToYoutubePlaylist(playlist_id, full_playlist, number_added, request_url)
},
error: function(response){
console.log(response);
console.error(response);
response = response.responseText;
Helper.log([
"export to youtube response",
@@ -868,14 +868,13 @@ var List = {
//}, 50);
}
}, error: function(response) {
console.log(response);
console.error(response);
}
});
},
addToYoutubePlaylist: function(playlist_id, full_playlist, num, request_url) {
console.log(full_playlist[num], num);
if(num == full_playlist.length - 1){
Helper.log(["All videoes added!"]);
Helper.log(["url: https://www.youtube.com/playlist?list=" + playlist_id]);
@@ -1007,13 +1006,13 @@ var List = {
}
},
error: function(e) {
console.log(e);
console.error(e);
}
});
}
}, error: function(e) {
console.log(e);
console.error(e);
}
});

View File

@@ -30,8 +30,16 @@ var Suggestions = {
var duration = Helper.secondsToOther(params.duration);
var video_id = params.id;
var video_title = params.title;
var song = List.generateSong({id: video_id, title: video_title, length: params.duration, duration: duration}, false, false, false, true);
if(document.querySelectorAll("#" + video_id).length == 0) {
var toSend = {id: video_id, title: video_title, length: params.duration, duration: duration};
if(params.source) toSend.source = params.source;
if(params.thumbnail) toSend.thumbnail = params.thumbnail;
var song = List.generateSong(toSend, false, false, false, true);
var testingElem;
try {
testingElem = document.getElementById(video_id);
} catch(e) {}
if(!testingElem && document.querySelectorAll("#suggested-" + video_id).length == 0) {
document.getElementById("user-suggest-html").insertAdjacentHTML("beforeend", song);
}
},