diff options
author | Marcel Klehr <mklehr@gmx.net> | 2012-12-30 10:56:31 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2012-12-30 10:56:31 +0100 |
commit | ba6e0d2a05782ee21d18e88aeb35345b35aef00a (patch) | |
tree | 0d4f21c435cd844e01b2b9465e626fa486ae88c8 /src/static/js/html10n.js | |
parent | b31563ea07545aea0f12d72ee8cd4d9af11ca946 (diff) | |
download | etherpad-lite-ba6e0d2a05782ee21d18e88aeb35345b35aef00a.zip |
Fix #1307: Chrome needs console.log to be called on console obj
Diffstat (limited to 'src/static/js/html10n.js')
-rw-r--r-- | src/static/js/html10n.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js index dc583967..bb4acf81 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/html10n.js @@ -21,8 +21,29 @@ * IN THE SOFTWARE. */ window.html10n = (function(window, document, undefined) { - var consoleLog = console? console.log : function() {} - , consoleWarn = console? console.warn : function() {} + var console = window.console + function interceptConsole(method){ + var original = console[method] + + if (!console) return function() {} + + // do sneaky stuff + if (original.bind){ + // Do this for normal browsers + return original.bind(console) + }else{ + return function() { + // Do this for IE + var message = Array.prototype.slice.apply(arguments).join(' ') + original(message) + } + } + } + var consoleLog = interceptConsole('log') + , consoleWarn = interceptConsole('warn') + , consoleError = interceptConsole('warn') + + /** * MicroEvent - to make any js object an event emitter (server or browser) |