Commit Graph

155 Commits

Author SHA1 Message Date
Ryan Graham
a9845df8e1 Don't break up foo({}, bar);
jQuery plugins commonly use $.extend({}, defaults, options) and this change
keeps that as a one-liner instead of breaking the line up (without even
indenting it).

Adds a basic test case to cover the scenario.
2010-02-16 17:09:19 +08:00
Einar Lielmanis
5ddf19e5f6 Do not err on weird non-packers 2010-02-14 10:48:14 +02:00
Einar Lielmanis
c527398928 Unpack other eval-based packers. 2010-02-14 10:37:07 +02:00
Einar Lielmanis
1faf70255d Changed textarea font default to Consolas
Under Windows, terminus.ttf doesn't include the prettiest low-res version of
Terminus (what the fuck are you doing people? It's ugly in the huge sizes! 10px
is where it's at!) so if a windows user has this font installed, it will look
ugly. So stick with the Consolas as a reasonable default instead.
2010-02-06 02:33:45 +02:00
Einar Lielmanis
1c35278afc Minor boring rewording 2010-02-04 01:47:19 +02:00
Einar Lielmanis
e56868dbcf You want Paypal, you get Paypal. 2010-02-03 02:25:26 +02:00
Einar Lielmanis
feae719b36 Skip processing <a> tags for html
browsers render the newline as a space in the link, and as a result

<a href='http://someurl.com'>Face</a> gets changed to

<a href='http://someurl.com'>
	Face
</a>

For now, just don't format the <a>..</a> altogether.
2010-02-03 02:23:55 +02:00
Einar Lielmanis
8c6ef8c28d JavascriptObfuscator fixes
The quoting/dequoting was messed up, resulting in a quite bad output.
2010-01-18 20:55:18 +02:00
Einar Lielmanis
c3b5a573b8 JSLint happiness: }()
before:

function () {
    return x;
} ()

now:

function () {
    return x;
}()
2010-01-08 03:05:47 +02:00
Einar Lielmanis
516a5f84cc JSlint-friendlier array closing tag indentation
[[1,2], [3,4]]

before:

[
    [1, 2],
    [3, 4]]

now:
[
    [1, 2],
    [3, 4]
]
2010-01-08 02:39:23 +02:00
Einar Lielmanis
d40624768a Link to Fabio's gEdit page 2009-12-18 05:24:29 +02:00
Einar Lielmanis
3fe884d3a2 Added a test for stack underflow
}}} for the input crashed with error, actually.

