有什么方法可以逆转闭包编译器(或类似的)对代码的影响吗?
我最近刚刚接手了一个项目,因为我的客户以前的网络开发人员消失了。我必须使用的唯一文件是存储在本地服务器上的文件。我遇到的唯一问题是所有 JS 都通过闭包编译器(或类似的东西)运行,这使得 javascript 读起来非常烦人(至少对于更大的函数来说)。有没有什么可以帮助我在 JS 中重新插入变量,以便我有更干净的东西可以看?我一直都是手工做的,而且变得相当乏味。
这是我正在处理的一个例子:
var n = {},
e = a.extend(n, x),
y = "pageLoaded",
u = "pageLoading",
c = "modLoaded",
w = "xhrComplete",
l = true,
v = false,
s = a("body"),
g = Modernizr.historymanagement,
f = "",
t = "",
r = "",
k = null,
b = window.History;
提前谢谢!
特雷
I just recently took over a project because my clients previous web dev disappeared. The only files I have to work with are what is stored on the local server. The only problem I've encountered is all of the JS has been run through Closure Compiler (or something of the like) which makes the javascript really annoying to read (at least for the bigger functions). Is there anything out there that would help me replug vars in JS so I have something cleaner to look at? I've been doing it by hand and it's getting quite tedious.
Here's an example of what I'm dealing with:
var n = {},
e = a.extend(n, x),
y = "pageLoaded",
u = "pageLoading",
c = "modLoaded",
w = "xhrComplete",
l = true,
v = false,
s = a("body"),
g = Modernizr.historymanagement,
f = "",
t = "",
r = "",
k = null,
b = window.History;
Thanks ahead of time!
Tre
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,已经烂了。在某种程度上,您可以在分配文字时替换标记 - 例如,您可以将
l
的所有实例替换为true
,将v
替换为代码中的false
。但它所做的其他事情要逆转要复杂得多,我不相信有人会为此付出太多努力。No. It's munged. To a certain degree you can replace tokens when literals are assigned - you could, for example, replace all instances of
l
withtrue
andv
withfalse
in the code. But there are other things which it does that would be a lot more complex to reverse and I don't believe anyone's put much effort into it.