Created
October 26, 2023 20:26
-
-
Save joonaspaakko/6cdc2d9f7e1e03704b94171980cd467e to your computer and use it in GitHub Desktop.
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
// 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