Also, slightly refactored the testing stuff.
2009-12-16 04:02:59 +02:00
Einar Lielmanis
17e74eb6a1 Bookmarklets! Mention the bookmarklets! 2009-12-16 03:43:53 +02:00
Einar Lielmanis
e2265477ef Unpacking cleanup, bookmarklet unescape
Added automatic detection of escaped bookmarklets — they can be freely pasted now; also slightly cleaned and organized
the filter (Edward's packer, Javascriptobfuscator, and bookmarklet unpacking) code.
2009-12-16 03:36:50 +02:00
Einar Lielmanis
c86606a496 I just wanted a nicer commit message here. 2009-12-12 12:49:34 +02:00
Einar Lielmanis
45136db008 keep_array_indentation improvements
Now the following code:
var a = [
'<html>',
  '<head><title>x</title></head>',
  '<body>',
    '<p>test</p>',
  '</body>',
'</html>'];

will get neatly beautified (with keep_array_indentation) to:

var a = [
    '<html>',
      '<head><title>x</title></head>',
      '<body>',
        '<p>test</p>',
      '</body>',
    '</html>'];'

Also some fixes with pre-"function" blank lines have been sucked in.
2009-12-07 12:55:23 +02:00
Einar Lielmanis
2eafed74d3 Array indentation option in frontpage. 2009-12-02 03:40:38 +02:00
Einar Lielmanis
8deddc851b Experimental "keep array indentation" feature
This feature allows retaining the indentation in cases like this:

var markup = [
  '<div>',
    '<span>Hello World</span>',
    some_variable,
  '</div>
].join('');

when merging it together would be very undesirable.

The option is defined as "keep_array_indentation" flag in parameters for js_beautify().
2009-12-02 03:40:10 +02:00
Einar Lielmanis
135e3a98eb Gab Harisson name on the page, minor CSS tweaks 2009-11-27 04:55:09 +02:00
Einar Lielmanis
22c87e9755 beaufify_js script updates by Gabriel Harrison
Updated the vim/beautify_js script so that you can pass the command
line arguments using vim as well;

added the ability to place the extracted directory anywhere and symlink
the bin/beautify_js file to someplace like /usr/bin and still have it
work.

After installed in your .vimrc, you can do stuff like the following

:BeautifyJavascript -i 4 -n
:BeautifyJavascript -i 1 -p
2009-11-27 04:54:21 +02:00
Einar Lielmanis
c05254230f A little bit more accent to unpacking 2009-11-17 10:41:44 +02:00
Einar Lielmanis
c178b7fe72 Fix for "do /regexp/"
input:
do/regexp/.test....

expected:
do /regexp/.test...

was:
do / regexp / .test...
2009-11-06 08:28:51 +02:00
Einar Lielmanis
6b79420cab Javadoc and var line changes
Added a support for javadoc syntax, which now gets neatly indented.

Varline handling was vastly improved, like:

input:
-----
var a, b, c, d = [], e, f, g = function () {};

was:
---
var a, b, c, d = []. // <- this moment varline got flagged as unclean,
e,                   // so next variables get each its own line
f,
g = function () {};

now it is:
---------
var a, b, c, d = [].
    e, f, g = function () {};

Some internal changes were done to preserve the flags between
block/expression mode changes.
2009-10-29 07:55:22 +02:00
Einar Lielmanis
6661c76c36 Fix for missing space on return<operator>
input:
return ++i

expected:
return ++i

returned:
return++i
2009-10-28 14:23:11 +02:00
Einar Lielmanis
353bed2108 Put a blank line before clean "function ..."
While not perfect, as there are no blank lines before "var x =
function()" and alike, this should slightly help formatting and break up
longer texts.
2009-10-23 09:09:56 +03:00
Einar Lielmanis
223c924f19 Removed wrong comment 2009-10-22 14:18:59 +03:00
Einar Lielmanis
ad9dd90958 Internet explorer fixes
str.charAt(x), not str[x].
2009-10-22 10:06:23 +03:00
Einar Lielmanis
7883b4d823 javascriptobfuscator.com support
...and wrote a tiny testing harness for easier testing.
2009-10-22 09:33:38 +03:00
Einar Lielmanis
796d7647b0 Fixed link to Mozilla Rhino 2009-10-20 15:08:34 +03:00
Einar Lielmanis
bca56b5097 No need to scream the legal shit 2009-09-27 05:57:25 +00:00
Einar Lielmanis
64e9646c18 Allex Wang's fix for else { if handling
if (exp1) {
    // somethings;
} else {
    if (exp2) {
        // somethings else;
    }
}

got borked to:

if (exp1) {
    // somethings;
} else { if (exp2) {
        // somethings else;
    }
}
2009-09-27 05:32:33 +00:00
Einar Lielmanis
aa44676ce9 MIT license. 2009-09-27 04:07:15 +00:00
Einar Lielmanis
65b1df8aed jslint duty 2009-09-18 16:29:16 +03:00
Einar Lielmanis
a933f69787 Newly found bugs fixed 2009-09-18 16:22:41 +03:00
Einar Lielmanis
aa631cea73 Added test wrapper to test for indentation bugs 2009-09-18 16:22:19 +03:00
Einar Lielmanis
80a63b7cfa Fixed array indentation regressions.
Was:

{
    [x()[x]];
indent;
}

Is:

{
    [x()[x]];
    indent;
}
2009-09-18 15:07:46 +03:00
Einar Lielmanis
516d388d4f Fixed indentation bugs caused by array handling 2009-09-17 11:13:09 +03:00
Einar Lielmanis
b2b974fc4a Better multidimensional array handling 2009-09-17 06:54:31 +03:00
Einar Lielmanis
c4ebaa4b6e Typo 2009-09-03 06:08:51 +03:00
Einar Lielmanis
1a7803ec93 jslint happiness 2009-09-03 06:08:46 +03:00
Einar Lielmanis
341283af6b Frontpage tweaks
Minor rewording, addded vim plugin, removed bbedit plugin (it is
somewhat stale).
2009-08-24 12:19:56 +03:00
Einar Lielmanis
ecbd9575bb More array tweaks
[1,2,3,[4,5,6,[7,8,9],10],11,12];

was:

[1, 2, 3,
    [4, 5, 6,
        [7, 8, 9], 10], 11, 12];

is:

[1, 2, 3, [4, 5, 6, [7, 8, 9], 10], 11, 12];
2009-08-21 07:04:26 +03:00
Einar Lielmanis
827b23ca71 Array tweaks
Recently introducted multidimensional array has its problems.

var a = a[b['c']];

was:

var a = a[b
    ['c']];

is:

var a = a[b['c']];
2009-08-21 06:54:46 +03:00
Einar Lielmanis
21e4e30d5c Moved unmaintained creatures off the main branch
Some projects, like bbedit script, have fallen behind the changes, and
not up to date. Moved them to "unmaintained" folder, and added a couple
of sent scripts (C#, opera) as well.
2009-08-19 17:21:24 +03:00
Einar Lielmanis
0b9aa4f4b8 Allow specifying tabsize on web page
http://jsbeautifier.org/?tabsize=1
http://jsbeautifier.org/?tabsize=2
http://jsbeautifier.org/?tabsize=4
2009-08-18 04:07:18 +03:00
Einar Lielmanis
b0125673bc It's "preserve empty lines" not "newlines" 2009-08-13 16:06:54 +03:00
Einar Lielmanis
c93ef04e99 Better handling of multi-dimensional arrays
Arrays get split and indented now.

a = [[1,2,3],[3,4,5]]

was:

  a = [[1, 2, 3], [3, 4, 5]]

is:

  a = [
      [1, 2, 3],
      [3, 4, 5]]
2009-08-12 17:00:59 +03:00
Einar Lielmanis
5503b05fe4 Documentation fix 2009-08-10 12:29:10 +03:00
Einar Lielmanis
8f6f06daba -p for jslint-pedantic mode
Currently only switches "function ()" (-p) and "function()" (default)
behaviour.
2009-08-07 22:44:43 +03:00
Einar Lielmanis
acceed54b2 -p for jslint-pedantic mode
Currently only switches "function ()" (-p) and "function()" (default)
behaviour.
2009-08-07 22:34:16 +03:00