JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
about 2 hours ago2 views
👨‍💻Programming

Untitled Page

// ==UserScript==
// @name         SBI YONO - Hide Statement Download Limit Modal

// @namespace    http://tampermonkey.net/
// @version      5.0
// @description  Safely add Export as PDF beside SBI Download button
// @match        https://yonoretail.sbi.bank.in/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==
(function () {
    'use strict';

    // ─── Strategy 1: Hide immediately if already in DOM ───────────────────────
    function hideModal() {
        // Target the outermost wrapper div of the error modal
        // It contains the "confirmation-heading" + "confirmation-popup" structure
        const allDivs = document.querySelectorAll('div');

        for (const div of allDivs) {
            // Look for the specific heading text that identifies this modal
            const heading = div.querySelector('p[aria-label="Authentication failed"]');
            const errorText = div.querySelector('div[aria-label="Authentication failed"]');

            if (heading || errorText) {
                // Walk up to find the root wrapper of this modal
                let target = heading || errorText;

                // Go up 3-4 levels to find the outermost modal container
                for (let i = 0; i < 4; i++) {
                    if (target.parentElement) {
                        target = target.parentElement;
                    }
                }

                console.log('[SBI Fix] Modal found and removed:', target);
                target.style.display = 'none'; // Hide it (safe approach)
                // OR use target.remove(); to completely remove from DOM
            }
        }

        // ─── Direct class-based targeting ─────────────────────────────────────
        // Hide the confirmation popup by its known class
        const confirmationPopup = document.querySelector('.confirmation-popup');
        const confirmationHeading = document.querySelector('.confirmation-heading');

        if (confirmationPopup) {
            // Hide parent container (go up 1 level from .confirmation-popup)
            const modalRoot = confirmationPopup.parentElement;
            if (modalRoot) {
                modalRoot.style.display = 'none';
                console.log('[SBI Fix] Modal root hidden via .confirmation-popup parent');
            }
        }
    }

    // ─── Strategy 2: MutationObserver (for dynamically injected modals) ───────
    // Angular apps render content AFTER page load — MutationObserver watches
    // for new nodes being added to the DOM in real time
    const observer = new MutationObserver(function (mutations) {
        for (const mutation of mutations) {
            // Check if new nodes were added to the DOM
            if (mutation.addedNodes.length > 0) {
                hideModal(); // Re-run our hiding logic whenever DOM changes
            }
        }
    });

    // Observe the entire document body for any child additions (deep watch)
    observer.observe(document.body, {
        childList: true,   // Watch for added/removed children
        subtree: true      // Watch deeply (all descendants, not just direct children)
    });

    // ─── Strategy 3: Run immediately on page load too ─────────────────────────
    hideModal();

    // ─── Strategy 4: Inject CSS to permanently suppress this modal class ──────
    const style = document.createElement('style');
    style.textContent = `
        /* Hide the SBI statement download limit error modal */
        .confirmation-heading:has(p[aria-label="Authentication failed"]),
        .confirmation-popup {
            display: none !important;
            visibility: hidden !important;
        }
    `;
    document.head.appendChild(style);
    console.log('[SBI Fix] CSS override injected');

})();
← Back to timeline