mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-30 17:10:42 +03:00
chore: global code formatting
This commit is contained in:
1 parent
5bf94bc567
commit
bc44870665
830 files changed
+21075
-13592
No files matched your search
@@ -10,7 +10,9 @@ function base64Encode(str: string) {
|
||||
}
|
||||
|
||||
function rot13Encode(str: string) {
|
||||
return str.replace(/[A-Za-z]/g, c => String.fromCharCode((c <= 'Z' ? 65 : 97) + ((c.charCodeAt(0) - (c <= 'Z' ? 65 : 97) + 13) % 26)));
|
||||
return str.replace(/[A-Za-z]/g, (c) =>
|
||||
String.fromCharCode((c <= 'Z' ? 65 : 97) + ((c.charCodeAt(0) - (c <= 'Z' ? 65 : 97) + 13) % 26)),
|
||||
);
|
||||
}
|
||||
|
||||
function obfuscateJavascript(code: string, method: 'base64' | 'rot13' | 'obfuscator.io' = 'base64'): string {
|
||||
@@ -20,18 +22,16 @@ function obfuscateJavascript(code: string, method: 'base64' | 'rot13' | 'obfusca
|
||||
|
||||
try {
|
||||
if (method === 'obfuscator.io') {
|
||||
return JavaScriptObfuscator.obfuscate(code,
|
||||
{
|
||||
compact: false,
|
||||
controlFlowFlattening: true,
|
||||
controlFlowFlatteningThreshold: 1,
|
||||
numbersToExpressions: true,
|
||||
simplify: true,
|
||||
stringArrayShuffle: true,
|
||||
splitStrings: true,
|
||||
stringArrayThreshold: 1,
|
||||
},
|
||||
).getObfuscatedCode();
|
||||
return JavaScriptObfuscator.obfuscate(code, {
|
||||
compact: false,
|
||||
controlFlowFlattening: true,
|
||||
controlFlowFlatteningThreshold: 1,
|
||||
numbersToExpressions: true,
|
||||
simplify: true,
|
||||
stringArrayShuffle: true,
|
||||
splitStrings: true,
|
||||
stringArrayThreshold: 1,
|
||||
}).getObfuscatedCode();
|
||||
}
|
||||
|
||||
if (method === 'base64') {
|
||||
@@ -41,8 +41,7 @@ function obfuscateJavascript(code: string, method: 'base64' | 'rot13' | 'obfusca
|
||||
|
||||
const r = rot13Encode(code);
|
||||
return `(function(s){function r(u){return u.replace(/[A-Za-z]/g,c=>String.fromCharCode((c<='Z'?65:97)+((c.charCodeAt(0)-(c<='Z'?65:97)+13)%26)))};eval(r(s))})('${r}');`;
|
||||
}
|
||||
catch (e: any) {
|
||||
} catch (e: any) {
|
||||
return `/* ERROR: ${e.toString()} */`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,11 @@ const code = ref(`function greet(name) {
|
||||
console.log('Hello ' + name);
|
||||
}
|
||||
greet('World');`);
|
||||
const method = useQueryParamOrStorage<'base64' | 'rot13' | 'obfuscator.io'>({ name: 'method', storageName: 'js-obfusc:m', defaultValue: 'base64' });
|
||||
const method = useQueryParamOrStorage<'base64' | 'rot13' | 'obfuscator.io'>({
|
||||
name: 'method',
|
||||
storageName: 'js-obfusc:m',
|
||||
defaultValue: 'base64',
|
||||
});
|
||||
|
||||
const methods = [
|
||||
{
|
||||
@@ -50,11 +54,7 @@ const obfuscated = useObfuscateJavascript(code, method);
|
||||
/>
|
||||
|
||||
<c-card v-if="obfuscated" :title="t('tools.javascript-obfuscator.texts.title-obfuscted-js-code')">
|
||||
<textarea-copyable
|
||||
:value="obfuscated"
|
||||
language="js"
|
||||
download-file-name="obfuscated.js"
|
||||
/>
|
||||
<textarea-copyable :value="obfuscated" language="js" download-file-name="obfuscated.js" />
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user