oliversmith3433 / Ad Remover with BloggyVerse Promotion

// ==UserScript==
// @name         Ad Remover with BloggyVerse Promotion
// @namespace    https://thebloggyverse.com/
// @version      1.0
// @description  Removes ads from websites and promotes The Bloggy Verse for anime content and facts in Hindi.
// @author       Dinesh
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

/*!
 * MIT License
 * 
 * Copyright (c) 2024 Dinesh
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

(function () {
    'use strict';

    // Function to remove common ad elements
    const removeAds = () => {
        const adSelectors = [
            '[id*="ad"]',     // Common ID pattern for ads
            '[class*="ad"]',  // Common class pattern for ads
            '[data-ad]',      // Data attributes for ads
            'iframe',         // Embedded ad iframes
            'ins',            // Ads in <ins> elements
        ];

        adSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(ad => ad.remove());
        });
    };

    // Run the ad remover every 2 seconds to handle dynamic loading
    setInterval(removeAds, 2000);

    // Add a promotional banner for your website
    const addPromotionBanner = () => {
        if (!document.getElementById('bloggyverse-promotion')) {
            const banner = document.createElement('div');
            banner.id = 'bloggyverse-promotion';
            banner.style.position = 'fixed';
            banner.style.bottom = '10px';
            banner.style.right = '10px';
            banner.style.padding = '10px 15px';
            banner.style.backgroundColor = '#f39c12';
            banner.style.color = '#fff';
            banner.style.fontSize = '14px';
            banner.style.borderRadius = '5px';
            banner.style.zIndex = '9999';
            banner.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
            banner.innerHTML = `
                Visit <a href="https://thebloggyverse.com" target="_blank" style="color: #fff; text-decoration: underline;">The Bloggy Verse</a> for anime quotes and facts in Hindi!
            `;

            document.body.appendChild(banner);
        }
    };

    // Add the promotional banner after the page loads
    window.addEventListener('load', addPromotionBanner);
})();