muzuiget / dualsub-support

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

How to enable/disable furigana/segment for "Japanese Analysis" on Chrome #481

Closed pabadacfuc closed 1 year ago

pabadacfuc commented 1 year ago

Hi, I don't know how to toggle these features after the "style" page has been removed. Do I have to input some command onto Wildmonkey? Thanks a lot! Really like your extension for learning through videos :)

muzuiget commented 1 year ago

Do you want to hide the segment underline?

pabadacfuc commented 1 year ago

Both the furigana and segment line. Sometimes I would like to hide either one of them for different videos or purposes.

pabadacfuc commented 1 year ago

e.g. sometimes I would like to have segment only, sometimes furigana only

muzuiget commented 1 year ago

You can change the 3rd column menu to "Close".

muzuiget commented 1 year ago

To hide the furigana, you can add a style:

Screenshot_20230106_144344

.dualsub-renderer .hiragana {
    display: none !important;
}

To hide the segment underline, create another style:

.dualsub-renderer .dividers {
    display: none !important;
}
pabadacfuc commented 1 year ago

Work like a charm! Though it seems to require page refreshing each time for the style to apply. Hope the style toggle options will be back in future updates. Thanks again! :)

muzuiget commented 1 year ago

Or you can add a "Page Script" like this:

Screenshot_20230106_150331

const styleText = `
body.hide-furigana .dualsub-renderer .hiragana {
    display: none !important;
}
body.hide-segments .dualsub-renderer .dividers {
    display: none !important;
}
`;

const style = document.createElement('style');
style.textContent = styleText;
document.head.appendChild(style);

document.addEventListener('keyup', (event) => {
    if (event.key === 'q') {
        document.body.classList.toggle('hide-furigana');
        return;
    }
    if (event.key === 'w') {
        document.body.classList.toggle('hide-segments');
        return;
    }
});

This snippet let you press q to toggle the furigana, and w to toggle the segment underline.

muzuiget commented 1 year ago

Remember to fill the Urls field a pattern at least, like the https://www.youtube.com/* in the screenshots, then you don't need to click the Wildmonkey buttons to apply the styles/scripts manually.

pabadacfuc commented 1 year ago

Got it, Perfecto! It's so much more convenient now with the script. Thanks heaps!