Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (61 sloc) 2.64 KB
<!DOCTYPE html>
<html><head><title>Readable JavaScript</title>
<link rel='stylesheet' href='css/popup.css'>
<script type='text/javascript' src='includes/readable_js.js'></script>
<script type='text/javascript' src='includes/unpacker_bookmarklet.js'></script>
<script type='text/javascript' src='includes/unpacker_javascriptobfuscator.js'></script>
<script type='text/javascript' src='includes/unpacker_p_a_c_k_e_r.js'></script>
<script type='text/javascript' src='includes/unpacker_myobfuscate.js'></script>
<script type='text/javascript' src='includes/common.js'></script>
<script type='text/javascript'>
document.getElementsByTagName('html')[0].setAttribute('lang', window.navigator.language.slice(0,2));
var theport, storage = widget.preferences;
function onMessageHandler(event) {
switch (event.data.type) {
case 'give-selection':
document.getElementById('inputjs').value = event.data.text;
break;
default:
}
if (document.getElementById('inputtext')) document.getElementById('inputtext').focus();
}
if (opera.extension) opera.extension.onmessage = function (event) {
if (event.data == "send_tab_port") {
if (event.ports.length > 0) {
theport = event.ports[0];
if (theport) {
theport.onmessage = onMessageHandler;
theport.postMessage('get-selection');
}
}
}
}
function make_readable() {
var sourcecode = document.getElementById('inputjs').value;
if (sourcecode === '') return;
document.getElementById('makereadable').disabled = true;
var newjs = js_beautify((s2b(storage['detect_packers']) ? unpacker_filter(sourcecode) : sourcecode),{
indent_size: parseInt(storage['indent_size'], 10),
indent_char: storage['indent_char'],
preserve_newlines: s2b(storage['preserve_newlines']),
braces_on_own_line: s2b(storage['braces_on_own_line']),
keep_array_indentation: s2b(storage['keep_array_indentation']),
space_after_anon_function: true
});
document.getElementById('inputjs').value = newjs;
setTimeout(function(){
document.getElementById('makereadable').disabled = false;
}, 100);
}
</script>
</head>
<body onload="document.getElementById('inputjs').focus()">
<form action="?" method="post">
<fieldset class="inputjsbox">
<button onclick="make_readable()" id="makereadable">Make readable</button><br />
<textarea id="inputjs" type="text" name="inputjs" cols="82" rows="25" required placeholder="/*JavaScript code*/ var test=1; function test(){var a = test; return;}"></textarea><br />
<label id="labeljs" for="inputjs">&uarr; JavaScript</label><br>
</fieldset>
</form>
</body>
</html>