Created
December 3, 2013 10:06
-
-
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
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
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); | |
} | |
}; | |
} |
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
deleter = new ReadabilityDeleter(); | |
deleter.deleteNextRow(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment