refactor: remove unused anti-detection code
This commit is contained in:
parent
1f44fcf449
commit
1cfb417c66
1 changed files with 3 additions and 16 deletions
19
src/btn.ts
19
src/btn.ts
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue