diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-20 10:23:54 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-20 10:23:54 +0300 |
commit | 85aa480be795eb75cb9a4d3e09724a09a328fb9a (patch) | |
tree | 68b38335bfaa5b80f752352821a06898d2c760d7 /js/transformations | |
parent | 805679626a0028fc1b567c48f7b114d24272f15b (diff) |
Remove transformation related code from makegrid.js and functions.js
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/transformations')
-rw-r--r-- | js/transformations/json.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/transformations/json.js b/js/transformations/json.js new file mode 100644 index 0000000000..d2cd111ee3 --- /dev/null +++ b/js/transformations/json.js @@ -0,0 +1,20 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * JSON syntax highlighting transformation plugin + */ +AJAX.registerOnload('transformations/json.js', function() { + var $elm = $('#page_content').find('code.json'); + $elm.each(function () { + var $json = $(this); + var $pre = $json.find('pre'); + /* We only care about visible elements to avoid double processing */ + if ($pre.is(":visible")) { + var $highlight = $('<div class="json-highlight cm-s-default"></div>'); + $json.append($highlight); + if (typeof CodeMirror != 'undefined') { + CodeMirror.runMode($json.text(), 'application/json', $highlight[0]); + $pre.hide(); + } + } + }); +});
\ No newline at end of file |