Last active
May 12, 2025 04:58
-
-
Save shrayasr/78cea7b07c8a02bb09f3011a41a5eef0 to your computer and use it in GitHub Desktop.
Populate done % on audible listen history pages
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
// ==UserScript== | |
// @name Populate done % on audible listen history pages | |
// @namespace http://tampermonkey.net/ | |
// @version 2025-05-12 | |
// @description https://shrayas.com/showing-the-done-percent-on-my-audible-listen-history-page | |
// @author Shrayasr (https://shrayas.com) | |
// @match https://www.audible.in/account/listen-history* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=audible.in | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const SCRIPT_NAME = 'Populate done % on audible listen history pages'; | |
console.log(`${SCRIPT_NAME}: Script started.`); | |
const timeRemainingDivs = document.querySelectorAll('div[id^="time-remaining-display-"]'); | |
timeRemainingDivs.forEach(div => { | |
const progressBar = div.querySelector('.bc-meter-bar[role="progressbar"]'); | |
if (!progressBar) { | |
console.log(`No progress bar found in ${div.id}`); | |
return; | |
} | |
const progressValue = progressBar.getAttribute('aria-valuenow'); | |
const textSpan = div.querySelector('.bc-text.bc-color-secondary'); | |
if (!textSpan) { | |
console.log(`No text span found in ${div.id}`); | |
return; | |
} | |
const currentText = textSpan.textContent; | |
textSpan.textContent = `${currentText} | ${progressValue}% done`; | |
console.log(`Updated ${div.id} with progress value: ${progressValue}`); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment