91 lines
1.7 KiB
Plaintext
91 lines
1.7 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>Cleaner</title>
|
||
|
|
||
|
|
||
|
<style>
|
||
|
.column {
|
||
|
float: left;
|
||
|
width: 50%;
|
||
|
}
|
||
|
|
||
|
/* Clear floats after the columns */
|
||
|
.row:after {
|
||
|
content: "";
|
||
|
display: table;
|
||
|
clear: both;
|
||
|
}
|
||
|
|
||
|
textarea {
|
||
|
resize: none;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="row">
|
||
|
<div class="column"><textarea cols="100" rows="60" id="source"></textarea></div>
|
||
|
<div class="column"><textarea cols="100" rows="60" id="output"></textarea></div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<button onclick="cleanScriptsLinks()">Clean Scripts / Links</button>
|
||
|
<button onclick="convertToBase64()">Convert To Base64</button>
|
||
|
<button onclick="convertFromBase64()">Convert From Base64</button>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
// ucs-2 string to base64 encoded ascii
|
||
|
function utoa(str) {
|
||
|
return window.btoa(unescape(encodeURIComponent(str)));
|
||
|
}
|
||
|
// base64 encoded ascii to ucs-2 string
|
||
|
function atou(str) {
|
||
|
return decodeURIComponent(escape(window.atob(str)));
|
||
|
}
|
||
|
|
||
|
|
||
|
function cleanScriptsLinks() {
|
||
|
const source = document.getElementById('source').value;
|
||
|
|
||
|
let output = source.replace(/(\<\bscript\b[\S\s]+?<\/\bscript\b\>)/g, '');
|
||
|
output = output.replace(/<\/?link[^>]*>/g,'');
|
||
|
|
||
|
|
||
|
|
||
|
document.getElementById('output').value = output;
|
||
|
|
||
|
}
|
||
|
|
||
|
function convertToBase64() {
|
||
|
|
||
|
const source = document.getElementById('source').value;
|
||
|
|
||
|
const output = utoa(source);
|
||
|
|
||
|
document.getElementById('output').value = output;
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
function convertFromBase64() {
|
||
|
|
||
|
const source = document.getElementById('source').value;
|
||
|
|
||
|
const output = atou(source);
|
||
|
|
||
|
document.getElementById('output').value = output;
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|