Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29004
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: What Does This Code Do? |
| Date | 2015-12-10 00:31 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <4853393.F10FAma5ux@PointedEars.de> (permalink) |
| References | <62tg6b5gdt3v9fprpj1runb86d7lsr1f7b@4ax.com> |
[This follow-up accidentally went out as an e-mail at first; please ignore
that.]
Gene Wirchenko wrote:
> I suspect that this code was run through a compresser of some
> sort. ("3e3" to save a byte over "3000" and the like.) I can
> understand bits of it, but I can not parse it in total.
This source code was generated by a tool called a “minifier”, which you can
deduce from observing that all variable and parameter identifiers are only
one character long where the characters have successive Unicode code points
(“a”, “b”, “c”, “d”, …).
Presumably you have seen this source code in a Web browser. If so, and you
have seen it in a script resource (usually with suffix “.js”) as well, you
can use the *built-in* developer tools’ “pretty print” feature to make the
source code easier readable.
For example, in Chrome Dev Tools it is toggled with the “{}” icon in the
left bottom corner of the source code pane of the “Sources” tab; in
Firefox/Iceweasel it is available as “Auto Prettify Minified Sources” in
the Settings menu of the source code pane, and as “Prettify Sources” in its
context menu, of the Web Developer Tools (not to be confused with the Web
Developer extension [0a]). Firebug 2.0.x [0b] also has the “{}” button; as
a point of note, it also has a “Pretty Print” Command in the Command Editor
of the Console (triangle buttons) that works if block braces were used, and
a “Copy” button that is suited to create (non-minified) one-line code for
bookmarklets out of the code in the Command Editor.
See also <http://devtoolsecrets.com/> (referred to by the FAQ in the
section “Debugging”), section “Debugging Minified JavaScript” there.
As indicated, you can then use an editor that supports ECMAScript
implementations insofar as that it can refactor a symbol in context to make
the source code even easier to understand. Eclipse JSDT [1] is one such
editor (Ctrl+1 → “Rename in file”, or Ctrl+2 → R by default), Visual Studio
Code (which is available even for Linux, and looks like a Sublime/Atom
clone ;-)) is another; Atom can do it with the js-refactor package, and
Sublime Text with Multiple Selections (built-in).
[0a] <http://chrispederick.com/work/web-developer/>
[0b] <http://getfirebug.com/>
[1] <https://www.eclipse.org/webtools/jsdt/> pp.
[2] <https://www.visualstudio.com/>
[3] <https://atom.io/>
[4] <http://www.sublimetext.com/>
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
What Does This Code Do? Gene Wirchenko <genew@telus.net> - 2015-12-09 10:44 -0800 Re: What Does This Code Do? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-09 18:17 -0200 Re: What Does This Code Do? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-10 00:31 +0100
csiph-web