Skip to content

Instantly share code, notes, and snippets.

@noraworld
Last active June 26, 2022 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noraworld/e6d0f0f778a7e0edf1f72c17cceb0b72 to your computer and use it in GitHub Desktop.
Save noraworld/e6d0f0f778a7e0edf1f72c17cceb0b72 to your computer and use it in GitHub Desktop.
It allows you to toggle CC (closed caption) on watch.pokemon.com by pressing "c" key
// Toggle closed caption on watch.pokemon.com by pressing "c" key
let count = 0
document.addEventListener('keydown', (event) => {
if (event.key === 'c') {
count++
if (count % 2 === 0) {
document.querySelector('.vjs-menu-item.vjs-subtitles-menu-item').previousElementSibling.click()
}
else {
document.querySelector('.vjs-menu-item.vjs-subtitles-menu-item').click()
}
document.activeElement.blur()
}
})
@noraworld
Copy link
Author

@noraworld
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment