Sha256: 34e89070650a5ac0eaa4a3f389bdbd352b9ea0202130650d19caaf667eb6f699
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
$('#rack-webconsole form').submit(function(e){ e.preventDefault(); }); $("#rack-webconsole form input").keyup(function(event) { function escapeHTML(string) { return(string.replace(/&/g,'&'). replace(/>/g,'>'). replace(/</g,'<'). replace(/"/g,'"') ); }; if (event.which == 13) { /*$.post('/webconsole', $("#rack-webconsole form").serialize());*/ var query = $("#query").val(); $.ajax({ url: '/webconsole', type: 'POST', dataType: 'json', data: ({query: query, token: "TOKEN"}), success: function (data) { var q = "<div class='query'>" + escapeHTML(">> " + query) + "</div>"; var r = "<div class='result'>" + escapeHTML("=> " + data.result) + "</div>"; $("#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(); } }); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-webconsole-0.1.1 | public/webconsole.js |