Last active
April 13, 2019 08:31
-
-
Save momota/6479565b0e36a4abac772b3aff9c39bd to your computer and use it in GitHub Desktop.
UserScript for copying family budget detail data to clipboard from the moneyfoward page.
This file contains hidden or 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 moneyforward_scraping | |
// @namespace http://momota.github.io/ | |
// @include https://moneyforward.com/cf | |
// @version 1 | |
// @grant GM.setClipboard | |
// ==/UserScript== | |
function copyTransaction() { | |
let tsv = '', | |
rows = document.querySelectorAll('#cf-detail-table > tbody > tr'); | |
for(let row of rows) { | |
for(let td of row.querySelectorAll('td')) { | |
tsv += td.innerText + '\t'; | |
} | |
tsv += '\n'; | |
} | |
return tsv; | |
} | |
(function () { | |
let t = copyTransaction(); | |
GM.setClipboard(t); | |
let period = document.querySelector('span.fc-header-title:nth-child(2) > h2:nth-child(1)'); | |
alert('copied: ' + period.innerText); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment