YouTubed Already

By paka Last update May 14, 2009 — Installed 693 times. Daily Installs: 1, 1, 2, 3, 0, 3, 0, 2, 0, 1, 1, 2, 3, 0, 1, 2, 0, 1, 1, 1, 0, 1, 0, 3, 0, 0, 1, 1, 0, 1, 1, 0

There are 9 previous versions of this script.

// ==UserScript==
// @name           YouTubed Already
// @namespace      none
// @include        http://www.youtube.com/*
// ==/UserScript==

// simple script to highlight visited links - add this to your favorite youtube enhancer script:

(function(){ //this serves as a wrapper to create a private, unnamed namespace

// highlight visited video links sitewide:
GM_addStyle('.video-entry a:visited { color:red !important;}');
// again for "Most Popular" section:
GM_addStyle('.video-title a:visited { color:red !important;}');

// for added emphasis, place the youtube favicon in front of each visited link
GM_addStyle('.video-mini-title a:visited{ padding-left: 18px; background: url(http://s.ytimg.com/yt/favicon-vfl86270.ico) left no-repeat; } ');
GM_addStyle('.video-short-title a:visited{ padding-left: 18px; background: url(http://s.ytimg.com/yt/favicon-vfl86270.ico) left no-repeat; } ');
GM_addStyle('.video-long-title a:visited { padding-left: 18px; background: url(http://s.ytimg.com/yt/favicon-vfl86270.ico) left no-repeat; } ');
GM_addStyle('.video-title a:visited { padding-left: 18px; background: url(http://s.ytimg.com/yt/favicon-vfl86270.ico) left no-repeat; } ');

// for search results page, make entire block have a gray background:
page = new String(document.URL)
if(page.indexOf("results?")>0) {
	alldivs = document.getElementsByTagName("div");
	for( var i = 0; i < alldivs.length; i++ ) { 
		if( alldivs[i].className == 'video-entry')
			if( alldivs[i].innerHTML.indexOf("Previously viewed") >0) {
				alldivs[i].style.backgroundColor = "#DDDDDD;";
		}
	} 
}

})(); // end of anonymous function
      // the () causes immediate execution of the containing anonymous function