PageSourceSearch

https://cvci.ch/js/novadaemon/filament-pretty-json/scripts.js?v=3.1.1.0

js cvci.ch collected 2026-09-30 09:57:41 UTC 1,038 bytes, 26 lines download raw bytes

1/**
2* Pretty Print JSON Objects.
3* Inspired by http://jsfiddle.net/unLSJ/
4*
5* @return {string}    html string of the formatted JS object
6* @example:  var obj = {"foo":"bar"};  obj.prettyPrint();
7*/
8window.prettyPrint = function (json) {
9    var jsonLine = /^( *)("([^"\\]|\\.)*": )?("[^"]*"|[\w.+-]*|\[\])?([,[{])?$/mg;
10    var replacer = function (match, pIndent, pKey, pKeyContent, pVal, pEnd) {
11        var key = '<span class="json-key" style="color: brown">',
12            val = '<span class="json-value" style="color: navy">',
13            str = '<span class="json-string" style="color: olive">',
14            r = pIndent || '';
15        if (pKey)
16            r = r + key + pKey.replace(/^"|": $/g, '') + '</span>: ';
17        if (pVal)
18            r = r + (pVal[0] == '"' ? str : val) + pVal + '</span>';
19        return r + (pEnd || '');
20    };
21
22    return JSON.stringify(json, null, 3)
23        .replace(/&/g, '&amp;').replace(/\\"/g, '&quot;')
24        .replace(/</g, '&lt;').replace(/>/g, '&gt;')
25        .replace(jsonLine, replacer);
26}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.