mirror of
https://github.com/velocitatem/garlic.git
synced 2026-06-01 01:03:36 +00:00
Restruct
This commit is contained in:
@@ -40,12 +40,25 @@ class Garlic {
|
||||
static encode(string) {
|
||||
return btoa(string+this.salt);
|
||||
}
|
||||
static decodeBase64(root) {
|
||||
for (let i = 0; i < root.childNodes.length; i++) {
|
||||
const child = root.childNodes[i];
|
||||
if (child.childNodes.length === 1 && child.childNodes[0].nodeType === 3) {
|
||||
const decoded = atob(child.childNodes[0].nodeValue).split("_yummy_")[0];
|
||||
child.innerHTML = decoded;
|
||||
console.log(child);
|
||||
} else {
|
||||
this.decodeBase64(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static peal(document) {
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
Garlic.decodeBase64(document.getElementById("root"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default Garlic;
|
||||
/*
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
*/
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
function decodeBase64(root) {
|
||||
for (let i = 0; i < root.childNodes.length; i++) {
|
||||
const child = root.childNodes[i];
|
||||
if (child.childNodes.length === 1 && child.childNodes[0].nodeType === 3) {
|
||||
const decoded = atob(child.childNodes[0].nodeValue).split("_yummy_")[0]
|
||||
child.innerHTML = decoded;
|
||||
console.log(child);
|
||||
} else {
|
||||
decodeBase64(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
// when document is ready, decode the base64
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
decodeBase64(document.getElementById("root"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user