Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 1 | % use JSON::XS; |
Nils Diewald | f2e02a9 | 2014-11-12 18:31:05 +0000 | [diff] [blame^] | 2 | % use Mojo::JSON; |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 3 | |
Nils Diewald | b40ddad | 2014-06-23 15:39:18 +0000 | [diff] [blame] | 4 | % if (stash('search.query') && stash('test_port')) { |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 5 | % my $action; |
| 6 | % if (param('action') && param('action') eq 'inspect') { |
| 7 | % $action = ' active" style="cursor: default'; |
| 8 | % }; |
| 9 | % state $json = JSON::XS->new->allow_blessed->pretty->canonical(1); |
| 10 | <pre class="query serial<%== $action // '' %>"> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 11 | <span>JSON-LD Serialization for <%= param 'q' %> (<%= param 'ql' %>)</span> |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 12 | <code> |
Nils Diewald | f2e02a9 | 2014-11-12 18:31:05 +0000 | [diff] [blame^] | 13 | %# Workaround to keep true, false, and null intact |
| 14 | %= $json->encode($json->decode(Mojo::JSON::encode_json(stash('search.query')))) |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 15 | </code> |
| 16 | </pre> |
| 17 | %= javascript begin |
| 18 | hljs.initHighlightingOnLoad(); |
| 19 | % unless ($action) { |
| 20 | $("pre.query.serial").on("click", function () { |
| 21 | $(this).toggleClass('active'); |
| 22 | }); |
| 23 | % }; |
| 24 | % end |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 25 | % }; |