From 9ba244b519a2d4adaf62954785e4ce4f94b93a7a Mon Sep 17 00:00:00 2001 From: Xmader Date: Thu, 5 Nov 2020 11:31:38 -0500 Subject: [PATCH] fix: anti-detection (#47) --- src/btn.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/btn.ts b/src/btn.ts index 8ece248..9ebbc50 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -40,6 +40,8 @@ export class BtnList { constructor (private templateBtn: BtnElement) { } + private antiDetectionText = 'Download' + add (options: BtnOptions): BtnElement { const btn = this.templateBtn.cloneNode(true) as HTMLButtonElement @@ -55,7 +57,12 @@ export class BtnList { const _set = textNode['__lookupSetter__'](_property) Object.defineProperty(textNode, _property, { set (v) { _set.call(textNode, v) }, - get () { return 'Download' }, + get: () => { + // first time only + const t = this.antiDetectionText + this.antiDetectionText = '' + return t + }, }) const setText = (str: string): void => {