refactor: get rid of `Disable Tampermonkey`
This commit is contained in:
parent
f224edbc49
commit
05e147a03c
10
src/file.ts
10
src/file.ts
|
@ -14,16 +14,6 @@ const TYPE_REG = /id=(\d+)&type=(img|mp3|midi)/
|
||||||
const magicHookConstr = (() => {
|
const magicHookConstr = (() => {
|
||||||
const l = {}
|
const l = {}
|
||||||
|
|
||||||
// get rid of `Disable Tampermonkey`
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
|
||||||
mutations.forEach(x => [...x.addedNodes].forEach(e => {
|
|
||||||
if (!document.querySelector('.js-page')) {
|
|
||||||
(e as HTMLElement).replaceWith(...x.removedNodes)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
observer.observe(document, { childList: true, subtree: true })
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const p = Object.getPrototypeOf(document.body)
|
const p = Object.getPrototypeOf(document.body)
|
||||||
Object.setPrototypeOf(document.body, null)
|
Object.setPrototypeOf(document.body, null)
|
||||||
|
|
10
src/intro.js
10
src/intro.js
|
@ -18,6 +18,16 @@ if (_GM && _GM.registerMenuCommand && _GM.openInTab) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get rid of `Disable Tampermonkey`
|
||||||
|
const observer = new MutationObserver((mutations) => {
|
||||||
|
mutations.forEach(x => [...x.addedNodes].forEach(e => {
|
||||||
|
if (!document.querySelector('.js-page')) {
|
||||||
|
e.replaceWith(...x.removedNodes)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
observer.observe(document, { childList: true, subtree: true })
|
||||||
|
|
||||||
// script loader
|
// script loader
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
const id = '' + Math.random();
|
const id = '' + Math.random();
|
||||||
|
|
Loading…
Reference in New Issue