Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

YouTube Title Adder

2.0r4: Better options, version checking, inline embedding. YouTube's URL format means you click videos blindly. This appends the title of a YouTube link to the link in the referring page. Fixed some links with referrers (see screens)

ver:2.0r4

6/07/08
Found out that some URLs weren't working if they were not a direct YouTube link (like a FARK 'referred' link).
So, now this script just parses the 11-digit video code from a YouTube URL and fetches that, regardless of the parameters of the originating link.

5/13/08
Thanks to inspiration from the excellent Google Anonymizer Script, I made the settings be its own window, as opposed to toggling Greasemonkey menus. You can access the 3 options from "Tools...GreaseMonkey...User Scripts Commands...YouTube Title Adder Options".
Also, online version checking has been implemented!
In the above mentioned "YouTube Title Adder Options" window, it will check this page for the latest version of the script, and present a link in the options menu should one be available! (See Screens)
I think it'll work fine, but comment if it doesn't!

(if you find this script useful, I accept TotalFark sponsorships to help waste my time. figured that was worth a shot, like this: )

5/11/08
Please uninstall your old script, as I've changed the name to cease having that version # that's never changing.
Contains a fix for if an image link has a title already (like Fark's YouTube buttons), plus a better title adding method.

4/10/08
New Addition! Inline switchable embedding!
I got sick of wondering if a link will "pop" or not, and also just don't really enjoy loading YouTube's pages when I just want to see the video and be on my merry way... so, I added the ability to just click a small image button, placed next to the link, to show/hide the video while in the same page! It's unobtrusive, and the video will only load if you click the "show" button... so there's no page load slowdown!
If embedding is disabled for a video (like the samples on this page), you can click the icon to at least see the video thumbnail.
It can be toggled in the "User Script Commands"
See screen shots below!

3/14/08
Yet another fix... why can't layouts stay the same?

1/10/08
Updated to fix YouTube's removal of the "div" for a title, and placing it instead in the meta head. Should work again!

10/05/07
That was easy. Added the ability to toggle the titles on Text/Image links via the GreaseMonkey...User Script Commands... menu.

10/04/07
Doesn't append the innerHTML if the link is an image button (like on Fark). Test here:
This should have no text appended, but show you the video name when you mouseover:
This should be appended as per usual: Video
What I'd like to do next is make the selections have toggles, so you can set it to append text, do the mouseovers, etc. I'll get on that for the hell of it soon.

v1.2 - 9/29/07
Thanks to all who have downloaded this; it's my fastest propagating script yet. Please spread the word! I have discovered some YouTube videos apparently use a < div > to display the video title, so I had to put in an alternate fetching should the more popular header method return nothing.
In other words, I got Rick Roll'd on a Youtube link (that should tell you what the video is, btw), and was forced to update this script.
Also, contrary to a post below, this script really does not affect page loads at all. Before I did the exclusion of Google searches and YouTube's page, it would fetch titles for every video on those pages. Everything still loaded great!
Please leave any suggestions or requests in the comments, as I really am happy with how this script turned out.

v1 - 9/9/07 - Initial release
One pet peeve on the web for me is the format of YouTube's links being so obscure that you have no clue what the hell you're clicking on half the time.
This script goes through a page, seeks out the YouTube links, grabs the YouTube video's title, and appends the title to the link in the page. It bolds the title, italicizes the link, and modifies the title. No you have no excuse for not knowing what you're clicking on.

Before:

After:




Jan 18, 2008
BorisTheBrave User

I recommend adding the following lines directly before the if ((link.innerHTML ... part.

var w=videoname[1].toLowerCase().split(/\s*\b\s*/);
var v=link.innerHTML.replace(/<[^>]+>/gi,"").toLowerCase().split(/\s*\b\s*/).filter(function(t){return t.length>2});
if(v.filter(function(t){return w.indexOf(t)!=-1}).length/v.length>0.5) return;

This checks if the link already has the correct name, and then doesn't change it if it does. I have mine set up to change the 'mouseover' text regardless.

 
Jan 13, 2008
Smiths Script's author

It looks like those pages need to be added to the exclude list. What's the URL of a favorites page?

I don't use YouTube really (hence my hatred of blind links), and definitely don't use it enough to have an account and page on it... so I just exclude pages that affect me.

you can add in the excluded pages under greasemonkey...manage user scripts... and select the YouTube Title Adder and click "Add" under the "the following sites are excluded..." box.

 
Jan 13, 2008
jtr3030 User

Here are some screenshots that might help explain:

Before installation:

http://img136.imageshack.us/img136/1060/ytfavs8...

http://img50.imageshack.us/img50/8118/ytsubs888...

http://img136.imageshack.us/img136/679/ytvid888...

After:

http://img136.imageshack.us/img136/4059/ytvid99...

http://img50.imageshack.us/img50/2336/ytsubs999...

http://img50.imageshack.us/my.php?image=ytfavs9...

 
Jan 13, 2008
jtr3030 User

I wanted to use it on YouTube. The problem is that the "Subscriptions", "My Videos", and "Favorites" pages only show half the title or so for each video, so you never know what each video actually is before clicking on it. They don't even have a hover feature. That's the main reason this script interested me.

Then when you watch a YouTube video on the YouTube site, there are links to other videos and all the titles get appended to and the whole page is a huge mess. You can barely read the comments or anything.

I've tried messing with the script but I'm programming illiterate so I broke it. I'll try again though.

Do you know if there is a way to just extend the file name rather than append to it? Or maybe erase the original file name at least partially and just view the appendage?

 
Jan 11, 2008
Smiths Script's author

{ link.innerHTML = '' + link.innerHTML + " (YT: " + videoname[1] + ")"; }

That is how it outputs after a link. You can play with that for formatting.

As far as showing up for "many links on the site", I am not sure what you mean. You may just want to add an exclusion in Greasemonkey for specific sites if it's a bother.

Right now, it excludes:
// @exclude http://*.youtube.com/*
// @exclude http://youtube.com/*
// @exclude http://*.google.*/search?*

 
Jan 11, 2008
jtr3030 User

Is there any way I can remove the first part of the title and just display the "(YT:" part? Then is there anyway I can remove the "(YT:" part so just the title appears?

Also, the "(YT:" links are appended to many links on the site and the page is filled with them.

I really want something like this - I even made a forum post about it - but this is much too buggy.

 
Dec 15, 2007
Barnfish User

Also stopped working for me. I tried uninstall/reinstall, still not working.

 
Dec 14, 2007
rargy User

Hmm, it recently stopped working for me. Not sure if it's the scripts problem or my own.

 
Oct 4, 2007
bl_nk User

Unbelievable! Thank you!!!

 
Oct 4, 2007
Smiths Script's author

You can comment out the line:
link.innerHTML = '' + link.innerHTML + " (YT: " + videoname[1] + ")"; with a // to avoid the innerHTML changing, then it'll just modify the title.
I'll see what making the identifier exclude images that are links to a video (like a Youtube button on Fark, for example) does.

 
Oct 4, 2007
bl_nk User

I am loving this script!

However it also adds titles to image links which tends to mess up the layout of pages. It would be a really nice addition to make the YT titles optionally show only in mouse-over tips - for text links too :)

Just my two cents :]

 
Oct 1, 2007
Smiths Script's author

You know, doing all these scripts I never caught on to changing the Title = having to uninstall old one (since I just upload the script by pasting the source code from my machine).

I apologize to all for having to uninstall/reinstall. I'll keep it titled as "1.2" from now on, even if i make changes.

Thanks for the heads up!

 
Sep 30, 2007
bl_nk User

Yes you were right, didn't notice any change in load times.

You shouldn't change the name of the script though, makes upgrading more complicated as users have to uninstall the previous version.

 
Sep 28, 2007
Smiths Script's author

You'd be surprised how it really doesn't.

 
Sep 27, 2007
bl_nk User

I bet this damages pageloads a lot

 
Sep 27, 2007
Bloigen User

Inspired idea and great work.

Highly recommended to all reading this page.

You could comment on this script if you were logged in.