Skip to content

Instantly share code, notes, and snippets.

@alukos
Created February 20, 2018 08:04
Show Gist options
  • Save alukos/fade2a4e8ffcf13cf4e9e263705a4f0a to your computer and use it in GitHub Desktop.
Save alukos/fade2a4e8ffcf13cf4e9e263705a4f0a to your computer and use it in GitHub Desktop.
Observer (restore transcript in youtube)
var button = document.querySelectorAll('ytd-menu-service-item-renderer')[1];
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type == "attributes") {
console.log("attributes changed");
button.click();
}
});
});
observer.observe(document.getElementById('transcript-loader'), {
attributes: true //configure it to listen to attribute changes
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment