Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
7
Indexable
Never
function popupRemover() {
    removeJsonPaths(domainsToRemove, jsonPathsToRemove);
    setInterval(() => {

        const popup = document.querySelector(".style-scope ytd-enforcement-message-view-model");

        const backdrop = document.querySelector("tp-yt-iron-overlay-backdrop");

        const video1 = document.querySelector("#movie_player > video.html5-main-video");
        const video2 = document.querySelector("#movie_player > .html5-video-container > video");

        const modalOverlay = document.querySelector("tp-yt-iron-overlay-backdrop");

        if (popup) {
            document.getElementById("dismiss-button").click();
            document.getElementsByClassName("ytp-play-button ytp-button")[0].click();
            
            if (debug) console.log("Remove Adblock Thing: Popup detected, removing...");
            popup.remove();
            if (backdrop) {
                backdrop.remove();
            };
            if (modalOverlay) modalOverlay.removeAttribute("opened");
            unpausedAfterSkip = 2;
            if (debug) console.log("Remove Adblock Thing: Popup removed");
        }

        // Check if the video is paused after removing the popup
        if (!unpausedAfterSkip > 0) return;


        if (video1) {
            // UnPause The Video
            if (video1.paused) unPauseVideo();
            else if (unpausedAfterSkip > 0) unpausedAfterSkip--;
        }
        if (video2) {
            if (video2.paused) unPauseVideo();
            else if (unpausedAfterSkip > 0) unpausedAfterSkip--;
        }

    }, 1000);
}