1/* DOKUWIKI:include_once jsonTree.js */ 2 3(function () { 4 const codeblocks = document.querySelectorAll('pre.code.json'); 5 codeblocks.forEach((codeblock) => { 6 try { 7 const json = JSON.parse(codeblock.innerText); 8 const viewer = document.createElement('div'); 9 jsonTree.create(json, viewer); 10 codeblock.innerHTML = ''; 11 codeblock.style.whiteSpace = 'normal'; 12 codeblock.append(viewer); 13 } catch (e) { 14 const err = document.createElement('div'); 15 err.innerText = e.message; 16 err.className = 'error'; 17 codeblock.append(err); 18 } 19 }); 20})(); 21