mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Merge pull request #695 from javascript-obfuscator/improved-disable-console-log-template
Improved ConsoleOutputDisableExpressionTemplate.ts and fixed Content-…
This commit is contained in:
@@ -1 +1,2 @@
|
||||
open_collective: javascript-obfuscator
|
||||
custom: ["https://xscode.com/sanex3339/javascript-obfuscator"]
|
||||
@@ -38,6 +38,7 @@ The example of obfuscated code: [github.com](https://github.com/javascript-obfus
|
||||
[](https://coveralls.io/github/javascript-obfuscator/javascript-obfuscator?branch=master)
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
[](https://xscode.com/sanex3339/javascript-obfuscator)
|
||||
|
||||
#### You can support this project by donating:
|
||||
* (OpenCollective) https://opencollective.com/javascript-obfuscator
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+9
-9
@@ -3,22 +3,22 @@
|
||||
*/
|
||||
export function ConsoleOutputDisableExpressionTemplate (): string {
|
||||
return `
|
||||
const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
|
||||
const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
|
||||
{globalVariableTemplate}
|
||||
|
||||
const _console = (that.console = that.console || {});
|
||||
|
||||
const consoleObject = (that.console = that.console || {});
|
||||
const methods = ['log', 'warn', 'info', 'error', 'exception', 'table', 'trace'];
|
||||
|
||||
|
||||
for (let index = 0; index < methods.length; index++){
|
||||
const func = {callControllerFunctionName}.constructor();
|
||||
const func = {callControllerFunctionName}.constructor.prototype.bind({callControllerFunctionName});
|
||||
const methodName = methods[index];
|
||||
const originalFunction = _console[methodName] || func;
|
||||
const originalFunction = consoleObject[methodName] || func;
|
||||
|
||||
func.toString = originalFunction.toString.bind(originalFunction);
|
||||
_console[methodName] = func;
|
||||
};
|
||||
consoleObject[methodName] = func;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
{consoleLogDisableFunctionName}();
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user