https://github.com/iwstkhr/kindle-highlight-deleter
Ad hoc JavaScript to delete Kindle highlights from Kindle Cloud Reader
https://github.com/iwstkhr/kindle-highlight-deleter
javascript kindle-highlights
Last synced: about 1 month ago
JSON representation
Ad hoc JavaScript to delete Kindle highlights from Kindle Cloud Reader
- Host: GitHub
- URL: https://github.com/iwstkhr/kindle-highlight-deleter
- Owner: iwstkhr
- License: mit
- Created: 2022-07-13T20:28:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-31T15:19:20.000Z (9 months ago)
- Last Synced: 2025-03-25T16:23:38.578Z (about 2 months ago)
- Topics: javascript, kindle-highlights
- Homepage:
- Size: 247 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kindle highlight deleter
Ad hoc JavaScript to delete Kindle highlights from Kindle "Your Notes and Highlights".## Usage
Open "Your Notes and Highlights"
https://read.amazon.com/notebookNote that you should select the appropriate site corresponding to your language. (amazon.co.jp, amazon.com, etc.).

---
Select a book in which you want to delete highlights.

---
Open "Developer Tools" of your browser.
In Google Chrome, you can open it with F12.---
Paste the following JavaScript in the console tab and press ENTER.

```javascript
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));(async () => {
const options = document.querySelector('#kp-notebook-annotations').querySelectorAll('div.a-row .a-spacing-base');
const triggers = Array.from(options || [])
.map(option => option.querySelector('a.a-popover-trigger'))
.filter(Boolean);for (const trigger of triggers) {
// Show a popup menu.
trigger.click();
await sleep(500);// Click a "delete highlight" item.
let deleteHighlight = document.querySelector('a#deletehighlight');
if (!deleteHighlight) {
console.warn('a#deletehighlight was not found.');
continue;
}
const value = deleteHighlight.attributes.getNamedItem('value').value;
deleteHighlight.click();
await sleep(500);// Submit.
deleteHighlight = document.querySelector('span#deleteHighlight');
if (!deleteHighlight) {
console.warn('span#deleteHighlight was not found.');
continue;
}
const submit = deleteHighlight.querySelector('input[type="submit"]');
if (!submit) {
console.warn('submit was not found.');
continue;
}
submit.click();console.info(`${value} was deleted.`)
await sleep(3000);
}
})();
```