Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 409 lines (343 sloc) 18.914 kb
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
1 <!DOCTYPE html>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
2 <!--[if lt IE 7]><html lang="en-us" class="ie6"><![endif]-->
3 <!--[if IE 7]><html lang="en-us" class="ie7"><![endif]-->
4 <!--[if IE 8]><html lang="en-us" class="ie8"><![endif]-->
5 <!--[if gt IE 8]><!--><html lang="en-us"><!--<![endif]-->
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
6 <head>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
7 <meta charset="utf-8">
8 <title>Online JavaScript beautifier</title>
154e81c @einars Who needs .ico anyway. png ftw
einars authored
9 <link rel="icon" href="favicon.png" type="image/png">
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
10 <script src="third-party/codemirror2/lib/codemirror.js"></script>
11 <script src="third-party/codemirror2/mode/javascript/javascript.js"></script>
12 <link rel="stylesheet" href="third-party/codemirror2/lib/codemirror.css">
13
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
14 <style>
d675f4b @einars Use the space in a more meaningful way.
einars authored
15 body {
16 background: #eee;
17 color: #333;
0d807d0 @einars Remove border from flattr
einars authored
18 }
2eafed7 @einars Array indentation option in frontpage.
einars authored
19
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
20 img {
2eafed7 @einars Array indentation option in frontpage.
einars authored
21 border: 0;
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
22 }
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
23
5759e3e @einars Add a self-link in the page top
einars authored
24 a.self { font-weight: bold; text-decoration: none; color: #444; border-bottom: 1px solid #aaa }
25
2fa8cc9 @VittGam Fixed turn-off-codemirror link in html page
VittGam authored
26 p, select, label, .blurb, a.turn-off-codemirror {
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
27 font:13px/1.231 arial, sans-serif;
28 *font-size:small;
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
29 }
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
30
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
31 a {
32 color: #36d;
33 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
34
2fa8cc9 @VittGam Fixed turn-off-codemirror link in html page
VittGam authored
35 a.turn-off-codemirror {
36 margin-left: 25px;
37 }
38
d675f4b @einars Use the space in a more meaningful way.
einars authored
39 button#submit {
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
40 clear: both;
d675f4b @einars Use the space in a more meaningful way.
einars authored
41 margin-top: 5px;
42 width: 100%;
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
43 padding: 10px 0;
d675f4b @einars Use the space in a more meaningful way.
einars authored
44 cursor: pointer;
1faf702 @einars Changed textarea font default to Consolas
einars authored
45 }
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
46
a81311e @einars Fix textarea width
einars authored
47 #source {
48 width: 100%;
49 padding-left: 0;
50 padding-right: 0;
51 }
52
d675f4b @einars Use the space in a more meaningful way.
einars authored
53 button#submit em {
54 font-size: 11px;
55 font-style: normal;
56 color: #999;
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
57 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
58
59 label {
60 cursor: pointer;
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
61 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
62
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
63 select {
d675f4b @einars Use the space in a more meaningful way.
einars authored
64 width: 220px;
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
65 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
66
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
67 table#options {
68 float: right;
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
69 }
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
70 table#options td {
71 vertical-align: top;
72 padding-left: 10px;
2eafed7 @einars Array indentation option in frontpage.
einars authored
73 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
74
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
75 #about p {
76 margin: 0 6px 6px 0;
2eafed7 @einars Array indentation option in frontpage.
einars authored
77 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
78
387b652 @einars Add a link to Burp Suite beautifier
einars authored
79 li {
80 line-height: 150%;
81 }
82
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
83
84 #testresults {
85 display: none;
86 font-family: monaco, "lucida console", "courier new", monospace;
2eafed7 @einars Array indentation option in frontpage.
einars authored
87 }
6c38dfe Support narrow window better. Issue #101.
Rafal Chlodnicki authored
88
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
89 .CodeMirror {
90 border: 1px solid #ccc;
91 margin-bottom: 6px;
bb36c7d @einars Make the codemirror background white and pretty
einars authored
92 background: white;
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
93 }
94 .CodeMirror-scroll {
95 min-height: 400px;
96 max-height: 100%;
97 height: auto;
98 overflow-y: hidden;
99 overflow-x: auto;
100 width: 100%
6c38dfe Support narrow window better. Issue #101.
Rafal Chlodnicki authored
101 }
9bdec17 @einars Add vittgam to contributors/readme
einars authored
102 .contributors a {
103 white-space: nowrap;
104 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
105 </style>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
106 <script src="jquery/jquery.js"></script>
107 <script src="jquery/jquery.cookie.js"></script>
d675f4b @einars Use the space in a more meaningful way.
einars authored
108
8ee16eb @einars Use CodeMirror editor
einars authored
109
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
110 <script src="beautify.js"></script>
5b98d75 @nightwing add basic css beautifier
nightwing authored
111 <script src="beautify-css.js"></script>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
112 <script src="beautify-html.js"></script>
113 <script src="tests/sanitytest.js"></script>
114 <script src="tests/beautify-tests.js"></script>
115 <script src="unpackers/javascriptobfuscator_unpacker.js"></script>
116 <script src="unpackers/urlencode_unpacker.js"></script>
117 <script src="unpackers/p_a_c_k_e_r_unpacker.js"></script>
118 <script src="unpackers/myobfuscate_unpacker.js"></script>
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
119
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
120 <script>
d675f4b @einars Use the space in a more meaningful way.
einars authored
121
122 var the = {
5b4f19c @einars ?without-codemirror for turning off codemirror
einars authored
123 use_codemirror: ( ! window.location.href.match(/without-codemirror/)),
8ee16eb @einars Use CodeMirror editor
einars authored
124 beautify_in_progress: false,
125 editor: null // codemirror editor
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
126 };
d675f4b @einars Use the space in a more meaningful way.
einars authored
127
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
128 function run_tests() {
d675f4b @einars Use the space in a more meaningful way.
einars authored
129 var st = new SanityTest();
130 run_beautifier_tests(st);
131 JavascriptObfuscator.run_tests(st);
132 P_A_C_K_E_R.run_tests(st);
133 Urlencoded.run_tests(st);
134 MyObfuscate.run_tests(st);
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
135 // $('#testresults').html(results.replace(/r/g, '').replace(/\n/g, '<br>'));
136 var results = st.results_raw().replace(/ /g, '&nbsp;').replace(/\r/g, '·').replace(/\n/g, '<br>');
137 $('#testresults').html(results).show();
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
138 }
139
d675f4b @einars Use the space in a more meaningful way.
einars authored
140
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
141 function any(a, b) {
142 return a || b;
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
143 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
144
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
145 function read_settings_from_cookie() {
d675f4b @einars Use the space in a more meaningful way.
einars authored
146 $('#tabsize').val(any($.cookie('tabsize'), '4'));
147 $('#brace-style').val(any($.cookie('brace-style'), 'collapse'));
148 $('#detect-packers').attr('checked', $.cookie('detect-packers') !== 'off');
149 $('#preserve-newlines').attr('checked', $.cookie('preserve-newlines') !== 'off');
150 $('#keep-array-indentation').attr('checked', $.cookie('keep-array-indentation') === 'on');
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
151 $('#break-chained-methods').attr('checked', $.cookie('break-chained-methods') === 'on');
cdee74c @einars Changes by Stan <stasson@orc.ru>
einars authored
152 $('#indent-scripts').val(any($.cookie('indent-scripts'), 'normal'));
153 $('#space-before-conditional').attr('checked', $.cookie('space-before-conditional') !== 'off');
569e558 @VittGam s/decode_characters/unescape_strings/
VittGam authored
154 $('#unescape-strings').attr('checked', $.cookie('unescape-strings') === 'on');
cdee74c @einars Changes by Stan <stasson@orc.ru>
einars authored
155 }
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
156
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
157 function store_settings_to_cookie() {
d675f4b @einars Use the space in a more meaningful way.
einars authored
158 var opts = { expires: 360 };
159 $.cookie('tabsize', $('#tabsize').val(), opts);
160 $.cookie('brace-style', $('#brace-style').val(), opts);
161 $.cookie('detect-packers', $('#detect-packers').attr('checked') ? 'on' : 'off', opts);
162 $.cookie('preserve-newlines', $('#preserve-newlines').attr('checked') ? 'on' : 'off', opts);
163 $.cookie('keep-array-indentation', $('#keep-array-indentation').attr('checked') ? 'on' : 'off', opts);
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
164 $.cookie('break-chained-methods', $('#break-chained-methods').attr('checked') ? 'on' : 'off', opts);
cdee74c @einars Changes by Stan <stasson@orc.ru>
einars authored
165 $.cookie('space-before-conditional', $('#space-before-conditional').attr('checked') ? 'on' : 'off', opts);
569e558 @VittGam s/decode_characters/unescape_strings/
VittGam authored
166 $.cookie('unescape-strings', $('#unescape-strings').attr('checked') ? 'on' : 'off', opts);
cdee74c @einars Changes by Stan <stasson@orc.ru>
einars authored
167 $.cookie('indent-scripts', $('#indent-scripts').val(), opts);
168 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
169
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
170 function unpacker_filter(source) {
93e37a2 @einars Improve trailing comment handling
einars authored
171 var trailing_comments = '';
172 var comment = '';
173 var found = false;
174
175 do {
176 found = false;
177 if (/^\s*\/\*/.test(source)) {
178 found = true;
10304c9 @einars Slightly improve variable naming
einars authored
179 comment = source.substr(0, source.indexOf('*/') + 2);
180 source = source.substr(comment.length).replace(/^\s+/, '');
181 trailing_comments += comment + "\n";
93e37a2 @einars Improve trailing comment handling
einars authored
182 } else if (/^\s*\/\//.test(source)) {
183 found = true;
10304c9 @einars Slightly improve variable naming
einars authored
184 comment = source.match(/^\s*\/\/.*/)[0];
185 source = source.substr(comment.length).replace(/^\s+/, '');
186 trailing_comments += comment + "\n";
d675f4b @einars Use the space in a more meaningful way.
einars authored
187 }
93e37a2 @einars Improve trailing comment handling
einars authored
188 } while (found);
d675f4b @einars Use the space in a more meaningful way.
einars authored
189
93e37a2 @einars Improve trailing comment handling
einars authored
190 if (P_A_C_K_E_R.detect(source)) {
4db2346 @einars Don't fall in infinite loop when unP.A.C.K fails
einars authored
191 // P.A.C.K.E.R unpacking may fail, even though it is detected
192 var unpacked = P_A_C_K_E_R.unpack(source);
193 if (unpacked != source) {
194 source = unpacker_filter(unpacked);
195 }
93e37a2 @einars Improve trailing comment handling
einars authored
196 }
d675f4b @einars Use the space in a more meaningful way.
einars authored
197 if (Urlencoded.detect(source)) {
93e37a2 @einars Improve trailing comment handling
einars authored
198 source = unpacker_filter(Urlencoded.unpack(source))
d675f4b @einars Use the space in a more meaningful way.
einars authored
199 }
93e37a2 @einars Improve trailing comment handling
einars authored
200 if (JavascriptObfuscator.detect(source)) {
201 source = unpacker_filter(JavascriptObfuscator.unpack(source))
d675f4b @einars Use the space in a more meaningful way.
einars authored
202 }
93e37a2 @einars Improve trailing comment handling
einars authored
203 if (MyObfuscate.detect(source)) {
204 source = unpacker_filter(MyObfuscate.unpack(source))
d675f4b @einars Use the space in a more meaningful way.
einars authored
205 }
93e37a2 @einars Improve trailing comment handling
einars authored
206
10304c9 @einars Slightly improve variable naming
einars authored
207 return trailing_comments + source;
d675f4b @einars Use the space in a more meaningful way.
einars authored
208 }
209
210
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
211 function beautify()
212 {
d675f4b @einars Use the space in a more meaningful way.
einars authored
213 if (the.beautify_in_progress) return;
214
215 store_settings_to_cookie();
216
217 the.beautify_in_progress = true;
218
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
219 var source = the.editor ? the.editor.getValue() : $('#source').val(),
220 output,
221 opts = {};
222
223 opts.indent_size = $('#tabsize').val();
224 opts.indent_char = opts.indent_size == 1 ? '\t' : ' ';
225 opts.preserve_newlines = $('#preserve-newlines').attr('checked');
226 opts.keep_array_indentation = $('#keep-array-indentation').attr('checked');
227 opts.break_chained_methods = $('#break-chained-methods').attr('checked');
228 opts.indent_scripts = $('#indent-scripts').val();
229 opts.brace_style = $('#brace-style').val();
230 opts.space_before_conditional = $('#space-before-conditional').attr('checked');
231 opts.unescape_strings = $('#unescape-strings').attr('checked');
232 opts.space_after_anon_function = true;
233
a6dd2d5 @einars jsbeautifier.org html w/leading whitespace
einars authored
234 if (looks_like_html(source)) {
8ee16eb @einars Use CodeMirror editor
einars authored
235 output = style_html(source, opts);
dc2fb8f @einars Make signature of `style_html` match that of `js_beautify`. Fixes #47.
einars authored
236 } else {
4db2346 @einars Don't fall in infinite loop when unP.A.C.K fails
einars authored
237 if ($('#detect-packers').attr('checked')) {
238 source = unpacker_filter(source);
239 }
8ee16eb @einars Use CodeMirror editor
einars authored
240 output = js_beautify(source, opts);
241 }
242 if (the.editor) {
243 the.editor.setValue(output);
244 } else {
245 $('#source').val(output);
d675f4b @einars Use the space in a more meaningful way.
einars authored
246 }
247
248 the.beautify_in_progress = false;
06ecc1b @einars Minor flattery changes, no need to jump in the face
einars authored
249 }
250
a6dd2d5 @einars jsbeautifier.org html w/leading whitespace
einars authored
251 function looks_like_html(source)
252 {
c2e8472 @einars jsbeautifier.org: unbreak looks_like_html
einars authored
253 // <foo> - looks like html
254 // <!--\nalert('foo!');\n--> - doesn't look like html
255
a6dd2d5 @einars jsbeautifier.org html w/leading whitespace
einars authored
256 var trimmed = source.replace(/^[ \t\n\r]+/, '');
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
257 var comment_mark = '<' + '!-' + '-';
c2e8472 @einars jsbeautifier.org: unbreak looks_like_html
einars authored
258 return (trimmed && (trimmed.substring(0, 1) === '<' && trimmed.substring(0, 4) !== comment_mark));
a6dd2d5 @einars jsbeautifier.org html w/leading whitespace
einars authored
259 }
260
d675f4b @einars Use the space in a more meaningful way.
einars authored
261 $(function() {
262
263 read_settings_from_cookie();
264
bdccfef @einars Didn't like the huge html-examplish default text at all
einars authored
265 var default_text = "// 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];}";
177dfa1 @nightwing add option to separately indent js/css in html
nightwing authored
266
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
267 if (the.use_codemirror) {
268 the.editor = CodeMirror.fromTextArea($('#source').get(0))
269 the.editor.setValue(default_text);
270 $('.CodeMirror').click(function () {
271 if (the.editor.getValue() == default_text) {
272 the.editor.setValue('');
273 }
274 });
275 } else {
276 $('#source').val(default_text).bind('click focus', function () {
277 if ($(this).val() == default_text) {
278 $(this).val('');
279 }
280 }).bind('blur', function () {
281 if ( ! $(this).val()) {
282 $(this).val(default_text);
283 }
284 });
285 }
286
287
d675f4b @einars Use the space in a more meaningful way.
einars authored
288 $(window).bind('keydown', function (e) {
289 if (e.ctrlKey && e.keyCode == 13) {
290 beautify();
291 }
292 })
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
293 $('#submit').click(beautify);
294 $('select').change(beautify);
8ee16eb @einars Use CodeMirror editor
einars authored
295
296
d675f4b @einars Use the space in a more meaningful way.
einars authored
297 });
298 </script>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
299 </head>
300 <body>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
301
302 <table id="options">
303 <tr>
304 <td>
305 <select name="tabsize" id="tabsize">
2eafed7 @einars Array indentation option in frontpage.
einars authored
306 <option value="1">indent with a tab character</option>
307 <option value="2">indent with 2 spaces</option>
308 <option value="3">indent with 3 spaces</option>
d675f4b @einars Use the space in a more meaningful way.
einars authored
309 <option value="4">indent with 4 spaces</option>
2eafed7 @einars Array indentation option in frontpage.
einars authored
310 <option value="8">indent with 8 spaces</option>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
311 </select><br>
312
313 <select id="brace-style">
0d22b9f @einars Alternate brace style patch by Chris J. Shull
einars authored
314 <option value="collapse">Braces with control statement</option>
315 <option value="expand">Braces on own line</option>
316 <option value="end-expand">End braces on own line</option>
cdee74c @einars Changes by Stan <stasson@orc.ru>
einars authored
317 <!-- option value="expand-strict">Braces always on own line (not recommended)</option -->
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
318 </select>
319
320 <p style="margin:6px 0 0 0">HTML &lt;style&gt;, &lt;script&gt; formatting:</p><select id="indent-scripts">
177dfa1 @nightwing add option to separately indent js/css in html
nightwing authored
321 <option value="keep">Keep indent level of the tag</option>
322 <option value="normal">Add one indent level</option>
577b700 @einars Clearer style/script indentation select
einars authored
323 <option value="separate">Separate indentation</option>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
324 </select>
325
326 </td><td>
d675f4b @einars Use the space in a more meaningful way.
einars authored
327
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
328 <input class="checkbox" type="checkbox" id="preserve-newlines"><label for="preserve-newlines"> Preserve empty lines?</label><br>
329 <input class="checkbox" type="checkbox" id="detect-packers"><label for="detect-packers"> Detect packers and obfuscators?</label><br>
330 <input class="checkbox" type="checkbox" id="keep-array-indentation"><label for="keep-array-indentation"> Keep array indentation?</label><br>
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
331 <input class="checkbox" type="checkbox" id="break-chained-methods"><label for="break-chained-methods"> Break lines on chained methods?</label><br>
1524045 @VittGam Shortened description for decode_characters option in html page, and …
VittGam authored
332 <input class="checkbox" type="checkbox" id="space-before-conditional"><label for="space-before-conditional"> Space before conditional: "if(x)" / "if (x)"</label><br>
569e558 @VittGam s/decode_characters/unescape_strings/
VittGam authored
333 <input class="checkbox" type="checkbox" id="unescape-strings"><label for="unescape-strings"> Unescape printable chars encoded as \xNN or \uNNNN?</label>
595d812 @einars Improve chained methods (fix #151, ref #93, #10)
einars authored
334 <br><a href="?without-codemirror" class="turn-off-codemirror">Use a simple textarea for code input?</a>
5b4f19c @einars ?without-codemirror for turning off codemirror
einars authored
335
107a2be @einars Index: Chrome problem warning on front page
einars authored
336
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
337 </td></tr>
338 </table>
339
340 <div id="about">
5759e3e @einars Add a self-link in the page top
einars authored
341 <p><a class="self" href="./">Beautify, unpack or deobfuscate JavaScript and HTML, make JSON/JSONP readable, etc.</a></p>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
342 <p>All of the source code is completely free and open, available on the <a href="https://github.com/einars/js-beautify">github</a> under MIT licence, <br>and we have a command-line version and a python library as well.
343 </div>
d675f4b @einars Use the space in a more meaningful way.
einars authored
344
107a2be @einars Index: Chrome problem warning on front page
einars authored
345
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
346 <button id="submit"><strong>Beautify JavaScript or HTML</strong> <em>(ctrl-enter)</em></button>
347 <textarea id="source" rows="30" cols="160"></textarea>
348
349 <div class="blurb">
350 <div style="float:right; width: 210px;">
351 <a style="display:block; float: left; padding-top: 3px" href="http://flattr.com/thing/94550/jsbeautifier-org" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr" /></a>
352 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
91e374c @einars Restore paypal button
einars authored
353 <input type="hidden" name="cmd" value="_s-xclick">
354 <input type="hidden" name="hosted_button_id" value="TL28UJK2ARCUJ">
20c2214 @einars Add link to the new Chrome extension,
einars authored
355 <input style="border:0" type="image" src="http://spicausis.lv/misc/paypal-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online!">
91e374c @einars Restore paypal button
einars authored
356 <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
357 </form>
8f475ba @einars As if IE could work without the tweaks.
einars authored
358 </div>
91e374c @einars Restore paypal button
einars authored
359
d675f4b @einars Use the space in a more meaningful way.
einars authored
360 <p>Browser extensions and other uses:</p>
361 <ul id="uses">
88c6846 @einars Add Hiroshi's bookmarklet
einars authored
362
a9a135b @einars s/hiroshi ichiro/ichiro hiroshi
einars authored
363 <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 it to your bookmarks) by Ichiro Hiroshi to see all scripts used on the page,</li>
88c6846 @einars Add Hiroshi's bookmarklet
einars authored
364
7882509 @einars Index: add a link to REST Console
einars authored
365 <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>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
366 <li><strong>Chrome</strong>: <a href="https://chrome.google.com/webstore/detail/piekbefgpgdecckjcpffhnacjflfoddg">Pretty Beautiful JavaScript</a> by Will McSweeney,</li>
4089325 @einars Add link to quick source viewer by tomimick
einars authored
367 <li><strong>Chrome</strong>: <a href="https://chrome.google.com/webstore/detail/cfmcghennfbpmhemnnfjhkdmnbidpanb">Quick source viewer</a> by Tomi Mickelsson (<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>
284f942 @einars Index: add a link to benmurphy's js deminifier
einars authored
368 <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,<br>to be used together with the firebug (<a href="https://github.com/benmmurphy/jsdeminifier_xpi/">github</a>),</li>
7882509 @einars Index: add a link to REST Console
einars authored
369 <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>
370 <li style="margin-top: 8px"><strong>Opera</strong>: <a href="https://addons.opera.com/addons/extensions/details/readable-javascript/">Readable JavaScript</a> (<a href="https://github.com/Dither/readable-javascript">github</a>) by Dither,</li>
93e37a2 @einars Improve trailing comment handling
einars authored
371 <li><strong>Opera</strong>: <a href="https://addons.opera.com/addons/extensions/details/source/">Source</a> extension by Deathamns,</li>
e61a60f @einars Add link to vim-jsbeautify
einars authored
372 <li style="margin-top: 8px"><strong>vim:</strong> <a style="font-weight:bold" href="https://github.com/michalliu/sourcebeautify.vim">sourcebeautify.vim</a>, a plugin by michalliu (requires node.js, V8, SpiderMonkey or cscript js engine),</li>
373 <li><strong>vim:</strong> <a style="font-weight:bold" href="https://github.com/maksimr/vim-jsbeautify">vim-jsbeautify</a>, a plugin by Maksim Ryzhikov (node.js or V8 required),</li>
7882509 @einars Index: add a link to REST Console
einars authored
374 <li style="margin-top: 12px"><a style="font-weight: bold" href="http://fiddler2.com/">Fiddler</a> proxy: <a href="http://fiddler2.com/Fiddler2/extensions.asp">JavaScript Formatter addon</a>,
375 <li><strong>gEdit</strong> <a href="https://github.com/nagaozen/gedit-tunnings/">tips by Fabio Nagao</a>,</li>
bb6ad9c @einars Add a link to Emacs integration by Seth Mason
einars authored
376 <li><strong>Akelpad</strong> <a href="http://akelpad.sourceforge.net/forum/viewtopic.php?p=11246#11246">extension</a> by Infocatcher,</li>
9b9729e @einars Add a link to Cloud9
einars authored
377 <li>Beautifier in <a style="font-weight: bold" href="http://sethmason.com/2011/04/28/jsbeautify-in-emacs.html">Emacs</a> write-up by Seth Mason,</li>
88c6846 @einars Add Hiroshi's bookmarklet
einars authored
378 <li><a style="font-weight:bold" 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>
8c731b0 @einars A new link for shrinker
einars authored
379 <li><a style="font-weight:bold" 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 no idea if it's any good,</li>
e7e3e00 @einars Add a link to cortesi's mitmproxy
einars authored
380 <li><a style="font-weight:bold" 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>
381 <li><a style="font-weight:bold" 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>
ea45cc4 @einars Add a link to wakanda
einars authored
382 <li><a style="font-weight:bold" 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> (<a href="https://github.com/Wakanda/wakanda-extensions/tree/master/Beautifier">github</a>).</li>
f2f452f @einars Add netbeans jsbeautify by Drew Hamlett
einars authored
383 <li><a style="font-weight:bold" href="http://portswigger.net/burp/">Burp Suite</a> now has a <a href="http://code.google.com/p/burp-suite-beautifier-extension/">beautfier extension</a>, thanks to Soroush Dalili,</li>
384 <li><a style="font-weight:bold" href="http://plugins.netbeans.org/plugin/43263/jsbeautify">Netbeans jsbeautify</a> plugin by Drew Hamlett (<a href="https://github.com/drewhjava/netbeans-jsbeautify">github</a>).</li>
d675f4b @einars Use the space in a more meaningful way.
einars authored
385 <li class="writeme">Doing anything interesting? Write me to einar@jsbeautifier.org and I'll include your link.</li>
386 </ul>
61e96a2 @einars WikiLeaks: Paypal can bite my shiny metal ass.
einars authored
387
5b4f19c @einars ?without-codemirror for turning off codemirror
einars authored
388 <p class="me-me-me">Written by Einar Lielmanis, <a href="mailto:einar@jsbeautifier.org">einar@jsbeautifier.org</a>, Python version flourished by <a href="http://github.com/satufk">Stefano Sanfilippo</a>. We use the wonderful <a href="http://codemirror.net">CodeMirror</a> syntax highlighting editor, written by Marijn Haverbeke.</p>
9bdec17 @einars Add vittgam to contributors/readme
einars authored
389 <p class="contributors">Made with a great help of <a href="http://jason.diamond.name/weblog/">Jason&nbsp;Diamond</a>, Patrick&nbsp;Hof, Nochum&nbsp;Sossonko, Andreas&nbsp;Schneider, Dave&nbsp;Vasilevsky, <a href="http://my.opera.com/Vital/blog/">Vital&nbsp;Batmanov,</a> Ron&nbsp;Baldwin, Gabriel&nbsp;Harrison, <a href="http://shullian.com">Chris&nbsp;J.&nbsp;Shull</a>, <a href="http://mathiasbynens.be/">Mathias Bynens</a>, <a href="https://www.vittgam.net/">Vittorio Gambaletta</a> and others.
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
390 </p>
d675f4b @einars Use the space in a more meaningful way.
einars authored
391
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
392 <p style="text-align:right">
393 <a href="#" style="color: #ccc; border-bottom: 1px dashed #ccc; text-decoration: none;" onclick="run_tests(); return false;">Run the tests</a>
394 </p>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
395
d675f4b @einars Use the space in a more meaningful way.
einars authored
396 </div>
3ab58e6 @einars Put the CodeMirror back, vastly simplify index mess
einars authored
397 <div id="testresults"></div>
5211567 @mathiasbynens Use a monospaced font for the <textarea>. Remove redundant code.
mathiasbynens authored
398 <script>
399 var _gaq = [['_setAccount', 'UA-7409939-1'], ['_trackPageview']];
400 (function(d, t) {
401 var g = d.createElement(t),
402 s = d.getElementsByTagName(t)[0];
403 g.src = '//www.google-analytics.com/ga.js';
404 s.parentNode.insertBefore(g, s);
405 }(document, 'script'));
406 </script>
f183cb6 @einars Added index.html back to git, removed local.html.
einars authored
407 </body>
557fbad @einars Stefano on the frontpage
einars authored
408 </html>
Something went wrong with that request. Please try again.