Translated using Weblate (Slovenian)
[phpmyadmin.git] / js / transformations / json.js
blob4326a2eda33e632efc0b582127dd412ef3bf35ef
1 /**
2  * JSON syntax highlighting transformation plugin
3  */
4 AJAX.registerOnload('transformations/json.js', function () {
5     var $elm = $('#page_content').find('code.json');
6     $elm.each(function () {
7         var $json = $(this);
8         var $pre = $json.find('pre');
9         /* We only care about visible elements to avoid double processing */
10         if ($pre.is(':visible')) {
11             var $highlight = $('<div class="json-highlight cm-s-default"></div>');
12             $json.append($highlight);
13             CodeMirror.runMode($json.text(), 'application/json', $highlight[0]);
14             $pre.hide();
15         }
16     });
17 });