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 7b91a5e5b5
commit 6412d0a478
3 changed files with 30 additions and 13 deletions

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);
}
},