-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
231 lines (194 loc) · 7.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pimp My JS</title>
<meta name="description" content="It's a code pimper with uglify option!">
<meta name="author" content="Leo Balter">
<link rel=”canonical” href="http://pimpmyjs.com/" />
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
}
</style>
<link rel="stylesheet" href="css/codemirror.css">
<script src="js/codemirror.js"></script>
<link rel="stylesheet" href="css/codemirror-night.css">
<script src="js/codemirror-javascript.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26406401-1']);
_gaq.push(['_setDomainName', '.com.br']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div class="topbar">
<div class="fill">
<div class="container">
<a class="brand" href="http://pimpmyjs.com">Pimp My JS</a>
<ul class="nav">
<li class="active"><a href="http://pimpmyjs.com">Home</a></li>
<li><a href="https://github.com/leobalter/PimpMyCode" target="_blank">See the code in Github</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<h1>Uglify or Beautify your JavaScript, it's your choice...</h1>
<form id="pimpForm" class="form-stacked" action="http://pimpmyjs.com:3000/" novalidate autocomplete="off"
method="POST" target="_blank">
<textarea name="toPimp" id="code" tabindex="1"></textarea>
<div class="row">
<button class="btn danger span16 large" id="pimpit" type="submit">Pimp it!</button>
</div>
<div class="row">
<h2>Options</h2>
<div class="span7">
<div class="clearfix">
<div class="input">
<ul class="inputs-list">
<li>
<label>
<input type="checkbox" value="beautify" name="uglifyopts">
<span>beautify</span>
</label>
<span class="help-block">
Invert the minification process: turns the ugly JS to a <strong>pretty
printed</strong> code. *
</span>
</li>
<li>
<label>
<input type="checkbox" value="lift" name="uglifyopts">
<span>lift-vars</span>
</label>
<span class="help-block">
Merge and move <code>var</code> declarations to the top of the scope
</span>
</li>
</ul>
</div>
</div>
</div>
<div class="span7">
<div class="clearfix">
<div class="input">
<ul class="inputs-list">
<li>
<label>
<input type="checkbox" value="unsafe" name="uglifyopts">
<span>unsafe</span>
</label>
<span class="help-block">
<em>Black Magic Voodoo</em> for better compression
</span>
</li>
<li>
<label>
<input type="checkbox" value="inline" name="uglifyopts">
<span>inline-script</span>
</label>
<span class="help-block">
Escape <code></script></code> to prevent errors in inline scripts
</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</form>
<h2>How does this works?</h2>
<div class="row">
<div class="span4">
<p>You send your Javascript code, ugly or not:</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=normal.js"></script>
</div>
</div>
<div class="row">
<div class="span4">
<p>Then you can uglify it:</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=ugly.js"></script>
</div>
</div>
<div class="row">
<div class="span4">
<p>Don't know what's written in that ugly js? Try beautifying it!</p>
<p>Yeah, it's not the same original code, but you can read it now, right?</p>
<p>This doesn't bring beauty of Dart of CoffeeScript codes, ever.</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=beautify.js"></script>
</div>
</div>
<h2>What do you mean by unsafe?</h2>
<div class="row">
<div class="span4">
<p>There're some code Uglify can compress but it's possible to break your code, so if you want it on, you have to
check this option</p>
<p>This will be ignored if you check the beautify option</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=unsafe.js"></script>
</div>
</div>
<h2>Inline Scripts</h2>
<div class="row">
<div class="span4">
<p>You can prevent showing <code></script></code> in your code, turn on this option and Uglify will escape it!
</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=inline.js"></script>
</div>
</div>
<h2>Lift me a var...</h2>
<div class="row">
<div class="span4">
<p>As well said in UglifyJS documentation:</p>
<p>"merge and move <code>var</code> declarations to the top of the scope; discard unused function arguments or
variables; discard unused (named) inner functions. It also tries to merge assignments following the var
declaration into it.</p>
<p>Note that although it might increase the file size (on jQuery it gains 865 bytes, 243 after gzip) it’s
technically more correct: in certain situations, dead code removal might drop variable declarations, which would
not happen if the variables are lifted in advance."</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=liftVars.js"></script>
</div>
</div>
<div class="row">
<div class="span4">
<p>Check out the lift vars result (with Beautify):</p>
</div>
<div class="span12">
<script src="https://gist.github.com/1297100.js?file=liftVarsResult.js"></script>
</div>
</div>
<footer>
<p>© WTFPL 2011</p>
</footer>
</div>
<!-- /container -->
<script src="js/my.js"></script>
</body>
</html>