pietervanheijningen / clickbait-remover-for-youtube

Replaces thumbnails and modifies titles of videos on youtube.com
https://chrome.google.com/webstore/detail/clickbait-remover-for-you/omoinegiohhgbikclijaniebjpkeopip
MIT License
373 stars 24 forks source link

Capitalize Each The Start of Each Word #26

Closed unbeatable-101 closed 4 years ago

unbeatable-101 commented 4 years ago

Could an option be added for this?

pietervanheijningen commented 4 years ago

I did look into that as an option when creating the extension. Basically, i only use CSS to change the titles, more specifically the text-transform property. Which does have the capitalise option like you described. But it doesn't work well for titles that are already all caps. It would need to first convert everything to lowercase, and then capitalise it, but it seems like there's no way to do that.

unbeatable-101 commented 4 years ago

case 'capitalize_first_letter': //language=CSS styleElement.innerHTML = `

video-title,

            .ytp-videowall-still-info-title,
            .large-media-item-metadata > a > h3 > span,
            .compact-media-item-headline > span {
                text-transform: lowercase;
                display: block !important;
            }
            #video-title::first-letter,
            .ytp-videowall-still-info-title::first-letter,
            .large-media-item-metadata > a > h3 > span::first-letter,
            .compact-media-item-headline > span::first-letter {
                text-transform: uppercase;

You have this in youtube.js, what if you changed text-transform: uppercase; to text-transform: capitalize;?

pietervanheijningen commented 4 years ago

text-transform: capitalize; would only really do something for titles that are: 1. already all lowercase 2. already have the first letter of each word capitalised, It won't get rid of the all-caps titles.

Here's an example:

Untitled 2

As you can see barely anything changed. Only the non-capitalised words got capitalised

unbeatable-101 commented 4 years ago

I meant how you it all in lowercase and then you change it to capitalize

pietervanheijningen commented 4 years ago

You can't apply two things to it unfortunately. What it does in the code you linked is only apply it to the first letter

pietervanheijningen commented 4 years ago

Okay nevermind, just figured out a way to do it. with the ::first-line property, ill add it soon :) thanks for giving me the idea!

unbeatable-101 commented 4 years ago

Thank you!

pietervanheijningen commented 4 years ago

Added it in 0.4, doesn't work perfectly, but its alright