Suggestion - coloring llinks by filehosting site.

in Ideas and script requests
Subscribe to Suggestion - coloring llinks by filehosting site. 6 posts, 4 voices



smooglei Scriptwright
FirefoxWindows

So for example, the following links would be higlighted in unique colors:

Megaupload Yellow
Rapidshare Green
Hotfile orange

These colors (or highlights) would really be turned on only if a user chooses, and for the sites needed.

Basically, when I am scrolling some forums/ blogs, there are links for all the different filehosting sites and it takes some time to find the one for the account you have, if any even exist.

I modified someones script to highlight all instances of the words megaupload / or rapidshare. But it didn't work as planned. But it's the same idea, just instead highlight the full links instead of all instances of the words.

I think if it just colored the full links it would look great. (I tried another script, (similar to this, but not as fast or good) when trying to get offline pages working. It highlights links, and they stand out really well. So coloring by company would be really good.

ex, here rapidshare links highlighted green - stands out from other sites you may not have an account with.

http://img560.imageshack.us/img560/5838/eeeei.jpg

 
devnull69 Scriptwright
FirefoxWindows

var theLinks = document.links;
for(i=0; i<theLinks.length; i++) {
   if(theLinks[i].href.toLowerCase().indexOf('megaupload') != -1) theLinks[i].style.backgroundColor = 'yellow';
   if(theLinks[i].href.toLowerCase().indexOf('rapidshare') != -1) theLinks[i].style.backgroundColor = 'green';
   if(theLinks[i].href.toLowerCase().indexOf('hotfile') != -1) theLinks[i].style.backgroundColor = 'orange';
}

 
Cletus Scriptwright
FirefoxWindows

I prefer using CSS for this kind of stuff if you are using anything above Firefox 3.5.

var css = 'a[href*="megaupload.com"] { background-color: yellow; }'+
	'a[href*="rapidshare.com"] { background-color: green; }'+
	'a[href*="hotfile.com"] { background-color: orange; }';
GM_addStyle(css);

 
smooglei Scriptwright
FirefoxWindows

Amazing, thank you both so much, this is so great, was not expecting a way to do it like this. I'm just playing with them now.

For this one, I can't work out how to join to change the text color as well as the background color.

eg

if(theLinks[i].href.toLowerCase().indexOf('http://hotfile.com/dl/') != -1) theLinks[i].style.color = 'orange' ; backgroundColor = 'black';
}

orange text works, but black background isn't registering.

I've tried a few guesses, I'm searching google now to see how others might have done it.

Thanks again, so cool. :)

 
AmpliDude Scriptwright
FirefoxWindows

if (theLinks[i].href.toLowerCase().indexOf('http://hotfile.com/dl/') != -1) {
	theLinks[i].style.color = 'orange';
	theLinks[i].style.backgroundColor = 'black';
}

 
smooglei Scriptwright
FirefoxWindows

Thanks heaps Ampildude, that's working as I wanted.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel