From f33e41380709d246dfd3d4dc5354e52883e619db Mon Sep 17 00:00:00 2001 From: piotrex Date: Wed, 25 Sep 2013 21:51:47 +0200 Subject: [PATCH] allowing to disable code deminifier --- data/js-view.js | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/data/js-view.js b/data/js-view.js index ce2301c..41d3a81 100644 --- a/data/js-view.js +++ b/data/js-view.js @@ -11,22 +11,34 @@ self.port.on("processSource", function () { (content === 'application/json') }; - if (contentIsAcceptable(content)) { + if (contentIsAcceptable(content)) { + var dontBeautify = false; + + if(window["JSViewAPI_jid1-u9RbFp9JcoEGGw"]) { + if(window["JSViewAPI_jid1-u9RbFp9JcoEGGw"].dontBeautify) + dontBeautify = true; + } + pre.setAttribute('class', 'line-numbers'); code.setAttribute('class', 'language-javascript'); - code.textContent = js_beautify(pre1.textContent, { - 'unescape_strings': true, - 'jslint_happy': true, - 'brace_style': 'collapse', - 'break_chained_methods': false, - 'indent_scripts': 'normal', - 'indent_size': 4, - 'keep_array_indentation': false, - 'preserve_newlines': true, - 'space_after_anon_function': true, - 'space_before_conditional': true - }); - + + if(!dontBeautify) { + code.textContent = js_beautify(pre1.textContent, { + 'unescape_strings': true, + 'jslint_happy': true, + 'brace_style': 'collapse', + 'break_chained_methods': false, + 'indent_scripts': 'normal', + 'indent_size': 4, + 'keep_array_indentation': false, + 'preserve_newlines': true, + 'space_after_anon_function': true, + 'space_before_conditional': true + }); + } else { + code.textContent = pre1.textContent; + } + pre.appendChild(code); body.replaceChild(pre, pre1);