diff --git a/public/webconsole.js b/public/webconsole.js index 55ed479..8f98372 100644 --- a/public/webconsole.js +++ b/public/webconsole.js @@ -1,35 +1,17 @@ -$(document).ready(function() { - $("#rack-webconsole").hide(); - $(this).keypress(function(event) { - if (event.which == 96) { - $("#rack-webconsole").slideToggle('fast', function() { - if ($(this).is(':visible')) { - $("#rack-webconsole form input").focus(); - $("#rack-webconsole .results_wrapper").scrollTop( - $("#rack-webconsole .results").height() - ); - } else { - $("#rack-webconsole form input").blur(); - } - }); - event.preventDefault(); - } - }); -}); $('#rack-webconsole form').submit(function(e){ - e.preventDefault(); + e.preventDefault(); }); -String.prototype.escapeHTML = function () { - return( - this.replace(/&/g,'&'). - replace(/>/g,'>'). - replace(//g,'>'). + replace(/"; - var r = "
=> " + data.result.escapeHTML() + "
"; + var q = "
" + escapeHTML(">> " + query) + "
"; + var r = "
" + escapeHTML("=> " + data.result) + "
"; $("#rack-webconsole .results").append(q + r); $("#rack-webconsole .results_wrapper").scrollTop( $("#rack-webconsole .results").height() - ); + ); $("#query").val(''); } }); } }); + +$(document).ready(function() { + $("#rack-webconsole").hide(); + $(this).keypress(function(event) { + if (event.which == 96) { + $("#rack-webconsole").slideToggle('fast', function() { + if ($(this).is(':visible')) { + $("#rack-webconsole form input").focus(); + $("#rack-webconsole .results_wrapper").scrollTop( + $("#rack-webconsole .results").height() + ); + } else { + $("#rack-webconsole form input").blur(); + } + }); + event.preventDefault(); + } + }); +}); +