Skip to content

Instantly share code, notes, and snippets.

@renbaoshuo
Forked from sam0737/clock.html
Last active December 3, 2022 13:55
Show Gist options
  • Save renbaoshuo/bf90d4cfad5b8ae7ad43bc8a8a6a6b89 to your computer and use it in GitHub Desktop.
Save renbaoshuo/bf90d4cfad5b8ae7ad43bc8a8a6a6b89 to your computer and use it in GitHub Desktop.
OBS Studio: A HTML page for showing current date and time in the video
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>A simple clock</title>
</head>
<body translate="no">
<div id="output"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script>
var urlParams = new URLSearchParams(location);
var output = document.getElementById('output');
if (urlParams.get('style')) {
output.setAttribute('style', urlParams['style']);
}
if (urlParams.get('bodyStyle')) {
document.body.setAttribute('style', urlParams['bodyStyle']);
}
var c = function () {
output.innerText = moment().format(urlParams.get('format') || '');
};
setInterval(c, 250);
c();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment