From 79744dc6fe2393a36eb9fa4714134c490b999f89 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 3 Dec 2006 23:29:46 +0000 Subject: Fixed #400 --- framework/Web/Javascripts/extra/logger.js | 14 +++++++------- framework/Web/Javascripts/js/compressed/logger.js | 8 +++++--- framework/Web/Javascripts/js/debug/logger.js | 14 +++++++------- 3 files changed, 19 insertions(+), 17 deletions(-) (limited to 'framework/Web/Javascripts') diff --git a/framework/Web/Javascripts/extra/logger.js b/framework/Web/Javascripts/extra/logger.js index 5771f2f4..b21df1ae 100644 --- a/framework/Web/Javascripts/extra/logger.js +++ b/framework/Web/Javascripts/extra/logger.js @@ -200,7 +200,7 @@ LogConsole.prototype = { // Methods // ------- - initialize : function() { + initialize : function(toggleKey) { this.outputCount = 0 this.tagPattern = Cookie.get('tagPattern') || ".*" @@ -283,6 +283,12 @@ LogConsole.prototype = { this.logElement.style.position="fixed"; this.logElement.style.bottom="0px"; } + var self=this; + Event.observe(document, 'keydown', function(e) + { + if((e.altKey==true) && Event.keyCode(e) == toggleKey ) //Alt+J | Ctrl+J + self.toggle(); + }); // Listen to the logger.... Logger.onupdate.addListener(this.logUpdate.bind(this)) @@ -452,12 +458,6 @@ LogConsole.prototype = { } } -// Load the Console when the window loads -var logConsole; -Event.OnLoad(function() { logConsole = new LogConsole()}); - - - // ------------------------- // Helper Functions And Junk diff --git a/framework/Web/Javascripts/js/compressed/logger.js b/framework/Web/Javascripts/js/compressed/logger.js index 342b4234..4588c723 100644 --- a/framework/Web/Javascripts/js/compressed/logger.js +++ b/framework/Web/Javascripts/js/compressed/logger.js @@ -40,7 +40,7 @@ LogEntry=Class.create() LogEntry.prototype={initialize:function(message,tag){this.message=message this.tag=tag}} LogConsole=Class.create() -LogConsole.prototype={commandHistory:[],commandIndex:0,hidden:true,initialize:function(){this.outputCount=0 +LogConsole.prototype={commandHistory:[],commandIndex:0,hidden:true,initialize:function(toggleKey){this.outputCount=0 this.tagPattern=Cookie.get('tagPattern')||".*" this.logElement=document.createElement('div') document.body.appendChild(this.logElement) @@ -97,7 +97,9 @@ if(document.all&&!window.opera) {window.setInterval(this.repositionWindow.bind(this),500)} else {this.logElement.style.position="fixed";this.logElement.style.bottom="0px";} -Logger.onupdate.addListener(this.logUpdate.bind(this)) +var self=this;Event.observe(document,'keydown',function(e) +{if((e.altKey==true)&&Event.keyCode(e)==toggleKey) +self.toggle();});Logger.onupdate.addListener(this.logUpdate.bind(this)) Logger.onclear.addListener(this.clear.bind(this)) for(var i=0;i0){if(this.commandIndex>0){this.commandIndex-=1} this.inputElement.value=this.commandHistory[this.commandIndex]} else{this.commandIndex=0}}} -var logConsole;Event.OnLoad(function(){logConsole=new LogConsole()});function inspect(o) +function inspect(o) {var objtype=typeof(o);if(objtype=="undefined"){return"undefined";}else if(objtype=="number"||objtype=="boolean"){return o+"";}else if(o===null){return"null";} try{var ostring=(o+"");}catch(e){return"["+typeof(o)+"]";} if(typeof(o)=="function") diff --git a/framework/Web/Javascripts/js/debug/logger.js b/framework/Web/Javascripts/js/debug/logger.js index 5d465d56..37e5028e 100644 --- a/framework/Web/Javascripts/js/debug/logger.js +++ b/framework/Web/Javascripts/js/debug/logger.js @@ -200,7 +200,7 @@ LogConsole.prototype = { // Methods // ------- - initialize : function() { + initialize : function(toggleKey) { this.outputCount = 0 this.tagPattern = Cookie.get('tagPattern') || ".*" @@ -283,6 +283,12 @@ LogConsole.prototype = { this.logElement.style.position="fixed"; this.logElement.style.bottom="0px"; } + var self=this; + Event.observe(document, 'keydown', function(e) + { + if((e.altKey==true) && Event.keyCode(e) == toggleKey ) //Alt+J | Ctrl+J + self.toggle(); + }); // Listen to the logger.... Logger.onupdate.addListener(this.logUpdate.bind(this)) @@ -452,12 +458,6 @@ LogConsole.prototype = { } } -// Load the Console when the window loads -var logConsole; -Event.OnLoad(function() { logConsole = new LogConsole()}); - - - // ------------------------- // Helper Functions And Junk -- cgit v1.2.3