Skip to content

Instantly share code, notes, and snippets.

@iepsen
Created October 24, 2019 07:38
Show Gist options
  • Save iepsen/14374a02f5742cd633a85b0f6f5b184a to your computer and use it in GitHub Desktop.
Save iepsen/14374a02f5742cd633a85b0f6f5b184a to your computer and use it in GitHub Desktop.
Helper code to debug on Smart TVs or devices we don't have access do logs
<style>
.console-wrapper {
position: absolute;
bottom: 0;
right: 0;
z-index: 99999;
padding: 20px;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.6;
}
#console {
width: 100%;
height: 100%;
color: rgb(205, 255, 105);
font-size: 30px;
font-family: 'Courier New', Courier, monospace;
overflow: hidden;
}
#console p {
margin: 0;
padding: 0;
}
</style>
<div class="console-wrapper">
<div id="console"></div>
</div>
<script>
var consoleBox = document.getElementById("console");
var content = "";
function printConsole(message) {
content += "<p>" + getTime() + message + "</p>";
consoleBox.innerHTML = content;
consoleBox.scrollTop = consoleBox.scrollHeight;
}
function getTime() {
return "[" + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1") + "] > ";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment