Code:
javascript:
function copyYoutubeTime()
{
var a=document.getElementById("movie_player");
var b=a.getCurrentTime();
var c="https://youtu.be/";
var d="?t="+parseInt(b);
var e=c+location.search.split("v=")[1].split("&")+d;
var f=document.createElement("textarea");
document.body.appendChild(f);
f.value=e;
f.select();
document.execCommand("copy");
document.body.removeChild(f);
alert("copied "+e+" !");
}
if(location.hostname==="www.youtube.com")
{
copyYoutubeTime();
}
else if(location.hostname==="youtu.be")
{
copyYoutubeTime();
}
else if(location.hostname==="www.youtube-nocookie.com")
{
copyYoutubeTime();
}
else
{
alert("not on youtube");
}
Bookmarklet:
javascript:function copyYoutubeTime(){var a=document.getElementById("movie_player");var b=a.getCurrentTime();var c="https://youtu.be/";var d="?t="+parseInt(b);var e=c+location.search.split("v=")[1].split("&")+d;var f=document.createElement("textarea");document.body.appendChild(f);f.value=e;f.select();document.execCommand("copy");document.body.removeChild(f);alert("copied "+e+" !");}if(location.hostname==="www.youtube.com"){copyYoutubeTime();}else if(location.hostname==="youtu.be"){copyYoutubeTime();}else if(location.hostname==="www.youtube-nocookie.com"){copyYoutubeTime();}else{alert("not on youtube");}