jscrewit 2.41.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Features.md +46 -180
- package/{readme.md → README.md} +30 -30
- package/api-doc/JScrewIt/namespaces/EncodeOptions/README.md +9 -0
- package/api-doc/{type-aliases → JScrewIt/namespaces/EncodeOptions/type-aliases}/RunAs.md +3 -2
- package/api-doc/README.md +5 -4
- package/api-doc/interfaces/CustomFeature.md +3 -3
- package/api-doc/interfaces/ElementaryFeature.md +2 -2
- package/api-doc/interfaces/{encode.md → EncodeInterface.md} +2 -2
- package/api-doc/interfaces/EncodeOptions.md +4 -4
- package/api-doc/interfaces/Feature.md +3 -3
- package/api-doc/interfaces/FeatureAll.md +64 -582
- package/api-doc/interfaces/FeatureConstructor.md +141 -874
- package/api-doc/interfaces/PredefinedFeature.md +2 -2
- package/api-doc/interfaces/default.md +1 -1
- package/api-doc/type-aliases/ElementaryFeatureName.md +1 -1
- package/api-doc/type-aliases/PredefinedFeatureName.md +1 -1
- package/lib/encode.d.ts +12 -10
- package/lib/feature-all.d.ts +80 -428
- package/lib/feature.d.ts +19 -21
- package/lib/jscrewit.d.ts +6 -6
- package/lib/jscrewit.js +407 -2090
- package/lib/jscrewit.min.js +2 -2
- package/package.json +2 -2
- package/screw.js +87 -103
- package/tools/cli.js +57 -73
- package/tools/time-utils.js +10 -26
- package/ui/ui.js +1 -1
- package/api-doc/variables/Feature.md +0 -7
- package/api-doc/variables/encode.md +0 -7
- package/tools/text-utils.js +0 -37
- /package/{license.txt → LICENSE.txt} +0 -0
package/screw.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/* eslint-env node */
|
|
4
|
-
|
|
5
3
|
'use strict';
|
|
6
4
|
|
|
5
|
+
const cli = require('./tools/cli');
|
|
6
|
+
|
|
7
7
|
function fail()
|
|
8
8
|
{
|
|
9
9
|
process.exit(1);
|
|
@@ -11,21 +11,21 @@ function fail()
|
|
|
11
11
|
|
|
12
12
|
function getBasename()
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const path = require('node:path');
|
|
15
|
+
const basename = path.basename(process.argv[1]);
|
|
16
16
|
return basename;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function printErrorMessage(errorMessage)
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
const basename = getBasename();
|
|
22
22
|
console.error
|
|
23
23
|
('%s: %s.\nTry "%s --help" for more information.', basename, errorMessage, basename);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function printHelpMessage()
|
|
27
27
|
{
|
|
28
|
-
|
|
28
|
+
const message =
|
|
29
29
|
'Usage: %s [OPTION]... [SOURCE [DESTINATION]]\n' +
|
|
30
30
|
'Encodes JavaScript with JScrewIt.\n' +
|
|
31
31
|
'\n' +
|
|
@@ -55,14 +55,14 @@ function printHelpMessage()
|
|
|
55
55
|
' none (none available)\n' +
|
|
56
56
|
'\n' +
|
|
57
57
|
'See the JScrewIt feature documentation for a list of all supported features.\n';
|
|
58
|
-
|
|
58
|
+
const basename = getBasename();
|
|
59
59
|
console.log(message, basename);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function printVersion()
|
|
63
63
|
{
|
|
64
|
-
|
|
65
|
-
console.log(
|
|
64
|
+
const { version } = require('./package.json');
|
|
65
|
+
console.log(`JScrewIt ${version}`);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function prompt()
|
|
@@ -70,114 +70,98 @@ function prompt()
|
|
|
70
70
|
process.stdout.write('SCREW> ');
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
let command;
|
|
74
|
+
try
|
|
74
75
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (command === 'version')
|
|
93
|
-
{
|
|
94
|
-
printVersion();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
var inputFileName = command.inputFileName;
|
|
99
|
-
var outputFileName = command.outputFileName;
|
|
100
|
-
var options = command.options;
|
|
76
|
+
command = cli.parseCommandLine(process.argv);
|
|
77
|
+
}
|
|
78
|
+
catch (error)
|
|
79
|
+
{
|
|
80
|
+
printErrorMessage(error.message);
|
|
81
|
+
fail();
|
|
82
|
+
}
|
|
83
|
+
if (command === 'help')
|
|
84
|
+
{
|
|
85
|
+
printHelpMessage();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (command === 'version')
|
|
89
|
+
{
|
|
90
|
+
printVersion();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
101
93
|
|
|
102
|
-
|
|
94
|
+
const { inputFileName, outputFileName, options } = command;
|
|
95
|
+
const JScrewIt = require('.');
|
|
103
96
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
var output;
|
|
110
|
-
try
|
|
111
|
-
{
|
|
112
|
-
output = JScrewIt.encode(input, options);
|
|
113
|
-
}
|
|
114
|
-
catch (error)
|
|
115
|
-
{
|
|
116
|
-
console.error('%s', error.message);
|
|
117
|
-
}
|
|
118
|
-
return output;
|
|
119
|
-
};
|
|
120
|
-
if (tryEncode('') == null) // validate options
|
|
121
|
-
fail();
|
|
122
|
-
var readline = require('readline');
|
|
123
|
-
var rl = readline.createInterface({ input: process.stdin, terminal: false });
|
|
124
|
-
rl.on
|
|
125
|
-
(
|
|
126
|
-
'line',
|
|
127
|
-
function (input)
|
|
128
|
-
{
|
|
129
|
-
if (input)
|
|
130
|
-
{
|
|
131
|
-
var output = tryEncode(input);
|
|
132
|
-
if (output != null)
|
|
133
|
-
console.log(output);
|
|
134
|
-
}
|
|
135
|
-
prompt();
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
prompt();
|
|
139
|
-
}
|
|
140
|
-
else
|
|
97
|
+
if (inputFileName == null)
|
|
98
|
+
{
|
|
99
|
+
const tryEncode =
|
|
100
|
+
input =>
|
|
141
101
|
{
|
|
142
|
-
|
|
143
|
-
var timeUtils = require('./tools/time-utils');
|
|
144
|
-
|
|
145
|
-
var input;
|
|
146
|
-
var output;
|
|
147
|
-
var encodingTime;
|
|
102
|
+
let output;
|
|
148
103
|
try
|
|
149
104
|
{
|
|
150
|
-
|
|
151
|
-
encodingTime =
|
|
152
|
-
timeUtils.timeThis
|
|
153
|
-
(
|
|
154
|
-
function ()
|
|
155
|
-
{
|
|
156
|
-
output = JScrewIt.encode(input, options);
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
if (outputFileName != null)
|
|
160
|
-
fs.writeFileSync(outputFileName, output);
|
|
161
|
-
else
|
|
162
|
-
console.log(output);
|
|
105
|
+
output = JScrewIt.encode(input, options);
|
|
163
106
|
}
|
|
164
107
|
catch (error)
|
|
165
108
|
{
|
|
166
109
|
console.error('%s', error.message);
|
|
167
|
-
fail();
|
|
168
110
|
}
|
|
169
|
-
|
|
111
|
+
return output;
|
|
112
|
+
};
|
|
113
|
+
if (tryEncode('') == null) // validate options
|
|
114
|
+
fail();
|
|
115
|
+
const { createInterface } = require('node:readline');
|
|
116
|
+
const rl = createInterface({ input: process.stdin, terminal: false });
|
|
117
|
+
rl.on
|
|
118
|
+
(
|
|
119
|
+
'line',
|
|
120
|
+
input =>
|
|
170
121
|
{
|
|
171
|
-
|
|
172
|
-
var perfLog = perfInfo && perfInfo.perfLog;
|
|
173
|
-
if (perfLog)
|
|
122
|
+
if (input)
|
|
174
123
|
{
|
|
175
|
-
|
|
176
|
-
|
|
124
|
+
const output = tryEncode(input);
|
|
125
|
+
if (output != null)
|
|
126
|
+
console.log(output);
|
|
177
127
|
}
|
|
178
|
-
|
|
179
|
-
|
|
128
|
+
prompt();
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
prompt();
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
{
|
|
135
|
+
const fs = require('node:fs');
|
|
136
|
+
const timeUtils = require('./tools/time-utils');
|
|
137
|
+
|
|
138
|
+
let input;
|
|
139
|
+
let output;
|
|
140
|
+
let encodingTime;
|
|
141
|
+
try
|
|
142
|
+
{
|
|
143
|
+
input = fs.readFileSync(inputFileName);
|
|
144
|
+
encodingTime =
|
|
145
|
+
timeUtils.timeThis(() => { output = JScrewIt.encode(input, options); });
|
|
146
|
+
if (outputFileName != null)
|
|
147
|
+
fs.writeFileSync(outputFileName, output);
|
|
148
|
+
else
|
|
149
|
+
console.log(output);
|
|
150
|
+
}
|
|
151
|
+
catch (error)
|
|
152
|
+
{
|
|
153
|
+
console.error('%s', error.message);
|
|
154
|
+
fail();
|
|
155
|
+
}
|
|
156
|
+
if (outputFileName != null)
|
|
157
|
+
{
|
|
158
|
+
const perfLog = options.perfInfo?.perfLog;
|
|
159
|
+
if (perfLog)
|
|
160
|
+
{
|
|
161
|
+
const diagnosticReport = cli.createDiagnosticReport(perfLog);
|
|
162
|
+
console.log(diagnosticReport);
|
|
180
163
|
}
|
|
164
|
+
const report = cli.createReport(input.length, output.length, encodingTime);
|
|
165
|
+
console.log(report);
|
|
181
166
|
}
|
|
182
167
|
}
|
|
183
|
-
)();
|
package/tools/cli.js
CHANGED
|
@@ -1,66 +1,55 @@
|
|
|
1
|
-
/* eslint-env node */
|
|
2
|
-
/* global padLeft, padRight, repeat */
|
|
3
|
-
|
|
4
1
|
'use strict';
|
|
5
2
|
|
|
6
|
-
require('./
|
|
7
|
-
var timeUtils = require('./time-utils');
|
|
3
|
+
const timeUtils = require('./time-utils');
|
|
8
4
|
|
|
9
5
|
function byteCount(size, width)
|
|
10
6
|
{
|
|
11
|
-
|
|
7
|
+
const str = `${String(size).padStart(width)}${size === 1 ? ' byte' : ' bytes'}`;
|
|
12
8
|
return str;
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
function createDiagnosticReport(perfLog)
|
|
16
12
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
function (str, perfInfoList)
|
|
23
|
-
{
|
|
24
|
-
str += formatPerfInfoList(perfInfoList, '', ['', '']);
|
|
25
|
-
return str;
|
|
26
|
-
},
|
|
27
|
-
''
|
|
28
|
-
);
|
|
13
|
+
const reportParts =
|
|
14
|
+
perfLog.map(perfInfoList => formatPerfInfoList(perfInfoList, '', ['', '']));
|
|
15
|
+
reportParts.unshift
|
|
16
|
+
(`\nStrategy Status Length Time (ms)\n${'─'.repeat(60)}\n`);
|
|
17
|
+
const report = reportParts.join('');
|
|
29
18
|
return report;
|
|
30
19
|
}
|
|
31
20
|
|
|
32
21
|
function createReport(originalSize, screwedSize, encodingTime)
|
|
33
22
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
const width = Math.max(widthOf(originalSize), widthOf(screwedSize));
|
|
24
|
+
const expansionFactorStr = originalSize ? (screwedSize / originalSize).toFixed(2) : '-';
|
|
25
|
+
const encodingTimeStr = timeUtils.formatDuration(encodingTime);
|
|
26
|
+
const report =
|
|
27
|
+
`Original size: ${byteCount(originalSize, width)
|
|
28
|
+
}\nScrewed size: ${byteCount(screwedSize, width)
|
|
29
|
+
}\nExpansion factor: ${expansionFactorStr
|
|
30
|
+
}\nEncoding time: ${encodingTimeStr}`;
|
|
42
31
|
return report;
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
function formatCodingLog(perfLog, padding, nextCodingLog)
|
|
46
35
|
{
|
|
47
36
|
padding += nextCodingLog ? '│' : ' ';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (
|
|
37
|
+
let str = '';
|
|
38
|
+
const count = perfLog.length;
|
|
39
|
+
for (let index = 0; index < count; ++index)
|
|
51
40
|
{
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const perfInfoList = perfLog[index];
|
|
42
|
+
const nextPerfInfoList = index < count - 1;
|
|
54
43
|
str += formatPerfInfoList(perfInfoList, padding, nextPerfInfoList ? '├│' : '└ ');
|
|
55
44
|
}
|
|
56
45
|
if (nextCodingLog)
|
|
57
|
-
str += padding
|
|
46
|
+
str += `${padding}\n`;
|
|
58
47
|
return str;
|
|
59
48
|
}
|
|
60
49
|
|
|
61
50
|
function formatInt(int)
|
|
62
51
|
{
|
|
63
|
-
|
|
52
|
+
const str = int === undefined ? '-' : String(int);
|
|
64
53
|
return str;
|
|
65
54
|
}
|
|
66
55
|
|
|
@@ -68,23 +57,23 @@ function formatPerfInfoList(perfInfoList, padding, paddingChars)
|
|
|
68
57
|
{
|
|
69
58
|
// In the current implementation, perfInfoList.name can be either undefined, a unit path or
|
|
70
59
|
// "legend".
|
|
71
|
-
|
|
60
|
+
let str = `${padding}${paddingChars[0]}${perfInfoList.name || '(default)'}\n`;
|
|
72
61
|
padding += paddingChars[1];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
for (var index = 0; index < count; ++index)
|
|
62
|
+
const count = perfInfoList.length;
|
|
63
|
+
const paddingLength = padding.length;
|
|
64
|
+
for (let index = 0; index < count; ++index)
|
|
77
65
|
{
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
const perfInfo = perfInfoList[index];
|
|
67
|
+
const next = index < count - 1;
|
|
80
68
|
str +=
|
|
81
|
-
padding
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
69
|
+
`${padding
|
|
70
|
+
}${next ? '├' : '└'
|
|
71
|
+
}${perfInfo.strategyName.padEnd(27 - paddingLength)
|
|
72
|
+
}${perfInfo.status.padEnd(10)
|
|
73
|
+
}${formatInt(perfInfo.outputLength).padStart(11)
|
|
74
|
+
}${formatInt(perfInfo.time).padStart(11)
|
|
75
|
+
}\n`;
|
|
76
|
+
const { perfLog } = perfInfo;
|
|
88
77
|
if (perfLog)
|
|
89
78
|
str += formatCodingLog(perfLog, padding, next);
|
|
90
79
|
}
|
|
@@ -95,9 +84,9 @@ function parseCommandLine(argv)
|
|
|
95
84
|
{
|
|
96
85
|
function parseFeatures()
|
|
97
86
|
{
|
|
98
|
-
|
|
87
|
+
const arg2 = argv[++index];
|
|
99
88
|
if (arg2 === undefined)
|
|
100
|
-
throw Error(
|
|
89
|
+
throw Error(`option ${quote(arg)} requires an argument`);
|
|
101
90
|
options.features = arg2.trim().split(/(?:\s+|\s*,\s*)/);
|
|
102
91
|
}
|
|
103
92
|
|
|
@@ -122,32 +111,32 @@ function parseCommandLine(argv)
|
|
|
122
111
|
express = true;
|
|
123
112
|
break;
|
|
124
113
|
default:
|
|
125
|
-
throw Error(
|
|
114
|
+
throw Error(`unrecognized flag ${quote(char)}`);
|
|
126
115
|
}
|
|
127
116
|
}
|
|
128
117
|
|
|
129
118
|
function parseRunAs()
|
|
130
119
|
{
|
|
131
|
-
|
|
120
|
+
const arg2 = argv[++index];
|
|
132
121
|
if (arg2 === undefined)
|
|
133
|
-
throw Error(
|
|
122
|
+
throw Error(`option ${quote(arg)} requires an argument`);
|
|
134
123
|
options.runAs = arg2;
|
|
135
124
|
}
|
|
136
125
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
126
|
+
let inputFileName;
|
|
127
|
+
let outputFileName;
|
|
128
|
+
let options = { };
|
|
129
|
+
let arg;
|
|
130
|
+
let express;
|
|
131
|
+
let wrapMode;
|
|
132
|
+
let index;
|
|
143
133
|
|
|
144
|
-
for (
|
|
134
|
+
for (index = 2; index < argv.length; ++index)
|
|
145
135
|
{
|
|
146
136
|
arg = argv[index];
|
|
147
|
-
var flag;
|
|
148
137
|
if (/^--/.test(arg))
|
|
149
138
|
{
|
|
150
|
-
flag = arg.slice(2);
|
|
139
|
+
const flag = arg.slice(2);
|
|
151
140
|
switch (flag)
|
|
152
141
|
{
|
|
153
142
|
case 'diagnostic':
|
|
@@ -167,12 +156,12 @@ function parseCommandLine(argv)
|
|
|
167
156
|
options.trimCode = true;
|
|
168
157
|
break;
|
|
169
158
|
default:
|
|
170
|
-
throw Error(
|
|
159
|
+
throw Error(`unrecognized option ${quote(arg)}`);
|
|
171
160
|
}
|
|
172
161
|
}
|
|
173
162
|
else if (/^-/.test(arg))
|
|
174
163
|
{
|
|
175
|
-
flag = arg.slice(1);
|
|
164
|
+
const flag = arg.slice(1);
|
|
176
165
|
if (flag === 'f')
|
|
177
166
|
parseFeatures();
|
|
178
167
|
else if (flag === 'r')
|
|
@@ -183,7 +172,7 @@ function parseCommandLine(argv)
|
|
|
183
172
|
else
|
|
184
173
|
{
|
|
185
174
|
if (outputFileName != null)
|
|
186
|
-
throw Error(
|
|
175
|
+
throw Error(`unexpected argument ${quote(arg)}`);
|
|
187
176
|
if (inputFileName != null)
|
|
188
177
|
outputFileName = arg;
|
|
189
178
|
else
|
|
@@ -192,17 +181,17 @@ function parseCommandLine(argv)
|
|
|
192
181
|
}
|
|
193
182
|
if (!options.runAs)
|
|
194
183
|
{
|
|
195
|
-
|
|
184
|
+
const runAs = (express ? ['express'] : []).concat(wrapMode || []).join('-');
|
|
196
185
|
if (runAs)
|
|
197
186
|
options.runAs = runAs;
|
|
198
187
|
}
|
|
199
|
-
|
|
188
|
+
const result = { inputFileName, outputFileName, options };
|
|
200
189
|
return result;
|
|
201
190
|
}
|
|
202
191
|
|
|
203
192
|
function quote(arg)
|
|
204
193
|
{
|
|
205
|
-
return
|
|
194
|
+
return `"${arg}"`;
|
|
206
195
|
}
|
|
207
196
|
|
|
208
197
|
function widthOf(size)
|
|
@@ -210,9 +199,4 @@ function widthOf(size)
|
|
|
210
199
|
return String(size).length;
|
|
211
200
|
}
|
|
212
201
|
|
|
213
|
-
module.exports =
|
|
214
|
-
{
|
|
215
|
-
createDiagnosticReport: createDiagnosticReport,
|
|
216
|
-
createReport: createReport,
|
|
217
|
-
parseCommandLine: parseCommandLine,
|
|
218
|
-
};
|
|
202
|
+
module.exports = { createDiagnosticReport, createReport, parseCommandLine };
|
package/tools/time-utils.js
CHANGED
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
/* eslint-env node */
|
|
2
|
-
/* global Promise */
|
|
3
|
-
|
|
4
1
|
'use strict';
|
|
5
2
|
|
|
6
3
|
exports.formatDuration =
|
|
7
4
|
function (duration)
|
|
8
5
|
{
|
|
9
|
-
|
|
6
|
+
const str = duration < 5e-3 ? '< 0.01 s' : `${duration.toFixed(2)} s`;
|
|
10
7
|
return str;
|
|
11
8
|
};
|
|
12
9
|
|
|
13
10
|
exports.timeThis =
|
|
14
11
|
function (fn)
|
|
15
12
|
{
|
|
16
|
-
|
|
13
|
+
const begin = process.hrtime();
|
|
17
14
|
fn();
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const time = process.hrtime(begin);
|
|
16
|
+
const duration = time[0] + time[1] / 1e9;
|
|
20
17
|
return duration;
|
|
21
18
|
};
|
|
22
19
|
|
|
23
20
|
exports.timeThisAsync =
|
|
24
|
-
function (fn)
|
|
21
|
+
async function (fn)
|
|
25
22
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.then
|
|
32
|
-
(
|
|
33
|
-
function ()
|
|
34
|
-
{
|
|
35
|
-
var time = process.hrtime(begin);
|
|
36
|
-
var duration = time[0] + time[1] / 1e9;
|
|
37
|
-
resolve(duration);
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
.catch(reject);
|
|
41
|
-
};
|
|
42
|
-
var promise = new Promise(executor);
|
|
43
|
-
return promise;
|
|
23
|
+
const begin = process.hrtime();
|
|
24
|
+
await fn();
|
|
25
|
+
const time = process.hrtime(begin);
|
|
26
|
+
const duration = time[0] + time[1] / 1e9;
|
|
27
|
+
return duration;
|
|
44
28
|
};
|
package/ui/ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){function a(e){var t=typeof e;return"object"==t&&null!==e||"undefined"==t&&void 0!==e}function o(n,o,i,r){return function(t){function e(e){t[r](e,o,i)}Array.isArray(n)?n.forEach(e):e(n)}}function u(e){e.removeAttribute("tabindex")}function T(e){e.setAttribute("tabindex",0)}function E(e){function t(){c.className="button focusable",a("off")}function n(e){e.target!==c&&i()&&t()}function o(e){!e.relatedTarget&&i()&&t()}function i(){return/\bactive\b/.test(c.className)}function r(){return!c.hasAttribute("tabindex")}function a(e){e=B[e];B(document,e("mousemove",n),e("mouseout",o))}var c=B("SPAN",{className:"button focusable",get disabled(){return r()},set disabled(e){(e=!!e)!==r()&&(e?(B(c,u),i()&&(document.releaseCapture(),a("off")),c.blur()):B(c,T),c.className="",c.className="button focusable")}},T,B.on("click",function(e){r()&&e.stopImmediatePropagation(),e.preventDefault()}),B.on("keydown",function(e){13===e.keyCode&&(c.click(),e.preventDefault())}),B.on("keyup",function(e){32===e.keyCode&&(c.click(),e.preventDefault())}),B.on("mouseup",function(e){0===e.button&&i()&&(document.releaseCapture(),t())}),B("SPAN",e),B("SPAN"));return c.setCapture&&(c.firstChild.setAttribute("unselectable","on"),B(c,B.on("mousedown",function(e){0!==e.button||r()||i()||(c.setCapture(),c.className="active button focusable",a("on"))}))),c}function N(e,t){function n(){var e=document.body;e.removeChild(c),B(e,B.off("keydown",r),B.off("focus",i,!0)),void 0!==t&&t()}function o(){a.focus()}function i(e){a.contains(e.target)||o()}function r(e){var t=e.keyCode;13!==t&&27!==t||!(t=document.activeElement).contains(a)&&t.contains(e.target)||(n(),e.preventDefault())}var a=B("DIV",{style:{borderRadius:"25px",display:"inline-block",maxWidth:"500px",width:"100%"}},T,B("DIV",{className:"focusable",id:"modalBox",style:{background:"whitesmoke",border:"10px solid blue",borderRadius:"23px",margin:"2px"}},B("DIV",{style:{margin:"1.5em 1.5em .25em",overflow:"hidden"}},e,B("DIV",{style:{margin:"1.25em 0"}},B(E("OK"),{style:{maxWidth:"5em",width:"100%"}},B.on("click",n)))))),c=B("DIV",{style:{background:"rgba(0, 0, 0, .25)",overflow:"auto",position:"fixed",textAlign:"center",left:"0",top:"0",bottom:"0",width:"100%"}},B("DIV",{style:{display:"table",tableLayout:"fixed",width:"100%",height:"100%"}},B("DIV",{style:{display:"table-cell",verticalAlign:"middle"}},a)));B(document.body,c,B.on("focus",i,!0),B.on("keydown",r)),setTimeout(o)}function i(e){var t,n=typeof e;try{t="string"==n?'"'.concat(e,'"'):0===e&&1/e<0?"-0":Array.isArray(e)?e.length?"[…]":"[]":"bigint"==n?"".concat(e,"n"):"symbol"!=n?String(e):e.toString()}catch(e){}return t}function t(){(O=new Worker(y)).onmessage=S}function n(){URL.revokeObjectURL(y),y=void 0}function D(){var e,t=r();try{e=JScrewIt.encode(inputArea.value,t)}catch(e){return l(),void d(String(e))}p(e)}function M(){var e=r(),e={input:inputArea.value,options:e};v&&(O.terminate(),t(),e.url=m),O.postMessage(e),l(),s(!0),inputArea.onkeyup=null}function r(){return{features:C.canonicalNames}}function k(e){9!==e.keyCode&&M()}function J(e){var t;L(e)&&(e=outputArea.value.length,0===outputArea.selectionStart&&outputArea.selectionEnd===e||(outputArea.selectionStart=0,outputArea.selectionEnd=e,"scrollTopMax"in outputArea&&(t=outputArea.scrollTop,B(outputArea,B.on("scroll",function(){outputArea.scrollTop=t},{once:!0})))))}function w(){j.disabled=!1;var e=this.result;null!=e&&(inputArea.value=e),inputArea.oninput(),inputArea.disabled=!1}function q(){var e,t,n,o;try{t=(0,eval)(outputArea.value)}catch(e){n=B("P",String(e))}void 0!==t&&(e=function(e){var t;if(Array.isArray(e))try{t="[".concat(e.map(i).join(", "),"]")}catch(e){}else t=i(e);return t}(t),t=function(e){var t;if(null!==e){var n=typeof e;if("function"==n||"object"==n||"undefined"==n){var o=Object.getPrototypeOf(e);if(o===Array.prototype)switch(e.length){case 0:t="an empty array";break;case 1:t="a one element array";break;default:t="an array"}else t=o===Date.prototype?"a date":o===RegExp.prototype?"a regular expression":"function"==n?"a function":"an object"}}return t}(t),n=e?B("DIV",B("P",t?"Evaluation result is "+t+":":"Evaluation result is"),B("P",{style:{overflowX:"auto"}},B("DIV",{style:{display:"inline-block",textAlign:"left",whiteSpace:"pre"}},e))):B("DIV",B("P","Evaluation result is "+t+"."))),null!=n&&(o=this,N(n,function(){o.focus()}))}function S(e){var e=e.data,t=e.error;t?d(t):p(e.output),s(!1)}function L(e){var t,n=e.target;return(n="runtimeStyle"in n?(t=n.lastMainMouseButtonEventTimeStamp,(n.lastMainMouseButtonEventTimeStamp=0===e.button?e.timeStamp:void 0)-t<=500):2<=e.detail&&0===e.button)&&e.preventDefault(),n}function e(){function n(){var e=+new Date;0<=((d=u+(e-l)*s/250)-a)*s&&(d=a,o()),i.height=1===d?"":t.scrollHeight*d+"px",r.display=0===d?"none":""}function o(){clearInterval(c),c=null,s=0}document.querySelector("main>div").style.display="block",inputArea.value=inputArea.defaultValue,B(outputArea,B.on("mousedown",J),B.on("mouseup",L),B.on("input",P)),B(stats.parentNode,B(E("Run this"),{style:{bottom:"0",fontSize:"10pt",position:"absolute",right:"0"}},B.on("click",q))),e=F.COMPACT,C=F.AUTO.includes(e)?e:F.BROWSER,compMenu.value=C.name,compMenu.previousIndex=compMenu.selectedIndex,O?(h=M)():(e=B(E("Encode"),B.on("click",D)),B(controls,e),h=W,outputArea.value=""),"undefined"!=typeof File&&(e=B("INPUT",{accept:".js",style:{display:"none"},type:"file"},B.on("change",H)),k=HTMLInputElement.prototype.click.bind(e),j=B(E("Load file…"),B.on("click",k)),B(controls,j,e)),inputArea.oninput=h;var t,i,r,a,c,u,l,s,d,p,f,m,b,v,e,y,h,g,A,k=function(){var e=compMenu.selectedIndex,t=compMenu.options[e].value,n=t?F[t]:R.feature;!V&&F.areEqual(n,C)||(C=n,this()),e!==compMenu.previousIndex&&(compMenu.previousIndex=e,U.rollTo(+!t))}.bind(h);function w(e,t){return B("LABEL",{style:{display:"inline-table"}},B("SPAN",{style:{display:"table-cell",verticalAlign:"middle"}},B("INPUT",{style:{margin:"0 .25em 0 0"},type:"checkbox"},t)),B("SPAN",{style:{display:"table-cell"}},e))}function S(e){var t=B("DIV",{className:"help-text"});return t.innerHTML=e,B("SPAN",{className:"focusable",style:{background:"black",borderRadius:"1em",color:"white",cursor:"pointer",display:"inline-table",fontSize:"8pt",fontWeight:"bold",lineHeight:"10.5pt",position:"relative",textAlign:"center",top:"-1.5pt",width:"10.5pt"},title:"Learn more…"},"?",T,B.on("click",function(){N(t)}))}function x(){var t=p.checked;Array.prototype.forEach.call(m,function(e){e.checked=t})}function I(){var t=JScrewIt.Feature,e=Array.prototype.filter.call(m,function(e){return e.checked}).map(function(e){return++n,t[e.featureName]}),n=e.length;p.checked=n,p.indeterminate=n&&n<m.length,f=t.commonOf.apply(null,e)||t.DEFAULT,v.checked&&(f=f.restrict("web-worker",e)),b.checked&&(f=f.restrict("forced-strict-mode",e))}B(compMenu,B.on("change",k)),R=B((e=B(w("Select/deselect all"),{style:{margin:"0 0 .5em"}},B.on("change",x),B.on(["keyup","mouseup"],function(){setTimeout(function(){p.indeterminate||x()})})),y=B("TABLE",{style:{borderSpacing:"0",width:"100%"}}),h=w("Generate strict mode code"),g=w("Support web workers"),A=B("FIELDSET",{className:"engine-selection-box",get feature(){return f}},B("DIV",B("P",{style:{margin:".25em 0 .75em"}},"Select the engines you want your code to support."),e,y,B("HR"),B("DIV",g," ",S("<p>Web workers are part of a standard HTML technology used to perform background tasks in JavaScript.<p>Check the option <dfn>Support web workers</dfn> only if your code needs to run inside a web worker. To create or use a web worker in your code, this option is not required.")),B("DIV",h," ",S('<p>The option <dfn>Generate strict mode code</dfn> instructs JScrewIt to avoid optimizations that don\'t work in strict mode JavaScript code. Check this option only if your environment disallows non-strict code. You may want to do this for example in one of the following circumstances.<ul><li>To encode a string or a number and embed it in a JavaScript file in a place where strict mode code is expected, like in a scope containing a <code>"use strict"</code> statement or in a class body.<li>To encode a script and run it in Node.js with the option <code>--use_strict</code>.<li>To encode an ECMAScript module. Note that module support in JSFuck is <em>very</em> limited, as <code>import</code> and <code>export</code> statements don\'t work at all. If your module doesn\'t contain these statements, you can encode it using this option.</ul><p>In most other cases, this option is not required, not even to encode a script that contains a top level <code>"use strict"</code> statement.')),B.on("change",function(){var e;I(),(e=document.createEvent("Event")).initEvent("input",!0,!1),A.dispatchEvent(e)}))),["Chrome","Edge","Firefox","Internet Explorer","Safari","Opera","Android Browser","Node.js"].forEach(function(e,t){for(var n,o=JScrewIt.Feature.FAMILIES[e],i=1&t?{className:"even-field"}:null,r=(o.length+2)/3^0,a=3*r,c=0;c<a;++c){var u,l,s=o[c],d=(c%3||(n=B("TR",i),c||B(n,B("TD",{rowSpan:r,style:{padding:"0 .5em 0 0"}},e)),B(y,n)),null);s&&(u=s.versions.map(function(e){var t;return"string"==typeof e?e:(t=e.from,null==(e=e.to)?t+"+":t+"–"+e)}).join(", "),null!=(l=s.shortTag)&&(u+=" ("+l+")"),d=w(u,{checked:!0,featureName:s.featureName})),B(n,B("TD",{style:{padding:"0 0 0 .5em",width:"6em"}},d))}}),p=e.querySelector("INPUT"),m=y.querySelectorAll("INPUT"),b=h.querySelector("INPUT"),v=g.querySelector("INPUT"),I(),A),B.on("input",k)),d=s=0,e=B("DIV"),(r=e.style).display="none",t=B("DIV",e,{container:e,rollTo:function(e){var t;e===d?o():((t=d<e?1:-1)!==s&&(u=d,l=+new Date,s=t),a=e,c=c||setInterval(n,0))}}),(i=t.style).height="0",i.overflowY="hidden",U=t,g="Custom Compatibility Selection","open"in(k=document.createElement("DETAILS"))?(B(k,{open:!0},B("SUMMARY",{dir:"rtl"},B("SPAN",{style:{float:"left"}},g))),B.css("details.frame:not([open])>:first-child",{"margin-bottom":"initial"})):k=B("DIV",B("SPAN",g)),B(U.container,B(k,{className:"frame"},R)),B(controls.parentNode,U),inputArea.selectionStart=2147483647,inputArea.focus()}function c(){document.addEventListener("DOMContentLoaded",e)}function H(){var e,t=this.files[0];t&&(inputArea.disabled=!0,inputArea.value="",j.disabled=!0,(e=new FileReader).addEventListener("loadend",w),e.readAsText(t))}function W(){b&&P(!0)}function l(){b=!1,outputArea.value="",stats.textContent="…"}function s(e){v=e,outputArea.disabled=e}function d(e){N(B("P",e))}function p(e){outputArea.value=e,P()}function P(e){var t=outputArea.value.length,t=1===t?"1 char":t+" chars";V=!!e,e&&(O&&(inputArea.onkeyup=k),t+=" – <i>out of sync</i>"),b=!0,stats.innerHTML=t}var f,C,R,m,j,V,b,U,v,O,y,h,g=Object,B=function(e){for(var t=e instanceof Node?e:"function"==typeof e?e.call(B):document.createElement(e),n=arguments.length,o=0;++o<n;){var i=arguments[o];i instanceof Node?t.appendChild(i):a(i)?function o(i,r){g.keys(r).forEach(function(e){var t,n=g.getOwnPropertyDescriptor(r,e);"value"in n?(t=n.value,e in i&&a(t)?o(i[e],t):i[e]=t):g.defineProperty(i,e,n)})}(t,i):"function"==typeof i?i.call(B,t):null!=i&&(i=document.createTextNode(i),t.appendChild(i))}return t},A=(B.off=function(e,t,n){return o(e,t,n,"removeEventListener")},B.on=function(e,t,n){return o(e,t,n,"addEventListener")},B.css=function(e,t){var n=t,t=e+"{"+g.keys(n).map(function(e){return e+":"+n[e]}).join(";")+"}";f||(e=B("STYLE"),B(document.head,e),f=e.sheet),f.insertRule(t,f.cssRules.length)},B.css(".button",{background:"#e0e0e0",color:"#212121",cursor:"default",display:"inline-block",position:"relative"}),B.css(".button, .button>:last-child",{"border-radius":".1em"}),B.css(".button.active, .button[tabindex]:active",{background:"#29b3e5"}),B.css(".button.active>:first-child, .button[tabindex]:active>:first-child",{left:".1em",top:".1em"}),B.css(".button.active>:last-child, .button[tabindex]:active>:last-child",{"border-color":"#0088b6"}),B.css(".button:not([tabindex])",{background:"#e9e9e9",color:"#707070"}),B.css(".button:not([tabindex])>:last-child",{"border-color":"#bababa"}),B.css(".button>:first-child",{display:"inline-block",margin:".15em .5em",position:"relative","user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-webkit-user-select":"none"}),B.css(".button>:last-child",{"border-color":"#707070","border-style":"solid","border-width":"1px",display:"inline-block",position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}),B.css(".button[tabindex]:hover:not(.active):not(:active)",{background:"#a3f4ff"}),B.css(".button[tabindex]:hover:not(.active):not(:active)>:last-child",{"border-color":"#189fdd"}),B.css("#modalBox p:first-child",{"margin-top":"0"}),B.css("#modalBox p:last-child",{"margin-bottom":"0"}),B.css(".engine-selection-box",{background:"#f0f0f0"}),B.css(".engine-selection-box .even-field",{background:"#fff"}),B.css(".help-text",{"font-size":"11pt","text-align":"justify"}),B.css(".help-text code",{"white-space":"pre"}),B.css(".help-text dfn",{"font-style":"normal","font-weight":"bold"}),B.css(".help-text li",{margin:".5em 0"}),"application/javascript"),F=JScrewIt.Feature;try{(h=new XMLHttpRequest).open("GET","lib/jscrewit.min.js",!0)}catch(e){h=void 0}if(h&&"undefined"!=typeof Worker){y=URL.createObjectURL(new Blob(["self.onmessage=function(t){var t=t.data,r=t.url,r=(null!=r&&importScripts(r),t.input);if(null!=r){try{e={output:JScrewIt.encode(r,t.options)}}catch(t){var e={error:String(t)}}postMessage(e)}};"],{type:A}));try{t()}catch(e){n()}}O?(h.onerror=function(){O.terminate(),O=void 0,n()},h.onload=function(){h.status<400?(m=URL.createObjectURL(h.response),O.postMessage({url:m})):this.onerror()},h.onloadend=function(){("loading"===document.readyState?c:e)()},h.overrideMimeType(A),h.responseType="blob",h.send()):c()}();
|
|
1
|
+
!function(){function a(e){var t=typeof e;return"object"==t&&null!==e||"undefined"==t&&void 0!==e}function o(n,o,i,r){return function(t){function e(e){t[r](e,o,i)}Array.isArray(n)?n.forEach(e):e(n)}}function u(e){e.removeAttribute("tabindex")}function T(e){e.setAttribute("tabindex",0)}function N(e){function t(){c.className="button focusable",a("off")}function n(e){e.target!==c&&i()&&t()}function o(e){!e.relatedTarget&&i()&&t()}function i(){return/\bactive\b/.test(c.className)}function r(){return!c.hasAttribute("tabindex")}function a(e){e=F[e];F(document,e("mousemove",n),e("mouseout",o))}var c=F("SPAN",{className:"button focusable",get disabled(){return r()},set disabled(e){(e=!!e)!==r()&&(e?(F(c,u),i()&&(document.releaseCapture(),a("off")),c.blur()):F(c,T),c.className="",c.className="button focusable")}},T,F.on("click",function(e){r()&&e.stopImmediatePropagation(),e.preventDefault()}),F.on("keydown",function(e){13===e.keyCode&&(c.click(),e.preventDefault())}),F.on("keyup",function(e){32===e.keyCode&&(c.click(),e.preventDefault())}),F.on("mouseup",function(e){0===e.button&&i()&&(document.releaseCapture(),t())}),F("SPAN",e),F("SPAN"));return c.setCapture&&(c.firstChild.setAttribute("unselectable","on"),F(c,F.on("mousedown",function(e){0!==e.button||r()||i()||(c.setCapture(),c.className="active button focusable",a("on"))}))),c}function E(e,t){function n(){var e=document.body;e.removeChild(c),F(e,F.off("keydown",r),F.off("focus",i,!0)),void 0!==t&&t()}function o(){a.focus()}function i(e){a.contains(e.target)||o()}function r(e){var t=e.keyCode;13!==t&&27!==t||!(t=document.activeElement).contains(a)&&t.contains(e.target)||(n(),e.preventDefault())}var a=F("DIV",{style:{borderRadius:"25px",display:"inline-block",maxWidth:"500px",width:"100%"}},T,F("DIV",{className:"focusable",id:"modalBox",style:{background:"whitesmoke",border:"10px solid blue",borderRadius:"23px",margin:"2px"}},F("DIV",{style:{margin:"1.5em 1.5em .25em",overflow:"hidden"}},e,F("DIV",{style:{margin:"1.25em 0"}},F(N("OK"),{style:{maxWidth:"5em",width:"100%"}},F.on("click",n)))))),c=F("DIV",{style:{background:"rgba(0, 0, 0, .25)",overflow:"auto",position:"fixed",textAlign:"center",left:"0",top:"0",bottom:"0",width:"100%"}},F("DIV",{style:{display:"table",tableLayout:"fixed",width:"100%",height:"100%"}},F("DIV",{style:{display:"table-cell",verticalAlign:"middle"}},a)));F(document.body,c,F.on("focus",i,!0),F.on("keydown",r)),setTimeout(o)}function i(e){var t,n=typeof e;try{t="string"==n?'"'.concat(e,'"'):0===e&&1/e<0?"-0":Array.isArray(e)?e.length?"[…]":"[]":"bigint"==n?"".concat(e,"n"):String(e)}catch(e){}return t}function t(){(O=new Worker(y)).onmessage=x}function n(){URL.revokeObjectURL(y),y=void 0}function D(){var e,t=r();try{e=JScrewIt.encode(inputArea.value,t)}catch(e){return l(),void d(String(e))}p(e)}function L(){var e=r(),e={input:inputArea.value,options:e};v&&(O.terminate(),t(),e.url=m),O.postMessage(e),l(),s(!0),inputArea.onkeyup=null}function r(){return{features:C.canonicalNames}}function A(e){9!==e.keyCode&&L()}function q(e){var t;P(e)&&(e=outputArea.value.length,0===outputArea.selectionStart&&outputArea.selectionEnd===e||(outputArea.selectionStart=0,outputArea.selectionEnd=e,"scrollTopMax"in outputArea&&(t=outputArea.scrollTop,F(outputArea,F.on("scroll",function(){outputArea.scrollTop=t},{once:!0})))))}function w(){j.disabled=!1;var e=this.result;null!=e&&(inputArea.value=e),inputArea.oninput(),inputArea.disabled=!1}function H(){var e,t,n,o;try{t=(0,eval)(outputArea.value)}catch(e){n=F("P",String(e))}void 0!==t&&(e=function(e){var t;if(Array.isArray(e))try{t="[".concat(e.map(i).join(", "),"]")}catch(e){}else t=i(e);return t}(t),t=function(e){var t;if(null!==e){var n=typeof e;if("function"==n||"object"==n||"undefined"==n){var o=Object.getPrototypeOf(e);if(o===Array.prototype)switch(e.length){case 0:t="an empty array";break;case 1:t="a one element array";break;default:t="an array"}else t=o===Date.prototype?"a date":o===RegExp.prototype?"a regular expression":"function"==n?"a function":"an object"}}return t}(t),n=e?F("DIV",F("P",t?"Evaluation result is "+t+":":"Evaluation result is"),F("P",{style:{overflowX:"auto"}},F("DIV",{style:{display:"inline-block",textAlign:"left",whiteSpace:"pre"}},e))):F("DIV",F("P","Evaluation result is "+t+"."))),null!=n&&(o=this,E(n,function(){o.focus()}))}function x(e){var e=e.data,t=e.error;t?d(t):p(e.output),s(!1)}function P(e){var t=2<=e.detail&&0===e.button;return t&&e.preventDefault(),t}function e(){function n(){var e=+new Date;0<=((d=u+(e-l)*s/250)-a)*s&&(d=a,o()),i.height=1===d?"":t.scrollHeight*d+"px",r.display=0===d?"none":""}function o(){clearInterval(c),c=null,s=0}document.querySelector("main>div").style.display="block",inputArea.value=inputArea.defaultValue,F(outputArea,F.on("mousedown",q),F.on("mouseup",P),F.on("input",M)),F(stats.parentNode,F(N("Run this"),{style:{bottom:"0",fontSize:"10pt",position:"absolute",right:"0"}},F.on("click",H))),e=J.COMPACT,C=J.AUTO.includes(e)?e:J.BROWSER,compMenu.value=C.name,compMenu.previousIndex=compMenu.selectedIndex,O?(h=L)():(e=F(N("Encode"),F.on("click",D)),F(controls,e),h=W,outputArea.value=""),"undefined"!=typeof File&&(e=F("INPUT",{accept:".js",style:{display:"none"},type:"file"},F.on("change",B)),A=HTMLElement.prototype.click.bind(e),j=F(N("Load file…"),F.on("click",A)),F(controls,j,e)),inputArea.oninput=h;var t,i,r,a,c,u,l,s,d,p,f,m,b,v,e,y,h,g,k,A=function(){var e=compMenu.selectedIndex,t=compMenu.options[e].value,n=t?J[t]:R.feature;!V&&J.areEqual(n,C)||(C=n,this()),e!==compMenu.previousIndex&&(compMenu.previousIndex=e,U.rollTo(+!t))}.bind(h);function w(e,t){return F("LABEL",{style:{display:"inline-table"}},F("SPAN",{style:{display:"table-cell",verticalAlign:"middle"}},F("INPUT",{style:{margin:"0 .25em 0 0"},type:"checkbox"},t)),F("SPAN",{style:{display:"table-cell"}},e))}function x(e){var t=F("DIV",{className:"help-text"});return t.innerHTML=e,F("SPAN",{className:"focusable",style:{background:"black",borderRadius:"1em",color:"white",cursor:"pointer",display:"inline-block",fontSize:"8pt",fontWeight:"bold",lineHeight:"10.5pt",position:"relative",textAlign:"center",top:"-1.5pt",width:"10.5pt"},title:"Learn more…"},"?",T,F.on("click",function(){E(t)}))}function S(){var t=p.checked;Array.prototype.forEach.call(m,function(e){e.checked=t})}function I(){var t=JScrewIt.Feature,e=Array.prototype.filter.call(m,function(e){return e.checked}).map(function(e){return++n,t[e.featureName]}),n=e.length;p.checked=n,p.indeterminate=n&&n<m.length,f=t.commonOf.apply(null,e)||t.DEFAULT,v.checked&&(f=f.restrict("web-worker",e)),b.checked&&(f=f.restrict("forced-strict-mode",e))}F(compMenu,F.on("change",A)),R=F((e=F(w("Select/deselect all"),{style:{margin:"0 0 .5em"}},F.on("change",S),F.on(["keyup","mouseup"],function(){setTimeout(function(){p.indeterminate||S()})})),y=F("TABLE",{style:{borderSpacing:"0",width:"100%"}}),h=w("Generate strict mode code"),g=w("Support web workers"),k=F("FIELDSET",{className:"engine-selection-box",get feature(){return f}},F("DIV",F("P",{style:{margin:".25em 0 .75em"}},"Select the engines you want your code to support."),e,y,F("HR"),F("DIV",g," ",x("<p>Web workers are part of a standard HTML technology used to perform background tasks in JavaScript.<p>Check the option <dfn>Support web workers</dfn> only if your code needs to run inside a web worker. To create or use a web worker in your code, this option is not required.")),F("DIV",h," ",x('<p>The option <dfn>Generate strict mode code</dfn> instructs JScrewIt to avoid optimizations that don\'t work in strict mode JavaScript code. Check this option only if your environment disallows non-strict code. You may want to do this for example in one of the following circumstances.<ul><li>To encode a string or a number and embed it in a JavaScript file in a place where strict mode code is expected, like in a scope containing a <code>"use strict"</code> statement or in a class body.<li>To encode a script and run it in Node.js with the option <code>--use_strict</code>.<li>To encode an ECMAScript module. Note that module support in JSFuck is <em>very</em> limited, as <code>import</code> and <code>export</code> statements don\'t work at all. If your module doesn\'t contain these statements, you can encode it using this option.</ul><p>In most other cases, this option is not required, not even to encode a script that contains a top level <code>"use strict"</code> statement.')),F.on("change",function(){var e;I(),(e=document.createEvent("Event")).initEvent("input",!0,!1),k.dispatchEvent(e)}))),["Chrome","Edge","Firefox","Internet Explorer","Safari","Opera","Node.js"].forEach(function(e,t){for(var n,o=JScrewIt.Feature.FAMILIES[e],i=1&t?{className:"even-field"}:null,r=(o.length+2)/3^0,a=3*r,c=0;c<a;++c){var u,l,s=o[c],d=(c%3||(n=F("TR",i),c||F(n,F("TD",{rowSpan:r,style:{padding:"0 .5em 0 0"}},e)),F(y,n)),null);s&&(u=s.versions.map(function(e){var t;return"string"==typeof e?e:(t=e.from,null==(e=e.to)?t+"+":t+"–"+e)}).join(", "),null!=(l=s.shortTag)&&(u+=" ("+l+")"),d=w(u,{checked:!0,featureName:s.featureName})),F(n,F("TD",{style:{padding:"0 0 0 .5em",width:"6em"}},d))}}),p=e.querySelector("INPUT"),m=y.querySelectorAll("INPUT"),b=h.querySelector("INPUT"),v=g.querySelector("INPUT"),I(),k),F.on("input",A)),d=s=0,e=F("DIV"),(r=e.style).display="none",t=F("DIV",e,{container:e,rollTo:function(e){var t;e===d?o():((t=d<e?1:-1)!==s&&(u=d,l=+new Date,s=t),a=e,c=c||setInterval(n,0))}}),(i=t.style).height="0",i.overflowY="hidden",U=t,g="Custom Compatibility Selection","open"in(A=document.createElement("DETAILS"))?(F(A,{open:!0},F("SUMMARY",{dir:"rtl"},F("SPAN",{style:{float:"left"}},g))),F.css("details.frame:not([open])>:first-child",{"margin-bottom":"initial"})):A=F("DIV",F("SPAN",g)),F(U.container,F(A,{className:"frame"},R)),F(controls.parentNode,U),inputArea.selectionStart=2147483647,inputArea.focus()}function c(){document.addEventListener("DOMContentLoaded",e)}function B(){var e,t=this.files[0];t&&(inputArea.disabled=!0,inputArea.value="",j.disabled=!0,(e=new FileReader).addEventListener("loadend",w),e.readAsText(t))}function W(){b&&M(!0)}function l(){b=!1,outputArea.value="",stats.textContent="…"}function s(e){v=e,outputArea.disabled=e}function d(e){E(F("P",e))}function p(e){outputArea.value=e,M()}function M(e){var t=outputArea.value.length,t=1===t?"1 char":t+" chars";V=!!e,e&&(O&&(inputArea.onkeyup=A),t+=" – <i>out of sync</i>"),b=!0,stats.innerHTML=t}var f,C,R,m,j,V,b,U,v,O,y,h,g=Object,F=function(e){for(var t=e instanceof Node?e:"function"==typeof e?e.call(F):document.createElement(e),n=arguments.length,o=0;++o<n;){var i=arguments[o];i instanceof Node?t.appendChild(i):a(i)?function o(i,r){g.keys(r).forEach(function(e){var t,n=g.getOwnPropertyDescriptor(r,e);"value"in n?(t=n.value,e in i&&a(t)?o(i[e],t):i[e]=t):g.defineProperty(i,e,n)})}(t,i):"function"==typeof i?i.call(F,t):null!=i&&(i=document.createTextNode(i),t.appendChild(i))}return t},k=(F.off=function(e,t,n){return o(e,t,n,"removeEventListener")},F.on=function(e,t,n){return o(e,t,n,"addEventListener")},F.css=function(e,t){var n=t,t=e+"{"+g.keys(n).map(function(e){return e+":"+n[e]}).join(";")+"}";f||(e=F("STYLE"),F(document.head,e),f=e.sheet),f.insertRule(t,f.cssRules.length)},F.css(".button",{background:"#e0e0e0",color:"#212121",cursor:"default",display:"inline-block",position:"relative"}),F.css(".button, .button>:last-child",{"border-radius":".1em"}),F.css(".button.active, .button[tabindex]:active",{background:"#29b3e5"}),F.css(".button.active>:first-child, .button[tabindex]:active>:first-child",{left:".1em",top:".1em"}),F.css(".button.active>:last-child, .button[tabindex]:active>:last-child",{"border-color":"#0088b6"}),F.css(".button:not([tabindex])",{background:"#e9e9e9",color:"#707070"}),F.css(".button:not([tabindex])>:last-child",{"border-color":"#bababa"}),F.css(".button>:first-child",{display:"inline-block",margin:".15em .5em",position:"relative","user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-webkit-user-select":"none"}),F.css(".button>:last-child",{"border-color":"#707070","border-style":"solid","border-width":"1px",display:"inline-block",position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}),F.css(".button[tabindex]:hover:not(.active):not(:active)",{background:"#a3f4ff"}),F.css(".button[tabindex]:hover:not(.active):not(:active)>:last-child",{"border-color":"#189fdd"}),F.css("#modalBox p:first-child",{"margin-top":"0"}),F.css("#modalBox p:last-child",{"margin-bottom":"0"}),F.css(".engine-selection-box",{background:"#f0f0f0"}),F.css(".engine-selection-box .even-field",{background:"#fff"}),F.css(".help-text",{"font-size":"11pt","text-align":"justify"}),F.css(".help-text code",{"white-space":"pre"}),F.css(".help-text dfn",{"font-style":"normal","font-weight":"bold"}),F.css(".help-text li",{margin:".5em 0"}),"application/javascript"),J=JScrewIt.Feature;try{(h=new XMLHttpRequest).open("GET","lib/jscrewit.min.js",!0)}catch(e){h=void 0}if(h&&"undefined"!=typeof Worker){y=URL.createObjectURL(new Blob(["self.onmessage=function(t){var t=t.data,r=t.url,r=(null!=r&&importScripts(r),t.input);if(null!=r){try{e={output:JScrewIt.encode(r,t.options)}}catch(t){var e={error:String(t)}}postMessage(e)}};"],{type:k}));try{t()}catch(e){n()}}O?(h.onerror=function(){O.terminate(),O=void 0,n()},h.onload=function(){h.status<400?(m=URL.createObjectURL(h.response),O.postMessage({url:m})):this.onerror()},h.onloadend=function(){("loading"===document.readyState?c:e)()},h.overrideMimeType(k),h.responseType="blob",h.send()):c()}();
|