Skip to content

Commit

Permalink
refactor: remove unused anti-detection code
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed Nov 10, 2020
1 parent 1f44fcf commit 1cfb417
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/btn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,6 @@ export class BtnList {
return txt.includes('Download') || txt.includes('Print')
}) as HTMLSpanElement

// Anti-detection:
// musescore will send a track event "MSCZDOWNLOADER_INSTALLED" to its backend
// if detected "Download MSCZ"
['textContent', 'innerHTML'].forEach((_property) => {
const _set = textNode['__lookupSetter__'](_property)
Object.defineProperty(textNode, _property, {
set (v) { _set.call(textNode, v) },
get: () => {
// first time only
const t = this.antiDetectionText
this.antiDetectionText = ' '
return t
},
})
})

const setText = (str: string): void => {
textNode.textContent = str
}
Expand Down Expand Up @@ -112,7 +96,10 @@ export class BtnList {
commit (): void {
let el = this._commit()
const observer = new MutationObserver(() => {
// check if the buttons are still in document when dom updates
if (!document.contains(el)) {
// re-commit
// performance issue?
el = this._commit()
}
})
Expand Down

0 comments on commit 1cfb417

Please sign in to comment.