Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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