This fixes both the links to the PDFs and the embeding in the mailbox. Click on the “View Raw” to install.
// ==UserScript== | |
// @name Bank Hapoalim | |
// @description Workaround bugs in Bank Hapoalim website to display pdf messages. | |
// @author Guy Rutenberg | |
// @namespace http://www.guyrutenberg.com | |
// @include https://login.bankhapoalim.co.il/portalserver/mailInbox#/folders/0 | |
// @include https://login.bankhapoalim.co.il/ng1-portals/rb/he/mails#/folders/0 | |
// @run-at document-idle | |
// @version 1.1 | |
// @grant none | |
// ==/UserScript== | |
// | |
// @include url should be the url of the inner iframe containing the list of mails. | |
var MutationObserver = window.MutationObserver; | |
var myObserver = new MutationObserver (mutationHandler); | |
var obsConfig = { | |
childList: true, attributes: false, | |
subtree: true, | |
}; | |
var target = document.getElementsByTagName('mail-manager')[0]; | |
myObserver.observe (target, obsConfig); | |
function mutationHandler (mutationRecords) { | |
console.log('here'); | |
mutationRecords.forEach ( function (mutation) { | |
for (var item of mutation.addedNodes) { | |
if (item.tagName == 'PDF-VIEWER') { | |
var url = 'https://login.bankhapoalim.co.il' + item.getAttribute('pdf-show'); | |
iframe = item.querySelector('iframe'); | |
iframe.src = url; | |
} | |
} | |
}); | |
} |