Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 545 lines (485 sloc) 28.611 kB
be6a325 @einars Drop the HTML header cruft
einars authored
1 <html>
2ea625f @bitwiseman More License administrivia
bitwiseman authored
2 <!--
3 The MIT License (MIT)
4
5 Copyright (c) 2007-2013 Einar Lielmanis and contributors.
6
7 Permission is hereby granted, free of charge, to any person
8 obtaining a copy of this software and associated documentation files
9 (the "Software"), to deal in the Software without restriction,
10 including without limitation the rights to use, copy, modify, merge,
11 publish, distribute, sublicense, and/or sell copies of the Software,
12 and to permit persons to whom the Software is furnished to do so,
13 subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be
16 included in all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 SOFTWARE.
26 -->
27
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
28 <head>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
29 <meta charset="utf-8">
30 <title>Online JavaScript beautifier</title>
9de057f @bitwiseman Reorganize file structure by language/platform
bitwiseman authored
31 <link rel="icon" href="web/favicon.png" type="image/png">
d02d83d @bitwiseman Update code mirror and jquery
bitwiseman authored
32 <link rel="stylesheet" href="web/third-party/codemirror/lib/codemirror.css">
33
9de057f @bitwiseman Reorganize file structure by language/platform
bitwiseman authored
34 <script src="web/third-party/codemirror/lib/codemirror.js"></script>
35 <script src="web/third-party/codemirror/mode/javascript/javascript.js"></script>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
36
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
37 <style>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
38 body {
39 background: #eee;
40 color: #333;
41 }
42 img {
43 border: 0;
44 }
45 a.self {
46 font-weight: bold;
47 text-decoration: none;
48 color: #444;
49 border-bottom: 1px solid #aaa
50 }
51 p, select, label, .blurb, a.turn-off-codemirror {
52 font:13px/1.231 arial, sans-serif;
53 *font-size:small;
54 }
55 a.turn-off-codemirror {
56 margin-left: 25px;
57 }
58 button.submit {
59 width: 100%;
60 padding: 10px 0;
61 cursor: pointer;
62 margin: 0;
63 }
64 button.submit em {
65 font-size: 11px;
66 font-style: normal;
67 color: #999;
68 }
69 label {
70 cursor: pointer;
71 }
72 select {
73 width: 220px;
74 }
75 table#options {
76 float: right;
77 }
78 table#options td {
79 vertical-align: top;
80 padding-left: 10px;
81 }
82 #about {
83 float: left;
84 }
85 #about p {
86 margin: 0 6px 6px 0;
87 }
88 li {
89 line-height: 150%;
90 }
91 li.writeme {
92 padding-top: 8px;
93 }
94 #testresults {
95 display: none;
96 font-family: monaco, "lucida console", "courier new", monospace;
97 }
98 .CodeMirror {
99 border: 1px solid #ccc;
100 height: 450px;
101 font-size: 90%;
102 margin-bottom: 6px;
103 background: white;
104 }
105 p {
106 margin-left: 40px;
107 margin-right: 40px;
108 }
109 a {
110 white-space: nowrap;
111 color: #36d;
112 }
113 .contributor-sep {
114 border-top: 1px solid #ccc;
115 padding-top: 8px;
116 }
117 </style>
ae86bf6 @einars Moving to beautify-web, junk commit
einars authored
118
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
119 <script src="web/third-party/jquery/jquery.js"></script>
120 <script src="web/third-party/jquery/jquery.cookie.js"></script>
709af23 @einars Some tweaks to the contributor list, mention node
einars authored
121
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
122 <script src="js/lib/beautify.js"></script>
123 <script src="js/lib/beautify-css.js"></script>
124 <script src="js/lib/beautify-html.js"></script>
125 <script src="js/test/sanitytest.js"></script>
d40e024 @bitwiseman Add css test generation
bitwiseman authored
126 <script src="js/test/beautify-javascript-tests.js"></script>
127 <script src="js/test/beautify-css-tests.js"></script>
283b1c4 @bitwiseman Create html beautifier tests generator
bitwiseman authored
128 <script src="js/test/beautify-html-tests.js"></script>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
129 <script src="js/lib/unpackers/javascriptobfuscator_unpacker.js"></script>
130 <script src="js/lib/unpackers/urlencode_unpacker.js"></script>
131 <script src="js/lib/unpackers/p_a_c_k_e_r_unpacker.js"></script>
3504226 @einars Fix the brokenness, I shouldn't be touching the code today
einars authored
132 <script src="js/lib/unpackers/myobfuscate_unpacker.js"></script>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
133
134 <script>
135 var the = {
136 use_codemirror: (!window.location.href.match(/without-codemirror/)),
137 beautify_in_progress: false,
138 editor: null // codemirror editor
139 };
140
141 function run_tests() {
142 var st = new SanityTest();
d40e024 @bitwiseman Add css test generation
bitwiseman authored
143 run_javascript_tests(st, Urlencoded, js_beautify, html_beautify, css_beautify);
144 run_css_tests(st, Urlencoded, js_beautify, html_beautify, css_beautify);
283b1c4 @bitwiseman Create html beautifier tests generator
bitwiseman authored
145 run_html_tests(st, Urlencoded, js_beautify, html_beautify, css_beautify);
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
146 JavascriptObfuscator.run_tests(st);
147 P_A_C_K_E_R.run_tests(st);
148 Urlencoded.run_tests(st);
3504226 @einars Fix the brokenness, I shouldn't be touching the code today
einars authored
149 MyObfuscate.run_tests(st);
5532b23 @Infocatcher Correctly escape special HTML symbols in tests output
Infocatcher authored
150 var results = st.results_raw()
151 .replace(/&/g, '&amp;')
152 .replace(/</g, '&lt;')
153 .replace(/>/g, '&gt;')
154 .replace(/ /g, '&nbsp;')
155 .replace(/\r/g, '·')
156 .replace(/\n/g, '<br>');
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
157 $('#testresults').html(results).show();
158 }
159
160
161 function any(a, b) {
162 return a || b;
163 }
164
165 function read_settings_from_cookie() {
166 $('#tabsize').val(any($.cookie('tabsize'), '4'));
167 $('#brace-style').val(any($.cookie('brace-style'), 'collapse'));
168 $('#detect-packers').prop('checked', $.cookie('detect-packers') !== 'off');
169 $('#max-preserve-newlines').val(any($.cookie('max-preserve-newlines'), '5'));
170 $('#keep-array-indentation').prop('checked', $.cookie('keep-array-indentation') === 'on');
171 $('#break-chained-methods').prop('checked', $.cookie('break-chained-methods') === 'on');
172 $('#indent-scripts').val(any($.cookie('indent-scripts'), 'normal'));
173 $('#space-before-conditional').prop('checked', $.cookie('space-before-conditional') !== 'off');
174 $('#wrap-line-length').val(any($.cookie('wrap-line-length'), '0'));
175 $('#unescape-strings').prop('checked', $.cookie('unescape-strings') === 'on');
04645a1 @einars Add a checkbox for jslint-happy mode
einars authored
176 $('#jslint-happy').prop('checked', $.cookie('jslint-happy') === 'on');
d030e1c @bitwiseman Add "end_with_newline" option throughout and make consistent
bitwiseman authored
177 $('#end-with-newline').prop('checked', $.cookie('end-with-newline') === 'on');
2775219 @bardiharborow Add GUI support for `--indent-inner-html`.
bardiharborow authored
178 $('#indent-inner-html').prop('checked', $.cookie('indent-inner-html') === 'on');
1fd3ff5 @bitwiseman Fix comma-first checkbox on web
bitwiseman authored
179 $('#comma-first').prop('checked', $.cookie('comma-first') === 'on');
966d63e @bitwiseman Add e4x/jsx checkbox to webpage
bitwiseman authored
180 $('#e4x').prop('checked', $.cookie('e4x') === 'on');
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
181 }
182
183 function store_settings_to_cookie() {
184 var opts = {
185 expires: 360
186 };
187 $.cookie('tabsize', $('#tabsize').val(), opts);
188 $.cookie('brace-style', $('#brace-style').val(), opts);
189 $.cookie('detect-packers', $('#detect-packers').prop('checked') ? 'on' : 'off', opts);
190 $.cookie('max-preserve-newlines', $('#max-preserve-newlines').val(), opts);
191 $.cookie('keep-array-indentation', $('#keep-array-indentation').prop('checked') ? 'on' : 'off', opts);
192 $.cookie('break-chained-methods', $('#break-chained-methods').prop('checked') ? 'on' : 'off', opts);
193 $.cookie('space-before-conditional', $('#space-before-conditional').prop('checked') ? 'on' : 'off',
194 opts);
195 $.cookie('unescape-strings', $('#unescape-strings').prop('checked') ? 'on' : 'off', opts);
d030e1c @bitwiseman Add "end_with_newline" option throughout and make consistent
bitwiseman authored
196 $.cookie('jslint-happy', $('#jslint-happy').prop('checked') ? 'on' : 'off', opts);
197 $.cookie('end-with-newline', $('#end-with-newline').prop('checked') ? 'on' : 'off', opts);
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
198 $.cookie('wrap-line-length', $('#wrap-line-length').val(), opts);
199 $.cookie('indent-scripts', $('#indent-scripts').val(), opts);
2775219 @bardiharborow Add GUI support for `--indent-inner-html`.
bardiharborow authored
200 $.cookie('indent-inner-html', $('#indent-inner-html').prop('checked') ? 'on' : 'off', opts);
0fa9753 @bitwiseman Add comma-first to GUI
bitwiseman authored
201 $.cookie('comma-first', $('#comma-first').prop('checked') ? 'on' : 'off', opts);
966d63e @bitwiseman Add e4x/jsx checkbox to webpage
bitwiseman authored
202 $.cookie('e4x', $('#e4x').prop('checked') ? 'on' : 'off', opts);
0fa9753 @bitwiseman Add comma-first to GUI
bitwiseman authored
203
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
204 }
205
206 function unpacker_filter(source) {
207 var trailing_comments = '',
208 comment = '',
209 unpacked = '',
210 found = false;
211
212 // cut trailing comments
213 do {
214 found = false;
215 if (/^\s*\/\*/.test(source)) {
216 found = true;
217 comment = source.substr(0, source.indexOf('*/') + 2);
218 source = source.substr(comment.length).replace(/^\s+/, '');
219 trailing_comments += comment + "\n";
220 } else if (/^\s*\/\//.test(source)) {
221 found = true;
222 comment = source.match(/^\s*\/\/.*/)[0];
223 source = source.substr(comment.length).replace(/^\s+/, '');
224 trailing_comments += comment + "\n";
225 }
226 } while (found);
227
3504226 @einars Fix the brokenness, I shouldn't be touching the code today
einars authored
228 var unpackers = [P_A_C_K_E_R, Urlencoded, /*JavascriptObfuscator,*/ MyObfuscate];
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
229 for (var i = 0; i < unpackers.length; i++) {
230 if (unpackers[i].detect(source)) {
231 unpacked = unpackers[i].unpack(source);
232 if (unpacked != source) {
233 source = unpacker_filter(unpacked);
234 }
235 }
236 }
237
238 return trailing_comments + source;
d675f4b @einars Use the space in a more meaningful way.
einars authored
239 }
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
240
241
242 function beautify() {
243 if (the.beautify_in_progress) return;
244
245 store_settings_to_cookie();
246
247 the.beautify_in_progress = true;
248
249 var source = the.editor ? the.editor.getValue() : $('#source').val(),
250 output,
251 opts = {};
252
253 opts.indent_size = $('#tabsize').val();
254 opts.indent_char = opts.indent_size == 1 ? '\t' : ' ';
255 opts.max_preserve_newlines = $('#max-preserve-newlines').val();
81e498b @bitwiseman Fix preserve no extra newlines setting in webpage.
bitwiseman authored
256 opts.preserve_newlines = opts.max_preserve_newlines !== "-1";
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
257 opts.keep_array_indentation = $('#keep-array-indentation').prop('checked');
258 opts.break_chained_methods = $('#break-chained-methods').prop('checked');
259 opts.indent_scripts = $('#indent-scripts').val();
260 opts.brace_style = $('#brace-style').val();
261 opts.space_before_conditional = $('#space-before-conditional').prop('checked');
262 opts.unescape_strings = $('#unescape-strings').prop('checked');
04645a1 @einars Add a checkbox for jslint-happy mode
einars authored
263 opts.jslint_happy = $('#jslint-happy').prop('checked');
d030e1c @bitwiseman Add "end_with_newline" option throughout and make consistent
bitwiseman authored
264 opts.end_with_newline = $('#end-with-newline').prop('checked');
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
265 opts.wrap_line_length = $('#wrap-line-length').val();
2775219 @bardiharborow Add GUI support for `--indent-inner-html`.
bardiharborow authored
266 opts.indent_inner_html = $('#indent-inner-html').prop('checked');
0fa9753 @bitwiseman Add comma-first to GUI
bitwiseman authored
267 opts.comma_first = $('#comma-first').prop('checked');
966d63e @bitwiseman Add e4x/jsx checkbox to webpage
bitwiseman authored
268 opts.e4x = $('#e4x').prop('checked');
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
269
270 if (looks_like_html(source)) {
271 output = html_beautify(source, opts);
272 } else {
273 if ($('#detect-packers').prop('checked')) {
274 source = unpacker_filter(source);
275 }
276 output = js_beautify(source, opts);
31a4e90 @einars Slightly refactor how unpackers are applied
einars authored
277 }
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
278 if (the.editor) {
279 the.editor.setValue(output);
280 } else {
281 $('#source').val(output);
282 }
283
284 the.beautify_in_progress = false;
4db2346 @einars Don't fall in infinite loop when unP.A.C.K fails
einars authored
285 }
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
286
287 function looks_like_html(source) {
288 // <foo> - looks like html
289 // <!--\nalert('foo!');\n--> - doesn't look like html
290
291 var trimmed = source.replace(/^[ \t\n\r]+/, '');
292 var comment_mark = '<' + '!-' + '-';
293 return (trimmed && (trimmed.substring(0, 1) === '<' && trimmed.substring(0, 4) !== comment_mark));
4db2346 @einars Don't fall in infinite loop when unP.A.C.K fails
einars authored
294 }
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
295 </script>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
296 </head>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
297
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
298 <body>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
299
109cad8 @bitwiseman Make about stay at the top for small window widths
bitwiseman authored
300 <div id="about">
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
301 <p>
302 <a class="self" href="./">Beautify, unpack or deobfuscate JavaScript and HTML, make JSON/JSONP readable, etc.</a>
303 </p>
304 <p>
b687f2e @danfern-simi Simple grammar fix
danfern-simi authored
305 All of the source code is completely free and open, available on <a href="https://github.com/beautify-web/js-beautify">GitHub</a> under MIT licence,
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
306 <br>and we have a command-line version, python library and a <a href="https://npmjs.org/package/js-beautify">node package</a> as well.
307 </p>
109cad8 @bitwiseman Make about stay at the top for small window widths
bitwiseman authored
308 </div>
309
310
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
311 <table id="options">
312 <tr>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
313 <td>
314 <select name="tabsize" id="tabsize">
315 <option value="1">Indent with a tab character</option>
316 <option value="2">Indent with 2 spaces</option>
317 <option value="3">Indent with 3 spaces</option>
318 <option value="4">Indent with 4 spaces</option>
319 <option value="8">Indent with 8 spaces</option>
320 </select>
321 <br>
322
323 <select name="max-preserve-newlines" id="max-preserve-newlines">
324 <option value="-1">Remove all extra newlines</option>
325 <option value="1">Allow 1 newline between tokens</option>
326 <option value="2">Allow 2 newlines between tokens</option>
327 <option value="5">Allow 5 newlines between tokens</option>
328 <option value="10">Allow 10 newlines between tokens</option>
329 <option value="0">Allow unlimited newlines between tokens</option>
330 </select>
331 <br>
332
333 <select name="wrap-line-length" id="wrap-line-length">
334 <option value="0">Do not wrap lines</option>
335 <option value="40">Wrap lines near 40 characters</option>
336 <option value="70">Wrap lines near 70 characters</option>
337 <option value="80">Wrap lines near 80 characters</option>
338 <option value="110">Wrap lines near 110 characters</option>
339 <option value="120">Wrap lines near 120 characters</option>
340 <option value="160">Wrap lines near 160 characters</option>
341 </select>
342 <br>
343
344 <select id="brace-style">
345 <option value="collapse">Braces with control statement</option>
346 <option value="expand">Braces on own line</option>
347 <option value="end-expand">End braces on own line</option>
0ec58cd @c32hedge Update documentation of brace style options (related to #538 and #554)
c32hedge authored
348 <option value="none">Attempt to keep braces where
349 they are</option>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
350 </select>
351
352 <p style="margin:6px 0 0 0">HTML &lt;style&gt;, &lt;script&gt; formatting:</p>
353 <select id="indent-scripts">
354 <option value="keep">Keep indent level of the tag</option>
355 <option value="normal">Add one indent level</option>
356 <option value="separate">Separate indentation</option>
357 </select>
358
359 </td>
360 <td>
d030e1c @bitwiseman Add "end_with_newline" option throughout and make consistent
bitwiseman authored
361 <input class="checkbox" type="checkbox" id="end-with-newline">
362 <label for="end-with-newline">End script and style with newline?</label>
363 <br>
966d63e @bitwiseman Add e4x/jsx checkbox to webpage
bitwiseman authored
364 <input class="checkbox" type="checkbox" id="e4x">
365 <label for="e4x">Support e4x/jsx syntax</label>
366 <br>
0fa9753 @bitwiseman Add comma-first to GUI
bitwiseman authored
367 <input class="checkbox" type="checkbox" id="comma-first">
368 <label for="comma-first">Use comma-first list style?</label>
369 <br>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
370 <input class="checkbox" type="checkbox" id="detect-packers">
371 <label for="detect-packers">Detect packers and obfuscators?</label>
372 <br>
373 <input class="checkbox" type="checkbox" id="keep-array-indentation">
374 <label for="keep-array-indentation">Keep array indentation?</label>
375 <br>
376 <input class="checkbox" type="checkbox" id="break-chained-methods">
377 <label for="break-chained-methods">Break lines on chained methods?</label>
378 <br>
379 <input class="checkbox" type="checkbox" id="space-before-conditional">
380 <label for="space-before-conditional">Space before conditional: "if(x)" / "if (x)"</label>
381 <br>
382 <input class="checkbox" type="checkbox" id="unescape-strings">
383 <label for="unescape-strings">Unescape printable chars encoded as \xNN or \uNNNN?</label>
04645a1 @einars Add a checkbox for jslint-happy mode
einars authored
384 <br>
385 <input class="checkbox" type="checkbox" id="jslint-happy">
386 <label for="jslint-happy">Use JSLint-happy formatting tweaks?</label>
2775219 @bardiharborow Add GUI support for `--indent-inner-html`.
bardiharborow authored
387 <br>
388 <input class="checkbox" type="checkbox" id="indent-inner-html">
389 <label for="indent-inner-html">Indent &lt;head&gt; and &lt;body&gt; sections?</label>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
390 <br><a href="?without-codemirror" class="turn-off-codemirror">Use a simple textarea for code input?</a>
391
392
393 </td>
394 </tr>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
395 </table>
396
fa6e597 @einars Add a second submit button, below the source
einars authored
397 <div style="line-height: 0">
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
398 <button class="submit"><strong>Beautify JavaScript or HTML</strong> <em>(ctrl-enter)</em>
399 </button>
400 <textarea id="source" rows="30" cols="160"></textarea>
401 <button class="submit"><strong>Beautify JavaScript or HTML</strong> <em>(ctrl-enter)</em>
402 </button>
fa6e597 @einars Add a second submit button, below the source
einars authored
403 </div>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
404
405 <div class="blurb">
5fb8b0d @einars To hell with the paypal button
einars authored
406 <div style="float:right;">
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
407 <a style="display:block; float: left; padding-top: 3px" href="http://flattr.com/thing/94550/jsbeautifier-org" target="_blank">
be6a325 @einars Drop the HTML header cruft
einars authored
408 <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr">
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
409 </a>
410 </div>
411
412 <p>Browser extensions and other uses:</p>
413 <ul id="uses">
414
415 <li>A <a href="javascript:(function(){s=document.getElementsByTagName('SCRIPT');tx='';sr=[];for(i=0;i<s.length;i++){with(s.item(i)){t=text;if(t){tx+=t;}else{sr.push(src)};}};with(window.open()){document.write('<textarea id=&quot;t&quot;>'+(sr.join(&quot;\n&quot;))+&quot;\n\n-----\n\n&quot;+tx+'</textarea><script src=&quot;http://jsbeautifier.org/beautify.js&quot;></script><script>with(document.getElementById(&quot;t&quot;)){value=js_beautify(value);with(style){width=&quot;99%&quot;;height=&quot;99%&quot;;borderStyle=&quot;none&quot;;}};</script>');document.close();}})();"><strong>bookmarklet</strong></a> (drag
416 it to your bookmarks) by Ichiro Hiroshi to see all scripts used on the page,</li>
417
418 <li style="margin-top: 8px"><strong>Chrome</strong>: <a href="https://github.com/rixth/jsbeautify-for-chrome">jsbeautify-for-chrome</a> by Tom Rix,</li>
ed5b72f @einars Tiny cleanups
einars authored
419 <li><strong>Chrome</strong>: <a href="https://chrome.google.com/webstore/detail/piekbefgpgdecckjcpffhnacjflfoddg">Pretty Beautiful JavaScript</a> by Will McSweeney,</li>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
420 <li><strong>Chrome</strong>: <a href="https://chrome.google.com/webstore/detail/cfmcghennfbpmhemnnfjhkdmnbidpanb">Quick source viewer</a> by Tomi Mickelsson
339474a @einars Add StackoverflowCodeBeautify by @MakingOddEdit
einars authored
421 (<a href="https://github.com/tomimick/chrome-ext-view-src">github</a>, <a href="http://tomicloud.com/2012/07/viewsrc-chrome-ext">blog</a>),</li>
422 <li><strong>Chrome</strong>: <a href="https://chrome.google.com/webstore/detail/stackoverflow-code-beauti/pljeafjjkkbacckkollfejkciddacmeb">Stackoverflow Code Beautify</a> by Making Odd Edit Studios (<a href="https://github.com/MakingOddEdit/CodeBeautify">github</a>),</li>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
423 <li style="margin-top: 8px"><strong>Firefox</strong>: <a href="https://addons.mozilla.org/en-US/firefox/addon/javascript-deminifier/">Javascript deminifier</a> by Ben Murphy, to be
424 used together with the firebug (<a href="https://github.com/benmmurphy/jsdeminifier_xpi/">github</a>),</li>
425 <li style="margin-top: 8px"><strong>Safari</strong>: <a href="http://spadin.github.com/js-beautify-safari-extension">Safari extension</a> by Sandro Padin,</li>
ed5b72f @einars Tiny cleanups
einars authored
426 <li style="margin-top: 8px"><strong>Opera</strong>: <a href="https://addons.opera.com/addons/extensions/details/readable-javascript/">Readable JavaScript</a>
427 (<a href="https://github.com/Dither/readable-javascript">github</a>) by Dither,</li>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
428 <li><strong>Opera</strong>: <a href="https://addons.opera.com/addons/extensions/details/source/">Source</a> extension by Deathamns,</li>
429 <li style="margin-top: 8px"><strong>Sublime Text 2:</strong> <a href="https://github.com/jdc0589/JsFormat">JsFormat</a>, a javascript formatting plugin for this nice editor by Davis
430 Clark,</li>
431 <li style="margin-top: 8px"><strong>vim:</strong> <a href="https://github.com/michalliu/sourcebeautify.vim">sourcebeautify.vim</a>, a plugin by michalliu (requires node.js, V8, SpiderMonkey
432 or cscript js engine),</li>
433 <li><strong>vim:</strong> <a href="https://github.com/maksimr/vim-jsbeautify">vim-jsbeautify</a>, a plugin by Maksim Ryzhikov (node.js or V8 required),</li>
e5c5193 @einars Add link to web-beautify for emacs
einars authored
434
435 <li style="margin-top: 8px"><strong>Emacs:</strong> <a href="https://github.com/yasuyk/web-beautify">Web-beautify</a> formatting package by Yasuyuki Oka,</li>
f49f156 @einars Add a link to @ghost6991's C# js-beautify port
einars authored
436 <li style="margin-top: 8px"><strong>C#:</strong> ghost6991 <a href="https://github.com/ghost6991/Jsbeautifier">ported the javascript formatter to C#</a>,
cdd9b23 @einars index.html: add a link to the golang port
einars authored
437 <li style="margin-top: 8px"><strong>Go:</strong> ditashi has <a href="https://github.com/ditashi/jsbeautifier-go">ported the javascript formatter to golang</a>,
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
438 <li style="margin-top: 12px"><a href="http://fiddler2.com/">Fiddler</a> proxy: <a href="http://fiddler2.com/Fiddler2/extensions.asp">JavaScript Formatter addon</a>,
439 <li><a href="https://github.com/nagaozen/gedit-tunnings/">gEdit tips</a> by Fabio Nagao,</li>
440 <li><a href="http://akelpad.sourceforge.net/forum/viewtopic.php?p=11246#11246">Akelpad extension</a> by Infocatcher,</li>
441 <li>Beautifier in <a href="http://sethmason.com/2011/04/28/jsbeautify-in-emacs.html">Emacs</a> write-up by Seth Mason,</li>
442 <li><a href="http://c9.io">Cloud9</a>, a lovely IDE running in a browser, working in the node/cloud, uses jsbeautifier (<a href="https://github.com/ajaxorg/cloud9">github</a>),</li>
443 <li><a href="http://www.symetronapps.com/pages/apps/shrinker.html">Shrinker</a>, a non-free JavaScript packer for Mac. I&nbsp;haven't used it, so I&nbsp;have
444 no idea if it's any good,</li>
445 <li><a href="http://www.restconsole.com/">REST Console</a>, a request debugging tool for Chrome, beautifies JSON responses (<a href="https://github.com/codeinchaos/rest-console">github</a>),</li>
446 <li><a href="http://mitmproxy.org/">mitmproxy</a>, a nifty SSL-capable HTTP proxy, provides pretty javascript responses (<a href="https://github.com/cortesi/mitmproxy">github</a>).</li>
ed5b72f @einars Tiny cleanups
einars authored
447 <li><a href="http://www.wakanda.org/">wakanda</a>, a neat IDE for web and mobile applications has a <a href="http://forum.wakanda.org/showthread.php?1483-3-new-extensions-JSLint-Beautifier-and-Snippet">Beautifier extension</a>
448 (<a href="https://github.com/Wakanda/wakanda-extensions/tree/master/Beautifier">github</a>).</li>
a1df537 @einars Link update: burp suite jsbeautifier moved to github
einars authored
449 <li><a href="http://portswigger.net/burp/">Burp Suite</a> now has a <a href="https://github.com/irsdl/BurpSuiteJSBeautifier/">beautfier extension</a>,
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
450 thanks to Soroush Dalili,</li>
ed5b72f @einars Tiny cleanups
einars authored
451 <li><a href="http://plugins.netbeans.org/plugin/43263/jsbeautify">Netbeans jsbeautify</a> plugin by Drew Hamlett
452 (<a href="https://github.com/drewhjava/netbeans-jsbeautify">github</a>).</li>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
453 <li><a href="https://github.com/drewhjava/brackets-beautify">brackets-beautify-extension</a> for <a href="http://brackets.io">Adobe Brackets</a> by Drew
e5cf46b @einars Add codecaddy.net to "interesting" section
einars authored
454 Hamlett (<a href="https://github.com/drewhjava/brackets-beautify">github</a>),</li>
482b995 @einars Add editey.com to the front page
einars authored
455 <li><a href="http://codecaddy.net/">codecaddy.net</a>, a collection of webdev-related tools, assembled by Darik Hall,
44c6b9c @einars Grunt plugin by @vkadam
einars authored
456 <li><a href="http://www.editey.com/">editey.com</a>, an interesting and free Google-Drive oriented editor uses this beautifier,
e7dd26a @einars Add SynWrite / JSFormat
einars authored
457 <li><a href="https://github.com/vkadam/grunt-jsbeautifier">a beautifier plugin for Grunt</a> by Vishal Kadam,
41d3740 @einars Update synwrite plugin link
einars authored
458 <li><a href="http://www.uvviewsoft.com/synwrite/">SynWrite</a> editor has a JsFormat plugin (<a href="https://sourceforge.net/projects/synwrite-addons/files/PyPlugins/Alexey.JsFormat/">rar</a>, <a href="http://synwrite.sourceforge.net/forums/viewtopic.php?f=19&t=865">readme</a>),
c33bf3d @einars Add a link to fullscreenmario project
einars authored
459 <li><a href="http://liveditor.com/">LIVEditor</a>, a live-editing HTML/CSS/JS IDE (commercial, Windows-only) uses the library,
460 <li><a href="https://github.com/Diogenesthecynic/FullScreenMario-JSON/">FullScreenMario</a>, a HTML5/javascript remake of Super Mario Bros game, uses the library in its level editor.
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
461 <li class="writeme">Doing anything interesting? Write me to einar@jsbeautifier.org and I'll include your link.</li>
462 </ul>
463
464 <p class="contributors contributor-sep">Written by Einar Lielmanis, <a href="mailto:einar@jsbeautifier.org">einar@jsbeautifier.org</a>, maintained and evolved by <a href="https://github.com/bitwiseman/">Liam Newman</a>.</p>
465 <p class="contributors">We use the wonderful <a href="http://codemirror.net">CodeMirror</a> syntax highlighting editor, written by Marijn Haverbeke.
466 </p>
467 <p class="contributors">Made with a great help of Jason&nbsp;Diamond, Patrick&nbsp;Hof, Nochum&nbsp;Sossonko, Andreas&nbsp;Schneider,
468 <br>Dave&nbsp;Vasilevsky,
469 <a href="http://my.opera.com/Vital/blog/">Vital&nbsp;Batmanov</a>, Ron&nbsp;Baldwin, Gabriel&nbsp;Harrison,
470 <a href="http://shullian.com">Chris J. Shull</a>,
471 <a href="http://mathiasbynens.be/">Mathias Bynens</a>,
472 <br>
473 <a href="https://www.vittgam.net/">Vittorio Gambaletta</a>,
474 <a href="https://github.com/esseks">Stefano Sanfilippo</a> and
475 <a href="https://github.com/evocateur">Daniel Stockman</a>.
476 </p>
477
478 <p style="text-align:right">
479 <a href="#" style="color: #ccc; border-bottom: 1px dashed #ccc; text-decoration: none;" onclick="run_tests(); return false;">Run the tests</a>
480 </p>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
481
d675f4b @einars Use the space in a more meaningful way.
einars authored
482 </div>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
483 <div id="testresults"></div>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
484 <script>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
485 $(function () {
486
487 read_settings_from_cookie();
488
489 var default_text =
490 "// This is just a sample script. Paste your real code (javascript or HTML) here.\n\nif ('this_is'==/an_example/){of_beautifer();}else{var a=b?(c%d):e[f];}";
491 var textArea = $('#source')[0];
492
493 if (the.use_codemirror && typeof CodeMirror !== 'undefined') {
494 the.editor = CodeMirror.fromTextArea(textArea, {
495 theme: 'default',
496 lineNumbers: true
497 });
498 the.editor.focus();
499
500 the.editor.setValue(default_text);
501 $('.CodeMirror').click(function () {
502 if (the.editor.getValue() == default_text) {
503 the.editor.setValue('');
504 }
505 });
506 } else {
507 $('#source').val(default_text).bind('click focus', function () {
508 if ($(this).val() == default_text) {
509 $(this).val('');
510 }
511 }).bind('blur', function () {
512 if (!$(this).val()) {
513 $(this).val(default_text);
514 }
515 });
7d1c293 @bitwiseman Prevent inline script from starting before external scripts have fini…
bitwiseman authored
516 }
517
518
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
519 $(window).bind('keydown', function (e) {
520 if (e.ctrlKey && e.keyCode == 13) {
521 beautify();
522 }
523 })
524 $('.submit').click(beautify);
525 $('select').change(beautify);
7d1c293 @bitwiseman Prevent inline script from starting before external scripts have fini…
bitwiseman authored
526
527
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
528 });
7d1c293 @bitwiseman Prevent inline script from starting before external scripts have fini…
bitwiseman authored
529 </script>
530 <script>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
531 var _gaq = [
532 ['_setAccount', 'UA-7409939-1'],
533 ['_trackPageview']
534 ];
535 (function (d, t) {
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
536 var g = d.createElement(t),
537 s = d.getElementsByTagName(t)[0];
538 g.src = '//www.google-analytics.com/ga.js';
539 s.parentNode.insertBefore(g, s);
540 }(document, 'script'));
541 </script>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
542 </body>
e8efb75 @bitwiseman Apply html beautifier to index.html
bitwiseman authored
543
557fbad @einars Stefano on the frontpage
einars authored
544 </html>
Something went wrong with that request. Please try again.