Skip to content

Instantly share code, notes, and snippets.

@ttodua
Created October 28, 2019 10:43
Show Gist options
  • Save ttodua/58945df800e1831efc8c46c6bd805498 to your computer and use it in GitHub Desktop.
Save ttodua/58945df800e1831efc8c46c6bd805498 to your computer and use it in GitHub Desktop.
javascript: use_DIRECT_COPY=true; function fallbackCopyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text; textArea.style.position="fixed"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand("copy"); } catch (err) { promptCopy1(text); } document.body.removeChild(textArea); } function promptCopy1(text){ prompt("url", text); }; (function(){ var yt=document.getElementById("movie_player"); var data=yt.getVideoData(); var text=data["title"] + " " + "https://youtu.be/"+data["video_id"]+"?t="+Math.floor(yt.getCurrentTime()); if (use_DIRECT_COPY) fallbackCopyTextToClipboard(text); else {promptCopy1(text);} })(); void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment