diff --git a/web/yaamp/modules/explorer/block.php b/web/yaamp/modules/explorer/block.php
index 0b4d8d9..da08044 100644
--- a/web/yaamp/modules/explorer/block.php
+++ b/web/yaamp/modules/explorer/block.php
@@ -25,12 +25,80 @@ $(function() {
END;
+//////////////////////////////////////////////////////////////////////////////////////
+
+function colorizeJson($json)
+{
+ $json = str_replace('"', '"', $json);
+ // strings
+ $res = preg_match_all("# "([^&]+)"([,\s])#", $json, $matches);
+ if ($res) foreach($matches[1] as $n=>$m) {
+ $sfx = $matches[2][$n];
+ $class = '';
+ if (strlen($m) == 64 && ctype_xdigit($m)) $class = 'hash';
+ if (strlen($m) == 34 && ctype_alnum($m)) $class = 'addr';
+ if (strlen($m) == 35 && ctype_alnum($m)) $class = 'addr';
+ if (strlen($m) > 160 && ctype_alnum($m)) $class = 'data';
+ if ($class == '' && strlen($m) < 64 && ctype_xdigit($m)) $class = 'hexa';
+ $json = str_replace(' "'.$m.""".$sfx, ' "'.$m.'"'.$sfx, $json);
+ }
+ // keys
+ $res = preg_match_all("#"([^&]+)":#", $json, $matches);
+ if ($res) foreach($matches[1] as $n=>$m) {
+ $json = str_replace('"'.$m.""", '"'.$m.'"', $json);
+ }
+ // humanize timestamps like "blocktime": 1462359961,
+ $res = preg_match_all("#: ([0-9]{10})([,\s])#", $json, $matches);
+ if ($res) foreach($matches[1] as $n=>$m) {
+ $ts = intval($m);
+ if ($ts > 1400000000 && $ts < 1600000000) {
+ $sfx = $matches[2][$n];
+ $date = strftime("%Y-%m-%d %T %z", $ts);
+ $json = str_replace(' '.$m.$sfx, ' "'.$date.'"'.$sfx, $json);
+ }
+ }
+ // numeric
+ $res = preg_match_all("#: ([e\-\.0-9]+)([,\s])#", $json, $matches);
+ if ($res) foreach($matches[1] as $n=>$m) {
+ $sfx = $matches[2][$n];
+ $json = str_replace(' '.$m.$sfx, ' '.$m.''.$sfx, $json);
+ }
+ $json = preg_replace('#\[\s+\]#', '[]', $json);
+ $json = str_replace('[', '[', $json);
+ $json = str_replace(']', ']', $json);
+ $json = str_replace('{', '{', $json);
+ $json = str_replace('}', '}', $json);
+ return $json;
+}
+
function simplifyscript($script)
{
$script = preg_replace("/[0-9a-f]+ OP_DROP ?/","", $script);
@@ -59,9 +127,9 @@ echo '