Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joonaspaakko/6cdc2d9f7e1e03704b94171980cd467e to your computer and use it in GitHub Desktop.
Save joonaspaakko/6cdc2d9f7e1e03704b94171980cd467e to your computer and use it in GitHub Desktop.
// Mark all Audible library books ON THE CURRENT PAGE as finished or unfinished
// The script is basically a macro: it works by emulating a button click and just automating it for every single book
function markAs(config) {
config = config || {};
var i = 0;
var elements = $(config.finished ? ".mark-as-finished-button" : ".mark-as-unfinished-button");
var l = elements.length;
(function fn() {
const item = elements[i++];
$(item).find("button").click();
if (i < l) setTimeout(fn, config.delay || 1000);
else {
console.log( 'Marking finished!' );
}
})();
}
// This starts the process
markAs({ finished: true, delay: 1000 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment