This repository was archived by the owner on Aug 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
105 lines (91 loc) · 3.68 KB
/
test.html
File metadata and controls
105 lines (91 loc) · 3.68 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>JS Minifier</title>
<script type="text/javascript" src="jsmin.js"></script>
<script type="text/javascript">
function $(i) {
return document.getElementById(i);
}
function fm(f) {
$('output').value = f($('comment').value, $('input').value, $('level').value);
$('outputtitle').style.display = $('output').style.display = $('statstitle').style.display = $('stats').style.display = 'block';
$('oldsize').value = f.oldSize;
$('newsize').value = f.newSize;
$('ratio').value = (Math.round(f.newSize / f.oldSize * 1000) / 10) + '%';
}
function min() {
fm(jsmin);
}
function bw() {
$('comment').value = $('input').value = $('output').value = '';
$('outputtitle').style.display = $('output').style.display = $('statstitle').style.display = $('stats').style.display = 'none';
}
</script>
<style type="text/css">
#comment { width:95%; height:4em; }
#input { width:95%; height:10em; }
#min, #huffman, #lzw, #bwt { font-weight:bold; }
#outputtitle, #statstitle, #stats { display:none; }
#oldsize, #newsize, #ratio { text-align:right; width:4em; }
#output { width:95%; height:10em;display:none; }
h2 { margin-bottom:0; }
</style>
</head>
<body bgcolor="linen">
<h1>JS Minifier</h1>
<p id="intro">By Franck Marcia<br/>
From the <a href="http://javascript.crockford.com/jsmin.html">original idea</a> of <a href="http://www.crockford.com/">Douglas Crockford</a><br/>
Last modified: 2007/03/29</p>
<hr/>
<p>Code is pre-filled with an example. Click <b>JSMin</b> to test it or fill fields with your own code.</p>
<h2>Comments</h2>
<textarea id="comment" name="comment">// is.js
// (c) 2001 Douglas Crockford
// 2001 June 3
// is
// The -is- object is used to identify the browser. Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.</textarea>
<h2>Code</h2>
<textarea id="input" name="input">var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}</textarea>
<br/><br/>
<center>
Level:
<select id="level">
<option value="1">minimal</option>
<option value="2">conservative</option>
<option value="3" selected="selected">agressive</option>
</select>
<input id="min" type="submit" value="Min" onclick="min();return false;"/>
<input type="submit" value="Clear" onclick="bw();return false;"/><br/><br/>
<small><b>Minimal</b>: original algorithm but keep linefeeds if single - <b>Conservative</b>: original algorithm - <b>Agressive</b>: remove more linefeed than the original algorithm but can be regressive</small>
</center>
<h2 id="outputtitle">Output</h2>
<textarea id="output" name="output"></textarea>
<h2 id="statstitle">Stats</h2>
<div id="stats">Old size: <input id="oldsize"></span> New size: <input id="newsize"></span> Ratio: <input id="ratio"></span></div>
</body>
</html>