Skip to content

Instantly share code, notes, and snippets.

@pawellenart
Last active July 9, 2024 08:41
Show Gist options
  • Save pawellenart/75df3fe1e6e295248e41f70f49380033 to your computer and use it in GitHub Desktop.
Save pawellenart/75df3fe1e6e295248e41f70f49380033 to your computer and use it in GitHub Desktop.
Add clock to YouTube player controls panel
javascript:if(!document.getElementById("ytx-clock")){function t(){var e=new Date,r=e.getHours(),l=e.getMinutes(),a=(r=r<10?"0"+r:r)+":"+(l=l<10?"0"+l:l);document.getElementById("ytx-clock").innerText=a,document.getElementById("ytx-clock").textContext=a,setTimeout(t,1e4)}var e=document.createElement("div"),r=document.createAttribute("id");r.value="ytx-clock",e.setAttributeNode(r);var l=document.createAttribute("class");l.value="ytp-time-display",e.setAttributeNode(l);var a=document.createAttribute("onload");a.value="sT()",e.setAttributeNode(a),document.getElementsByClassName("ytp-right-controls")[0].prepend(e),t()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment