Skip to content

Instantly share code, notes, and snippets.

@borkDoy
Last active April 1, 2022 10:00
Show Gist options
  • Save borkDoy/7abb08e74e278106556009d2b7de9aec to your computer and use it in GitHub Desktop.
Save borkDoy/7abb08e74e278106556009d2b7de9aec to your computer and use it in GitHub Desktop.
javascript:function minutesSeconds(s){return(s-(s%=60))/60+(9<s?':':':0')+s}function start(){var currentURL=window.location.href;var bar=document.getElementsByClassName("ytp-progress-bar")[0];var seconds=bar.getAttribute("aria-valuenow");var secondsInMS=minutesSeconds(seconds);var URL=currentURL+"?t="+seconds;var obsidianFormat="["+secondsInMS+"]("+URL+")";navigator.clipboard.writeText(obsidianFormat);null;var elemDiv=document.createElement('div');elemDiv.innerHTML="<h1 style='font-size:100px; color:white; text-align:center; margin-top:2em;'>"+secondsInMS+"</h1>";elemDiv.style.cssText='position:absolute;width:100%;height:100%;opacity:0.8;z-index:1000;background:#000;';document.body.appendChild(elemDiv);setTimeout(function(){elemDiv.style.display="none"},600)}start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment