Last active
July 7, 2018 07:30
-
-
Save guyru/60c480c64967d3259442efbad015e940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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; | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment