Created
June 20, 2023 05:42
-
-
Save ngseke/34bf7450052c40a9cf0ebd5eac258398 to your computer and use it in GitHub Desktop.
Liberate 87pu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Liberate 87pu | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @author You | |
// @match https://www.87pu.com.tw/* | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
function waitForEl(selector) { | |
return new Promise(resolve => { | |
if (document.querySelector(selector)) { | |
return resolve(document.querySelector(selector)); | |
} | |
const observer = new MutationObserver(mutations => { | |
if (document.querySelector(selector)) { | |
resolve(document.querySelector(selector)); | |
observer.disconnect(); | |
} | |
}); | |
observer.observe(document.body, { childList: true, subtree: true }); | |
}); | |
} | |
function removeAds () { | |
const selectors = ['.a-post-show', '#viptoneWindow', '#liveVideo', '.update_vip_bar'] | |
selectors.forEach(async (ad) => { | |
await waitForEl(ad) | |
;[...document.querySelectorAll(ad)].forEach(el => el?.remove()) | |
}) | |
} | |
function liberate () { | |
ẵ = () => 1 | |
} | |
removeAds() | |
liberate() | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment