From 1cfb417c66ebd7db7d5a8c537d3abfafda40eb80 Mon Sep 17 00:00:00 2001 From: Xmader Date: Tue, 10 Nov 2020 13:47:19 -0500 Subject: [PATCH] refactor: remove unused anti-detection code --- src/btn.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/btn.ts b/src/btn.ts index 54cc20a..0ef3ddf 100644 --- a/src/btn.ts +++ b/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() } })