Last active
December 15, 2021 08:36
-
-
Save yysaki/10537d2a82ea33f9db59dfb22ca0f224 to your computer and use it in GitHub Desktop.
マネーフォワードの未分類なkindle本の支出を本に分類するbookmarklet
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:(async () => { | |
const kindleRow = () => { | |
const rows = document.querySelectorAll('#cf-detail-table tbody tr'); | |
const kindleRows = [...rows].filter(({ innerText }) => innerText.includes('Kindle') && innerText.includes('未分類')); | |
return kindleRows[0]; | |
}; | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
let row = kindleRow(); | |
while(row !== undefined) { | |
const dropdownToggle = row.querySelector('a.dropdown-toggle'); | |
dropdownToggle.click(); | |
const listItems = row.querySelectorAll('a.m_c_name'); | |
const targetItem = [...listItems].filter(({ innerText }) => innerText === '本')[0]; | |
targetItem.click(); | |
const jsSaving = document.getElementsByClassName('js-saving')[0]; | |
while (jsSaving.style['display'] !== 'none') { | |
await sleep(1000); | |
} | |
row = kindleRow(); | |
} | |
alert('完了しました。'); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment