Created
July 13, 2012 13:26
-
-
Save elwinschmitz/3104882 to your computer and use it in GitHub Desktop.
A simple (console).log viewer. Especially handy for iOS-devices.
This file contains hidden or 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
<!doctype html> | |
<title>iOS console.log viewer</title> | |
<script> | |
((function(){ | |
window.log = function(){ | |
log.history = log.history || [] | |
log.history.push(arguments) | |
if(!document.getElementById("log")) { | |
var list = document.createElement("ul") | |
list.setAttribute("id","log") | |
list.setAttribute("style","position:absolute;top:70%;left:10%;width:80%;height:25%;z-index:10000;margin:0;padding:0;font:80%/1 Consolas,monospace;background:rgba(255,255,0,.5);border:1px solid rgba(0,0,0,.2);overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;") | |
document.body.appendChild(list) | |
} | |
document.getElementById("log").insertAdjacentHTML("afterbegin", "<li>" + JSON.stringify(Array.prototype.slice.call(arguments)) + "</li>") | |
console.log( arguments ) | |
}; | |
})()); | |
</script> | |
<h1>(iOS) console.log viewer</h1> | |
<script> | |
var testObject = { | |
"iets": "nogwat", | |
"dit": ["zus", "zo", "dit", "dat"], | |
"jaja": 123 | |
}; | |
</script> | |
<button onclick="log('iets', testObject)">Test 1</button> | |
<button onclick="log('Test 2')">Test 2</button> | |
<button onclick="log('testje')">Test 2</button> | |
<button onclick="document.addEventListener('touchstart',function(){ log('Touchy!') }, false)">Touch</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment