// ==UserScript==
// @name SBI Highlight Button When PDF Selected (Final Working)
// @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';
function highlightButton(isPDF) {
const btn = document.querySelector('.custom-download-btn');
if (!btn) return;
if (isPDF) {
btn.disabled = false;
btn.style.backgroundColor = "rgba(82,74,151,0.12)";
btn.style.color = "#524a97";
btn.style.border = "2px solid #524a97";
btn.style.boxShadow = "0 0 8px rgba(82,74,151,0.4)";
btn.style.cursor = "pointer";
btn.style.opacity = "1";
console.log("PDF selected → Button highlighted");
} else {
btn.disabled = true;
btn.style.backgroundColor = "#ccc";
btn.style.color = "#666";
btn.style.border = "2px solid #ccc";
btn.style.boxShadow = "none";
btn.style.cursor = "not-allowed";
btn.style.opacity = "0.6";
console.log("Non-PDF selected → Button disabled");
}
}
// Listen globally for clicks
document.addEventListener('click', function (e) {
const option = e.target.closest('mat-option');
if (!option) return;
const text = option.innerText.trim();
if (text === "PDF") {
highlightButton(true);
} else if (text === "Excel") {
highlightButton(false);
}
});
})();2 views