Skip to content

Instantly share code, notes, and snippets.

@momota
Last active April 13, 2019 08:31
Show Gist options
  • Select an option

  • Save momota/6479565b0e36a4abac772b3aff9c39bd to your computer and use it in GitHub Desktop.

Select an option

Save momota/6479565b0e36a4abac772b3aff9c39bd to your computer and use it in GitHub Desktop.

Revisions

  1. momota revised this gist Apr 13, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion moneyforward_scraping.js
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,8 @@ function copyTransaction() {
    }

    (function () {
    GM.setClipboard(copyTransaction());
    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);
    })();
  2. momota revised this gist Apr 13, 2019. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions moneyforward_scraping.js
    Original file line number Diff line number Diff line change
    @@ -7,19 +7,19 @@
    // ==/UserScript==

    function copyTransaction() {
    var csv = '',
    let tsv = '',
    rows = document.querySelectorAll('#cf-detail-table > tbody > tr');
    for(var row of rows) {
    for(var td of row.querySelectorAll('td')) {
    csv += td.innerText + '\t';
    for(let row of rows) {
    for(let td of row.querySelectorAll('td')) {
    tsv += td.innerText + '\t';
    }
    csv += '\n';
    tsv += '\n';
    }
    return csv;
    return tsv;
    }

    (function () {
    GM.setClipboard(copyTransaction());
    var period = document.querySelector('span.fc-header-title:nth-child(2) > h2:nth-child(1)');
    let period = document.querySelector('span.fc-header-title:nth-child(2) > h2:nth-child(1)');
    alert('copied: ' + period.innerText);
    })();
  3. momota revised this gist Apr 13, 2019. No changes.
  4. momota created this gist Apr 13, 2019.
    25 changes: 25 additions & 0 deletions moneyforward_scraping.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    // ==UserScript==
    // @name moneyforward_scraping
    // @namespace http://momota.github.io/
    // @include https://moneyforward.com/cf
    // @version 1
    // @grant GM.setClipboard
    // ==/UserScript==

    function copyTransaction() {
    var csv = '',
    rows = document.querySelectorAll('#cf-detail-table > tbody > tr');
    for(var row of rows) {
    for(var td of row.querySelectorAll('td')) {
    csv += td.innerText + '\t';
    }
    csv += '\n';
    }
    return csv;
    }

    (function () {
    GM.setClipboard(copyTransaction());
    var period = document.querySelector('span.fc-header-title:nth-child(2) > h2:nth-child(1)');
    alert('copied: ' + period.innerText);
    })();