Highlight words greasemonkey script
Posted by ark, ,
I wrote this short greasemonkey script to highlight particular words on a web page. You can choose what color they are highlighted in (or anything about their style). I find it useful I hope you do too...

highlightwords.user.js

I've also wanted to have a Mozilla keyword that opens multiple websites and I finally set it up. It's easy to do, just make a new bookmark with a keyword and have the URL be something like:

javascript:window.open('http://wtwf.com/scripts/');window.open('http://www.fark.com/');window.open('http://slashdot.org/');

You can make that as long as you like and it'll just work. You might need to be using Tab Mix Plus to make sure that unresized popups end up in a new tab rather than a new window, but you should be using that anyway.

In case you didn't know you can do this a lot easier from the command line (or a window manager menu or some such like this:

firefox http://wtwf.com/scripts/|http://www.fark.com/|http://slashdot.org/

Comments

Sam C
Hi, I'm trying to make this work with multiple words. Is that possible?
Mark Wickens
Thanks very much for this! It is going to make my life much easier!
ark
Erik, sorry for the late reply. you should just be able to replace 'garlic' with the word you want highlighted, but you'll also need to edit the pages this script runs on to make it run on the site you want the words highlighted on, I bet that's what was missing.
Erik
I was looking for that script :)
Only problem i do not know how to add words.
I tried some little but nothing became red.

Could you explain a bit how it works?
ark
Hi Joe,

Glad you found the script! highlighting just the word is a little more complex, you'll need to split the current object into 2, before the word and after it, then add in the before, add a new highlighted span for the word and then add in the after.

That's more work than I'm willing to get into right now and I have no idea how it'd work out if your word was in a link or some such.

If you do get it worked out, let me know I'll gladly update the script here.
Joe
Hi,

This script is exactly what I am looking for. Unfortunately, I do not know how to modify it to only highlight a single word as opposed to the whole paragraph. Do you have a version that only hightlights the word or could you post the code to do so?

Many thanks!! Joe