mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-07-06 02:05:22 +08:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
|
|
var obtn = document.getElementById('ob')
|
|
var obnormalbtn = document.getElementById('obnormal')
|
|
var uglifybtn = document.getElementById('uglify')
|
|
var uglify_minibtn = document.getElementById('uglify_mini')
|
|
var txt = document.getElementById('txt')
|
|
|
|
obtn.addEventListener('click', function(e){
|
|
try{
|
|
txt.value = muti_process_obdefusion(txt.value)
|
|
}catch(e){
|
|
txt.value = e.stack
|
|
}
|
|
})
|
|
|
|
uglifybtn.addEventListener('click', function(e){
|
|
var r = UglifyJS.minify(txt.value, {
|
|
compress: {
|
|
drop_debugger: false,
|
|
hoist_vars: false,
|
|
join_vars: false,
|
|
sequences: false,
|
|
inline: false,
|
|
loops: false,
|
|
reduce_funcs: false,
|
|
reduce_vars: false,
|
|
collapse_vars: false,
|
|
comparisons: false,
|
|
computed_props: false,
|
|
conditionals: true,
|
|
evaluate: true,
|
|
expression: false,
|
|
},
|
|
output: {
|
|
bracketize: true,
|
|
beautify: true,
|
|
},
|
|
})
|
|
txt.value = r.code?r.code:r.error;
|
|
})
|
|
|
|
uglify_minibtn.addEventListener('click', function(e){
|
|
var r = UglifyJS.minify(txt.value)
|
|
txt.value = r.code?r.code:r.error;
|
|
})
|