muzuiget / dualsub-support

Dualsub - Dual Subtitles for YouTube
https://www.dualsub.xyz/
281 stars 24 forks source link

Turn on/off the subs easily #342

Closed rbatty19 closed 3 years ago

rbatty19 commented 3 years ago

Hi!

all the parameters already in are just awesome, I was wondering if it would be possible to take in/out the subtitles quickly

like this image

😄

muzuiget commented 3 years ago

There are already several ways to "turn off" the subtitles. I don't want to add a new one, otherwise the UI interaction will be messy.

If you just want the subtitles to disappear temporarily because the subtitles are covering the player menu, I suggest using the hotkey.

Open the extension setting page, switch to "Plugin" tab, add a new plugin, type "Script", use the code below:

document.addEventListener('keydown', (event) => {
    if (event.altKey && event.key === 't') {
        const node = document.querySelector('.dualsub-renderer');
        node.style.display = node.style.display === '' ? 'none' : '';
        return;
    }
});

Then check the website checkbox you want to enable. When you press Alt + t, it will toggle the subtitle display.

I prefer add opacity, so it can notices you the extension is working:

document.addEventListener('keydown', (event) => {
    if (event.altKey && event.key === 't') {
        const node = document.querySelector('.dualsub-renderer');
        node.style.opacity = node.style.opacity === '' ? '0.2' : '';
        return;
    }
});
rbatty19 commented 3 years ago

I didn't know the plugin option, that would be great as well. Thank you for the suggestion!