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 - Allow Custom Date Range and PDF
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Allows Custom Date Range and PDF; blocks other options
// @match        https://yonoretail.sbi.bank.in/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    const ALLOWED_OPTIONS = [
        'Custom Date Range',
        'PDF'
    ];

    const ERROR_MESSAGE =
        'The service is temporarily closed. Please try again later.';

    function getOption(event) {
        if (!(event.target instanceof Element)) {
            return null;
        }

        return event.target.closest(
            'mat-option, [role="option"], .mat-mdc-option'
        );
    }

    function getOptionText(option) {
        return option?.textContent
            .replace(/\s+/g, ' ')
            .trim() || '';
    }

    function isAllowed(option) {
        return ALLOWED_OPTIONS.includes(getOptionText(option));
    }

    function blockEvent(event, showMessage = false) {
        const option = getOption(event);

        if (!option || isAllowed(option)) {
            return;
        }

        event.preventDefault();
        event.stopPropagation();
        event.stopImmediatePropagation();

        if (showMessage) {
            alert(ERROR_MESSAGE);
        }
    }

    // Block unwanted mouse selections
    document.addEventListener('pointerdown', event => {
        blockEvent(event, false);
    }, true);

    document.addEventListener('click', event => {
        blockEvent(event, true);
    }, true);

    // Block unwanted keyboard selections
    document.addEventListener('keydown', event => {
        if (event.key === 'Enter' || event.key === ' ') {
            blockEvent(event, true);
        }
    }, true);
})();
← Back to timeline