Skip to content

Commit

Permalink
fix: anti-detection (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed Nov 5, 2020
1 parent cb0a85b commit 9ba244b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/btn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 => {
Expand Down

0 comments on commit 9ba244b

Please sign in to comment.