Last active
August 29, 2015 13:56
-
-
Save wizard04wsu/8963578 to your computer and use it in GitHub Desktop.
Template for an on-page JavaScript log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Log</title> | |
<style type="text/css" media="all"> | |
#log { | |
padding:0.5em; | |
overflow:auto; | |
font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace; | |
font-size:80%; | |
background-color:#EEE; | |
color:#000; | |
} | |
#log div { | |
transition-property:background-color, color; | |
transition-duration:0.75s, 0.25s; | |
transition-delay:0.01s, 0.2s; | |
} | |
#log div:hover { | |
background-color:#AAA; | |
color:#FFF; | |
} | |
</style> | |
<script type="text/javascript"> | |
function log(entry, appendToTop){ | |
var log = document.getElementById("log"), | |
existing = log.innerHTML; | |
log.innerHTML = appendToTop ? "<div>"+entry+"</div>"+existing : existing+"<div>"+entry+"</div>"; | |
} | |
</script> | |
</head> | |
<body> | |
<div id="log"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment