Copying video link now working

This commit is contained in:
Kasper Rynning-Tønnesen
2017-05-14 14:06:01 +02:00
parent c8cc177bbe
commit e72f9a635c
9 changed files with 582 additions and 4 deletions

View File

@@ -66,6 +66,7 @@ var List = {
insertAtIndex: function(song_info, transition, change) {
var i = List.getIndexOfSong(song_info.id);
var display = "none";
console.log(song_info.id);
if(!song_info.now_playing){
if(i >= List.page && i < List.page + (List.can_fit)) display = "block"
var add = List.generateSong(song_info, transition, false, true, false, display, false);

View File

@@ -107,8 +107,8 @@ try{/*
}*/
navigator.serviceWorker.getRegistration('/').then(function(registration) {
registration.unregister();
});
registration.unregister();
});
} catch(e) {}
@@ -329,6 +329,31 @@ function init(){
}
}
$.contextMenu({
selector: '.list-song',
reposition: true,
items: {
copy: {
name: "Copy link",
callback: function(key, opt){
var this_id = $(this[0]).attr("id");
var this_url = "https://www.youtube.com/watch?v=" + this_id;
$(".copy_video_id").css("display", "block");
$(".copy_video_id").text(this_url);
var copyTextarea = document.querySelector('.copy_video_id');
copyTextarea.select();
var successful = document.execCommand('copy');
if(successful) {
Materialize.toast("Copied!", 2000, "green lighten");
} else {
Materialize.toast("Error copying..", 2000, "red lighten");
}
$(".copy_video_id").css("display", "none");
}
}
}
});
if(!Helper.mobilecheck() && navigator.userAgent.match(/iPad/i) == null){
setTimeout(function(){set_title_width();}, 100);
}
@@ -1601,6 +1626,7 @@ function onepage_load(){
if(private_channel) add = Crypt.getCookie("_uI") + "_";
socket.emit("list", {channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
}else if(url_split[3] === ""){
$.contextMenu( 'destroy', ".list-song" );
user_change_password = false;
clearTimeout(width_timeout);
if(fireplace_initiated){
@@ -1691,6 +1717,7 @@ function onepage_load(){
$(".page-footer").removeClass("padding-bottom-novideo");
$("#favicon").attr("href", "public/images/favicon.png");
$(".context-menu-list").remove();
Helper.log(socket);
if($("#alreadyfp").length == 1){
initfp();