Last active
August 29, 2015 14:13
-
-
Save ricardobeat/1147f0d1fe9ef117ea87 to your computer and use it in GitHub Desktop.
IE7 panel for console.*
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
;(function () { | |
var doc = document.documentElement | |
var IE7 = navigator.userAgent.indexOf('MSIE 7') > 0 | |
logpane = document.createElement('div') | |
var height = 180 | |
var width = 480 | |
document.body.appendChild(logpane) | |
logpane.style.background = '#fff' | |
logpane.style.padding = '10px' | |
logpane.style.position = IE7 ? 'absolute' : 'fixed' | |
logpane.style.zIndex = 98777 | |
logpane.style.border = '1px solid #ccc' | |
logpane.style[IE7 ? 'top' : 'bottom'] = 0 | |
logpane.style.right = 0 | |
logpane.style.width = width + 'px' | |
logpane.style.height = height + 'px' | |
logpane.style.overflowY = 'scroll' | |
function update () { logpane.style.top = (doc.clientHeight + doc.scrollTop - height) + 'px' } | |
function log () { logpane.innerHTML += '<p style="margin: .5em 0">' + Array.prototype.join.call(arguments, ' ') + '</p>' } | |
window.console = {} | |
console.log = console.info = console.warn = console.error = log | |
IE7 && setInterval(update, 2000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment