diff --git a/server/public/assets/js/functions.js b/server/public/assets/js/functions.js index 3c72fc5e..058211e3 100644 --- a/server/public/assets/js/functions.js +++ b/server/public/assets/js/functions.js @@ -355,6 +355,7 @@ function contextListener(that, event) { if(parent.id.indexOf("suggested-") > -1) suggested = true; document.getElementsByClassName("context-menu-root")[0].setAttribute("data-suggested", suggested); document.getElementsByClassName("context-menu-root")[0].setAttribute("data-id", parent.getAttribute("id").replace("suggested-", "")); + document.getElementsByClassName("context-menu-root")[0].setAttribute("data-source", parent.getAttribute("data-video-source")); Helper.removeClass("#context-menu-overlay", "hide"); var left = event.pageX - document.querySelector(".context-menu-root").offsetWidth / 2; var top = event.pageY; diff --git a/server/public/assets/js/listeners.js b/server/public/assets/js/listeners.js index 8c22b356..2e73278d 100755 --- a/server/public/assets/js/listeners.js +++ b/server/public/assets/js/listeners.js @@ -602,7 +602,11 @@ function addDynamicListeners() { var id = parent.getAttribute("data-id"); if(id != "") { Helper.css(".copy_video_id", "display", "block"); - Helper.setHtml(".copy_video_id", "https://www.youtube.com/watch?v=" + id); + if(parent.getAttribute("data-source") == "soundcloud") { + Helper.setHtml(".copy_video_id", "https://api.soundcloud.com/tracks/" + id + "?client_id=" + api_key.soundcloud); + } else if(parent.getAttribute("data-source") == "youtube") { + Helper.setHtml(".copy_video_id", "https://www.youtube.com/watch?v=" + id); + } var copyTextarea = document.querySelector('.copy_video_id'); copyTextarea.select(); var successful = document.execCommand('copy'); @@ -613,6 +617,7 @@ function addDynamicListeners() { } Helper.css(".copy_video_id", "display", "none"); } + Helper.addClass(".context-menu-root", "hide"); Helper.addClass("#context-menu-overlay", "hide"); document.getElementsByClassName("context-menu-root")[0].setAttribute("data-id", "");