• We've moved. Our community is now at ownd.sh — latest discussions and updates live there.

Flixer.sh Adblocker Tampermonkey Script - If you tired for popup ads thats for you!

lguesslmlose

Divine
Divine
Rep
0
0
0
Rep
1307
Vouches
26
0
0
Vouches
26
Posts
2,855
Likes
1,868
Bits
5 YEARS
5 YEARS OF SERVICE
GOOD LUCK GUYS

 

Code:

Code:
// ==UserScript==

// @name         ? FLIXER Ad Blocker

// @namespace    http://tampermonkey.net/

// @version      1.0

// @description  Comprehensive ad, popup, and redirect blocker for FLIXER.sh and FLIXY.watch

// @author       Anakin

// @match        *://flixer.sh/*

// @match        *://flixy.watch/*

// @grant        unsafeWindow

// @run-at       document-start

// ==/UserScript==

(function() {

    'use strict';

    const config = {

        debug: false,

        debounce: 100,

        iframeInterval: 1000

    };

    const patterns = {

        scripts: ['bvtpk.com', 'monetag', 'doubleclick', 'googleadservices', 'google.com/ads'],

        iframes: ['bvtpk', 'ads', 'google.com/ads', 'doubleclick', 'ad-server'],

        redirects: ['redirect', 'tracking', 'track.php', 'ads/', 'adclick'],

        popups: [

            '.modal', '.modal-dialog', '.popup', '.popover', '.advertisement',

            '[role="dialog"]', '.dialog', '.alert', '[class*="modal"]',

            '[id*="modal"]', '[class*="popup"]', '[id*="popup"]',

            '[class*="advertisement"]', '[id*="advertisement"]',

            '.overlay', '.modal-overlay', '.backdrop', '[class*="overlay"]',

            '[id*="overlay"]', '.fullscreen-ad', '.ad-container',

            '[data-zone]', '[data-ad]', '.ad-banner', '.ad-box',

            '[id*="google_ads"]', '[id*="ad-"]', '[class*="ad-"]',

            '.redirect-popup', '.notification', '.banner',

            '[class*="redirect"]', '[id*="redirect"]',

            '[class*="skip-this"]', '[class*="interstitial"]',

            '.bvtpk-ad', '[data-monetag]'

        ],

        closeButtons: [

            '.close', '.btn-close', '.modal-close', '.closeButton',

            '[aria-label*="close"]', '[class*="close"]', '[id*="close"]',

            '.modal-header .close', 'button[title*="Close"]',

            '[data-dismiss="modal"]'

        ]

    };

    const dom = {

        queryAll: (selector) => {

            try {

                return document.querySelectorAll(selector);

            } catch (e) {

                return [];

            }

        },

        query: (selector) => {

            try {

                return document.querySelector(selector);

            } catch (e) {

                return null;

            }

        },

        hide: (element) => {

            if (!element) return;

            element.style.display = 'none !important';

            element.style.visibility = 'hidden !important';

            element.style.opacity = '0 !important';

            element.style.pointerEvents = 'none !important';

        },

        remove: (element) => {

            if (element && element.parentNode) {

                element.parentNode.removeChild(element);

            }

        }

    };

    const blockScripts = () => {

        window.addEventListener('beforescriptexecute', (e) => {

            const src = e.target.src || '';

            if (patterns.scripts.some(pattern => src.includes(pattern))) {

                e.preventDefault();

            }

        }, true);

    };

    const removePopups = () => {

        patterns.popups.forEach(selector => {

            dom.queryAll(selector).forEach(element => {

                dom.hide(element);

                dom.remove(element);

            });

        });

    };

    const autoClosePopups = () => {

        patterns.closeButtons.forEach(selector => {

            dom.queryAll(selector).forEach(element => {

                if (element.offsetParent !== null) {

                    try {

                        element.click();

                    } catch (e) {}

                }

                dom.remove(element);

            });

        });

    };

    const removeIframes = () => {

        dom.queryAll('iframe').forEach(iframe => {

            const src = iframe.getAttribute('src') || '';

            const id = iframe.getAttribute('id') || '';

            const name = iframe.getAttribute('name') || '';

            const isAd = patterns.iframes.some(p => src.includes(p)) ||

                         id.includes('ad') ||

                         name.includes('ad');

            if (isAd) {

                dom.remove(iframe);

            }

        });

    };

    const overrideFunctions = () => {

        const originalOpen = window.open;

        window.open = function(url, target, features) {

            if (patterns.redirects.some(p => (url || '').includes(p))) {

                return null;

            }

            return originalOpen.call(window, url, target, features);

        };

        const originalAlert = window.alert;

        window.alert = function(message) {

            if (/ad|popup|redirect/i.test(message || '')) {

                return;

            }

            return originalAlert.call(window, message);

        };

        window.confirm = function(message) {

            if (/ad|popup|redirect/i.test(message || '')) {

                return false;

            }

            return confirm(message);

        };

    };

    const blockLocationChanges = () => {

        const originalAssign = window.location.assign;

        const originalReplace = window.location.replace;

        window.location.assign = function(url) {

            if (patterns.redirects.some(p => (url || '').includes(p))) {

                return;

            }

            return originalAssign.call(window.location, url);

        };

        window.location.replace = function(url) {

            if (patterns.redirects.some(p => (url || '').includes(p))) {

                return;

            }

            return originalReplace.call(window.location, url);

        };

    };

    const blockClicks = () => {

        document.addEventListener('click', (e) => {

            const href = e.target.getAttribute('href') || '';

            const onclick = e.target.getAttribute('onclick') || '';

            const dataUrl = e.target.getAttribute('data-url') || '';

            const isAdClick = patterns.redirects.some(p =>

                href.includes(p) || onclick.includes(p) || dataUrl.includes(p)

            ) || href.includes('ad') || onclick.includes('ad');

            if (isAdClick) {

                e.preventDefault();

                e.stopPropagation();

                e.stopImmediatePropagation();

            }

        }, true);

    };

    const blockHistory = () => {

        const originalPush = window.history.pushState;

        const originalReplace = window.history.replaceState;

        window.history.pushState = function(state, title, url) {

            if (patterns.redirects.some(p => (url || '').includes(p))) {

                return;

            }

            return originalPush.apply(window.history, arguments);

        };

        window.history.replaceState = function(state, title, url) {

            if (patterns.redirects.some(p => (url || '').includes(p))) {

                return;

            }

            return originalReplace.apply(window.history, arguments);

        };

        window.addEventListener('popstate', (e) => {

            e.preventDefault();

        }, true);

    };

    let debounceTimer = null;

    const setupMutationObserver = () => {

        const observer = new MutationObserver(() => {

            clearTimeout(debounceTimer);

            debounceTimer = setTimeout(() => {

                removePopups();

                autoClosePopups();

                removeIframes();

            }, config.debounce);

        });

        observer.observe(document.documentElement, {

            childList: true,

            subtree: true,

            attributes: true,

            attributeFilter: ['style', 'class', 'display', 'data-zone', 'data-ad']

        });

    };

    const init = () => {

        removePopups();

        autoClosePopups();

        removeIframes();

        blockScripts();

        overrideFunctions();

        blockLocationChanges();

        blockClicks();

        blockHistory();

        setupMutationObserver();

        setInterval(removeIframes, config.iframeInterval);

    };

    if (document.readyState === 'loading') {

        document.addEventListener('DOMContentLoaded', init);

    } else {

        init();

    }

    window.addEventListener('load', init);

    window.FLIXERBlocker = {

        clean: removePopups,

        debug: () => { config.debug = !config.debug; }

    };

})();

Beware of scammers who impersonate me!

 

PARADIES

Royal
Royal
PARADIES Rep
0
0
Rep
372
PARADIES Vouches
2
0
0
Vouches
2
Posts
1,228
Likes
632
Bits
3 YEARS
3 YEARS OF SERVICE
uhq W

UasAmmf.gif
 
PARADIES's signature

juliass

Royal
Royal
juliass Rep
0
0
Rep
804
juliass Vouches
0
0
0
Vouches
0
Posts
1,382
Likes
1,521
Bits
2 YEARS
2 YEARS OF SERVICE
HQ script
hype.png


 

I do not buy, sell or exchange anything

GzZjykf.gif
 

Attachments

  • hype.png
    hype.png
    802 bytes · Views: 0
juliass's signature

179,172

126,023

1,405,739

Top