Skip to content

Instantly share code, notes, and snippets.

@kaeff
Created December 3, 2013 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaeff/7766895 to your computer and use it in GitHub Desktop.
Save kaeff/7766895 to your computer and use it in GitHub Desktop.
UserScript for deleting readability entries from Amazon's Kindle Personal Document settings UI
var ReadabilityDeleter = function () {
var readabilityColumnOnly = function(el) {
return el.innerHTML.indexOf("@readability.com") > 0;
};
var queryReadabilityRows = function () {
var candidates = document.querySelectorAll("#orderList td.greyed");
return Array.prototype.slice.call(candidates).filter(readabilityColumnOnly);
};
var openActionsForRow = function (rowElem) {
rowElem.lastChild.firstChild.lastChild.click();
};
var openRowForDeletion = function (tdElemInRow) {
var rowElem = tdElemInRow.parentElement;
openActionsForRow(rowElem);
};
var clickDeleteOnNextRow = function () {
document.querySelectorAll('.ap_popover .actionLink a')[1].click();
};
var clickConfirmDelete = function () {
document.querySelectorAll('.ap_popover .ap_custom_close')[0].click();
};
var deleteOpenRow = function () {
clickDeleteOnNextRow();
clickConfirmDelete();
};
var openNextRowForDeletion = function () {
openRowForDeletion(queryReadabilityRows()[0]);
};
return {
deleteOpenRow: deleteOpenRow,
openNextRowForDeletion: openNextRowForDeletion,
deleteNextRow: function () {
openNextRowForDeletion();
setTimeout(deleteOpenRow, 0);
}
};
}
deleter = new ReadabilityDeleter();
deleter.deleteNextRow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment