Last active
September 9, 2024 13:06
-
-
Save rudiedirkx/816fc0be0cb72f481f5afe496ea53fad 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
javascript: (function(f, a) { | |
f = new Blob(['"Date","Description","Amount"\n', [].map.call(queryAllShadow('ing-ow-expandable-item', queryAllShadow('ing-feat-transaction-period').reverse()[0]), row => ([ | |
row.closest('.date-item').querySelector('time').getAttribute('datetime'), | |
row.querySelector('h5').textContent.trim(), | |
row.querySelector('h5 + strong').textContent.trim().replace(',', '.').replace('−', '-'), | |
]).map(col => '"' + col.replace(/"/g, '""') + '"').join(',')).join('\n')], {type: 'text/plain'}); | |
a = document.createElement('a'); | |
a.download = 'trans.csv'; | |
a.href = URL.createObjectURL(f); | |
a.click(); | |
})(); void(0) |
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
queryAllShadow = function(selector, doc) { | |
const roots = [doc || document]; | |
const addRoots = (root) => [root, ...root.querySelectorAll('*')].forEach(el => { | |
if (el.shadowRoot) { | |
roots.push(el.shadowRoot); | |
addRoots(el.shadowRoot); | |
} | |
}); | |
addRoots(roots[0]); | |
const els = []; | |
roots.forEach(root => { | |
els.push(...root.querySelectorAll(selector)); | |
}); | |
return els; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment