Created
February 20, 2018 08:04
-
-
Save alukos/fade2a4e8ffcf13cf4e9e263705a4f0a to your computer and use it in GitHub Desktop.
Observer (restore transcript in youtube)
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
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