Merge remote-tracking branch 'staabm/control-chars'

master
Jordi Boggiano 12 years ago
commit 87c39122f3
  1. 19
      php-console.js
  2. 9
      styles.css

@ -73,10 +73,27 @@
localStorage.setItem('phpCode', editor.getSession().getValue());
}
var controlChars = {
'NUL' : /\x00/g,
'SOH' : /\x01/g,
'STX' : /\x02/g,
'ETX' : /\x03/g,
'EOT' : /\x04/g,
'ENQ' : /\x05/g,
'ACK' : /\x06/g,
'BEL' : /\x07/g,
'BS' : /\x08/g,
'SUB' : /\x1A/g,
};
// eval server-side
$.post('?js=1', { code: editor.getSession().getValue() }, function (res) {
if (res.match(/#end-php-console-output#$/)) {
$('div.output').html(res.substring(0, res.length - 24));
var result = res.substring(0, res.length - 24);
for (var k in controlChars) {
result = result.replace(controlChars[k], '<span class="control-char">'+ k +'</span>');
}
$('div.output').html(result);
} else {
$('div.output').html(res + "<br /><br /><em>Script ended unexpectedly.</em>");
}

@ -95,3 +95,12 @@ a {
.footer a {
color: #aaa;
}
.krumo-root .control-char {
background: #000;
color: #fff;
margin-left: 2px;
margin-right: 2px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
Loading…
Cancel
Save