Skip to content

Instantly share code, notes, and snippets.

@ricardobeat
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardobeat/1147f0d1fe9ef117ea87 to your computer and use it in GitHub Desktop.
Save ricardobeat/1147f0d1fe9ef117ea87 to your computer and use it in GitHub Desktop.
IE7 panel for console.*
;(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