Skip to content

Instantly share code, notes, and snippets.

@Scrumplex
Created November 29, 2017 16:54
Show Gist options
  • Save Scrumplex/46dd4e41d6b1a41c06b3db379da4eb18 to your computer and use it in GitHub Desktop.
Save Scrumplex/46dd4e41d6b1a41c06b3db379da4eb18 to your computer and use it in GitHub Desktop.
YouTube Clock JS
function clock() {
var time = new Date(),
hours = time.getHours(),
minutes = time.getMinutes(),
seconds = time.getSeconds();
document.querySelectorAll('.clock')[0].innerHTML = harold(hours) + ":" + harold(minutes) + ":" + harold(seconds);
function harold(standIn) {
if (standIn < 10) {
standIn = '0' + standIn
}
return standIn;
}
}
setInterval(clock, 1000);
var clockElem = document.createElement("div");
clockElem.className = "clock";
clockElem.style.fontSize = "2em";
clockElem.style.position = "fixed";
clockElem.style.zIndex = "1000";
clockElem.style.right = "0";
$(".html5-video-container").prepend(clockElem);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment